winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
December 2012
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
549 discussions
Start a n
N
ew thread
Jacek Caban : atl: Allow version-based differences in struct layouts.
by Alexandre Julliard
10 Dec '12
10 Dec '12
Module: wine Branch: master Commit: f1e41255e3cef650740948d0be1d81d6578cbe61 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f1e41255e3cef650740948d0b…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Dec 10 12:27:03 2012 +0100 atl: Allow version-based differences in struct layouts. --- dlls/atl/Makefile.in | 1 + dlls/atl/atl_main.c | 2 +- dlls/atl/tests/Makefile.in | 1 + dlls/atl100/Makefile.in | 5 +++-- dlls/atl100/atl.c | 2 +- dlls/atl80/Makefile.in | 4 +++- dlls/atl80/atl80.c | 3 ++- dlls/kernel32/except.c | 2 +- include/atlbase.h | 26 ++++++++++++++++++++++++++ 9 files changed, 39 insertions(+), 7 deletions(-) diff --git a/dlls/atl/Makefile.in b/dlls/atl/Makefile.in index 350db90..8af9e8b 100644 --- a/dlls/atl/Makefile.in +++ b/dlls/atl/Makefile.in @@ -1,6 +1,7 @@ MODULE = atl.dll IMPORTLIB = atl IMPORTS = uuid atl100 oleaut32 ole32 user32 +EXTRADEFS = -D_ATL_VER=_ATL_VER_30 C_SRCS = \ atl_main.c \ diff --git a/dlls/atl/atl_main.c b/dlls/atl/atl_main.c index f215151..eee6fee 100644 --- a/dlls/atl/atl_main.c +++ b/dlls/atl/atl_main.c @@ -478,5 +478,5 @@ void* WINAPI AtlModuleExtractCreateWndData(_ATL_MODULEW *pM) */ DWORD WINAPI AtlGetVersion(void *pReserved) { - return 0x0300; + return _ATL_VER; } diff --git a/dlls/atl/tests/Makefile.in b/dlls/atl/tests/Makefile.in index b397c85..b573713 100644 --- a/dlls/atl/tests/Makefile.in +++ b/dlls/atl/tests/Makefile.in @@ -1,5 +1,6 @@ TESTDLL = atl.dll IMPORTS = uuid atl oleaut32 ole32 rpcrt4 user32 gdi32 advapi32 +EXTRADEFS = -D_ATL_VER=_ATL_VER_30 C_SRCS = \ atl_ax.c \ diff --git a/dlls/atl100/Makefile.in b/dlls/atl100/Makefile.in index 65cae11..19cfcad 100644 --- a/dlls/atl100/Makefile.in +++ b/dlls/atl100/Makefile.in @@ -1,6 +1,7 @@ -MODULE = atl100.dll +MODULE = atl100.dll IMPORTLIB = atl100 -IMPORTS = uuid ole32 oleaut32 user32 gdi32 advapi32 +IMPORTS = uuid ole32 oleaut32 user32 gdi32 advapi32 +EXTRADEFS = -D_ATL_VER=_ATL_VER_100 C_SRCS = \ atl.c \ diff --git a/dlls/atl100/atl.c b/dlls/atl100/atl.c index f1b76a5..88cdce4 100644 --- a/dlls/atl100/atl.c +++ b/dlls/atl100/atl.c @@ -231,5 +231,5 @@ HRESULT WINAPI AtlIPersistStreamInit_Save(LPSTREAM pStm, BOOL fClearDirty, */ DWORD WINAPI AtlGetVersion(void *pReserved) { - return 0x0a00; + return _ATL_VER; } diff --git a/dlls/atl80/Makefile.in b/dlls/atl80/Makefile.in index c310fdb..70f416f 100644 --- a/dlls/atl80/Makefile.in +++ b/dlls/atl80/Makefile.in @@ -1,4 +1,6 @@ -MODULE = atl80.dll +MODULE = atl80.dll +EXTRADEFS = -D_ATL_VER=_ATL_VER_80 + C_SRCS = atl80.c diff --git a/dlls/atl80/atl80.c b/dlls/atl80/atl80.c index ec9a515..b250d32 100644 --- a/dlls/atl80/atl80.c +++ b/dlls/atl80/atl80.c @@ -19,11 +19,12 @@ #include <stdarg.h> #include "windef.h" #include "winbase.h" +#include "atlbase.h" /*********************************************************************** * AtlGetVersion [atl80.@] */ DWORD WINAPI AtlGetVersion(void *pReserved) { - return 0x0800; + return _ATL_VER; } diff --git a/dlls/kernel32/except.c b/dlls/kernel32/except.c index 54be105..49e5c25 100644 --- a/dlls/kernel32/except.c +++ b/dlls/kernel32/except.c @@ -154,7 +154,7 @@ static int format_exception_msg( const EXCEPTION_POINTERS *ptr, char *buffer, in len = snprintf( buffer, size, "Unhandled PIC return in vm86 mode"); break; default: - len = snprintf( buffer, size, "Unhandled exception 0x%08x", rec->ExceptionCode); + len = snprintf( buffer, size, "Unhandled exception 0x%08x in thread %x", rec->ExceptionCode, GetCurrentThreadId()); break; } if ((len<0) || (len>=size)) diff --git a/include/atlbase.h b/include/atlbase.h index 4033f9a..794a099 100644 --- a/include/atlbase.h +++ b/include/atlbase.h @@ -23,6 +23,16 @@ #include <atliface.h> +/* Wine extention: we (ab)use _ATL_VER to handle truct layout differences between ATL versions. */ +#define _ATL_VER_30 0x0300 +#define _ATL_VER_70 0x0700 +#define _ATL_VER_80 0x0800 +#define _ATL_VER_100 0x0a00 + +#ifndef _ATL_VER +#define _ATL_VER _ATL_VER_100 +#endif + typedef HRESULT (WINAPI _ATL_CREATORFUNC)(void* pv, REFIID riid, LPVOID* ppv); typedef HRESULT (WINAPI _ATL_CREATORARGFUNC)(void* pv, REFIID riid, LPVOID* ppv, DWORD dw); typedef HRESULT (WINAPI _ATL_MODULEFUNC)(DWORD dw); @@ -31,6 +41,8 @@ typedef LPCWSTR (WINAPI _ATL_DESCRIPTIONFUNCW)(void); typedef const struct _ATL_CATMAP_ENTRY* (_ATL_CATMAPFUNC)(void); typedef void (WINAPI _ATL_TERMFUNC)(DWORD dw); +typedef CRITICAL_SECTION CComCriticalSection; + typedef struct _ATL_OBJMAP_ENTRYA_V1_TAG { const CLSID* pclsid; @@ -148,6 +160,20 @@ typedef struct _ATL_MODULEW_TAG _ATL_TERMFUNC_ELEM* m_pTermFuncs; } _ATL_MODULEW; +typedef struct _ATL_MODULE70 +{ + UINT cbSize; + LONG m_nLockCnt; + _ATL_TERMFUNC_ELEM *m_pTermFuncs; + CComCriticalSection m_csStaticDataInitAndTypeInfo; +} _ATL_MODULE70; + +#if _ATL_VER >= _ATL_VER_70 +typedef _ATL_MODULE70 _ATL_MODULE; +#else +typedef _ATL_MODULEW _ATL_MODULE; +#endif + typedef struct _ATL_INTMAP_ENTRY_TAG { const IID* piid;
1
0
0
0
André Hentschel : winedbg: Add load/store dual/ exclusive and table branch operators to Thumb2 disassembler.
by Alexandre Julliard
10 Dec '12
10 Dec '12
Module: wine Branch: master Commit: 785bdb6412dcabbfd38b7292e173bb5f4306a501 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=785bdb6412dcabbfd38b7292e…
Author: André Hentschel <nerv(a)dawncrow.de> Date: Mon Dec 10 15:16:29 2012 +0100 winedbg: Add load/store dual/exclusive and table branch operators to Thumb2 disassembler. --- programs/winedbg/be_arm.c | 68 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 68 insertions(+), 0 deletions(-) diff --git a/programs/winedbg/be_arm.c b/programs/winedbg/be_arm.c index c3963c4..a6f57f7 100644 --- a/programs/winedbg/be_arm.c +++ b/programs/winedbg/be_arm.c @@ -1147,6 +1147,73 @@ static UINT thumb2_disasm_ldrstrmul(UINT inst, ADDRESS64 *addr) return 0; } +static UINT thumb2_disasm_ldrstrextbr(UINT inst, ADDRESS64 *addr) +{ + WORD op1 = (inst >> 23) & 0x03; + WORD op2 = (inst >> 20) & 0x03; + WORD op3 = (inst >> 4) & 0x0f; + WORD indexing = (inst >> 24) & 0x01; + WORD direction = (inst >> 23) & 0x01; + WORD writeback = (inst >> 21) & 0x01; + WORD load = (inst >> 20) & 0x01; + short offset = (inst & 0xff) << 2; + + if (op1 == 1 && op2 == 1 && op3 < 2) + { + WORD halfword = (inst >> 4) & 0x01; + if (halfword) + dbg_printf("\n\ttbh\t [%s, %s, lsl #1]", tbl_regs[get_nibble(inst, 4)], + tbl_regs[get_nibble(inst, 0)]); + else + dbg_printf("\n\ttbb\t [%s, %s]", tbl_regs[get_nibble(inst, 4)], + tbl_regs[get_nibble(inst, 0)]); + return 0; + } + + if (op1 == 0 && op2 < 2) + { + if (get_nibble(inst, 2) == 15) + dbg_printf("\n\tldrex\t %s, [%s, #%u]", tbl_regs[get_nibble(inst, 3)], + tbl_regs[get_nibble(inst, 4)], offset); + else + dbg_printf("\n\tstrex\t %s, %s, [%s, #%u]", tbl_regs[get_nibble(inst, 2)], + tbl_regs[get_nibble(inst, 3)], tbl_regs[get_nibble(inst, 4)], offset); + return 0; + } + + if (op1 == 1 && op2 < 2) + { + WORD halfword = (inst >> 4) & 0x01; + if (get_nibble(inst, 0) == 15) + dbg_printf("\n\tldrex%s\t %s, [%s]", halfword ? "h" : "b", + tbl_regs[get_nibble(inst, 3)], tbl_regs[get_nibble(inst, 4)]); + else + dbg_printf("\n\tstrex%s\t %s, %s, [%s]", halfword ? "h" : "b", + tbl_regs[get_nibble(inst, 0)], tbl_regs[get_nibble(inst, 3)], + tbl_regs[get_nibble(inst, 4)]); + return 0; + } + + if (!direction) offset *= -1; + dbg_printf("\n\t%s\t", load ? "ldrd" : "strd"); + if (indexing) + { + if (load && get_nibble(inst, 4) == 15) + { + dbg_printf("%s, %s, ", tbl_regs[get_nibble(inst, 3)], tbl_regs[get_nibble(inst, 2)]); + db_printsym(addr->Offset + offset + 4); + } + else + dbg_printf("%s, %s, [%s, #%d]%s", tbl_regs[get_nibble(inst, 3)], + tbl_regs[get_nibble(inst, 2)], tbl_regs[get_nibble(inst, 4)], offset, + writeback?"!":""); + } + else + dbg_printf("%s, %s, [%s], #%d", tbl_regs[get_nibble(inst, 3)], + tbl_regs[get_nibble(inst, 2)], tbl_regs[get_nibble(inst, 4)], offset); + return 0; +} + struct inst_arm { UINT mask; @@ -1226,6 +1293,7 @@ static const struct inst_arm tbl_thumb32[] = { { 0xefe00000, 0xec400000, thumb2_disasm_coprocmov2 }, { 0xee000000, 0xec000000, thumb2_disasm_coprocdatatrans }, { 0xfe402000, 0xe8000000, thumb2_disasm_ldrstrmul }, + { 0xfe400000, 0xe8400000, thumb2_disasm_ldrstrextbr }, { 0x00000000, 0x00000000, NULL } };
1
0
0
0
Piotr Caban : msvcrt: Fixed get_this_pointer implementation.
by Alexandre Julliard
10 Dec '12
10 Dec '12
Module: wine Branch: master Commit: b9c71ffd42ee4021fea363661d65170994482c3a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b9c71ffd42ee4021fea363661…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Mon Dec 10 16:13:50 2012 +0100 msvcrt: Fixed get_this_pointer implementation. --- dlls/msvcrt/cppexcept.h | 17 +++++++++-------- dlls/msvcrt/tests/cpp.c | 12 ++++++++++++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/dlls/msvcrt/cppexcept.h b/dlls/msvcrt/cppexcept.h index d9ed2fa..7947a17 100644 --- a/dlls/msvcrt/cppexcept.h +++ b/dlls/msvcrt/cppexcept.h @@ -133,20 +133,21 @@ static inline const char *dbgstr_type_info( const type_info *info ) /* compute the this pointer for a base class of a given type */ static inline void *get_this_pointer( const this_ptr_offsets *off, void *object ) { - void *this_ptr; - int *offset_ptr; - if (!object) return NULL; - this_ptr = (char *)object + off->this_offset; + if (off->vbase_descr >= 0) { + int *offset_ptr; + /* move this ptr to vbase descriptor */ - this_ptr = (char *)this_ptr + off->vbase_descr; + object = (char *)object + off->vbase_descr; /* and fetch additional offset from vbase descriptor */ - offset_ptr = (int *)(*(char **)this_ptr + off->vbase_offset); - this_ptr = (char *)this_ptr + *offset_ptr; + offset_ptr = (int *)(*(char **)object + off->vbase_offset); + object = (char *)object + *offset_ptr; } - return this_ptr; + + object = (char *)object + off->this_offset; + return object; } #ifndef __x86_64__ diff --git a/dlls/msvcrt/tests/cpp.c b/dlls/msvcrt/tests/cpp.c index 8baf9b6..88f8225 100644 --- a/dlls/msvcrt/tests/cpp.c +++ b/dlls/msvcrt/tests/cpp.c @@ -901,6 +901,12 @@ static void test_rtti(void) { {RTTI_REF(child_class_rtti, base_descriptor[0]), RTTI_REF(child_class_rtti, base_descriptor[1])} }, {0, 0, 2, RTTI_REF(child_class_rtti, base_array)}, {1, 0, 0, RTTI_REF(child_class_rtti, type_info[1]), RTTI_REF(child_class_rtti, object_hierarchy), RTTI_REF(child_class_rtti, object_locator)} + }, virtual_base_class_rtti = { + { {NULL, NULL, "simple_class"}, {NULL, NULL, "child_class"} }, + { {RTTI_REF(virtual_base_class_rtti, type_info[1]), 0, {0x10, sizeof(void*), sizeof(int)}, 0}, {RTTI_REF(virtual_base_class_rtti, type_info[0]), 0, {8, -1, 0}, 0} }, + { {RTTI_REF(virtual_base_class_rtti, base_descriptor[0]), RTTI_REF(virtual_base_class_rtti, base_descriptor[1])} }, + {0, 0, 2, RTTI_REF(virtual_base_class_rtti, base_array)}, + {1, 0, 0, RTTI_REF(virtual_base_class_rtti, type_info[1]), RTTI_REF(virtual_base_class_rtti, object_hierarchy), RTTI_REF(virtual_base_class_rtti, object_locator)} }; static struct rtti_data simple_class_sig0_rtti, child_class_sig0_rtti; @@ -912,6 +918,9 @@ static void test_rtti(void) void *simple_class_sig0 = &simple_class_sig0_vtbl[1]; void *child_class_sig0_vtbl[2] = {&child_class_sig0_rtti.object_locator}; void *child_class_sig0 = &child_class_sig0_vtbl[1]; + void *virtual_base_class_vtbl[2] = {&virtual_base_class_rtti.object_locator}; + int virtual_base_class_vbtbl[2] = {0, 0x100}; + void *virtual_base_class[2] = {&virtual_base_class_vtbl[1], virtual_base_class_vbtbl}; static const char* e_name = "name"; type_info *ti,*bti; @@ -1026,6 +1035,9 @@ static void test_rtti(void) casted = p__RTDynamicCast(&child_class, 0, &child_class_rtti.type_info[0], &child_class_rtti.type_info[1], 0); ok(casted == (char*)&child_class+4, "failed cast to child class (%p %p)\n", casted, &child_class); + + casted = p__RTDynamicCast(&virtual_base_class, 0, &virtual_base_class_rtti.type_info[0], &virtual_base_class_rtti.type_info[1], 0); + ok(casted == (char*)&virtual_base_class+0x110+sizeof(void*), "failed cast to child class (%p %p)\n", casted, &virtual_base_class); } struct _demangle {
1
0
0
0
Piotr Caban : msvcrt: Fixed _localtime64 implementation.
by Alexandre Julliard
10 Dec '12
10 Dec '12
Module: wine Branch: master Commit: d3ecfe059960440f95ce8c25f13b4b0070952c5d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d3ecfe059960440f95ce8c25f…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Mon Dec 10 12:48:07 2012 +0100 msvcrt: Fixed _localtime64 implementation. --- dlls/msvcrt/dir.c | 1 - dlls/msvcrt/file.c | 1 - dlls/msvcrt/time.c | 66 ++++++++++++++++++++++++--------------------------- 3 files changed, 31 insertions(+), 37 deletions(-) diff --git a/dlls/msvcrt/dir.c b/dlls/msvcrt/dir.c index a504fee..82824e9 100644 --- a/dlls/msvcrt/dir.c +++ b/dlls/msvcrt/dir.c @@ -25,7 +25,6 @@ #include "wine/port.h" #include <stdarg.h> -#include <time.h> #include "windef.h" #include "winbase.h" diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 1b87dd2..bca17d2 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -29,7 +29,6 @@ #include "config.h" #include "wine/port.h" -#include <time.h> #include <stdarg.h> #include <stdio.h> #ifdef HAVE_UNISTD_H diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index 263c035..4c21380 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -25,12 +25,6 @@ #include "config.h" #include <stdlib.h> -#define _POSIX_PTHREAD_SEMANTICS /* switch to a 2 arg style asctime_r on Solaris */ -#include <time.h> -#ifdef HAVE_SYS_TIMES_H -# include <sys/times.h> -#endif -#include <limits.h> #include "msvcrt.h" #include "mtdll.h" @@ -52,20 +46,6 @@ static inline int IsLeapYear(int Year) return Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0); } -static inline void unix_tm_to_msvcrt( struct MSVCRT_tm *dest, const struct tm *src ) -{ - memset( dest, 0, sizeof(*dest) ); - dest->tm_sec = src->tm_sec; - dest->tm_min = src->tm_min; - dest->tm_hour = src->tm_hour; - dest->tm_mday = src->tm_mday; - dest->tm_mon = src->tm_mon; - dest->tm_year = src->tm_year; - dest->tm_wday = src->tm_wday; - dest->tm_yday = src->tm_yday; - dest->tm_isdst = src->tm_isdst; -} - static inline void write_invalid_msvcrt_tm( struct MSVCRT_tm *tm ) { tm->tm_sec = -1; @@ -378,32 +358,48 @@ MSVCRT___time32_t CDECL MSVCRT__mkgmtime(struct MSVCRT_tm *time) /********************************************************************* * _localtime64_s (MSVCRT.@) */ -int CDECL _localtime64_s(struct MSVCRT_tm *time, const MSVCRT___time64_t *secs) +int CDECL _localtime64_s(struct MSVCRT_tm *res, const MSVCRT___time64_t *secs) { - struct tm *tm; - time_t seconds; + int i; + FILETIME ft; + SYSTEMTIME st; + ULONGLONG time; - if (!time || !secs || *secs < 0 || *secs > _MAX__TIME64_T) + if (!res || !secs || *secs < 0 || *secs > _MAX__TIME64_T) { - if (time) - write_invalid_msvcrt_tm(time); + if (res) + write_invalid_msvcrt_tm(res); *MSVCRT__errno() = MSVCRT_EINVAL; return MSVCRT_EINVAL; } - seconds = *secs; + _tzset_init(); + time = (*secs - MSVCRT___timezone) * (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1970; - _mlock(_TIME_LOCK); - if (!(tm = localtime(&seconds))) - { - _munlock(_TIME_LOCK); - *MSVCRT__errno() = MSVCRT_EINVAL; - return MSVCRT_EINVAL; + ft.dwHighDateTime = (UINT)(time >> 32); + ft.dwLowDateTime = (UINT)time; + FileTimeToSystemTime(&ft, &st); + + res->tm_isdst = is_dst(&st) ? 1 : 0; + if(res->tm_isdst) { + time -= MSVCRT__dstbias * (ULONGLONG)TICKSPERSEC; + ft.dwHighDateTime = (UINT)(time >> 32); + ft.dwLowDateTime = (UINT)time; + FileTimeToSystemTime(&ft, &st); } - unix_tm_to_msvcrt(time, tm); - _munlock(_TIME_LOCK); + res->tm_sec = st.wSecond; + res->tm_min = st.wMinute; + res->tm_hour = st.wHour; + res->tm_mday = st.wDay; + res->tm_year = st.wYear - 1900; + res->tm_mon = st.wMonth - 1; + res->tm_wday = st.wDayOfWeek; + for (i = res->tm_yday = 0; i < st.wMonth - 1; i++) + res->tm_yday += MonthLengths[IsLeapYear(st.wYear)][i]; + res->tm_yday += st.wDay - 1; + return 0; }
1
0
0
0
Piotr Caban : msvcrt: Reorganize _localtime64 function.
by Alexandre Julliard
10 Dec '12
10 Dec '12
Module: wine Branch: master Commit: 11216fabc488f407a4a92ed2d187c5913afe2869 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=11216fabc488f407a4a92ed2d…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Mon Dec 10 12:47:54 2012 +0100 msvcrt: Reorganize _localtime64 function. --- dlls/msvcrt/time.c | 49 +++++++++++++++++++++---------------------------- 1 files changed, 21 insertions(+), 28 deletions(-) diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index 05980a5..263c035 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -376,33 +376,6 @@ MSVCRT___time32_t CDECL MSVCRT__mkgmtime(struct MSVCRT_tm *time) #endif /********************************************************************* - * _localtime64 (MSVCRT.@) - */ -struct MSVCRT_tm* CDECL MSVCRT__localtime64(const MSVCRT___time64_t* secs) -{ - struct tm *tm; - thread_data_t *data; - time_t seconds = *secs; - - if (seconds < 0) return NULL; - - _mlock(_TIME_LOCK); - if (!(tm = localtime( &seconds))) { - _munlock(_TIME_LOCK); - return NULL; - } - - data = msvcrt_get_thread_data(); - if(!data->time_buffer) - data->time_buffer = MSVCRT_malloc(sizeof(struct MSVCRT_tm)); - - unix_tm_to_msvcrt( data->time_buffer, tm ); - _munlock(_TIME_LOCK); - - return data->time_buffer; -} - -/********************************************************************* * _localtime64_s (MSVCRT.@) */ int CDECL _localtime64_s(struct MSVCRT_tm *time, const MSVCRT___time64_t *secs) @@ -435,11 +408,31 @@ int CDECL _localtime64_s(struct MSVCRT_tm *time, const MSVCRT___time64_t *secs) } /********************************************************************* + * _localtime64 (MSVCRT.@) + */ +struct MSVCRT_tm* CDECL MSVCRT__localtime64(const MSVCRT___time64_t* secs) +{ + thread_data_t *data = msvcrt_get_thread_data(); + + if(!data->time_buffer) + data->time_buffer = MSVCRT_malloc(sizeof(struct MSVCRT_tm)); + + if(_localtime64_s(data->time_buffer, secs)) + return NULL; + return data->time_buffer; +} + +/********************************************************************* * _localtime32 (MSVCRT.@) */ struct MSVCRT_tm* CDECL MSVCRT__localtime32(const MSVCRT___time32_t* secs) { - MSVCRT___time64_t secs64 = *secs; + MSVCRT___time64_t secs64; + + if(!secs) + return NULL; + + secs64 = *secs; return MSVCRT__localtime64( &secs64 ); }
1
0
0
0
Piotr Caban : msvcrt: Improved input parameter range check in _gmtime64_s.
by Alexandre Julliard
10 Dec '12
10 Dec '12
Module: wine Branch: master Commit: acac63663a2b4d910ad7d3acbb5dc161dd94c15c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=acac63663a2b4d910ad7d3acb…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Mon Dec 10 12:47:40 2012 +0100 msvcrt: Improved input parameter range check in _gmtime64_s. --- dlls/msvcrt/time.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index 60c7120..05980a5 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -488,7 +488,7 @@ int CDECL MSVCRT__gmtime64_s(struct MSVCRT_tm *res, const MSVCRT___time64_t *sec SYSTEMTIME st; ULONGLONG time; - if (!res || !secs || *secs < 0) { + if (!res || !secs || *secs < 0 || *secs > _MAX__TIME64_T) { if (res) { write_invalid_msvcrt_tm(res); }
1
0
0
0
Piotr Caban : msvcrt: Fixed mkgmtime and _mkgmtime64 implementation.
by Alexandre Julliard
10 Dec '12
10 Dec '12
Module: wine Branch: master Commit: c9a7436812560b612f83b9d44388ff2de8682780 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c9a7436812560b612f83b9d44…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Mon Dec 10 12:47:26 2012 +0100 msvcrt: Fixed mkgmtime and _mkgmtime64 implementation. --- dlls/msvcrt/time.c | 30 +++--------------------------- 1 files changed, 3 insertions(+), 27 deletions(-) diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index e484bf4..60c7120 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -348,32 +348,7 @@ MSVCRT___time32_t CDECL MSVCRT_mktime(struct MSVCRT_tm *mstm) */ MSVCRT___time64_t CDECL MSVCRT__mkgmtime64(struct MSVCRT_tm *time) { - SYSTEMTIME st; - FILETIME ft; - MSVCRT___time64_t ret; - int i; - - st.wMilliseconds = 0; - st.wSecond = time->tm_sec; - st.wMinute = time->tm_min; - st.wHour = time->tm_hour; - st.wDay = time->tm_mday; - st.wMonth = time->tm_mon+1; - st.wYear = time->tm_year+1900; - - if(!SystemTimeToFileTime(&st, &ft)) - return -1; - - FileTimeToSystemTime(&ft, &st); - time->tm_wday = st.wDayOfWeek; - - for(i=time->tm_yday=0; i<st.wMonth-1; i++) - time->tm_yday += MonthLengths[IsLeapYear(st.wYear)][i]; - time->tm_yday += st.wDay-1; - - ret = ((MSVCRT___time64_t)ft.dwHighDateTime<<32)+ft.dwLowDateTime; - ret = (ret-TICKS_1601_TO_1970)/TICKSPERSEC; - return ret; + return mktime_helper(time, FALSE); } /********************************************************************** @@ -381,7 +356,8 @@ MSVCRT___time64_t CDECL MSVCRT__mkgmtime64(struct MSVCRT_tm *time) */ MSVCRT___time32_t CDECL MSVCRT__mkgmtime32(struct MSVCRT_tm *time) { - return MSVCRT__mkgmtime64(time); + MSVCRT___time64_t ret = MSVCRT__mkgmtime64(time); + return ret == (MSVCRT___time32_t)ret ? ret : -1; } /**********************************************************************
1
0
0
0
Piotr Caban : msvcrt: Fixed mktime and _mktime64 implementation.
by Alexandre Julliard
10 Dec '12
10 Dec '12
Module: wine Branch: master Commit: a66ed048a32fd1cd4e8afebd262b7b1b1eabfbcd URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a66ed048a32fd1cd4e8afebd2…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Mon Dec 10 12:47:13 2012 +0100 msvcrt: Fixed mktime and _mktime64 implementation. --- dlls/msvcrt/time.c | 165 ++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 142 insertions(+), 23 deletions(-) diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index 27f93b1..e484bf4 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -52,20 +52,6 @@ static inline int IsLeapYear(int Year) return Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0); } -static inline void msvcrt_tm_to_unix( struct tm *dest, const struct MSVCRT_tm *src ) -{ - memset( dest, 0, sizeof(*dest) ); - dest->tm_sec = src->tm_sec; - dest->tm_min = src->tm_min; - dest->tm_hour = src->tm_hour; - dest->tm_mday = src->tm_mday; - dest->tm_mon = src->tm_mon; - dest->tm_year = src->tm_year; - dest->tm_wday = src->tm_wday; - dest->tm_yday = src->tm_yday; - dest->tm_isdst = src->tm_isdst; -} - static inline void unix_tm_to_msvcrt( struct MSVCRT_tm *dest, const struct tm *src ) { memset( dest, 0, sizeof(*dest) ); @@ -177,6 +163,57 @@ void CDECL MSVCRT__tzset(void) _munlock(_TIME_LOCK); } +static void _tzset_init(void) +{ + static BOOL init = FALSE; + + if(!init) { + _mlock(_TIME_LOCK); + if(!init) { + MSVCRT__tzset(); + init = TRUE; + } + _munlock(_TIME_LOCK); + } +} + +static BOOL is_dst(const SYSTEMTIME *st) +{ + TIME_ZONE_INFORMATION tmp; + SYSTEMTIME out; + + if(!MSVCRT___daylight) + return FALSE; + + if(tzi.DaylightDate.wMonth) { + tmp = tzi; + }else if(st->wYear >= 2007) { + memset(&tmp, 0, sizeof(tmp)); + tmp.StandardDate.wMonth = 11; + tmp.StandardDate.wDay = 1; + tmp.StandardDate.wHour = 2; + tmp.DaylightDate.wMonth = 3; + tmp.DaylightDate.wDay = 2; + tmp.DaylightDate.wHour = 2; + }else { + memset(&tmp, 0, sizeof(tmp)); + tmp.StandardDate.wMonth = 10; + tmp.StandardDate.wDay = 5; + tmp.StandardDate.wHour = 2; + tmp.DaylightDate.wMonth = 4; + tmp.DaylightDate.wDay = 1; + tmp.DaylightDate.wHour = 2; + } + + tmp.Bias = 0; + tmp.StandardBias = 0; + tmp.DaylightBias = MSVCRT__dstbias/60; + if(!SystemTimeToTzSpecificLocalTime(&tmp, st, &out)) + return FALSE; + + return memcmp(st, &out, sizeof(SYSTEMTIME)); +} + #define SECSPERDAY 86400 /* 1601 to 1970 is 369 years plus 89 leap days */ #define SECS_1601_TO_1970 ((369 * 365 + 89) * (ULONGLONG)SECSPERDAY) @@ -184,19 +221,100 @@ void CDECL MSVCRT__tzset(void) #define TICKSPERMSEC 10000 #define TICKS_1601_TO_1970 (SECS_1601_TO_1970 * TICKSPERSEC) +static MSVCRT___time64_t mktime_helper(struct MSVCRT_tm *mstm, BOOL local) +{ + SYSTEMTIME st; + FILETIME ft; + MSVCRT___time64_t ret = 0; + int i; + BOOL use_dst = FALSE; + + ret = mstm->tm_year + mstm->tm_mon/12; + mstm->tm_mon %= 12; + if(mstm->tm_mon < 0) { + mstm->tm_mon += 12; + ret--; + } + + if(ret<70 || ret>1100) { + *MSVCRT__errno() = MSVCRT_EINVAL; + return -1; + } + + memset(&st, 0, sizeof(SYSTEMTIME)); + st.wDay = 1; + st.wMonth = mstm->tm_mon+1; + st.wYear = ret+1900; + + if(!SystemTimeToFileTime(&st, &ft)) { + *MSVCRT__errno() = MSVCRT_EINVAL; + return -1; + } + + ret = ((MSVCRT___time64_t)ft.dwHighDateTime<<32)+ft.dwLowDateTime; + ret += (MSVCRT___time64_t)mstm->tm_sec*TICKSPERSEC; + ret += (MSVCRT___time64_t)mstm->tm_min*60*TICKSPERSEC; + ret += (MSVCRT___time64_t)mstm->tm_hour*60*60*TICKSPERSEC; + ret += (MSVCRT___time64_t)(mstm->tm_mday-1)*SECSPERDAY*TICKSPERSEC; + + ft.dwLowDateTime = ret & 0xffffffff; + ft.dwHighDateTime = ret >> 32; + FileTimeToSystemTime(&ft, &st); + + if(local) { + _tzset_init(); + use_dst = is_dst(&st); + if((mstm->tm_isdst<=-1 && use_dst) || (mstm->tm_isdst>=1)) { + SYSTEMTIME tmp; + + ret += (MSVCRT___time64_t)MSVCRT__dstbias*TICKSPERSEC; + + ft.dwLowDateTime = ret & 0xffffffff; + ft.dwHighDateTime = ret >> 32; + FileTimeToSystemTime(&ft, &tmp); + + if(!is_dst(&tmp)) { + st = tmp; + use_dst = FALSE; + }else { + use_dst = TRUE; + } + }else if(mstm->tm_isdst==0 && use_dst) { + ret -= (MSVCRT___time64_t)MSVCRT__dstbias*TICKSPERSEC; + ft.dwLowDateTime = ret & 0xffffffff; + ft.dwHighDateTime = ret >> 32; + FileTimeToSystemTime(&ft, &st); + ret += (MSVCRT___time64_t)MSVCRT__dstbias*TICKSPERSEC; + } + ret += (MSVCRT___time64_t)MSVCRT___timezone*TICKSPERSEC; + } + + mstm->tm_sec = st.wSecond; + mstm->tm_min = st.wMinute; + mstm->tm_hour = st.wHour; + mstm->tm_mday = st.wDay; + mstm->tm_mon = st.wMonth-1; + mstm->tm_year = st.wYear-1900; + mstm->tm_wday = st.wDayOfWeek; + for(i=mstm->tm_yday=0; i<st.wMonth-1; i++) + mstm->tm_yday += MonthLengths[IsLeapYear(st.wYear)][i]; + mstm->tm_yday += st.wDay-1; + mstm->tm_isdst = use_dst ? 1 : 0; + + if(ret < TICKS_1601_TO_1970) { + *MSVCRT__errno() = MSVCRT_EINVAL; + return -1; + } + ret = (ret-TICKS_1601_TO_1970)/TICKSPERSEC; + return ret; +} + /********************************************************************** * _mktime64 (MSVCRT.@) */ MSVCRT___time64_t CDECL MSVCRT__mktime64(struct MSVCRT_tm *mstm) { - time_t secs; - struct tm tm; - - msvcrt_tm_to_unix( &tm, mstm ); - secs = mktime( &tm ); - unix_tm_to_msvcrt( mstm, &tm ); - - return secs < 0 ? -1 : secs; + return mktime_helper(mstm, TRUE); } /********************************************************************** @@ -204,7 +322,8 @@ MSVCRT___time64_t CDECL MSVCRT__mktime64(struct MSVCRT_tm *mstm) */ MSVCRT___time32_t CDECL MSVCRT__mktime32(struct MSVCRT_tm *mstm) { - return MSVCRT__mktime64( mstm ); + MSVCRT___time64_t ret = MSVCRT__mktime64( mstm ); + return ret == (MSVCRT___time32_t)ret ? ret : -1; } /**********************************************************************
1
0
0
0
Piotr Caban : msvcrt: Added _tzset tests.
by Alexandre Julliard
10 Dec '12
10 Dec '12
Module: wine Branch: master Commit: 59776ccc9949ff5c1ef6e7a0cf512b1a06d7bed9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=59776ccc9949ff5c1ef6e7a0c…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Mon Dec 10 12:47:00 2012 +0100 msvcrt: Added _tzset tests. --- dlls/msvcrt/tests/time.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 46 insertions(+), 0 deletions(-) diff --git a/dlls/msvcrt/tests/time.c b/dlls/msvcrt/tests/time.c index c6e2a9c..b9bc7f1 100644 --- a/dlls/msvcrt/tests/time.c +++ b/dlls/msvcrt/tests/time.c @@ -46,6 +46,8 @@ static errno_t (__cdecl *p_localtime32_s)(struct tm*, __time32_t*); static errno_t (__cdecl *p_localtime64_s)(struct tm*, __time64_t*); static int* (__cdecl *p__daylight)(void); static int* (__cdecl *p___p__daylight)(void); +static long* (__cdecl *p___p__dstbias)(void); +static long* (__cdecl *p___p__timezone)(void); static size_t (__cdecl *p_strftime)(char *, size_t, const char *, const struct tm *); static size_t (__cdecl *p_wcsftime)(wchar_t *, size_t, const wchar_t *, const struct tm *); static char* (__cdecl *p_asctime)(const struct tm *); @@ -64,6 +66,8 @@ static void init(void) p_localtime64_s = (void*)GetProcAddress(hmod, "_localtime64_s"); p__daylight = (void*)GetProcAddress(hmod, "__daylight"); p___p__daylight = (void*)GetProcAddress(hmod, "__p__daylight"); + p___p__dstbias = (void*)GetProcAddress(hmod, "__p__dstbias"); + p___p__timezone = (void*)GetProcAddress(hmod, "__p__timezone"); p_strftime = (void*)GetProcAddress(hmod, "strftime"); p_wcsftime = (void*)GetProcAddress(hmod, "wcsftime"); p_asctime = (void*)GetProcAddress(hmod, "asctime"); @@ -804,10 +808,52 @@ static void test_asctime(void) ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno); } +static void test__tzset(void) +{ + char TZ_env[256]; + int ret; + + if(!p___p__daylight || !p___p__timezone || !p___p__dstbias) { + win_skip("__p__daylight, __p__timezone or __p__dstbias is not available\n"); + return; + } + + _snprintf(TZ_env,255,"TZ=%s",(getenv("TZ")?getenv("TZ"):"")); + + ret = *p___p__daylight(); + ok(ret == 1, "*__p__daylight() = %d\n", ret); + ret = *p___p__timezone(); + ok(ret == 28800, "*__p__timezone() = %d\n", ret); + ret = *p___p__dstbias(); + ok(ret == -3600, "*__p__dstbias() = %d\n", ret); + + _putenv("TZ=xxx+1yyy"); + _tzset(); + ret = *p___p__daylight(); + ok(ret == 121, "*__p__daylight() = %d\n", ret); + ret = *p___p__timezone(); + ok(ret == 3600, "*__p__timezone() = %d\n", ret); + ret = *p___p__dstbias(); + ok(ret == -3600, "*__p__dstbias() = %d\n", ret); + + *p___p__dstbias() = 0; + _putenv("TZ=xxx+1:3:5zzz"); + _tzset(); + ret = *p___p__daylight(); + ok(ret == 122, "*__p__daylight() = %d\n", ret); + ret = *p___p__timezone(); + ok(ret == 3785, "*__p__timezone() = %d\n", ret); + ret = *p___p__dstbias(); + ok(ret == 0, "*__p__dstbias() = %d\n", ret); + + _putenv(TZ_env); +} + START_TEST(time) { init(); + test__tzset(); test_strftime(); test_ctime(); test_gmtime();
1
0
0
0
Piotr Caban : msvcrt: Reimplement _tzset function.
by Alexandre Julliard
10 Dec '12
10 Dec '12
Module: wine Branch: master Commit: 351dff91debce853e7c25e7970b1f66b1e737894 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=351dff91debce853e7c25e797…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Mon Dec 10 12:46:46 2012 +0100 msvcrt: Reimplement _tzset function. --- dlls/msvcrt/time.c | 146 ++++++++++++++++++++++++++++++---------------------- 1 files changed, 85 insertions(+), 61 deletions(-) diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index 2c08185..27f93b1 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -24,6 +24,7 @@ #include "config.h" +#include <stdlib.h> #define _POSIX_PTHREAD_SEMANTICS /* switch to a 2 arg style asctime_r on Solaris */ #include <time.h> #ifdef HAVE_SYS_TIMES_H @@ -92,6 +93,90 @@ static inline void write_invalid_msvcrt_tm( struct MSVCRT_tm *tm ) tm->tm_isdst = -1; } +/********************************************************************* + * _daylight (MSVCRT.@) + */ +int MSVCRT___daylight = 1; + +/********************************************************************* + * _timezone (MSVCRT.@) + */ +MSVCRT_long MSVCRT___timezone = 28800; + +/********************************************************************* + * _dstbias (MSVCRT.@) + */ +int MSVCRT__dstbias = -3600; + +/********************************************************************* + * _tzname (MSVCRT.@) + * NOTES + * Some apps (notably Mozilla) insist on writing to these, so the buffer + * must be large enough. + */ +static char tzname_std[64] = "PST"; +static char tzname_dst[64] = "PDT"; +char *MSVCRT__tzname[2] = { tzname_std, tzname_dst }; + +static TIME_ZONE_INFORMATION tzi = {0}; +/********************************************************************* + * _tzset (MSVCRT.@) + */ +void CDECL MSVCRT__tzset(void) +{ + char *tz = MSVCRT_getenv("TZ"); + BOOL error; + + _mlock(_TIME_LOCK); + if(tz && tz[0]) { + BOOL neg_zone = FALSE; + + memset(&tzi, 0, sizeof(tzi)); + + /* Parse timezone information: tzn[+|-]hh[:mm[:ss]][dzn] */ + lstrcpynA(MSVCRT__tzname[0], tz, 3); + tz += 3; + + if(*tz == '-') { + neg_zone = TRUE; + tz++; + }else if(*tz == '+') { + tz++; + } + MSVCRT___timezone = strtol(tz, &tz, 10)*3600; + if(*tz == ':') { + MSVCRT___timezone += strtol(tz+1, &tz, 10)*60; + if(*tz == ':') + MSVCRT___timezone += strtol(tz+1, &tz, 10); + } + if(neg_zone) + MSVCRT___timezone = -MSVCRT___timezone; + + MSVCRT___daylight = *tz; + lstrcpynA(MSVCRT__tzname[1], tz, 3); + }else if(GetTimeZoneInformation(&tzi) != TIME_ZONE_ID_INVALID) { + MSVCRT___timezone = tzi.Bias*60; + if(tzi.StandardDate.wMonth) + MSVCRT___timezone += tzi.StandardBias*60; + + if(tzi.DaylightDate.wMonth) { + MSVCRT___daylight = 1; + MSVCRT__dstbias = (tzi.DaylightBias-tzi.StandardBias)*60; + }else { + MSVCRT___daylight = 0; + MSVCRT__dstbias = 0; + } + + if(!WideCharToMultiByte(CP_ACP, 0, tzi.StandardName, -1, MSVCRT__tzname[0], + sizeof(tzname_std), NULL, &error) || error) + *MSVCRT__tzname[0] = 0; + if(!WideCharToMultiByte(CP_ACP, 0, tzi.DaylightName, -1, MSVCRT__tzname[1], + sizeof(tzname_dst), NULL, &error) || error) + *MSVCRT__tzname[0] = 0; + } + _munlock(_TIME_LOCK); +} + #define SECSPERDAY 86400 /* 1601 to 1970 is 369 years plus 89 leap days */ #define SECS_1601_TO_1970 ((369 * 365 + 89) * (ULONGLONG)SECSPERDAY) @@ -701,11 +786,6 @@ MSVCRT___time32_t CDECL MSVCRT_time(MSVCRT___time32_t* buf) #endif /********************************************************************* - * _daylight (MSVCRT.@) - */ -int MSVCRT___daylight = 0; - -/********************************************************************* * __p_daylight (MSVCRT.@) */ int * CDECL MSVCRT___p__daylight(void) @@ -714,11 +794,6 @@ int * CDECL MSVCRT___p__daylight(void) } /********************************************************************* - * _dstbias (MSVCRT.@) - */ -int MSVCRT__dstbias = 0; - -/********************************************************************* * __p_dstbias (MSVCRT.@) */ int * CDECL __p__dstbias(void) @@ -727,11 +802,6 @@ int * CDECL __p__dstbias(void) } /********************************************************************* - * _timezone (MSVCRT.@) - */ -MSVCRT_long MSVCRT___timezone = 0; - -/********************************************************************* * __p_timezone (MSVCRT.@) */ MSVCRT_long * CDECL MSVCRT___p__timezone(void) @@ -740,17 +810,6 @@ MSVCRT_long * CDECL MSVCRT___p__timezone(void) } /********************************************************************* - * _tzname (MSVCRT.@) - * NOTES - * Some apps (notably Mozilla) insist on writing to these, so the buffer - * must be large enough. The size is picked based on observation of - * Windows XP. - */ -static char tzname_std[64] = "PST"; -static char tzname_dst[64] = "PDT"; -char *MSVCRT__tzname[2] = { tzname_std, tzname_dst }; - -/********************************************************************* * _get_tzname (MSVCRT.@) */ int CDECL MSVCRT__get_tzname(MSVCRT_size_t *ret, char *buf, MSVCRT_size_t bufsize, int index) @@ -792,41 +851,6 @@ char ** CDECL __p__tzname(void) return MSVCRT__tzname; } -/********************************************************************* - * _tzset (MSVCRT.@) - */ -void CDECL MSVCRT__tzset(void) -{ - tzset(); -#if defined(HAVE_TIMEZONE) && defined(HAVE_DAYLIGHT) - MSVCRT___daylight = daylight; - MSVCRT___timezone = timezone; -#else - { - static const time_t seconds_in_year = (365 * 24 + 6) * 3600; - time_t t; - struct tm *tmp; - int zone_january, zone_july; - - _mlock(_TIME_LOCK); - t = (time(NULL) / seconds_in_year) * seconds_in_year; - tmp = localtime(&t); - zone_january = -tmp->tm_gmtoff; - t += seconds_in_year / 2; - tmp = localtime(&t); - zone_july = -tmp->tm_gmtoff; - _munlock(_TIME_LOCK); - - MSVCRT___daylight = (zone_january != zone_july); - MSVCRT___timezone = max(zone_january, zone_july); - } -#endif - lstrcpynA(tzname_std, tzname[0], sizeof(tzname_std)); - tzname_std[sizeof(tzname_std) - 1] = '\0'; - lstrcpynA(tzname_dst, tzname[1], sizeof(tzname_dst)); - tzname_dst[sizeof(tzname_dst) - 1] = '\0'; -} - static inline BOOL strftime_date(char *str, MSVCRT_size_t *pos, MSVCRT_size_t max, BOOL alternate, const struct MSVCRT_tm *mstm, MSVCRT___lc_time_data *time_data) {
1
0
0
0
← Newer
1
...
34
35
36
37
38
39
40
...
55
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Results per page:
10
25
50
100
200