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
November 2019
----- 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
1 participants
895 discussions
Start a n
N
ew thread
Zebediah Figura : ddraw: Use wined3d_stateblock_* methods directly in BeginStateBlock() and EndStateBlock().
by Alexandre Julliard
26 Nov '19
26 Nov '19
Module: wine Branch: master Commit: 332fd135b5ff2336ef0ee1bcc973b3910b2e1957 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=332fd135b5ff2336ef0ee1bc…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Nov 26 09:57:36 2019 -0600 ddraw: Use wined3d_stateblock_* methods directly in BeginStateBlock() and EndStateBlock(). Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ddraw/device.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index ffa029321c..faeb7ba1ff 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -5642,7 +5642,7 @@ static HRESULT d3d_device7_BeginStateBlock(IDirect3DDevice7 *iface) WARN("Trying to begin a stateblock while recording, returning D3DERR_INBEGINSTATEBLOCK.\n"); return D3DERR_INBEGINSTATEBLOCK; } - if (SUCCEEDED(hr = wined3d_device_begin_stateblock(device->wined3d_device, &stateblock))) + if (SUCCEEDED(hr = wined3d_stateblock_create(device->wined3d_device, WINED3D_SBT_RECORDED, &stateblock))) device->update_state = device->recording = stateblock; wined3d_mutex_unlock(); @@ -5686,7 +5686,6 @@ static HRESULT d3d_device7_EndStateBlock(IDirect3DDevice7 *iface, DWORD *statebl { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); struct wined3d_stateblock *wined3d_sb; - HRESULT hr; DWORD h; TRACE("iface %p, stateblock %p.\n", iface, stateblock); @@ -5701,15 +5700,8 @@ static HRESULT d3d_device7_EndStateBlock(IDirect3DDevice7 *iface, DWORD *statebl WARN("Trying to end a stateblock, but no stateblock is being recorded.\n"); return D3DERR_NOTINBEGINSTATEBLOCK; } - hr = wined3d_device_end_stateblock(device->wined3d_device); - if (FAILED(hr)) - { - WARN("Failed to end stateblock, hr %#x.\n", hr); - wined3d_mutex_unlock(); - *stateblock = 0; - return hr_ddraw_from_wined3d(hr); - } wined3d_sb = device->recording; + wined3d_stateblock_init_contained_states(wined3d_sb); device->recording = NULL; device->update_state = device->state; @@ -5726,7 +5718,7 @@ static HRESULT d3d_device7_EndStateBlock(IDirect3DDevice7 *iface, DWORD *statebl wined3d_mutex_unlock(); *stateblock = h + 1; - return hr_ddraw_from_wined3d(hr); + return D3D_OK; } static HRESULT WINAPI d3d_device7_EndStateBlock_FPUSetup(IDirect3DDevice7 *iface, DWORD *stateblock)
1
0
0
0
Zebediah Figura : wined3d: Export wined3d_stateblock_init_contained_states().
by Alexandre Julliard
26 Nov '19
26 Nov '19
Module: wine Branch: master Commit: d1e3e6127984c3df796d2a9fdb96d0ac82c7c253 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d1e3e6127984c3df796d2a9f…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Nov 26 09:57:35 2019 -0600 wined3d: Export wined3d_stateblock_init_contained_states(). Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/device.c | 2 +- dlls/wined3d/stateblock.c | 4 ++-- dlls/wined3d/wined3d.spec | 1 + dlls/wined3d/wined3d_private.h | 2 -- include/wine/wined3d.h | 1 + 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 87db701d15..5983281f93 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4131,7 +4131,7 @@ HRESULT CDECL wined3d_device_end_stateblock(struct wined3d_device *device) return WINED3DERR_INVALIDCALL; } - stateblock_init_contained_states(stateblock); + wined3d_stateblock_init_contained_states(stateblock); wined3d_stateblock_decref(device->recording); device->recording = NULL; diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 898a4bc93d..dc714914ec 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -283,7 +283,7 @@ static void stateblock_savedstates_set_vertex(struct wined3d_saved_states *state memset(states->vs_consts_f, TRUE, sizeof(BOOL) * num_constants); } -void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) +void CDECL wined3d_stateblock_init_contained_states(struct wined3d_stateblock *stateblock) { const struct wined3d_d3d_info *d3d_info = &stateblock->device->adapter->d3d_info; unsigned int i, j; @@ -2032,7 +2032,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, break; } - stateblock_init_contained_states(stateblock); + wined3d_stateblock_init_contained_states(stateblock); wined3d_stateblock_capture(stateblock); /* According to the tests, stream offset is not updated in the captured state if diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index ea04c85d38..29bcd75926 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -262,6 +262,7 @@ @ cdecl wined3d_stateblock_create(ptr long ptr) @ cdecl wined3d_stateblock_decref(ptr) @ cdecl wined3d_stateblock_incref(ptr) +@ cdecl wined3d_stateblock_init_contained_states(ptr) @ cdecl wined3d_stateblock_reset(ptr) @ cdecl wined3d_stateblock_set_base_vertex_index(ptr long) @ cdecl wined3d_stateblock_set_blend_factor(ptr ptr) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index f6d25aa6d8..8ebf377b11 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3974,8 +3974,6 @@ struct wined3d_stateblock unsigned int num_contained_sampler_states; }; -void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; - void wined3d_stateblock_state_init(struct wined3d_stateblock_state *state, const struct wined3d_device *device, DWORD flags) DECLSPEC_HIDDEN; void wined3d_stateblock_state_cleanup(struct wined3d_stateblock_state *state) DECLSPEC_HIDDEN; diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index fac9eef5be..37e012b979 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2667,6 +2667,7 @@ HRESULT __cdecl wined3d_stateblock_create(struct wined3d_device *device, enum wined3d_stateblock_type type, struct wined3d_stateblock **stateblock); ULONG __cdecl wined3d_stateblock_decref(struct wined3d_stateblock *stateblock); ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock); +void __cdecl wined3d_stateblock_init_contained_states(struct wined3d_stateblock *stateblock); void __cdecl wined3d_stateblock_reset(struct wined3d_stateblock *stateblock); void __cdecl wined3d_stateblock_set_base_vertex_index(struct wined3d_stateblock *stateblock, INT base_index); void __cdecl wined3d_stateblock_set_blend_factor(struct wined3d_stateblock *stateblock,
1
0
0
0
Alexandre Julliard : kernel32/tests: Add tests for NtGetNlsSectionPtr() and RtlInitCodePageTable().
by Alexandre Julliard
26 Nov '19
26 Nov '19
Module: wine Branch: master Commit: 4901386892449c0831194fe3aed1d6a572f04405 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4901386892449c0831194fe3…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Nov 26 17:56:04 2019 +0100 kernel32/tests: Add tests for NtGetNlsSectionPtr() and RtlInitCodePageTable(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/locale.c | 116 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 115 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c index 0e2c3496a9..5ae7bd492b 100644 --- a/dlls/kernel32/tests/locale.c +++ b/dlls/kernel32/tests/locale.c @@ -87,6 +87,8 @@ static INT (WINAPI *pNormalizeString)(NORM_FORM, LPCWSTR, INT, LPWSTR, INT); static INT (WINAPI *pFindStringOrdinal)(DWORD, LPCWSTR lpStringSource, INT, LPCWSTR, INT, BOOL); static NTSTATUS (WINAPI *pRtlNormalizeString)(ULONG, LPCWSTR, INT, LPWSTR, INT*); static NTSTATUS (WINAPI *pRtlIsNormalizedString)(ULONG, LPCWSTR, INT, BOOLEAN*); +static NTSTATUS (WINAPI *pNtGetNlsSectionPtr)(ULONG,ULONG,void*,void**,SIZE_T*); +static void (WINAPI *pRtlInitCodePageTable)(USHORT*,CPTABLEINFO*); static void InitFunctionPointers(void) { @@ -130,6 +132,8 @@ static void InitFunctionPointers(void) X(RtlLocaleNameToLcid); X(RtlNormalizeString); X(RtlIsNormalizedString); + X(NtGetNlsSectionPtr); + X(RtlInitCodePageTable); #undef X } @@ -1572,7 +1576,7 @@ static void test_GetNumberFormatA(void) if (IsValidLocale(lcid, 0)) { STRINGSA("-12345","-12 345,00"); /* Try French formatting */ - Expected[3] = 160; /* Non breaking space */ + Expected[3] = (char)160; /* Non breaking space */ ret = GetNumberFormatA(lcid, NUO, input, NULL, buffer, ARRAY_SIZE(buffer)); ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError()); EXPECT_LENA; EXPECT_EQA; @@ -4092,6 +4096,7 @@ static void test_EnumTimeFormatsW(void) GetLastError()); } } + static void test_GetCPInfo(void) { BOOL ret; @@ -4135,6 +4140,115 @@ static void test_GetCPInfo(void) ok(cpinfo.MaxCharSize == 4 || broken(cpinfo.MaxCharSize == 3) /* win9x */, "expected 4, got %u\n", cpinfo.MaxCharSize); } + + if (pNtGetNlsSectionPtr) + { + CPTABLEINFO table; + NTSTATUS status; + void *ptr, *ptr2; + SIZE_T size; + int i; + + for (i = 0; i < 100; i++) + { + ptr = NULL; + size = 0; + status = pNtGetNlsSectionPtr( i, 9999, NULL, &ptr, &size ); + switch (i) + { + case 9: /* unknown */ + case 13: /* unknown */ + ok( status == STATUS_INVALID_PARAMETER_1 || status == STATUS_INVALID_PARAMETER_3, /* vista */ + "%u: failed %x\n", i, status ); + break; + case 10: /* casemap */ + ok( status == STATUS_INVALID_PARAMETER_1 || status == STATUS_UNSUCCESSFUL, + "%u: failed %x\n", i, status ); + break; + case 11: /* codepage */ + case 12: /* normalization */ + ok( status == STATUS_OBJECT_NAME_NOT_FOUND, "%u: failed %x\n", i, status ); + break; + default: + ok( status == STATUS_INVALID_PARAMETER_1, "%u: failed %x\n", i, status ); + break; + } + } + + /* casemap table */ + + status = pNtGetNlsSectionPtr( 10, 0, NULL, &ptr, &size ); + if (status != STATUS_INVALID_PARAMETER_1) + { + ok( !status, "failed %x\n", status ); + ok( size > 0x1000 && size <= 0x8000 , "wrong size %lx\n", size ); + status = pNtGetNlsSectionPtr( 10, 0, NULL, &ptr2, &size ); + ok( ptr != ptr2, "got same pointer\n" ); + ret = UnmapViewOfFile( ptr ); + todo_wine ok( ret, "UnmapViewOfFile failed err %u\n", GetLastError() ); + ret = UnmapViewOfFile( ptr2 ); + todo_wine ok( ret, "UnmapViewOfFile failed err %u\n", GetLastError() ); + } + + /* codepage tables */ + + ptr = (void *)0xdeadbeef; + size = 0xdeadbeef; + status = pNtGetNlsSectionPtr( 11, 437, NULL, &ptr, &size ); + ok( !status, "failed %x\n", status ); + ok( size > 0x10000 && size <= 0x20000, "wrong size %lx\n", size ); + memset( &table, 0xcc, sizeof(table) ); + if (pRtlInitCodePageTable) + { + pRtlInitCodePageTable( ptr, &table ); + ok( table.CodePage == 437, "wrong codepage %u\n", table.CodePage ); + ok( table.MaximumCharacterSize == 1, "wrong char size %u\n", table.MaximumCharacterSize ); + ok( table.DefaultChar == '?', "wrong default char %x\n", table.DefaultChar ); + ok( !table.DBCSCodePage, "wrong dbcs %u\n", table.DBCSCodePage ); + } + ret = UnmapViewOfFile( ptr ); + todo_wine ok( ret, "UnmapViewOfFile failed err %u\n", GetLastError() ); + + status = pNtGetNlsSectionPtr( 11, 932, NULL, &ptr, &size ); + ok( !status, "failed %x\n", status ); + ok( size > 0x20000 && size <= 0x30000, "wrong size %lx\n", size ); + memset( &table, 0xcc, sizeof(table) ); + if (pRtlInitCodePageTable) + { + pRtlInitCodePageTable( ptr, &table ); + ok( table.CodePage == 932, "wrong codepage %u\n", table.CodePage ); + ok( table.MaximumCharacterSize == 2, "wrong char size %u\n", table.MaximumCharacterSize ); + ok( table.DefaultChar == '?', "wrong default char %x\n", table.DefaultChar ); + ok( table.DBCSCodePage == TRUE, "wrong dbcs %u\n", table.DBCSCodePage ); + } + ret = UnmapViewOfFile( ptr ); + todo_wine ok( ret, "UnmapViewOfFile failed err %u\n", GetLastError() ); + + /* normalization tables */ + + for (i = 0; i < 100; i++) + { + status = pNtGetNlsSectionPtr( 12, i, NULL, &ptr, &size ); + switch (i) + { + case NormalizationC: + case NormalizationD: + case NormalizationKC: + case NormalizationKD: + case 13: /* IDN */ + todo_wine ok( !status, "%u: failed %x\n", i, status ); + if (status) break; + ok( size > 0x8000 && size <= 0x30000 , "wrong size %lx\n", size ); + ret = UnmapViewOfFile( ptr ); + ok( ret, "UnmapViewOfFile failed err %u\n", GetLastError() ); + break; + default: + ok( status == STATUS_OBJECT_NAME_NOT_FOUND, "%u: failed %x\n", i, status ); + break; + } + } + } + else win_skip( "NtGetNlsSectionPtr not supported\n" ); } /*
1
0
0
0
Alexandre Julliard : ntdll: Generate a Windows format codepage table using the libwine data.
by Alexandre Julliard
26 Nov '19
26 Nov '19
Module: wine Branch: master Commit: ea20035272cad30406a2e10cefb27d3d0ba5af48 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ea20035272cad30406a2e10c…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Nov 26 17:53:51 2019 +0100 ntdll: Generate a Windows format codepage table using the libwine data. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/locale.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c index c271cab732..26b2f4203c 100644 --- a/dlls/ntdll/locale.c +++ b/dlls/ntdll/locale.c @@ -234,6 +234,88 @@ static NTSTATUS open_nls_data_file( ULONG type, ULONG id, HANDLE *file ) } +static USHORT *build_cptable( const union cptable *src, SIZE_T *size ) +{ + unsigned int i, leadbytes = 0; + USHORT *data, *ptr; + + *size = 13 + 1 + 256 + 1 + 1 + 1; + if (src->info.char_size == 2) + { + for (i = leadbytes = 0; i < 256; i++) if (src->dbcs.cp2uni_leadbytes[i]) leadbytes++; + *size += 256 + 256 * leadbytes; + *size += 65536; + *size *= sizeof(USHORT); + } + else + { + if (src->sbcs.cp2uni_glyphs != src->sbcs.cp2uni) *size += 256; + *size *= sizeof(USHORT); + *size += 65536; + } + if (!(data = RtlAllocateHeap( GetProcessHeap(), 0, *size ))) return NULL; + ptr = data; + ptr[0] = 0x0d; + ptr[1] = src->info.codepage; + ptr[2] = src->info.char_size; + ptr[3] = (src->info.def_char & 0xff00 ? + RtlUshortByteSwap( src->info.def_char ) : src->info.def_char); + ptr[4] = src->info.def_unicode_char; + + if (src->info.char_size == 2) + { + USHORT off = src->dbcs.cp2uni_leadbytes[src->info.def_char >> 8] * 256; + ptr[5] = src->dbcs.cp2uni[off + (src->info.def_char & 0xff)]; + + ptr[6] = src->dbcs.uni2cp_low[src->dbcs.uni2cp_high[src->info.def_unicode_char >> 8] + + (src->info.def_unicode_char & 0xff)]; + + ptr += 7; + memcpy( ptr, src->dbcs.lead_bytes, 12 ); + ptr += 6; + *ptr++ = 256 + 3 + (leadbytes + 1) * 256; + for (i = 0; i < 256; i++) *ptr++ = (src->dbcs.cp2uni_leadbytes[i] ? 0 : src->dbcs.cp2uni[i]); + *ptr++ = 0; + for (i = 0; i < 12; i++) if (!src->dbcs.lead_bytes[i]) break; + *ptr++ = i / 2; + for (i = 0; i < 256; i++) *ptr++ = 256 * src->dbcs.cp2uni_leadbytes[i]; + for (i = 0; i < leadbytes; i++, ptr += 256) + memcpy( ptr, src->dbcs.cp2uni + 256 * (i + 1), 256 * sizeof(USHORT) ); + *ptr++ = 4; + for (i = 0; i < 65536; i++) + ptr[i] = src->dbcs.uni2cp_low[src->dbcs.uni2cp_high[i >> 8] + (i & 0xff)]; + } + else + { + char *uni2cp; + + ptr[5] = src->sbcs.cp2uni[src->info.def_char]; + ptr[6] = src->sbcs.uni2cp_low[src->sbcs.uni2cp_high[src->info.def_unicode_char >> 8] + + (src->info.def_unicode_char & 0xff)]; + + ptr += 7; + memset( ptr, 0, 12 ); + ptr += 6; + *ptr++ = 256 + 3 + (src->sbcs.cp2uni_glyphs != src->sbcs.cp2uni ? 256 : 0); + memcpy( ptr, src->sbcs.cp2uni, 256 * sizeof(USHORT) ); + ptr += 256; + if (src->sbcs.cp2uni_glyphs != src->sbcs.cp2uni) + { + *ptr++ = 256; + memcpy( ptr + 1, src->sbcs.cp2uni_glyphs, 256 ); + ptr += 256; + } + else *ptr++ = 0; + *ptr++ = 0; + *ptr++ = 0; + uni2cp = (char *)ptr; + for (i = 0; i < 65536; i++) + uni2cp[i] = src->sbcs.uni2cp_low[src->sbcs.uni2cp_high[i >> 8] + (i & 0xff)]; + } + return data; +} + + #if !defined(__APPLE__) && !defined(__ANDROID__) /* these platforms always use UTF-8 */ /* charset to codepage map, sorted by name */ @@ -604,7 +686,17 @@ NTSTATUS WINAPI NtGetNlsSectionPtr( ULONG type, ULONG id, void *unknown, void ** HANDLE file; NTSTATUS status; - if ((status = open_nls_data_file( type, id, &file ))) return status; + if ((status = open_nls_data_file( type, id, &file ))) + { + /* FIXME: special case for codepage table, generate it from the libwine data */ + if (type == NLS_SECTION_CODEPAGE) + { + const union cptable *table = wine_cp_get_table( id ); + if (table && (*ptr = build_cptable( table, size ))) return STATUS_SUCCESS; + } + return status; + } + if ((status = NtQueryInformationFile( file, &io, &info, sizeof(info), FileEndOfFileInformation ))) goto done; /* FIXME: return a heap block instead of a file mapping for now */
1
0
0
0
Alexandre Julliard : ntdll Implement RtlInitNlsTables() and RtlResetRtlTranslations().
by Alexandre Julliard
26 Nov '19
26 Nov '19
Module: wine Branch: master Commit: c0ff49061f0bfb200d18854309ad177c1f718b65 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c0ff49061f0bfb200d188543…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Nov 26 17:49:31 2019 +0100 ntdll Implement RtlInitNlsTables() and RtlResetRtlTranslations(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/locale.c | 29 +++++++++++++++++++++++++++++ dlls/ntdll/ntdll.spec | 4 ++-- dlls/ntdll/rtlstr.c | 5 ----- include/winternl.h | 2 ++ 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c index 6da6f5ead3..c271cab732 100644 --- a/dlls/ntdll/locale.c +++ b/dlls/ntdll/locale.c @@ -71,9 +71,14 @@ enum nls_section_type NLS_SECTION_NORMALIZE = 12 }; +UINT NlsAnsiCodePage = 0; +BYTE NlsMbCodePageTag = 0; +BYTE NlsMbOemCodePageTag = 0; + LCID user_lcid = 0, system_lcid = 0; static LANGID user_ui_language, system_ui_language; +static NLSTABLEINFO nls_info; static HMODULE kernel32_handle; static const union cptable *unix_table; /* NULL if UTF8 */ @@ -652,6 +657,30 @@ void WINAPI RtlInitCodePageTable( USHORT *ptr, CPTABLEINFO *info ) } +/************************************************************************** + * RtlInitNlsTables (NTDLL.@) + */ +void WINAPI RtlInitNlsTables( USHORT *ansi, USHORT *oem, USHORT *casetable, NLSTABLEINFO *info ) +{ + RtlInitCodePageTable( ansi, &info->AnsiTableInfo ); + RtlInitCodePageTable( oem, &info->OemTableInfo ); + info->UpperCaseTable = casetable + 2; + info->LowerCaseTable = casetable + casetable[1] + 2; +} + + +/************************************************************************** + * RtlResetRtlTranslations (NTDLL.@) + */ +void WINAPI RtlResetRtlTranslations( const NLSTABLEINFO *info ) +{ + NlsAnsiCodePage = info->AnsiTableInfo.CodePage; + NlsMbCodePageTag = info->AnsiTableInfo.DBCSCodePage; + NlsMbOemCodePageTag = info->OemTableInfo.DBCSCodePage; + nls_info = *info; +} + + /****************************************************************** * RtlLocaleNameToLcid (NTDLL.@) */ diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index d713e80a16..899b044c74 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -731,7 +731,7 @@ @ stdcall RtlInitAnsiStringEx(ptr str) @ stdcall RtlInitCodePageTable(ptr ptr) # @ stub RtlInitMemoryStream -@ stub RtlInitNlsTables +@ stdcall RtlInitNlsTables(ptr ptr ptr ptr) # @ stub RtlInitOutOfProcessMemoryStream @ stdcall RtlInitString(ptr str) @ stdcall RtlInitUnicodeString(ptr wstr) @@ -901,7 +901,7 @@ @ stub RtlRemoteCall @ stdcall RtlRemoveVectoredContinueHandler(ptr) @ stdcall RtlRemoveVectoredExceptionHandler(ptr) -@ stub RtlResetRtlTranslations +@ stdcall RtlResetRtlTranslations(ptr) @ stdcall -arch=x86_64 RtlRestoreContext(ptr ptr) @ stdcall RtlRestoreLastWin32Error(long) RtlSetLastWin32Error @ stub RtlRevertMemoryStream diff --git a/dlls/ntdll/rtlstr.c b/dlls/ntdll/rtlstr.c index ee861ddea4..0eeb14ed65 100644 --- a/dlls/ntdll/rtlstr.c +++ b/dlls/ntdll/rtlstr.c @@ -40,10 +40,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ntdll); #define GUID_STRING_LENGTH 38 -UINT NlsAnsiCodePage = 0; -BYTE NlsMbCodePageTag = 0; -BYTE NlsMbOemCodePageTag = 0; - extern const union cptable cptable_20127; /* 7-bit ASCII */ static const union cptable *ansi_table = &cptable_20127; @@ -59,7 +55,6 @@ void CDECL __wine_init_codepages( const union cptable *ansi, const union cptable { ansi_table = ansi; oem_table = oem; - NlsAnsiCodePage = ansi->info.codepage; } /************************************************************************** diff --git a/include/winternl.h b/include/winternl.h index a2fb7e94e3..1477932d10 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2782,6 +2782,7 @@ NTSYSAPI void WINAPI RtlInitString(PSTRING,PCSZ); NTSYSAPI void WINAPI RtlInitAnsiString(PANSI_STRING,PCSZ); NTSYSAPI NTSTATUS WINAPI RtlInitAnsiStringEx(PANSI_STRING,PCSZ); NTSYSAPI void WINAPI RtlInitCodePageTable(USHORT*,CPTABLEINFO*); +NTSYSAPI void WINAPI RtlInitNlsTables(USHORT*,USHORT*,USHORT*,NLSTABLEINFO*); NTSYSAPI void WINAPI RtlInitUnicodeString(PUNICODE_STRING,PCWSTR); NTSYSAPI NTSTATUS WINAPI RtlInitUnicodeStringEx(PUNICODE_STRING,PCWSTR); NTSYSAPI void WINAPI RtlInitializeBitMap(PRTL_BITMAP,PULONG,ULONG); @@ -2861,6 +2862,7 @@ NTSYSAPI void WINAPI RtlReleaseResource(LPRTL_RWLOCK); NTSYSAPI void WINAPI RtlReleaseSRWLockExclusive(RTL_SRWLOCK*); NTSYSAPI void WINAPI RtlReleaseSRWLockShared(RTL_SRWLOCK*); NTSYSAPI ULONG WINAPI RtlRemoveVectoredExceptionHandler(PVOID); +NTSYSAPI void WINAPI RtlResetRtlTranslations(const NLSTABLEINFO*); NTSYSAPI void WINAPI RtlRestoreLastWin32Error(DWORD); NTSYSAPI void WINAPI RtlSecondsSince1970ToTime(DWORD,LARGE_INTEGER *); NTSYSAPI void WINAPI RtlSecondsSince1980ToTime(DWORD,LARGE_INTEGER *);
1
0
0
0
Alexandre Julliard : ntdll: Implement RtlInitCodePageTable().
by Alexandre Julliard
26 Nov '19
26 Nov '19
Module: wine Branch: master Commit: 9ae5717ba6d10126c4a274240ec1e72fa241a6db URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9ae5717ba6d10126c4a27424…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Nov 26 17:29:41 2019 +0100 ntdll: Implement RtlInitCodePageTable(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/locale.c | 58 +++++++++++++++++++++++++++++++++++++ dlls/ntdll/ntdll.spec | 2 +- dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- include/winternl.h | 24 +++++++++++++++ 4 files changed, 84 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c index 1c80bf80bb..6da6f5ead3 100644 --- a/dlls/ntdll/locale.c +++ b/dlls/ntdll/locale.c @@ -40,6 +40,30 @@ WINE_DEFAULT_DEBUG_CHANNEL(nls); +/* NLS file format: + * + * header: + * WORD offset to cp2uni table in words + * WORD CodePage + * WORD MaximumCharacterSize + * BYTE[2] DefaultChar + * WORD UniDefaultChar + * WORD TransDefaultChar + * WORD TransUniDefaultChar + * BYTE[12] LeadByte + * cp2uni table: + * WORD offset to uni2cp table in words + * WORD[256] cp2uni table + * WORD glyph table size + * WORD[glyph_table_size] glyph table + * WORD number of lead byte ranges + * WORD[256] lead byte offsets in words + * WORD[leadbytes][256] cp2uni table for lead bytes + * uni2cp table: + * WORD 0 / 4 + * BYTE[65536] / WORD[65536] uni2cp table + */ + enum nls_section_type { NLS_SECTION_CASEMAP = 10, @@ -594,6 +618,40 @@ done: } +/****************************************************************** + * RtlInitCodePageTable (NTDLL.@) + */ +void WINAPI RtlInitCodePageTable( USHORT *ptr, CPTABLEINFO *info ) +{ + USHORT hdr_size = ptr[0]; + + info->CodePage = ptr[1]; + info->MaximumCharacterSize = ptr[2]; + info->DefaultChar = ptr[3]; + info->UniDefaultChar = ptr[4]; + info->TransDefaultChar = ptr[5]; + info->TransUniDefaultChar = ptr[6]; + memcpy( info->LeadByte, ptr + 7, sizeof(info->LeadByte) ); + ptr += hdr_size; + + info->WideCharTable = ptr + ptr[0] + 1; + info->MultiByteTable = ++ptr; + ptr += 256; + if (*ptr++) ptr += 256; /* glyph table */ + info->DBCSRanges = ptr; + if (*ptr) /* dbcs ranges */ + { + info->DBCSCodePage = 1; + info->DBCSOffsets = ptr + 1; + } + else + { + info->DBCSCodePage = 0; + info->DBCSOffsets = NULL; + } +} + + /****************************************************************** * RtlLocaleNameToLcid (NTDLL.@) */ diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 3e1aa2fe49..d713e80a16 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -729,7 +729,7 @@ @ stdcall RtlImpersonateSelf(long) @ stdcall RtlInitAnsiString(ptr str) @ stdcall RtlInitAnsiStringEx(ptr str) -@ stub RtlInitCodePageTable +@ stdcall RtlInitCodePageTable(ptr ptr) # @ stub RtlInitMemoryStream @ stub RtlInitNlsTables # @ stub RtlInitOutOfProcessMemoryStream diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 297487fa25..d59e500187 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -1079,7 +1079,7 @@ @ stdcall RtlImageDirectoryEntryToData(long long long ptr) @ stdcall RtlImageNtHeader(long) @ stdcall RtlInitAnsiString(ptr str) -@ stub RtlInitCodePageTable +@ stdcall RtlInitCodePageTable(ptr ptr) ntdll.RtlInitCodePageTable @ stdcall RtlInitString(ptr str) @ stdcall RtlInitUnicodeString(ptr wstr) @ stdcall RtlInitializeBitMap(ptr ptr long) diff --git a/include/winternl.h b/include/winternl.h index 635c230ded..a2fb7e94e3 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2203,6 +2203,29 @@ typedef enum _SYSDBG_COMMAND { SysDbgWriteBusData } SYSDBG_COMMAND, *PSYSDBG_COMMAND; +typedef struct _CPTABLEINFO +{ + USHORT CodePage; + USHORT MaximumCharacterSize; + USHORT DefaultChar; + USHORT UniDefaultChar; + USHORT TransDefaultChar; + USHORT TransUniDefaultChar; + USHORT DBCSCodePage; + UCHAR LeadByte[12]; + USHORT *MultiByteTable; + void *WideCharTable; + USHORT *DBCSRanges; + USHORT *DBCSOffsets; +} CPTABLEINFO, *PCPTABLEINFO; + +typedef struct _NLSTABLEINFO +{ + CPTABLEINFO OemTableInfo; + CPTABLEINFO AnsiTableInfo; + USHORT *UpperCaseTable; + USHORT *LowerCaseTable; +} NLSTABLEINFO, *PNLSTABLEINFO; /************************************************************************* * Loader structures @@ -2758,6 +2781,7 @@ NTSYSAPI NTSTATUS WINAPI RtlImpersonateSelf(SECURITY_IMPERSONATION_LEVEL); NTSYSAPI void WINAPI RtlInitString(PSTRING,PCSZ); NTSYSAPI void WINAPI RtlInitAnsiString(PANSI_STRING,PCSZ); NTSYSAPI NTSTATUS WINAPI RtlInitAnsiStringEx(PANSI_STRING,PCSZ); +NTSYSAPI void WINAPI RtlInitCodePageTable(USHORT*,CPTABLEINFO*); NTSYSAPI void WINAPI RtlInitUnicodeString(PUNICODE_STRING,PCWSTR); NTSYSAPI NTSTATUS WINAPI RtlInitUnicodeStringEx(PUNICODE_STRING,PCWSTR); NTSYSAPI void WINAPI RtlInitializeBitMap(PRTL_BITMAP,PULONG,ULONG);
1
0
0
0
Alexandre Julliard : ntdll: Implement NtGetNlsSectionPtr().
by Alexandre Julliard
26 Nov '19
26 Nov '19
Module: wine Branch: master Commit: f5c4a89cf28c6e7d9a2f27968bc35e8cbc724e79 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f5c4a89cf28c6e7d9a2f2796…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Nov 26 17:25:42 2019 +0100 ntdll: Implement NtGetNlsSectionPtr(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/locale.c | 167 ++++++++++++++++++++++++++++++++++++++++++++++++++ dlls/ntdll/ntdll.spec | 2 + include/winternl.h | 1 + 3 files changed, 170 insertions(+) diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c index 94a945c17c..1c80bf80bb 100644 --- a/dlls/ntdll/locale.c +++ b/dlls/ntdll/locale.c @@ -40,6 +40,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(nls); +enum nls_section_type +{ + NLS_SECTION_CASEMAP = 10, + NLS_SECTION_CODEPAGE = 11, + NLS_SECTION_NORMALIZE = 12 +}; + LCID user_lcid = 0, system_lcid = 0; static LANGID user_ui_language, system_ui_language; @@ -67,6 +74,137 @@ static NTSTATUS load_string( ULONG id, LANGID lang, WCHAR *buffer, ULONG len ) } +static NTSTATUS open_nls_data_file( ULONG type, ULONG id, HANDLE *file ) +{ + static const WCHAR pathfmtW[] = {'\\','?','?','\\','%','s','%','s',0}; + static const WCHAR keyfmtW[] = + {'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e','\\','S','y','s','t','e','m','\\', + 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', + 'C','o','n','t','r','o','l','\\','N','l','s','\\','%','s',0}; + static const WCHAR cpW[] = {'C','o','d','e','p','a','g','e',0}; + static const WCHAR normW[] = {'N','o','r','m','a','l','i','z','a','t','i','o','n',0}; + static const WCHAR langW[] = {'L','a','n','g','u','a','g','e',0}; + static const WCHAR cpfmtW[] = {'%','u',0}; + static const WCHAR normfmtW[] = {'%','x',0}; + static const WCHAR langfmtW[] = {'%','0','4','x',0}; + static const WCHAR winedatadirW[] = {'W','I','N','E','D','A','T','A','D','I','R',0}; + static const WCHAR winebuilddirW[] = {'W','I','N','E','B','U','I','L','D','D','I','R',0}; + static const WCHAR dataprefixW[] = {'\\',0}; + static const WCHAR buildprefixW[] = {'\\','l','o','a','d','e','r','\\',0}; + static const WCHAR cpdefaultW[] = {'c','_','%','0','3','d','.','n','l','s',0}; + static const WCHAR intlW[] = {'l','_','i','n','t','l','.','n','l','s',0}; + static const WCHAR normnfcW[] = {'n','o','r','m','n','f','c','.','n','l','s',0}; + static const WCHAR normnfdW[] = {'n','o','r','m','n','f','d','.','n','l','s',0}; + static const WCHAR normnfkcW[] = {'n','o','r','m','n','f','k','c','.','n','l','s',0}; + static const WCHAR normnfkdW[] = {'n','o','r','m','n','f','k','d','.','n','l','s',0}; + + DWORD size; + HANDLE handle; + NTSTATUS status; + IO_STATUS_BLOCK io; + OBJECT_ATTRIBUTES attr; + UNICODE_STRING nameW, valueW; + WCHAR buffer[MAX_PATH], value[10]; + const WCHAR *name = NULL, *prefix = buildprefixW; + KEY_VALUE_PARTIAL_INFORMATION *info; + + /* get filename from registry */ + + switch (type) + { + case NLS_SECTION_CASEMAP: + if (id) return STATUS_UNSUCCESSFUL; + sprintfW( buffer, keyfmtW, langW ); + sprintfW( value, langfmtW, LANGIDFROMLCID(system_lcid) ); + break; + case NLS_SECTION_CODEPAGE: + sprintfW( buffer, keyfmtW, cpW ); + sprintfW( value, cpfmtW, id ); + break; + case NLS_SECTION_NORMALIZE: + sprintfW( buffer, keyfmtW, normW ); + sprintfW( value, normfmtW, id ); + break; + default: + return STATUS_INVALID_PARAMETER_1; + } + RtlInitUnicodeString( &nameW, buffer ); + RtlInitUnicodeString( &valueW, value ); + InitializeObjectAttributes( &attr, &nameW, 0, 0, NULL ); + if ((status = NtOpenKey( &handle, KEY_READ, &attr ))) return status; + info = (KEY_VALUE_PARTIAL_INFORMATION *)buffer; + size = sizeof(buffer) - sizeof(WCHAR); + status = NtQueryValueKey( handle, &valueW, KeyValuePartialInformation, info, size, &size ); + NtClose( handle ); + if (!status) + { + ((WCHAR *)info->Data)[info->DataLength / sizeof(WCHAR)] = 0; + name = (WCHAR *)info->Data; + } + else /* otherwise some hardcoded defaults */ + { + switch (type) + { + case NLS_SECTION_CASEMAP: + name = intlW; + break; + case NLS_SECTION_CODEPAGE: + sprintfW( buffer, cpdefaultW, id ); + name = buffer; + break; + case NLS_SECTION_NORMALIZE: + switch (id) + { + case NormalizationC: name = normnfcW; break; + case NormalizationD: name = normnfdW; break; + case NormalizationKC: name = normnfkcW; break; + case NormalizationKD: name = normnfkdW; break; + } + break; + } + if (!name) return status; + } + + /* try to open file in system dir */ + + valueW.MaximumLength = (strlenW(name) + strlenW(system_dir) + 5) * sizeof(WCHAR); + if (!(valueW.Buffer = RtlAllocateHeap( GetProcessHeap(), 0, valueW.MaximumLength ))) + return STATUS_NO_MEMORY; + valueW.Length = sprintfW( valueW.Buffer, pathfmtW, system_dir, name ) * sizeof(WCHAR); + InitializeObjectAttributes( &attr, &valueW, 0, 0, NULL ); + status = NtOpenFile( file, GENERIC_READ, &attr, &io, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_ALERT ); + if (!status) TRACE( "found %s\n", debugstr_w( valueW.Buffer )); + RtlFreeUnicodeString( &valueW ); + if (status != STATUS_OBJECT_NAME_NOT_FOUND) return status; + + /* not found, try in build or data dir */ + + RtlInitUnicodeString( &nameW, winebuilddirW ); + valueW.MaximumLength = 0; + if (RtlQueryEnvironmentVariable_U( NULL, &nameW, &valueW ) != STATUS_BUFFER_TOO_SMALL) + { + RtlInitUnicodeString( &nameW, winedatadirW ); + prefix = dataprefixW; + if (RtlQueryEnvironmentVariable_U( NULL, &nameW, &valueW ) != STATUS_BUFFER_TOO_SMALL) + return status; + } + valueW.MaximumLength = valueW.Length + sizeof(buildprefixW) + strlenW(name) * sizeof(WCHAR); + if (!(valueW.Buffer = RtlAllocateHeap( GetProcessHeap(), 0, valueW.MaximumLength ))) + return STATUS_NO_MEMORY; + if (!RtlQueryEnvironmentVariable_U( NULL, &nameW, &valueW )) + { + strcatW( valueW.Buffer, prefix ); + strcatW( valueW.Buffer, name ); + valueW.Length = strlenW(valueW.Buffer) * sizeof(WCHAR); + InitializeObjectAttributes( &attr, &valueW, 0, 0, NULL ); + status = NtOpenFile( file, GENERIC_READ, &attr, &io, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_ALERT ); + if (!status) TRACE( "found %s\n", debugstr_w( valueW.Buffer )); + } + RtlFreeUnicodeString( &valueW ); + return status; +} + + #if !defined(__APPLE__) && !defined(__ANDROID__) /* these platforms always use UTF-8 */ /* charset to codepage map, sorted by name */ @@ -427,6 +565,35 @@ NTSTATUS WINAPI NtQueryInstallUILanguage( LANGID *lang ) } +/************************************************************************** + * NtGetNlsSectionPtr (NTDLL.@) + */ +NTSTATUS WINAPI NtGetNlsSectionPtr( ULONG type, ULONG id, void *unknown, void **ptr, SIZE_T *size ) +{ + FILE_END_OF_FILE_INFORMATION info; + IO_STATUS_BLOCK io; + HANDLE file; + NTSTATUS status; + + if ((status = open_nls_data_file( type, id, &file ))) return status; + if ((status = NtQueryInformationFile( file, &io, &info, sizeof(info), FileEndOfFileInformation ))) + goto done; + /* FIXME: return a heap block instead of a file mapping for now */ + if (!(*ptr = RtlAllocateHeap( GetProcessHeap(), 0, info.EndOfFile.QuadPart ))) + { + status = STATUS_NO_MEMORY; + goto done; + } + status = NtReadFile( file, 0, NULL, NULL, &io, *ptr, info.EndOfFile.QuadPart, NULL, NULL ); + if (!status && io.Information != info.EndOfFile.QuadPart) status = STATUS_INVALID_FILE_FOR_SECTION; + if (!status) *size = io.Information; + else RtlFreeHeap( GetProcessHeap(), 0, *ptr ); +done: + NtClose( file ); + return status; +} + + /****************************************************************** * RtlLocaleNameToLcid (NTDLL.@) */ diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index fa2c7a32cd..3e1aa2fe49 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -220,6 +220,7 @@ @ stdcall -norelay NtGetContextThread(long ptr) @ stdcall NtGetCurrentProcessorNumber() # @ stub NtGetDevicePowerState +@ stdcall NtGetNlsSectionPtr(long long long ptr ptr) @ stub NtGetPlugPlayEvent @ stdcall NtGetTickCount() @ stdcall NtGetWriteWatch(long long ptr long ptr ptr ptr) @@ -1182,6 +1183,7 @@ @ stdcall -private -norelay ZwGetContextThread(long ptr) NtGetContextThread @ stdcall -private ZwGetCurrentProcessorNumber() NtGetCurrentProcessorNumber # @ stub ZwGetDevicePowerState +@ stdcall -private ZwGetNlsSectionPtr(long long long ptr ptr) NtGetNlsSectionPtr @ stub ZwGetPlugPlayEvent @ stdcall -private ZwGetTickCount() NtGetTickCount @ stdcall -private ZwGetWriteWatch(long long ptr long ptr ptr ptr) NtGetWriteWatch diff --git a/include/winternl.h b/include/winternl.h index d5c8d76ccf..635c230ded 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2407,6 +2407,7 @@ NTSYSAPI NTSTATUS WINAPI NtFreeVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG); NTSYSAPI NTSTATUS WINAPI NtFsControlFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,PVOID,ULONG,PVOID,ULONG); NTSYSAPI NTSTATUS WINAPI NtGetContextThread(HANDLE,CONTEXT*); NTSYSAPI ULONG WINAPI NtGetCurrentProcessorNumber(void); +NTSYSAPI NTSTATUS WINAPI NtGetNlsSectionPtr(ULONG,ULONG,void*,void**,SIZE_T*); NTSYSAPI NTSTATUS WINAPI NtGetPlugPlayEvent(ULONG,ULONG,PVOID,ULONG); NTSYSAPI ULONG WINAPI NtGetTickCount(VOID); NTSYSAPI NTSTATUS WINAPI NtGetWriteWatch(HANDLE,ULONG,PVOID,SIZE_T,PVOID*,ULONG_PTR*,ULONG*);
1
0
0
0
Nikolay Sivov : kernel32: Implement higher level API to access thread description.
by Alexandre Julliard
26 Nov '19
26 Nov '19
Module: wine Branch: master Commit: 179cd78f828c67a113e5f0ad85952cfb99c0a281 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=179cd78f828c67a113e5f0ad…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Nov 26 09:48:11 2019 +0300 kernel32: Implement higher level API to access thread description. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- .../api-ms-win-core-processthreads-l1-1-3.spec | 2 +- dlls/kernel32/kernel32.spec | 1 + dlls/kernel32/tests/thread.c | 2 +- dlls/kernelbase/kernelbase.spec | 2 +- dlls/kernelbase/thread.c | 60 ++++++++++++++++++++-- 5 files changed, 61 insertions(+), 6 deletions(-) diff --git a/dlls/api-ms-win-core-processthreads-l1-1-3/api-ms-win-core-processthreads-l1-1-3.spec b/dlls/api-ms-win-core-processthreads-l1-1-3/api-ms-win-core-processthreads-l1-1-3.spec index 6f0c4fa752..9cc853d288 100644 --- a/dlls/api-ms-win-core-processthreads-l1-1-3/api-ms-win-core-processthreads-l1-1-3.spec +++ b/dlls/api-ms-win-core-processthreads-l1-1-3/api-ms-win-core-processthreads-l1-1-3.spec @@ -1,7 +1,7 @@ @ stub GetProcessDefaultCpuSets @ stub GetProcessInformation @ stub GetSystemCpuSetInformation -@ stub GetThreadDescription +@ stdcall GetThreadDescription(long ptr) kernel32.GetThreadDescription @ stub GetThreadSelectedCpuSets @ stub SetProcessDefaultCpuSets @ stub SetProcessInformation diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 367f5d2373..984422d2b4 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -847,6 +847,7 @@ @ stdcall -import GetTempPathA(long ptr) @ stdcall -import GetTempPathW(long ptr) @ stdcall -import GetThreadContext(long ptr) +@ stdcall -import GetThreadDescription(long ptr) @ stdcall -import GetThreadErrorMode() @ stdcall -import GetThreadGroupAffinity(long ptr) @ stdcall -import GetThreadIOPendingFlag(long ptr) diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c index 180eed8241..8ff34ba5f3 100644 --- a/dlls/kernel32/tests/thread.c +++ b/dlls/kernel32/tests/thread.c @@ -2125,7 +2125,7 @@ static void test_thread_description(void) if (!pGetThreadDescription) { - skip("Thread description API is not supported.\n"); + win_skip("Thread description API is not supported.\n"); return; } diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec index 7d20d3b112..6022d4ea37 100644 --- a/dlls/kernelbase/kernelbase.spec +++ b/dlls/kernelbase/kernelbase.spec @@ -711,7 +711,7 @@ @ stdcall GetTempPathA(long ptr) @ stdcall GetTempPathW(long ptr) @ stdcall GetThreadContext(long ptr) -# @ stub GetThreadDescription +@ stdcall GetThreadDescription(long ptr) @ stdcall GetThreadErrorMode() @ stdcall GetThreadGroupAffinity(long ptr) @ stdcall GetThreadIOPendingFlag(long ptr) diff --git a/dlls/kernelbase/thread.c b/dlls/kernelbase/thread.c index 345f44dff7..521d3be079 100644 --- a/dlls/kernelbase/thread.c +++ b/dlls/kernelbase/thread.c @@ -20,6 +20,7 @@ #include <stdarg.h> #include <string.h> +#include <limits.h> #include "ntstatus.h" #define WIN32_NO_STATUS @@ -33,6 +34,7 @@ #include "wine/exception.h" #include "wine/asm.h" #include "wine/debug.h" +#include "wine/heap.h" WINE_DEFAULT_DEBUG_CHANNEL(thread); @@ -390,12 +392,64 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetThreadContext( HANDLE thread, const CONTEXT *co /*********************************************************************** * SetThreadDescription (kernelbase.@) */ -HRESULT WINAPI /* DECLSPEC_HOTPATCH */ SetThreadDescription( HANDLE thread, PCWSTR description ) +HRESULT WINAPI DECLSPEC_HOTPATCH SetThreadDescription( HANDLE thread, PCWSTR description ) { - FIXME( "(%p %s): stub\n", thread, debugstr_w( description )); - return E_NOTIMPL; + THREAD_DESCRIPTION_INFORMATION info; + int length; + + TRACE( "(%p, %s)\n", thread, debugstr_w( description )); + + length = description ? lstrlenW( description ) * sizeof(WCHAR) : 0; + + if (length > USHRT_MAX) + return HRESULT_FROM_NT(STATUS_INVALID_PARAMETER); + + info.Length = length << 16 | length; + info.Description = (WCHAR *)description; + + return HRESULT_FROM_NT(NtSetInformationThread( thread, ThreadDescription, &info, sizeof(info) )); } +/*********************************************************************** + * GetThreadDescription (kernelbase.@) + */ +HRESULT WINAPI DECLSPEC_HOTPATCH GetThreadDescription( HANDLE thread, WCHAR **description ) +{ + THREAD_DESCRIPTION_INFORMATION *info; + NTSTATUS status; + ULONG length; + + TRACE( "(%p, %p)\n", thread, description ); + + *description = NULL; + + length = 0; + status = NtQueryInformationThread( thread, ThreadDescription, NULL, 0, &length ); + if (status != STATUS_BUFFER_TOO_SMALL) + return HRESULT_FROM_NT(status); + + if (!(info = heap_alloc( length ))) + return HRESULT_FROM_NT(STATUS_NO_MEMORY); + + status = NtQueryInformationThread( thread, ThreadDescription, info, length, &length ); + if (!status) + { + length = info->Length & 0xffff; + + if (!(*description = LocalAlloc( 0, length + sizeof(WCHAR)))) + status = STATUS_NO_MEMORY; + else + { + if (length) + memcpy(*description, info->Description, length); + (*description)[length / sizeof(WCHAR)] = 0; + } + } + + heap_free(info); + + return HRESULT_FROM_NT(status); +} /*********************************************************************** * SetThreadErrorMode (kernelbase.@)
1
0
0
0
Nikolay Sivov : ntdll: Implement thread description as information class.
by Alexandre Julliard
26 Nov '19
26 Nov '19
Module: wine Branch: master Commit: b934f6626ed7cb8a6cc18b261550d363a0068141 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b934f6626ed7cb8a6cc18b26…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Nov 26 09:48:10 2019 +0300 ntdll: Implement thread description as information class. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/thread.c | 52 ++++++++++++++++++++++++++++++++++++++++++ include/wine/server_protocol.h | 15 +++++++----- server/protocol.def | 12 ++++++---- server/request.h | 1 + server/thread.c | 36 +++++++++++++++++++++++++++++ server/thread.h | 2 ++ server/trace.c | 3 +++ 7 files changed, 111 insertions(+), 10 deletions(-) diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index 621aaddfe3..6079a6c195 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -1115,6 +1115,36 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class, *(BOOL*)data = FALSE; if (ret_len) *ret_len = sizeof(BOOL); return STATUS_SUCCESS; + case ThreadDescription: + { + THREAD_DESCRIPTION_INFORMATION *info = data; + data_size_t len, desc_len = 0; + WCHAR *ptr; + + len = length >= sizeof(*info) ? length - sizeof(*info) : 0; + ptr = info ? (WCHAR *)(info + 1) : NULL; + + SERVER_START_REQ( get_thread_info ) + { + req->handle = wine_server_obj_handle( handle ); + if (ptr) wine_server_set_reply( req, ptr, len ); + status = wine_server_call( req ); + desc_len = reply->desc_len; + } + SERVER_END_REQ; + + if (!info) + status = STATUS_BUFFER_TOO_SMALL; + else if (status == STATUS_SUCCESS) + { + info->Length = desc_len << 16 | desc_len; + info->Description = ptr; + } + + if (ret_len && (status == STATUS_SUCCESS || status == STATUS_BUFFER_TOO_SMALL)) + *ret_len = sizeof(*info) + desc_len; + } + return status; case ThreadPriority: case ThreadBasePriority: case ThreadImpersonationToken: @@ -1270,6 +1300,28 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class, SERVER_END_REQ; } return status; + case ThreadDescription: + { + const THREAD_DESCRIPTION_INFORMATION *info = data; + data_size_t desc_len; + + if (length != sizeof(*info)) return STATUS_INFO_LENGTH_MISMATCH; + if (!info) return STATUS_ACCESS_VIOLATION; + + desc_len = info->Length & 0xffff; + if (info->Length >> 16 != desc_len) return STATUS_INVALID_PARAMETER; + if (info->Length && !info->Description) return STATUS_ACCESS_VIOLATION; + + SERVER_START_REQ( set_thread_info ) + { + req->handle = wine_server_obj_handle( handle ); + req->mask = SET_THREAD_INFO_DESCRIPTION; + wine_server_add_data( req, info->Description, desc_len ); + status = wine_server_call( req ); + } + SERVER_END_REQ; + } + return status; case ThreadBasicInformation: case ThreadTimes: case ThreadPriority: diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 0712170c80..108701b2bc 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -1006,7 +1006,8 @@ struct get_thread_info_reply int exit_code; int priority; int last; - char __pad_52[4]; + data_size_t desc_len; + /* VARARG(desc,unicode_str); */ }; @@ -1034,16 +1035,18 @@ struct set_thread_info_request affinity_t affinity; client_ptr_t entry_point; obj_handle_t token; + /* VARARG(desc,unicode_str); */ char __pad_44[4]; }; struct set_thread_info_reply { struct reply_header __header; }; -#define SET_THREAD_INFO_PRIORITY 0x01 -#define SET_THREAD_INFO_AFFINITY 0x02 -#define SET_THREAD_INFO_TOKEN 0x04 -#define SET_THREAD_INFO_ENTRYPOINT 0x08 +#define SET_THREAD_INFO_PRIORITY 0x01 +#define SET_THREAD_INFO_AFFINITY 0x02 +#define SET_THREAD_INFO_TOKEN 0x04 +#define SET_THREAD_INFO_ENTRYPOINT 0x08 +#define SET_THREAD_INFO_DESCRIPTION 0x10 @@ -6697,6 +6700,6 @@ union generic_reply struct resume_process_reply resume_process_reply; }; -#define SERVER_PROTOCOL_VERSION 591 +#define SERVER_PROTOCOL_VERSION 592 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/server/protocol.def b/server/protocol.def index c5c15ea1d7..566bc83bb2 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -944,6 +944,8 @@ struct rawinput_device int exit_code; /* thread exit code */ int priority; /* thread priority level */ int last; /* last thread in process */ + data_size_t desc_len; /* description length in bytes */ + VARARG(desc,unicode_str); /* description string */ @END @@ -964,11 +966,13 @@ struct rawinput_device affinity_t affinity; /* affinity mask */ client_ptr_t entry_point; /* thread entry point */ obj_handle_t token; /* impersonation token */ + VARARG(desc,unicode_str); /* description string */ @END -#define SET_THREAD_INFO_PRIORITY 0x01 -#define SET_THREAD_INFO_AFFINITY 0x02 -#define SET_THREAD_INFO_TOKEN 0x04 -#define SET_THREAD_INFO_ENTRYPOINT 0x08 +#define SET_THREAD_INFO_PRIORITY 0x01 +#define SET_THREAD_INFO_AFFINITY 0x02 +#define SET_THREAD_INFO_TOKEN 0x04 +#define SET_THREAD_INFO_ENTRYPOINT 0x08 +#define SET_THREAD_INFO_DESCRIPTION 0x10 /* Retrieve information about a module */ diff --git a/server/request.h b/server/request.h index f0d2003cd7..de7720ae68 100644 --- a/server/request.h +++ b/server/request.h @@ -849,6 +849,7 @@ C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, affinity) == 32 ); C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, exit_code) == 40 ); C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, priority) == 44 ); C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, last) == 48 ); +C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, desc_len) == 52 ); C_ASSERT( sizeof(struct get_thread_info_reply) == 56 ); C_ASSERT( FIELD_OFFSET(struct get_thread_times_request, handle) == 12 ); C_ASSERT( sizeof(struct get_thread_times_request) == 16 ); diff --git a/server/thread.c b/server/thread.c index e753c8d0dd..4fc6abf0ef 100644 --- a/server/thread.c +++ b/server/thread.c @@ -201,6 +201,8 @@ static inline void init_thread_structure( struct thread *thread ) thread->suspend = 0; thread->desktop_users = 0; thread->token = NULL; + thread->desc = NULL; + thread->desc_len = 0; thread->creation_time = current_time; thread->exit_time = 0; @@ -336,6 +338,7 @@ static void cleanup_thread( struct thread *thread ) thread->inflight[i].client = thread->inflight[i].server = -1; } } + free( thread->desc ); thread->req_data = NULL; thread->reply_data = NULL; thread->request_fd = NULL; @@ -344,6 +347,8 @@ static void cleanup_thread( struct thread *thread ) thread->context = NULL; thread->suspend_context = NULL; thread->desktop = 0; + thread->desc = NULL; + thread->desc_len = 0; } /* destroy a thread when its refcount is 0 */ @@ -551,6 +556,28 @@ static void set_thread_info( struct thread *thread, security_set_thread_token( thread, req->token ); if (req->mask & SET_THREAD_INFO_ENTRYPOINT) thread->entry_point = req->entry_point; + if (req->mask & SET_THREAD_INFO_DESCRIPTION) + { + WCHAR *desc; + data_size_t desc_len = get_req_data_size(); + + if (desc_len) + { + if ((desc = mem_alloc( desc_len ))) + { + memcpy( desc, get_req_data(), desc_len ); + free( thread->desc ); + thread->desc = desc; + thread->desc_len = desc_len; + } + } + else + { + free( thread->desc ); + thread->desc = NULL; + thread->desc_len = 0; + } + } } /* stop a thread (at the Unix level) */ @@ -1436,6 +1463,15 @@ DECL_HANDLER(get_thread_info) reply->priority = thread->priority; reply->affinity = thread->affinity; reply->last = thread->process->running_threads == 1; + reply->desc_len = thread->desc_len; + + if (thread->desc && get_reply_max_size()) + { + if (thread->desc_len <= get_reply_max_size()) + set_reply_data( thread->desc, thread->desc_len ); + else + set_error( STATUS_BUFFER_TOO_SMALL ); + } release_object( thread ); } diff --git a/server/thread.h b/server/thread.h index e10120dcf6..66e35603d3 100644 --- a/server/thread.h +++ b/server/thread.h @@ -88,6 +88,8 @@ struct thread timeout_t exit_time; /* Thread exit time */ struct token *token; /* security token associated with this thread */ struct list kernel_object; /* list of kernel object pointers */ + data_size_t desc_len; /* thread description length in bytes */ + WCHAR *desc; /* thread description string */ }; struct thread_snapshot diff --git a/server/trace.c b/server/trace.c index 11df768755..d44f67a021 100644 --- a/server/trace.c +++ b/server/trace.c @@ -1423,6 +1423,8 @@ static void dump_get_thread_info_reply( const struct get_thread_info_reply *req fprintf( stderr, ", exit_code=%d", req->exit_code ); fprintf( stderr, ", priority=%d", req->priority ); fprintf( stderr, ", last=%d", req->last ); + fprintf( stderr, ", desc_len=%u", req->desc_len ); + dump_varargs_unicode_str( ", desc=", cur_size ); } static void dump_get_thread_times_request( const struct get_thread_times_request *req ) @@ -1444,6 +1446,7 @@ static void dump_set_thread_info_request( const struct set_thread_info_request * dump_uint64( ", affinity=", &req->affinity ); dump_uint64( ", entry_point=", &req->entry_point ); fprintf( stderr, ", token=%04x", req->token ); + dump_varargs_unicode_str( ", desc=", cur_size ); } static void dump_get_dll_info_request( const struct get_dll_info_request *req )
1
0
0
0
Nikolay Sivov : mfplat/tests: Fix buffer object leak (Valgrind).
by Alexandre Julliard
26 Nov '19
26 Nov '19
Module: wine Branch: master Commit: fd3fb2efdb4dc94fe267e1b92fbe2aeb28c27c34 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=fd3fb2efdb4dc94fe267e1b9…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Nov 26 13:35:31 2019 +0300 mfplat/tests: Fix buffer object leak (Valgrind). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/tests/mfplat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 832b52713c..1db4d2dcc4 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -1712,6 +1712,8 @@ todo_wine todo_wine ok(count == 1, "Unexpected buffer count %u.\n", count); + IMFMediaBuffer_Release(buffer); + IMFSample_Release(sample); }
1
0
0
0
← Newer
1
...
10
11
12
13
14
15
16
...
90
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Results per page:
10
25
50
100
200