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
July 2020
----- 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
826 discussions
Start a n
N
ew thread
Zebediah Figura : ntdll: Fill the VM counters in NtQuerySystemInformation(SystemProcessInformation).
by Alexandre Julliard
09 Jul '20
09 Jul '20
Module: wine Branch: master Commit: 829c7595130bb84e131b797e45a84176b169a81c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=829c7595130bb84e131b797e…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Wed Jul 8 21:14:53 2020 -0500 ntdll: Fill the VM counters in NtQuerySystemInformation(SystemProcessInformation). Process Hacker displays this information. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/process.c | 19 +++++++++++++------ dlls/ntdll/unix/system.c | 1 + dlls/ntdll/unix/unix_private.h | 1 + 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/unix/process.c b/dlls/ntdll/unix/process.c index 1e31fee326..8a4da2cd55 100644 --- a/dlls/ntdll/unix/process.c +++ b/dlls/ntdll/unix/process.c @@ -1002,10 +1002,13 @@ NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code ) #if defined(HAVE_MACH_MACH_H) -static void fill_VM_COUNTERS( VM_COUNTERS_EX *pvmi ) +void fill_vm_counters( VM_COUNTERS_EX *pvmi, int unix_pid ) { #if defined(MACH_TASK_BASIC_INFO) struct mach_task_basic_info info; + + if (unix_pid != -1) return; /* FIXME: Retrieve information for other processes. */ + mach_msg_type_number_t infoCount = MACH_TASK_BASIC_INFO_COUNT; if(task_info(mach_task_self(), MACH_TASK_BASIC_INFO, (task_info_t)&info, &infoCount) == KERN_SUCCESS) { @@ -1019,13 +1022,17 @@ static void fill_VM_COUNTERS( VM_COUNTERS_EX *pvmi ) #elif defined(linux) -static void fill_VM_COUNTERS( VM_COUNTERS_EX *pvmi ) +void fill_vm_counters( VM_COUNTERS_EX *pvmi, int unix_pid ) { FILE *f; - char line[256]; + char line[256], path[26]; unsigned long value; - f = fopen("/proc/self/status", "r"); + if (unix_pid == -1) + strcpy( path, "/proc/self/status" ); + else + sprintf( path, "/proc/%u/status", unix_pid); + f = fopen( path, "r" ); if (!f) return; while (fgets(line, sizeof(line), f)) @@ -1050,7 +1057,7 @@ static void fill_VM_COUNTERS( VM_COUNTERS_EX *pvmi ) #else -static void fill_VM_COUNTERS( VM_COUNTERS_EX *pvmi ) +void fill_vm_counters( VM_COUNTERS_EX *pvmi, int unix_pid ) { /* FIXME : real data */ } @@ -1171,7 +1178,7 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class else { memset(&pvmi, 0, sizeof(pvmi)); - if (handle == GetCurrentProcess()) fill_VM_COUNTERS(&pvmi); + if (handle == GetCurrentProcess()) fill_vm_counters( &pvmi, -1 ); else { SERVER_START_REQ(get_process_vm_counters) diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index a80d3c4fd4..33fb37ec33 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -2147,6 +2147,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class, nt_process->ParentProcessId = UlongToHandle(server_process->parent_pid); nt_process->HandleCount = server_process->handle_count; get_thread_times( server_process->unix_pid, -1, &nt_process->KernelTime, &nt_process->UserTime ); + fill_vm_counters( &nt_process->vmCounters, server_process->unix_pid ); } pos = (pos + 7) & ~7; diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index be3906cfd1..711a0bed2b 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -221,6 +221,7 @@ extern void DECLSPEC_NORETURN signal_start_thread( PRTL_THREAD_START_ROUTINE ent BOOL suspend, void *relay, TEB *teb ) DECLSPEC_HIDDEN; extern void DECLSPEC_NORETURN signal_exit_thread( int status, void (*func)(int) ) DECLSPEC_HIDDEN; extern void __wine_syscall_dispatcher(void) DECLSPEC_HIDDEN; +extern void fill_vm_counters( VM_COUNTERS_EX *pvmi, int unix_pid ) DECLSPEC_HIDDEN; extern NTSTATUS cdrom_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc, void *apc_user, IO_STATUS_BLOCK *io, ULONG code, void *in_buffer,
1
0
0
0
Dmitry Timoshkov : gdi32: Add support for GCP_USEKERNING to GetCharacterPlacement().
by Alexandre Julliard
09 Jul '20
09 Jul '20
Module: wine Branch: master Commit: cb511b82bd55245b55ad208afccf59088f6d6bf1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=cb511b82bd55245b55ad208a…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Thu Jul 9 15:20:51 2020 +0100 gdi32: Add support for GCP_USEKERNING to GetCharacterPlacement(). Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/font.c | 97 +++++++++++++++++++++++++++++++++++++++------- dlls/gdi32/tests/font.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 185 insertions(+), 13 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 8788426a2c..e099bec5e8 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -3278,6 +3278,55 @@ GetCharacterPlacementA(HDC hdc, LPCSTR lpString, INT uCount, return ret; } +static int kern_pair(const KERNINGPAIR *kern, int count, WCHAR c1, WCHAR c2) +{ + int i; + + for (i = 0; i < count; i++) + { + if (kern[i].wFirst == c1 && kern[i].wSecond == c2) + return kern[i].iKernAmount; + } + + return 0; +} + +static int *kern_string(HDC hdc, const WCHAR *str, int len, int *kern_total) +{ + int i, count; + KERNINGPAIR *kern = NULL; + int *ret; + + *kern_total = 0; + + ret = heap_alloc(len * sizeof(*ret)); + if (!ret) return NULL; + + count = GetKerningPairsW(hdc, 0, NULL); + if (count) + { + kern = heap_alloc(count * sizeof(*kern)); + if (!kern) + { + heap_free(ret); + return NULL; + } + + GetKerningPairsW(hdc, count, kern); + } + + for (i = 0; i < len - 1; i++) + { + ret[i] = kern_pair(kern, count, str[i], str[i + 1]); + *kern_total += ret[i]; + } + + ret[len - 1] = 0; /* no kerning for last element */ + + heap_free(kern); + return ret; +} + /************************************************************************* * GetCharacterPlacementW [GDI32.@] * @@ -3309,6 +3358,7 @@ GetCharacterPlacementW( DWORD ret=0; SIZE size; UINT i, nSet; + int *kern = NULL, kern_total = 0; TRACE("%s, %d, %d, 0x%08x\n", debugstr_wn(lpString, uCount), uCount, nMaxExtent, dwFlags); @@ -3325,30 +3375,30 @@ GetCharacterPlacementW( lpResults->lpDx, lpResults->lpCaretPos, lpResults->lpClass, lpResults->lpGlyphs, lpResults->nGlyphs, lpResults->nMaxFit); - if(dwFlags&(~GCP_REORDER)) + if (dwFlags & ~(GCP_REORDER | GCP_USEKERNING)) FIXME("flags 0x%08x ignored\n", dwFlags); - if(lpResults->lpClass) + if (lpResults->lpClass) FIXME("classes not implemented\n"); if (lpResults->lpCaretPos && (dwFlags & GCP_REORDER)) FIXME("Caret positions for complex scripts not implemented\n"); nSet = (UINT)uCount; - if(nSet > lpResults->nGlyphs) + if (nSet > lpResults->nGlyphs) nSet = lpResults->nGlyphs; /* return number of initialized fields */ lpResults->nGlyphs = nSet; - if((dwFlags&GCP_REORDER)==0 ) + if (!(dwFlags & GCP_REORDER)) { /* Treat the case where no special handling was requested in a fastpath way */ /* copy will do if the GCP_REORDER flag is not set */ - if(lpResults->lpOutString) + if (lpResults->lpOutString) memcpy( lpResults->lpOutString, lpString, nSet * sizeof(WCHAR)); - if(lpResults->lpOrder) + if (lpResults->lpOrder) { - for(i = 0; i < nSet; i++) + for (i = 0; i < nSet; i++) lpResults->lpOrder[i] = i; } } @@ -3358,6 +3408,16 @@ GetCharacterPlacementW( nSet, lpResults->lpOrder, NULL, NULL ); } + if (dwFlags & GCP_USEKERNING) + { + kern = kern_string(hdc, lpString, nSet, &kern_total); + if (!kern) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + } + /* FIXME: Will use the placement chars */ if (lpResults->lpDx) { @@ -3365,7 +3425,11 @@ GetCharacterPlacementW( for (i = 0; i < nSet; i++) { if (GetCharWidth32W(hdc, lpString[i], lpString[i], &c)) - lpResults->lpDx[i]= c; + { + lpResults->lpDx[i] = c; + if (dwFlags & GCP_USEKERNING) + lpResults->lpDx[i] += kern[i]; + } } } @@ -3374,16 +3438,23 @@ GetCharacterPlacementW( int pos = 0; lpResults->lpCaretPos[0] = 0; - for (i = 1; i < nSet; i++) - if (GetTextExtentPoint32W(hdc, &(lpString[i - 1]), 1, &size)) - lpResults->lpCaretPos[i] = (pos += size.cx); + for (i = 0; i < nSet - 1; i++) + { + if (dwFlags & GCP_USEKERNING) + pos += kern[i]; + + if (GetTextExtentPoint32W(hdc, &lpString[i], 1, &size)) + lpResults->lpCaretPos[i + 1] = (pos += size.cx); + } } - if(lpResults->lpGlyphs) + if (lpResults->lpGlyphs) GetGlyphIndicesW(hdc, lpString, nSet, lpResults->lpGlyphs, 0); if (GetTextExtentPoint32W(hdc, lpString, uCount, &size)) - ret = MAKELONG(size.cx, size.cy); + ret = MAKELONG(size.cx + kern_total, size.cy); + + heap_free(kern); return ret; } diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index ae4a643aa5..ad894dfdca 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -7168,6 +7168,106 @@ static void test_char_width(void) ReleaseDC(NULL, dc); } +static void test_GetCharacterPlacement_kerning(void) +{ + LOGFONTA lf; + HFONT hfont, hfont_old; + KERNINGPAIR *kp; + HDC hdc; + DWORD count, ret, i, size, width, width_kern, idx; + WCHAR str[30]; + GCP_RESULTSW result; + int kern[30], pos[30], pos_kern[30], dx[30], dx_kern[30], kern_amount; + + if (!is_font_installed("Arial")) + { + skip("Arial is not installed, skipping the test\n"); + return; + } + + hdc = GetDC(0); + + memset(&lf, 0, sizeof(lf)); + strcpy(lf.lfFaceName, "Arial"); + lf.lfHeight = 120; + hfont = CreateFontIndirectA(&lf); + ok(hfont != NULL, "CreateFontIndirect failed\n"); + + hfont_old = SelectObject(hdc, hfont); + + count = GetKerningPairsW(hdc, 0, NULL); + kp = HeapAlloc(GetProcessHeap(), 0, count * sizeof(*kp)); + + ret = GetKerningPairsW(hdc, count, kp); + ok(ret == count, "got %u, expected %u\n", ret, count); + + size = kern_amount = idx = 0; + for (i = 0; i < count; i++) + { + if (kp[i].wFirst >= 'A' && kp[i].wFirst <= 'z' && + kp[i].wSecond >= 'A' && kp[i].wSecond <= 'z') + { + str[size++] = kp[i].wFirst; + str[size++] = kp[i].wSecond; + str[size++] = 0; + kern[idx] = kp[i].iKernAmount; + idx++; + kern_amount += kp[i].iKernAmount; + if (size >= ARRAY_SIZE(str)) break; + } + } + + HeapFree(GetProcessHeap(), 0, kp); + + count = size; + + memset(&result, 0, sizeof(result)); + result.lStructSize = sizeof(result); + result.lpCaretPos = pos; + result.lpDx = dx; + result.nGlyphs = count; + ret = GetCharacterPlacementW(hdc, str, count, 0, &result, 0); + ok(ret, "GetCharacterPlacement failed\n"); + ok(result.nGlyphs == count, "got %u\n", result.nGlyphs); + width = LOWORD(ret); + + memset(&result, 0, sizeof(result)); + result.lStructSize = sizeof(result); + result.lpCaretPos = pos_kern; + result.lpDx = dx_kern; + result.nGlyphs = count; + ret = GetCharacterPlacementW(hdc, str, count, 0, &result, GCP_USEKERNING); + ok(ret, "GetCharacterPlacement failed\n"); + ok(result.nGlyphs == count, "got %u\n", result.nGlyphs); + width_kern = LOWORD(ret); + + if (width == width_kern) + { + win_skip("GCP_USEKERNING is broken on this platform\n"); + goto done; + } + + ok(width + kern_amount == width_kern, "%d + %d != %d\n", width, kern_amount, width_kern); + + kern_amount = idx = 0; + for (i = 0; i < count; i += 3, idx++) + { + ok(pos[i] + kern_amount == pos_kern[i], "%d: %d + %d != %d\n", i, pos[i], kern_amount, pos_kern[i]); + kern_amount += kern[idx]; + ok(pos[i+1] + kern_amount == pos_kern[i+1], "%d: %d + %d != %d\n", i, pos[i+1], kern_amount, pos_kern[i+1]); + ok(pos[i+2] + kern_amount == pos_kern[i+2], "%d: %d + %d != %d\n", i, pos[i+2], kern_amount, pos_kern[i+2]); + + ok(dx[i] + kern[idx] == dx_kern[i], "%d: %d + %d != %d\n", i, dx[i], kern[idx], dx_kern[i]); + ok(dx[i+1] == dx_kern[i+1], "%d: %d != %d\n", i, dx[i+1], dx_kern[i+1]); + ok(dx[i+2] == dx_kern[i+2], "%d: %d != %d\n", i, dx[i+2], dx_kern[i+2]); + } + +done: + SelectObject(hdc, hfont_old); + DeleteObject(hfont); + ReleaseDC(0, hdc); +} + START_TEST(font) { static const char *test_names[] = @@ -7236,6 +7336,7 @@ START_TEST(font) test_GetTextMetrics2("Arial", -55); test_GetTextMetrics2("Arial", -110); test_GetCharacterPlacement(); + test_GetCharacterPlacement_kerning(); test_GetCharWidthInfo(); test_CreateFontIndirect(); test_CreateFontIndirectEx();
1
0
0
0
Gijs Vermeulen : gdi32: Fix some test failures when not using X11.
by Alexandre Julliard
09 Jul '20
09 Jul '20
Module: wine Branch: master Commit: 53d54af817d55f14558becc3ada82388eba87a74 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=53d54af817d55f14558becc3…
Author: Gijs Vermeulen <gijsvrm(a)gmail.com> Date: Tue Jul 7 16:58:37 2020 +0200 gdi32: Fix some test failures when not using X11. Signed-off-by: Gijs Vermeulen <gijsvrm(a)gmail.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/tests/driver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/gdi32/tests/driver.c b/dlls/gdi32/tests/driver.c index c656eb4245..8276c1c4be 100644 --- a/dlls/gdi32/tests/driver.c +++ b/dlls/gdi32/tests/driver.c @@ -107,7 +107,7 @@ static void test_D3DKMTOpenAdapterFromHdc(void) if (!pD3DKMTOpenAdapterFromHdc || pD3DKMTOpenAdapterFromHdc(NULL) == STATUS_PROCEDURE_NOT_FOUND) { - skip("D3DKMTOpenAdapterFromHdc() is unavailable.\n"); + win_skip("D3DKMTOpenAdapterFromHdc() is unavailable.\n"); return; } @@ -367,7 +367,7 @@ static void test_D3DKMTCheckVidPnExclusiveOwnership(void) if (!pD3DKMTCheckVidPnExclusiveOwnership || pD3DKMTCheckVidPnExclusiveOwnership(NULL) == STATUS_PROCEDURE_NOT_FOUND) { - win_skip("D3DKMTCheckVidPnExclusiveOwnership() is unavailable.\n"); + skip("D3DKMTCheckVidPnExclusiveOwnership() is unavailable.\n"); return; } @@ -591,7 +591,7 @@ static void test_D3DKMTSetVidPnSourceOwner(void) if (!pD3DKMTSetVidPnSourceOwner || pD3DKMTSetVidPnSourceOwner(&set_owner_desc) == STATUS_PROCEDURE_NOT_FOUND) { - win_skip("D3DKMTSetVidPnSourceOwner() is unavailable.\n"); + skip("D3DKMTSetVidPnSourceOwner() is unavailable.\n"); return; }
1
0
0
0
Zebediah Figura : wined3d: Mark the stateblock as dirty in wined3d_stateblock_multiply_transform().
by Alexandre Julliard
09 Jul '20
09 Jul '20
Module: wine Branch: master Commit: d117156862c72632135f162e9bbaf6b2f0f5087f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d117156862c72632135f162e…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Wed Jul 8 10:48:45 2020 -0500 wined3d: Mark the stateblock as dirty in wined3d_stateblock_multiply_transform(). Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=49422
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/stateblock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 4272d5aef2..b5ab0e72eb 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1424,6 +1424,8 @@ void CDECL wined3d_stateblock_multiply_transform(struct wined3d_stateblock *stat TRACE("%.8e %.8e %.8e %.8e\n", matrix->_41, matrix->_42, matrix->_43, matrix->_44); multiply_matrix(mat, mat, matrix); + stateblock->changed.transform[d3dts >> 5] |= 1u << (d3dts & 0x1f); + stateblock->changed.transforms = 1; } HRESULT CDECL wined3d_stateblock_set_clip_plane(struct wined3d_stateblock *stateblock,
1
0
0
0
Alexandre Julliard : ntdll: Use stack buffers to retrieve the drive info from mountmgr.
by Alexandre Julliard
09 Jul '20
09 Jul '20
Module: wine Branch: master Commit: b14eee69c7240658252bc96b6302e98948f2c62c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b14eee69c7240658252bc96b…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Jul 9 10:17:50 2020 +0200 ntdll: Use stack buffers to retrieve the drive info from mountmgr. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/file.c | 74 ++++++++++++-------------------------------------- 1 file changed, 18 insertions(+), 56 deletions(-) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 9356fb03f4..a0ad361fcb 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -1946,9 +1946,8 @@ static int find_dos_device( const char *path ) return -1; } -static struct mountmgr_unix_drive *get_mountmgr_fs_info( HANDLE handle, int fd ) +static NTSTATUS get_mountmgr_fs_info( HANDLE handle, int fd, struct mountmgr_unix_drive *drive, ULONG size ) { - struct mountmgr_unix_drive *drive; OBJECT_ATTRIBUTES attr; UNICODE_STRING string; char *unix_name; @@ -1957,25 +1956,16 @@ static struct mountmgr_unix_drive *get_mountmgr_fs_info( HANDLE handle, int fd ) NTSTATUS status; int letter; - if (server_get_unix_name( handle, &unix_name )) - return NULL; + if ((status = server_get_unix_name( handle, &unix_name ))) return status; letter = find_dos_device( unix_name ); RtlFreeHeap( GetProcessHeap(), 0, unix_name ); - if (!(drive = RtlAllocateHeap( GetProcessHeap(), 0, 1024 ))) - return NULL; - if (letter == -1) { struct stat st; - if (fstat( fd, &st ) == -1) - { - RtlFreeHeap( GetProcessHeap(), 0, drive ); - return NULL; - } - + fstat( fd, &st ); drive->unix_dev = st.st_dev; drive->letter = 0; } @@ -1984,36 +1974,16 @@ static struct mountmgr_unix_drive *get_mountmgr_fs_info( HANDLE handle, int fd ) RtlInitUnicodeString( &string, MOUNTMGR_DEVICE_NAME ); InitializeObjectAttributes( &attr, &string, 0, NULL, NULL ); - if (NtOpenFile( &mountmgr, GENERIC_READ | SYNCHRONIZE, &attr, &io, - FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SYNCHRONOUS_IO_NONALERT )) - { - RtlFreeHeap( GetProcessHeap(), 0, drive ); - return NULL; - } + status = NtOpenFile( &mountmgr, GENERIC_READ | SYNCHRONIZE, &attr, &io, + FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SYNCHRONOUS_IO_NONALERT ); + if (status) return status; status = NtDeviceIoControlFile( mountmgr, NULL, NULL, NULL, &io, IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE, - drive, sizeof(*drive), drive, 1024 ); - if (status == STATUS_BUFFER_OVERFLOW) - { - if (!(drive = RtlReAllocateHeap( GetProcessHeap(), 0, drive, drive->size ))) - { - RtlFreeHeap( GetProcessHeap(), 0, drive ); - NtClose( mountmgr ); - return NULL; - } - status = NtDeviceIoControlFile( mountmgr, NULL, NULL, NULL, &io, IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE, - drive, sizeof(*drive), drive, drive->size ); - } + drive, sizeof(*drive), drive, size ); NtClose( mountmgr ); - - if (status) - { - WARN("failed to retrieve filesystem type from mountmgr, status %#x\n", status); - RtlFreeHeap( GetProcessHeap(), 0, drive ); - return NULL; - } - - return drive; + if (status == STATUS_BUFFER_OVERFLOW) status = STATUS_SUCCESS; + else if (status) WARN("failed to retrieve filesystem type from mountmgr, status %#x\n", status); + return status; } @@ -4106,15 +4076,12 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, if (fd_get_file_info( fd, options, &st, &attr ) == -1) io->u.Status = errno_to_status( errno ); else { - struct mountmgr_unix_drive *drive; + struct mountmgr_unix_drive drive; FILE_ID_INFORMATION *info = ptr; info->VolumeSerialNumber = 0; - if ((drive = get_mountmgr_fs_info( handle, fd ))) - { - info->VolumeSerialNumber = drive->serial; - RtlFreeHeap( GetProcessHeap(), 0, drive ); - } + if (!(io->u.Status = get_mountmgr_fs_info( handle, fd, &drive, sizeof(drive) ))) + info->VolumeSerialNumber = drive.serial; memset( &info->FileId, 0, sizeof(info->FileId) ); *(ULONGLONG *)&info->FileId = st.st_ino; } @@ -6212,7 +6179,7 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, IO_STATUS_BLOCK *io static const WCHAR udfW[] = {'U','D','F'}; FILE_FS_ATTRIBUTE_INFORMATION *info = buffer; - struct mountmgr_unix_drive *drive; + struct mountmgr_unix_drive drive; enum mountmgr_fs_type fs_type = MOUNTMGR_FS_TYPE_NTFS; if (length < sizeof(FILE_FS_ATTRIBUTE_INFORMATION)) @@ -6221,11 +6188,7 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, IO_STATUS_BLOCK *io break; } - if ((drive = get_mountmgr_fs_info( handle, fd ))) - { - fs_type = drive->fs_type; - RtlFreeHeap( GetProcessHeap(), 0, drive ); - } + if (!get_mountmgr_fs_info( handle, fd, &drive, sizeof(drive) )) fs_type = drive.fs_type; else { struct statfs stfs; @@ -6298,7 +6261,8 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, IO_STATUS_BLOCK *io case FileFsVolumeInformation: { FILE_FS_VOLUME_INFORMATION *info = buffer; - struct mountmgr_unix_drive *drive; + ULONGLONG data[64]; + struct mountmgr_unix_drive *drive = (struct mountmgr_unix_drive *)data; const WCHAR *label; if (length < sizeof(FILE_FS_VOLUME_INFORMATION)) @@ -6307,7 +6271,7 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, IO_STATUS_BLOCK *io break; } - if (!(drive = get_mountmgr_fs_info( handle, fd ))) + if (get_mountmgr_fs_info( handle, fd, drive, sizeof(data) )) { io->u.Status = STATUS_NOT_IMPLEMENTED; break; @@ -6320,8 +6284,6 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, IO_STATUS_BLOCK *io length - offsetof( FILE_FS_VOLUME_INFORMATION, VolumeLabel ) ); info->SupportsObjects = (drive->fs_type == MOUNTMGR_FS_TYPE_NTFS); memcpy( info->VolumeLabel, label, info->VolumeLabelLength ); - RtlFreeHeap( GetProcessHeap(), 0, drive ); - io->Information = offsetof( FILE_FS_VOLUME_INFORMATION, VolumeLabel ) + info->VolumeLabelLength; io->u.Status = STATUS_SUCCESS; break;
1
0
0
0
Alexandre Julliard : mountmgr: Fix handling of buffer overflows in IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE.
by Alexandre Julliard
09 Jul '20
09 Jul '20
Module: wine Branch: master Commit: bc8d04d6a502b47ecc219bb2fc1000c391e20189 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bc8d04d6a502b47ecc219bb2…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Jul 9 10:09:49 2020 +0200 mountmgr: Fix handling of buffer overflows in IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mountmgr.sys/mountmgr.c | 42 +++++++++++------------------------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c index 6393dbf022..1961eab983 100644 --- a/dlls/mountmgr.sys/mountmgr.c +++ b/dlls/mountmgr.sys/mountmgr.c @@ -328,6 +328,7 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize, } size = sizeof(*output); + if (label) size += (strlenW(label) + 1) * sizeof(WCHAR); if (device) size += strlen(device) + 1; if (mount_point) size += strlen(mount_point) + 1; @@ -342,54 +343,33 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize, output->device_offset = 0; output->label_offset = 0; - if (size > outsize) - { - iosb->Information = 0; - if (size >= FIELD_OFFSET( struct mountmgr_unix_drive, size ) + sizeof(output->size)) - { - output->size = size; - iosb->Information = FIELD_OFFSET( struct mountmgr_unix_drive, size ) + sizeof(output->size); - } - if (size >= FIELD_OFFSET( struct mountmgr_unix_drive, type ) + sizeof(output->type)) - { - output->type = type; - iosb->Information = FIELD_OFFSET( struct mountmgr_unix_drive, type ) + sizeof(output->type); - } - status = STATUS_BUFFER_OVERFLOW; - goto done; - } - ptr = (char *)(output + 1); - if (mount_point) + if (label && ptr + (strlenW(label) + 1) * sizeof(WCHAR) - (char *)output <= outsize) + { + output->label_offset = ptr - (char *)output; + strcpyW( (WCHAR *)ptr, label ); + ptr += (strlenW(label) + 1) * sizeof(WCHAR); + } + if (mount_point && ptr + strlen(mount_point) + 1 - (char *)output <= outsize) { output->mount_point_offset = ptr - (char *)output; strcpy( ptr, mount_point ); ptr += strlen(ptr) + 1; } - else output->mount_point_offset = 0; - - if (device) + if (device && ptr + strlen(device) + 1 - (char *)output <= outsize) { output->device_offset = ptr - (char *)output; strcpy( ptr, device ); ptr += strlen(ptr) + 1; } - else output->device_offset = 0; - - if (label) - { - output->label_offset = ptr - (char *)output; - strcpyW( (WCHAR *)ptr, label ); - ptr += (strlenW(label) + 1) * sizeof(WCHAR); - } - else output->label_offset = 0; TRACE( "returning %c: dev %s mount %s type %u\n", letter, debugstr_a(device), debugstr_a(mount_point), type ); iosb->Information = ptr - (char *)output; -done: + if (size > outsize) status = STATUS_BUFFER_OVERFLOW; + RtlFreeHeap( GetProcessHeap(), 0, device ); RtlFreeHeap( GetProcessHeap(), 0, mount_point ); RtlFreeHeap( GetProcessHeap(), 0, label );
1
0
0
0
Alexandre Julliard : ntdll: Clear the reply data on error in virtual_locked_server_call().
by Alexandre Julliard
09 Jul '20
09 Jul '20
Module: wine Branch: master Commit: 113e9811c473dd73b14964893cecf0c7042502cc URL:
https://source.winehq.org/git/wine.git/?a=commit;h=113e9811c473dd73b1496489…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Jul 9 10:09:33 2020 +0200 ntdll: Clear the reply data on error in virtual_locked_server_call(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/virtual.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index d16259e5ae..868dd57055 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -2911,6 +2911,7 @@ unsigned int virtual_locked_server_call( void *req_ptr ) ret = server_call_unlocked( req ); if (has_write_watch) update_write_watches( addr, size, wine_server_reply_size( req )); } + else memset( &req->u.reply, 0, sizeof(req->u.reply) ); server_leave_uninterrupted_section( &virtual_mutex, &sigset ); return ret; }
1
0
0
0
Alexandre Julliard : ntdll: Allocate the buffer in the caller for wine_unix_to_nt_file_name().
by Alexandre Julliard
09 Jul '20
09 Jul '20
Module: wine Branch: master Commit: 6f862a1ad803b1a7037797cedb3624445538afc1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6f862a1ad803b1a7037797ce…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Jul 9 10:03:15 2020 +0200 ntdll: Allocate the buffer in the caller for wine_unix_to_nt_file_name(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/path.c | 28 +++++++++++++++------------- dlls/ntdll/ntdll.spec | 2 +- dlls/ntdll/path.c | 35 +++++++++++++++++++---------------- dlls/ntdll/unix/file.c | 16 +++++++++++++--- dlls/ntdll/unixlib.h | 4 ++-- include/winternl.h | 2 +- 6 files changed, 51 insertions(+), 36 deletions(-) diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c index f958610dbd..5377c2302b 100644 --- a/dlls/kernel32/path.c +++ b/dlls/kernel32/path.c @@ -312,36 +312,38 @@ char * CDECL wine_get_unix_file_name( LPCWSTR dosW ) WCHAR * CDECL wine_get_dos_file_name( LPCSTR str ) { UNICODE_STRING nt_name; - ANSI_STRING unix_name; NTSTATUS status; WCHAR *buffer; - DWORD len; + SIZE_T len = strlen(str) + 1; if (str[0] != '/') /* relative path name */ { - len = strlen( str ) + 1; if (!(buffer = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return NULL; MultiByteToWideChar( CP_UNIXCP, 0, str, len, buffer, len ); status = RtlDosPathNameToNtPathName_U_WithStatus( buffer, &nt_name, NULL, NULL ); RtlFreeHeap( GetProcessHeap(), 0, buffer ); + if (!set_ntstatus( status )) return NULL; + buffer = nt_name.Buffer; + len = nt_name.Length / sizeof(WCHAR) + 1; } else { - RtlInitAnsiString( &unix_name, str ); - status = wine_unix_to_nt_file_name( &unix_name, &nt_name ); + len += 8; /* \??\unix prefix */ + if (!(buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return NULL; + if (!set_ntstatus( wine_unix_to_nt_file_name( str, buffer, &len ))) + { + HeapFree( GetProcessHeap(), 0, buffer ); + return NULL; + } } - if (!set_ntstatus( status )) return NULL; - if (nt_name.Buffer[5] == ':') + if (buffer[5] == ':') { /* get rid of the \??\ prefix */ /* FIXME: should implement RtlNtPathNameToDosPathName and use that instead */ - len = nt_name.Length - 4 * sizeof(WCHAR); - memmove( nt_name.Buffer, nt_name.Buffer + 4, len ); - nt_name.Buffer[len / sizeof(WCHAR)] = 0; + memmove( buffer, buffer + 4, (len - 4) * sizeof(WCHAR) ); } - else - nt_name.Buffer[1] = '\\'; - return nt_name.Buffer; + else buffer[1] = '\\'; + return buffer; } /************************************************************************* diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index d80a80cf39..bd41da37af 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1605,4 +1605,4 @@ # Filesystem @ cdecl wine_nt_to_unix_file_name(ptr ptr ptr long) -@ cdecl wine_unix_to_nt_file_name(ptr ptr) +@ cdecl wine_unix_to_nt_file_name(str ptr ptr) diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c index fb85942eca..5f2d379071 100644 --- a/dlls/ntdll/path.c +++ b/dlls/ntdll/path.c @@ -545,26 +545,34 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size) if (name[0] == '/') /* may be a Unix path */ { char *unix_name; - ANSI_STRING unix_str; - UNICODE_STRING nt_str; + WCHAR *nt_str; + SIZE_T buflen; + NTSTATUS status; unix_name = RtlAllocateHeap( GetProcessHeap(), 0, 3 * wcslen(name) + 1 ); ntdll_wcstoumbs( name, wcslen(name) + 1, unix_name, 3 * wcslen(name) + 1, FALSE ); - RtlInitAnsiString( &unix_str, unix_name ); - unix_funcs->unix_to_nt_file_name( &unix_str, &nt_str ); - RtlFreeAnsiString( &unix_str ); - if (nt_str.Length > 5 * sizeof(WCHAR) && nt_str.Buffer[5] == ':') + buflen = strlen(unix_name) + 10; + for (;;) { - reqsize = nt_str.Length - 3 * sizeof(WCHAR); + if (!(nt_str = RtlAllocateHeap( GetProcessHeap(), 0, buflen * sizeof(WCHAR) ))) break; + status = unix_funcs->unix_to_nt_file_name( unix_name, nt_str, &buflen ); + if (status != STATUS_BUFFER_TOO_SMALL) break; + RtlFreeHeap( GetProcessHeap(), 0, nt_str ); + } + RtlFreeHeap( GetProcessHeap(), 0, unix_name ); + if (!status && buflen > 6 && nt_str[5] == ':') + { + reqsize = (buflen - 4) * sizeof(WCHAR); if (reqsize <= size) { - memcpy( buffer, nt_str.Buffer + 4, reqsize ); + memcpy( buffer, nt_str + 4, reqsize ); collapse_path( buffer, 3 ); reqsize -= sizeof(WCHAR); } - RtlFreeUnicodeString( &nt_str ); + RtlFreeHeap( GetProcessHeap(), 0, nt_str ); goto done; } + RtlFreeHeap( GetProcessHeap(), 0, nt_str ); } if (cd->Buffer[1] == ':') { @@ -889,12 +897,7 @@ NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING* dir) /****************************************************************** * wine_unix_to_nt_file_name (NTDLL.@) Not a Windows API */ -NTSTATUS CDECL wine_unix_to_nt_file_name( const ANSI_STRING *name, UNICODE_STRING *nt ) +NTSTATUS CDECL wine_unix_to_nt_file_name( const char *name, WCHAR *buffer, SIZE_T *size ) { - unsigned int lenA = name->Length; - const char *path = name->Buffer; - - if (!lenA) return STATUS_INVALID_PARAMETER; - if (path[0] != '/') return STATUS_INVALID_PARAMETER; /* relative path not supported */ - return unix_funcs->unix_to_nt_file_name( name, nt ); + return unix_funcs->unix_to_nt_file_name( name, buffer, size ); } diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 760fb4c249..9356fb03f4 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -3482,11 +3482,21 @@ NTSTATUS unix_to_nt_file_name( const char *name, WCHAR **nt ) /****************************************************************** * wine_unix_to_nt_file_name */ -NTSTATUS CDECL wine_unix_to_nt_file_name( const ANSI_STRING *name, UNICODE_STRING *nt ) +NTSTATUS CDECL wine_unix_to_nt_file_name( const char *name, WCHAR *buffer, SIZE_T *size ) { WCHAR *nt_name = NULL; - NTSTATUS status = unix_to_nt_file_name( name->Buffer, &nt_name ); - if (nt_name) RtlInitUnicodeString( nt, nt_name ); + NTSTATUS status; + + if (name[0] != '/') return STATUS_INVALID_PARAMETER; /* relative paths are not supported */ + + status = unix_to_nt_file_name( name, &nt_name ); + if (nt_name) + { + if (*size > wcslen(nt_name)) wcscpy( buffer, nt_name ); + else status = STATUS_BUFFER_TOO_SMALL; + *size = wcslen(nt_name) + 1; + RtlFreeHeap( GetProcessHeap(), 0, nt_name ); + } return status; } diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h index ca708e45c2..f39dd2d6d8 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -28,7 +28,7 @@ struct msghdr; struct _DISPATCHER_CONTEXT; /* increment this when you change the function table */ -#define NTDLL_UNIXLIB_VERSION 73 +#define NTDLL_UNIXLIB_VERSION 74 struct unix_funcs { @@ -334,7 +334,7 @@ struct unix_funcs /* file functions */ NTSTATUS (CDECL *nt_to_unix_file_name)( const UNICODE_STRING *nameW, char *nameA, SIZE_T *size, UINT disposition ); - NTSTATUS (CDECL *unix_to_nt_file_name)( const ANSI_STRING *name, UNICODE_STRING *nt ); + NTSTATUS (CDECL *unix_to_nt_file_name)( const char *name, WCHAR *buffer, SIZE_T *size ); void (CDECL *set_show_dot_files)( BOOL enable ); /* loader functions */ diff --git a/include/winternl.h b/include/winternl.h index ea2a23f3b6..10d109fede 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -3373,7 +3373,7 @@ NTSYSAPI void WINAPI TpWaitForWork(TP_WORK *,BOOL); NTSYSAPI NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, char *nameA, SIZE_T *size, UINT disposition ); -NTSYSAPI NTSTATUS CDECL wine_unix_to_nt_file_name( const ANSI_STRING *name, UNICODE_STRING *nt ); +NTSYSAPI NTSTATUS CDECL wine_unix_to_nt_file_name( const char *name, WCHAR *buffer, SIZE_T *size ); /***********************************************************************
1
0
0
0
Alexandre Julliard : ntdll: Use char pointers instead of ANSI/UNICODE_STRING in unix_to_nt_file_name().
by Alexandre Julliard
09 Jul '20
09 Jul '20
Module: wine Branch: master Commit: 5ebdeaaa372186b4c3a9098676c76423a1781154 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5ebdeaaa372186b4c3a90986…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Jul 9 10:01:19 2020 +0200 ntdll: Use char pointers instead of ANSI/UNICODE_STRING in unix_to_nt_file_name(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/env.c | 29 ++++++------- dlls/ntdll/unix/file.c | 97 +++++++++++++++++++++++------------------- dlls/ntdll/unix/loader.c | 25 ++++++----- dlls/ntdll/unix/unix_private.h | 2 +- 4 files changed, 79 insertions(+), 74 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=5ebdeaaa372186b4c3a9…
1
0
0
0
Alexandre Julliard : ntdll: Allocate the return buffer in the caller for wine_nt_to_unix_file_name().
by Alexandre Julliard
09 Jul '20
09 Jul '20
Module: wine Branch: master Commit: 368e3a93b8da3641c53f260bb4c96d03d00d1080 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=368e3a93b8da3641c53f260b…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Jul 9 09:59:08 2020 +0200 ntdll: Allocate the return buffer in the caller for wine_nt_to_unix_file_name(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/path.c | 18 +++++++++++++++--- dlls/ntdll/directory.c | 4 ++-- dlls/ntdll/ntdll.spec | 2 +- dlls/ntdll/unix/file.c | 11 +++++++++-- dlls/ntdll/unixlib.h | 2 +- include/winternl.h | 2 +- 6 files changed, 29 insertions(+), 10 deletions(-) diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c index 33c39865b9..f958610dbd 100644 --- a/dlls/kernel32/path.c +++ b/dlls/kernel32/path.c @@ -276,18 +276,30 @@ DWORD /*BOOLEAN*/ WINAPI KERNEL32_Wow64EnableWow64FsRedirection( BOOLEAN enable char * CDECL wine_get_unix_file_name( LPCWSTR dosW ) { UNICODE_STRING nt_name; - ANSI_STRING unix_name; NTSTATUS status; + SIZE_T size = 256; + char *buffer; if (!RtlDosPathNameToNtPathName_U( dosW, &nt_name, NULL, NULL )) return NULL; - status = wine_nt_to_unix_file_name( &nt_name, &unix_name, FILE_OPEN_IF ); + for (;;) + { + if (!(buffer = HeapAlloc( GetProcessHeap(), 0, size ))) + { + RtlFreeUnicodeString( &nt_name ); + return NULL; + } + status = wine_nt_to_unix_file_name( &nt_name, buffer, &size, FILE_OPEN_IF ); + if (status != STATUS_BUFFER_TOO_SMALL) break; + HeapFree( GetProcessHeap(), 0, buffer ); + } RtlFreeUnicodeString( &nt_name ); if (status && status != STATUS_NO_SUCH_FILE) { + HeapFree( GetProcessHeap(), 0, buffer ); SetLastError( RtlNtStatusToDosError( status ) ); return NULL; } - return unix_name.Buffer; + return buffer; } diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c index 6c78203981..ad129acfb5 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c @@ -110,10 +110,10 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH NtQueryDirectoryFile( HANDLE handle, HANDLE ev * element doesn't have to exist; in that case STATUS_NO_SUCH_FILE is * returned, but the unix name is still filled in properly. */ -NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret, +NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, char *nameA, SIZE_T *size, UINT disposition ) { - return unix_funcs->nt_to_unix_file_name( nameW, unix_name_ret, disposition ); + return unix_funcs->nt_to_unix_file_name( nameW, nameA, size, disposition ); } diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 3f28e3d5ea..d80a80cf39 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1604,5 +1604,5 @@ @ cdecl __wine_get_unix_codepage() # Filesystem -@ cdecl wine_nt_to_unix_file_name(ptr ptr long) +@ cdecl wine_nt_to_unix_file_name(ptr ptr ptr long) @ cdecl wine_unix_to_nt_file_name(ptr ptr) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 0862b94921..9b6158f2cc 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -3427,12 +3427,19 @@ NTSTATUS nt_to_unix_file_name( const UNICODE_STRING *nameW, char **unix_name_ret * element doesn't have to exist; in that case STATUS_NO_SUCH_FILE is * returned, but the unix name is still filled in properly. */ -NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret, +NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, char *nameA, SIZE_T *size, UINT disposition ) { char *buffer = NULL; NTSTATUS status = nt_to_unix_file_name( nameW, &buffer, disposition ); - if (buffer) RtlInitAnsiString( unix_name_ret, buffer ); + + if (buffer) + { + if (*size > strlen(buffer)) strcpy( nameA, buffer ); + else status = STATUS_BUFFER_TOO_SMALL; + *size = strlen(buffer) + 1; + RtlFreeHeap( GetProcessHeap(), 0, buffer ); + } return status; } diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h index 0c0d2e3250..ca708e45c2 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -332,7 +332,7 @@ struct unix_funcs void (CDECL *server_init_process_done)( void *relay ); /* file functions */ - NTSTATUS (CDECL *nt_to_unix_file_name)( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret, + NTSTATUS (CDECL *nt_to_unix_file_name)( const UNICODE_STRING *nameW, char *nameA, SIZE_T *size, UINT disposition ); NTSTATUS (CDECL *unix_to_nt_file_name)( const ANSI_STRING *name, UNICODE_STRING *nt ); void (CDECL *set_show_dot_files)( BOOL enable ); diff --git a/include/winternl.h b/include/winternl.h index 4ee32d3c9e..ea2a23f3b6 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -3371,7 +3371,7 @@ NTSYSAPI void WINAPI TpWaitForWork(TP_WORK *,BOOL); /* Wine internal functions */ -NTSYSAPI NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret, +NTSYSAPI NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, char *nameA, SIZE_T *size, UINT disposition ); NTSYSAPI NTSTATUS CDECL wine_unix_to_nt_file_name( const ANSI_STRING *name, UNICODE_STRING *nt );
1
0
0
0
← Newer
1
...
61
62
63
64
65
66
67
...
83
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
Results per page:
10
25
50
100
200