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
March 2023
----- 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
910 discussions
Start a n
N
ew thread
Rémi Bernon : imm32: Rewrite ImmGetDescription(A|W).
by Alexandre Julliard
15 Mar '23
15 Mar '23
Module: wine Branch: master Commit: e242e094324bf520ed0cc34b78c8696decca3294 URL:
https://gitlab.winehq.org/wine/wine/-/commit/e242e094324bf520ed0cc34b78c869…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Feb 17 10:43:36 2023 +0100 imm32: Rewrite ImmGetDescription(A|W). --- dlls/imm32/imm.c | 65 +++++++++++++++++++++++------------------------- dlls/imm32/tests/imm32.c | 15 ----------- 2 files changed, 31 insertions(+), 49 deletions(-) diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 6acdd8a7344..6fe6b5e3f0e 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -1728,52 +1728,49 @@ HWND WINAPI ImmGetDefaultIMEWnd(HWND hWnd) } /*********************************************************************** - * ImmGetDescriptionA (IMM32.@) + * ImmGetDescriptionA (IMM32.@) */ -UINT WINAPI ImmGetDescriptionA( - HKL hKL, LPSTR lpszDescription, UINT uBufLen) +UINT WINAPI ImmGetDescriptionA( HKL hkl, LPSTR bufferA, UINT lengthA ) { - WCHAR *buf; - DWORD len; - - TRACE("%p %p %d\n", hKL, lpszDescription, uBufLen); - - /* find out how many characters in the unicode buffer */ - len = ImmGetDescriptionW( hKL, NULL, 0 ); - if (!len) - return 0; - - /* allocate a buffer of that size */ - buf = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof (WCHAR) ); - if( !buf ) - return 0; - - /* fetch the unicode buffer */ - len = ImmGetDescriptionW( hKL, buf, len + 1 ); - - /* convert it back to ANSI */ - len = WideCharToMultiByte( CP_ACP, 0, buf, len + 1, - lpszDescription, uBufLen, NULL, NULL ); + WCHAR *bufferW; + DWORD lengthW; - HeapFree( GetProcessHeap(), 0, buf ); + TRACE( "hkl %p, bufferA %p, lengthA %d\n", hkl, bufferA, lengthA ); - if (len == 0) - return 0; + if (!(lengthW = ImmGetDescriptionW( hkl, NULL, 0 ))) return 0; + if (!(bufferW = malloc( (lengthW + 1) * sizeof(WCHAR) ))) return 0; + lengthW = ImmGetDescriptionW( hkl, bufferW, lengthW + 1 ); + lengthA = WideCharToMultiByte( CP_ACP, 0, bufferW, lengthW, bufferA, + bufferA ? lengthA : 0, NULL, NULL ); + if (bufferA) bufferA[lengthA] = 0; + free( bufferW ); - return len - 1; + return lengthA; } /*********************************************************************** * ImmGetDescriptionW (IMM32.@) */ -UINT WINAPI ImmGetDescriptionW(HKL hKL, LPWSTR lpszDescription, UINT uBufLen) +UINT WINAPI ImmGetDescriptionW( HKL hkl, WCHAR *buffer, UINT length ) { - FIXME("(%p, %p, %d): semi stub\n", hKL, lpszDescription, uBufLen); + WCHAR path[MAX_PATH]; + HKEY hkey = 0; + DWORD size; + + TRACE( "hkl %p, buffer %p, length %u\n", hkl, buffer, length ); + + swprintf( path, ARRAY_SIZE(path), layouts_formatW, (ULONG)(ULONG_PTR)hkl ); + if (RegOpenKeyW( HKEY_LOCAL_MACHINE, path, &hkey )) return 0; - if (!hKL) return 0; - if (!uBufLen) return lstrlenW(L"Wine XIM" ); - lstrcpynW( lpszDescription, L"Wine XIM", uBufLen ); - return lstrlenW( lpszDescription ); + size = ARRAY_SIZE(path) * sizeof(WCHAR); + if (RegGetValueW( hkey, NULL, L"Layout Text", RRF_RT_REG_SZ, NULL, path, &size )) *path = 0; + RegCloseKey( hkey ); + + size = wcslen( path ); + if (!buffer) return size; + + lstrcpynW( buffer, path, length ); + return wcslen( buffer ); } /*********************************************************************** diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c index f75b777d65b..7c376287993 100644 --- a/dlls/imm32/tests/imm32.c +++ b/dlls/imm32/tests/imm32.c @@ -2851,10 +2851,8 @@ static void test_ImmGetDescription(void) ret = ImmGetDescriptionA( NULL, NULL, 100 ); ok( !ret, "ImmGetDescriptionA returned %lu\n", ret ); ret = ImmGetDescriptionW( hkl, bufferW, 100 ); - todo_wine ok( !ret, "ImmGetDescriptionW returned %lu\n", ret ); ret = ImmGetDescriptionA( hkl, bufferA, 100 ); - todo_wine ok( !ret, "ImmGetDescriptionA returned %lu\n", ret ); ret = GetLastError(); ok( ret == 0xdeadbeef, "got error %lu\n", ret ); @@ -2868,46 +2866,33 @@ static void test_ImmGetDescription(void) memset( bufferA, 0xcd, sizeof(bufferA) ); ret = ImmGetDescriptionA( hkl, bufferA, 2 ); ok( ret == 0, "ImmGetDescriptionA returned %lu\n", ret ); - todo_wine ok( !strcmp( bufferA, "" ), "got bufferA %s\n", debugstr_a(bufferA) ); memset( bufferW, 0xcd, sizeof(bufferW) ); ret = ImmGetDescriptionW( hkl, bufferW, 11 ); - todo_wine ok( ret == 10, "ImmGetDescriptionW returned %lu\n", ret ); - todo_wine ok( !wcscmp( bufferW, L"WineTest I" ), "got bufferW %s\n", debugstr_w(bufferW) ); memset( bufferA, 0xcd, sizeof(bufferA) ); ret = ImmGetDescriptionA( hkl, bufferA, 11 ); - todo_wine ok( ret == 0, "ImmGetDescriptionA returned %lu\n", ret ); - todo_wine ok( !strcmp( bufferA, "" ), "got bufferA %s\n", debugstr_a(bufferA) ); memset( bufferW, 0xcd, sizeof(bufferW) ); ret = ImmGetDescriptionW( hkl, bufferW, 12 ); - todo_wine ok( ret == 11, "ImmGetDescriptionW returned %lu\n", ret ); - todo_wine ok( !wcscmp( bufferW, L"WineTest IM" ), "got bufferW %s\n", debugstr_w(bufferW) ); memset( bufferA, 0xcd, sizeof(bufferA) ); ret = ImmGetDescriptionA( hkl, bufferA, 12 ); - todo_wine ok( ret == 12, "ImmGetDescriptionA returned %lu\n", ret ); - todo_wine ok( !strcmp( bufferA, "WineTest IME" ), "got bufferA %s\n", debugstr_a(bufferA) ); memset( bufferW, 0xcd, sizeof(bufferW) ); ret = ImmGetDescriptionW( hkl, bufferW, 13 ); - todo_wine ok( ret == 12, "ImmGetDescriptionW returned %lu\n", ret ); - todo_wine ok( !wcscmp( bufferW, L"WineTest IME" ), "got bufferW %s\n", debugstr_w(bufferW) ); memset( bufferA, 0xcd, sizeof(bufferA) ); ret = ImmGetDescriptionA( hkl, bufferA, 13 ); - todo_wine ok( ret == 12, "ImmGetDescriptionA returned %lu\n", ret ); - todo_wine ok( !strcmp( bufferA, "WineTest IME" ), "got bufferA %s\n", debugstr_a(bufferA) ); ime_cleanup( hkl );
1
0
0
0
Rémi Bernon : imm32: Rewrite ImmGetIMEFileName(A|W).
by Alexandre Julliard
15 Mar '23
15 Mar '23
Module: wine Branch: master Commit: 85489a53f5e839fd2e5d804a1172da25214351e5 URL:
https://gitlab.winehq.org/wine/wine/-/commit/85489a53f5e839fd2e5d804a1172da…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Feb 17 11:00:59 2023 +0100 imm32: Rewrite ImmGetIMEFileName(A|W). --- dlls/imm32/imm.c | 87 +++++++++++++++--------------------------------- dlls/imm32/tests/imm32.c | 13 -------- 2 files changed, 27 insertions(+), 73 deletions(-) diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index a915bb25132..6acdd8a7344 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -1802,82 +1802,49 @@ DWORD WINAPI ImmGetGuideLineW(HIMC hIMC, DWORD dwIndex, LPWSTR lpBuf, DWORD dwBu } /*********************************************************************** - * ImmGetIMEFileNameA (IMM32.@) + * ImmGetIMEFileNameA (IMM32.@) */ -UINT WINAPI ImmGetIMEFileNameA( HKL hKL, LPSTR lpszFileName, UINT uBufLen) +UINT WINAPI ImmGetIMEFileNameA( HKL hkl, char *bufferA, UINT lengthA ) { - LPWSTR bufW = NULL; - UINT wBufLen = uBufLen; - UINT rc; + WCHAR *bufferW; + DWORD lengthW; - if (uBufLen && lpszFileName) - bufW = HeapAlloc(GetProcessHeap(),0,uBufLen * sizeof(WCHAR)); - else /* We need this to get the number of byte required */ - { - bufW = HeapAlloc(GetProcessHeap(),0,MAX_PATH * sizeof(WCHAR)); - wBufLen = MAX_PATH; - } - - rc = ImmGetIMEFileNameW(hKL,bufW,wBufLen); + TRACE( "hkl %p, bufferA %p, lengthA %d\n", hkl, bufferA, lengthA ); - if (rc > 0) - { - if (uBufLen && lpszFileName) - rc = WideCharToMultiByte(CP_ACP, 0, bufW, -1, lpszFileName, - uBufLen, NULL, NULL); - else /* get the length */ - rc = WideCharToMultiByte(CP_ACP, 0, bufW, -1, NULL, 0, NULL, - NULL); - } + if (!(lengthW = ImmGetIMEFileNameW( hkl, NULL, 0 ))) return 0; + if (!(bufferW = malloc( (lengthW + 1) * sizeof(WCHAR) ))) return 0; + lengthW = ImmGetIMEFileNameW( hkl, bufferW, lengthW + 1 ); + lengthA = WideCharToMultiByte( CP_ACP, 0, bufferW, lengthW, bufferA, + bufferA ? lengthA : 0, NULL, NULL ); + if (bufferA) bufferA[lengthA] = 0; + free( bufferW ); - HeapFree(GetProcessHeap(),0,bufW); - return rc; + return lengthA; } /*********************************************************************** * ImmGetIMEFileNameW (IMM32.@) */ -UINT WINAPI ImmGetIMEFileNameW(HKL hKL, LPWSTR lpszFileName, UINT uBufLen) +UINT WINAPI ImmGetIMEFileNameW( HKL hkl, WCHAR *buffer, UINT length ) { - HKEY hkey; - DWORD length; - DWORD rc; - WCHAR regKey[ARRAY_SIZE(layouts_formatW)+8]; - - wsprintfW( regKey, layouts_formatW, (ULONG_PTR)hKL ); - rc = RegOpenKeyW( HKEY_LOCAL_MACHINE, regKey, &hkey); - if (rc != ERROR_SUCCESS) - { - SetLastError(rc); - return 0; - } + WCHAR path[MAX_PATH]; + HKEY hkey = 0; + DWORD size; - length = 0; - rc = RegGetValueW(hkey, NULL, L"Ime File", RRF_RT_REG_SZ, NULL, NULL, &length); + TRACE( "hkl %p, buffer %p, length %u\n", hkl, buffer, length ); - if (rc != ERROR_SUCCESS) - { - RegCloseKey(hkey); - SetLastError(rc); - return 0; - } - if (length > uBufLen * sizeof(WCHAR) || !lpszFileName) - { - RegCloseKey(hkey); - if (lpszFileName) - { - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return 0; - } - else - return length / sizeof(WCHAR); - } + swprintf( path, ARRAY_SIZE(path), layouts_formatW, (ULONG)(ULONG_PTR)hkl ); + if (RegOpenKeyW( HKEY_LOCAL_MACHINE, path, &hkey )) return 0; - RegGetValueW(hkey, NULL, L"Ime File", RRF_RT_REG_SZ, NULL, lpszFileName, &length); + size = ARRAY_SIZE(path) * sizeof(WCHAR); + if (RegGetValueW( hkey, NULL, L"Ime File", RRF_RT_REG_SZ, NULL, path, &size )) *path = 0; + RegCloseKey( hkey ); - RegCloseKey(hkey); + size = wcslen( path ); + if (!buffer) return size; - return length / sizeof(WCHAR); + lstrcpynW( buffer, path, length ); + return wcslen( buffer ); } /*********************************************************************** diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c index 83c3ff25719..f75b777d65b 100644 --- a/dlls/imm32/tests/imm32.c +++ b/dlls/imm32/tests/imm32.c @@ -2945,60 +2945,47 @@ static void test_ImmGetIMEFileName(void) ret = ImmGetIMEFileNameA( hkl, bufferA, 100 ); ok( !ret, "ImmGetIMEFileNameA returned %lu\n", ret ); ret = GetLastError(); - todo_wine ok( ret == 0xdeadbeef, "got error %lu\n", ret ); if (!(hkl = ime_install())) goto cleanup; memset( bufferW, 0xcd, sizeof(bufferW) ); ret = ImmGetIMEFileNameW( hkl, bufferW, 2 ); - todo_wine ok( ret == 1, "ImmGetIMEFileNameW returned %lu\n", ret ); - todo_wine ok( !wcscmp( bufferW, L"W" ), "got bufferW %s\n", debugstr_w(bufferW) ); memset( bufferA, 0xcd, sizeof(bufferA) ); ret = ImmGetIMEFileNameA( hkl, bufferA, 2 ); ok( ret == 0, "ImmGetIMEFileNameA returned %lu\n", ret ); - todo_wine ok( !strcmp( bufferA, "" ), "got bufferA %s\n", debugstr_a(bufferA) ); swprintf( expectW, ARRAY_SIZE(expectW), L"WINE%04X.I", ime_count - 1 ); memset( bufferW, 0xcd, sizeof(bufferW) ); ret = ImmGetIMEFileNameW( hkl, bufferW, 11 ); - todo_wine ok( ret == 10, "ImmGetIMEFileNameW returned %lu\n", ret ); - todo_wine ok( !wcscmp( bufferW, expectW ), "got bufferW %s\n", debugstr_w(bufferW) ); memset( bufferA, 0xcd, sizeof(bufferA) ); ret = ImmGetIMEFileNameA( hkl, bufferA, 11 ); ok( ret == 0, "ImmGetIMEFileNameA returned %lu\n", ret ); - todo_wine ok( !strcmp( bufferA, "" ), "got bufferA %s\n", debugstr_a(bufferA) ); swprintf( expectW, ARRAY_SIZE(expectW), L"WINE%04X.IM", ime_count - 1 ); memset( bufferW, 0xcd, sizeof(bufferW) ); ret = ImmGetIMEFileNameW( hkl, bufferW, 12 ); - todo_wine ok( ret == 11, "ImmGetIMEFileNameW returned %lu\n", ret ); - todo_wine ok( !wcscmp( bufferW, expectW ), "got bufferW %s\n", debugstr_w(bufferW) ); snprintf( expectA, ARRAY_SIZE(expectA), "WINE%04X.IME", ime_count - 1 ); memset( bufferA, 0xcd, sizeof(bufferA) ); ret = ImmGetIMEFileNameA( hkl, bufferA, 12 ); - todo_wine ok( ret == 12, "ImmGetIMEFileNameA returned %lu\n", ret ); - todo_wine ok( !strcmp( bufferA, expectA ), "got bufferA %s\n", debugstr_a(bufferA) ); swprintf( expectW, ARRAY_SIZE(expectW), L"WINE%04X.IME", ime_count - 1 ); memset( bufferW, 0xcd, sizeof(bufferW) ); ret = ImmGetIMEFileNameW( hkl, bufferW, 13 ); - todo_wine ok( ret == 12, "ImmGetIMEFileNameW returned %lu\n", ret ); ok( !wcscmp( bufferW, expectW ), "got bufferW %s\n", debugstr_w(bufferW) ); memset( bufferA, 0xcd, sizeof(bufferA) ); ret = ImmGetIMEFileNameA( hkl, bufferA, 13 ); - todo_wine ok( ret == 12, "ImmGetIMEFileNameA returned %lu\n", ret ); ok( !strcmp( bufferA, expectA ), "got bufferA %s\n", debugstr_a(bufferA) );
1
0
0
0
Rémi Bernon : imm32: Transform "Ime File" value in ImmInstallIMEW.
by Alexandre Julliard
15 Mar '23
15 Mar '23
Module: wine Branch: master Commit: 8b0b53379f99d6878e2189edb317780faf3abd55 URL:
https://gitlab.winehq.org/wine/wine/-/commit/8b0b53379f99d6878e2189edb31778…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Feb 20 21:53:19 2023 +0100 imm32: Transform "Ime File" value in ImmInstallIMEW. --- dlls/imm32/imm.c | 61 +++++++++++++++++++++++------------------------- dlls/imm32/tests/imm32.c | 3 --- 2 files changed, 29 insertions(+), 35 deletions(-) diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 94bc0dea024..a915bb25132 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -2048,34 +2048,30 @@ HKL WINAPI ImmInstallIMEA( /*********************************************************************** * ImmInstallIMEW (IMM32.@) */ -HKL WINAPI ImmInstallIMEW( - LPCWSTR lpszIMEFileName, LPCWSTR lpszLayoutText) +HKL WINAPI ImmInstallIMEW( const WCHAR *filename, const WCHAR *description ) { - INT lcid = GetUserDefaultLCID(); - INT count; - HKL hkl; - DWORD rc; + WCHAR path[ARRAY_SIZE(layouts_formatW)+8], buffer[MAX_PATH]; + LCID lcid = GetUserDefaultLCID(); + WORD count = 0x20; + const WCHAR *tmp; + DWORD length; HKEY hkey; - WCHAR regKey[ARRAY_SIZE(layouts_formatW)+8]; - - TRACE ("(%s, %s):\n", debugstr_w(lpszIMEFileName), - debugstr_w(lpszLayoutText)); + HKL hkl; - /* Start with 2. e001 will be blank and so default to the wine internal IME */ - count = 2; + TRACE( "filename %s, description %s\n", debugstr_w(filename), debugstr_w(description) ); while (count < 0xfff) { DWORD disposition = 0; hkl = (HKL)MAKELPARAM( lcid, 0xe000 | count ); - wsprintfW( regKey, layouts_formatW, (ULONG_PTR)hkl); - - rc = RegCreateKeyExW(HKEY_LOCAL_MACHINE, regKey, 0, NULL, 0, KEY_WRITE, NULL, &hkey, &disposition); - if (rc == ERROR_SUCCESS && disposition == REG_CREATED_NEW_KEY) - break; - else if (rc == ERROR_SUCCESS) - RegCloseKey(hkey); + swprintf( path, ARRAY_SIZE(path), layouts_formatW, (ULONG_PTR)hkl); + if (!RegCreateKeyExW( HKEY_LOCAL_MACHINE, path, 0, NULL, 0, + KEY_WRITE, NULL, &hkey, &disposition )) + { + if (disposition == REG_CREATED_NEW_KEY) break; + RegCloseKey( hkey ); + } count++; } @@ -2086,21 +2082,22 @@ HKL WINAPI ImmInstallIMEW( return 0; } - if (rc == ERROR_SUCCESS) - { - rc = RegSetValueExW(hkey, L"Ime File", 0, REG_SZ, (const BYTE*)lpszIMEFileName, - (lstrlenW(lpszIMEFileName) + 1) * sizeof(WCHAR)); - if (rc == ERROR_SUCCESS) - rc = RegSetValueExW(hkey, L"Layout Text", 0, REG_SZ, (const BYTE*)lpszLayoutText, - (lstrlenW(lpszLayoutText) + 1) * sizeof(WCHAR)); - RegCloseKey(hkey); - return hkl; - } - else + if ((tmp = wcsrchr( filename, '\\' ))) tmp++; + else tmp = filename; + + length = LCMapStringW( LOCALE_USER_DEFAULT, LCMAP_UPPERCASE, tmp, -1, buffer, ARRAY_SIZE(buffer) ); + + if (RegSetValueExW( hkey, L"Ime File", 0, REG_SZ, (const BYTE *)buffer, length * sizeof(WCHAR) ) || + RegSetValueExW( hkey, L"Layout Text", 0, REG_SZ, (const BYTE *)description, + (wcslen(description) + 1) * sizeof(WCHAR) )) { - WARN("Unable to set IME registry values\n"); - return 0; + WARN( "Unable to write registry to install IME\n"); + hkl = 0; } + RegCloseKey( hkey ); + + if (!hkl) RegDeleteKeyW( HKEY_LOCAL_MACHINE, path ); + return hkl; } /*********************************************************************** diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c index f3dfef389f5..83c3ff25719 100644 --- a/dlls/imm32/tests/imm32.c +++ b/dlls/imm32/tests/imm32.c @@ -2693,7 +2693,6 @@ static HKL ime_install(void) memset( buffer, 0xcd, sizeof(buffer) ); ret = RegQueryValueExW( hkey, L"Ime File", NULL, NULL, (BYTE *)buffer, &len ); ok( !ret, "RegQueryValueExW returned %#lx, error %lu\n", ret, GetLastError() ); - todo_wine ok( !wcsicmp( buffer, wcsrchr( ime_path, '\\' ) + 1 ), "got Ime File %s\n", debugstr_w(buffer) ); len = sizeof(buffer); @@ -2996,13 +2995,11 @@ static void test_ImmGetIMEFileName(void) ret = ImmGetIMEFileNameW( hkl, bufferW, 13 ); todo_wine ok( ret == 12, "ImmGetIMEFileNameW returned %lu\n", ret ); - todo_wine ok( !wcscmp( bufferW, expectW ), "got bufferW %s\n", debugstr_w(bufferW) ); memset( bufferA, 0xcd, sizeof(bufferA) ); ret = ImmGetIMEFileNameA( hkl, bufferA, 13 ); todo_wine ok( ret == 12, "ImmGetIMEFileNameA returned %lu\n", ret ); - todo_wine ok( !strcmp( bufferA, expectA ), "got bufferA %s\n", debugstr_a(bufferA) ); ime_cleanup( hkl );
1
0
0
0
Rémi Bernon : imm32: Rename szImeRegFmt to layouts_formatW.
by Alexandre Julliard
15 Mar '23
15 Mar '23
Module: wine Branch: master Commit: 4eba0765d9f52e26c8cf499cac81f784ba83ddd5 URL:
https://gitlab.winehq.org/wine/wine/-/commit/4eba0765d9f52e26c8cf499cac81f7…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Feb 21 10:04:55 2023 +0100 imm32: Rename szImeRegFmt to layouts_formatW. --- dlls/imm32/imm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 14b357d9533..94bc0dea024 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -123,7 +123,7 @@ static CRITICAL_SECTION_DEBUG ime_cs_debug = static CRITICAL_SECTION ime_cs = { &ime_cs_debug, -1, 0, 0, 0, 0 }; static struct list ime_list = LIST_INIT( ime_list ); -static const WCHAR szImeRegFmt[] = L"System\\CurrentControlSet\\Control\\Keyboard Layouts\\%08lx"; +static const WCHAR layouts_formatW[] = L"System\\CurrentControlSet\\Control\\Keyboard Layouts\\%08lx"; static BOOL ime_is_unicode( const struct ime *ime ) { @@ -1842,9 +1842,9 @@ UINT WINAPI ImmGetIMEFileNameW(HKL hKL, LPWSTR lpszFileName, UINT uBufLen) HKEY hkey; DWORD length; DWORD rc; - WCHAR regKey[ARRAY_SIZE(szImeRegFmt)+8]; + WCHAR regKey[ARRAY_SIZE(layouts_formatW)+8]; - wsprintfW( regKey, szImeRegFmt, (ULONG_PTR)hKL ); + wsprintfW( regKey, layouts_formatW, (ULONG_PTR)hKL ); rc = RegOpenKeyW( HKEY_LOCAL_MACHINE, regKey, &hkey); if (rc != ERROR_SUCCESS) { @@ -2056,7 +2056,7 @@ HKL WINAPI ImmInstallIMEW( HKL hkl; DWORD rc; HKEY hkey; - WCHAR regKey[ARRAY_SIZE(szImeRegFmt)+8]; + WCHAR regKey[ARRAY_SIZE(layouts_formatW)+8]; TRACE ("(%s, %s):\n", debugstr_w(lpszIMEFileName), debugstr_w(lpszLayoutText)); @@ -2069,7 +2069,7 @@ HKL WINAPI ImmInstallIMEW( DWORD disposition = 0; hkl = (HKL)MAKELPARAM( lcid, 0xe000 | count ); - wsprintfW( regKey, szImeRegFmt, (ULONG_PTR)hkl); + wsprintfW( regKey, layouts_formatW, (ULONG_PTR)hkl); rc = RegCreateKeyExW(HKEY_LOCAL_MACHINE, regKey, 0, NULL, 0, KEY_WRITE, NULL, &hkey, &disposition); if (rc == ERROR_SUCCESS && disposition == REG_CREATED_NEW_KEY)
1
0
0
0
Alexandre Julliard : wineboot: Add processor features for supported WoW64 architectures on ARM64.
by Alexandre Julliard
15 Mar '23
15 Mar '23
Module: wine Branch: master Commit: 9e8fbdab722c9af1feec3f393a6303e69ce91edb URL:
https://gitlab.winehq.org/wine/wine/-/commit/9e8fbdab722c9af1feec3f393a6303…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Mar 15 14:21:41 2023 +0100 wineboot: Add processor features for supported WoW64 architectures on ARM64. --- dlls/ntdll/rtl.c | 24 +++++++++++++++++++++++- dlls/ntdll/tests/wow64.c | 5 +++++ programs/wineboot/wineboot.c | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index 3305d770c13..e0f5dab2732 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -2128,7 +2128,29 @@ void WINAPI RtlGetCurrentProcessorNumberEx(PROCESSOR_NUMBER *processor) */ BOOLEAN WINAPI RtlIsProcessorFeaturePresent( UINT feature ) { -#ifdef _WIN64 +#ifdef __aarch64__ + static const ULONGLONG arm64_features = + (1ull << PF_COMPARE_EXCHANGE_DOUBLE) | + (1ull << PF_NX_ENABLED) | + (1ull << PF_ARM_VFP_32_REGISTERS_AVAILABLE) | + (1ull << PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) | + (1ull << PF_SECOND_LEVEL_ADDRESS_TRANSLATION) | + (1ull << PF_FASTFAIL_AVAILABLE) | + (1ull << PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE) | + (1ull << PF_ARM_64BIT_LOADSTORE_ATOMIC) | + (1ull << PF_ARM_EXTERNAL_CACHE_AVAILABLE) | + (1ull << PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE) | + (1ull << PF_ARM_V8_INSTRUCTIONS_AVAILABLE) | + (1ull << PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) | + (1ull << PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE) | + (1ull << PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE) | + (1ull << PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE) | + (1ull << PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE) | + (1ull << PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE); + + return (feature < PROCESSOR_FEATURE_MAX && (arm64_features & (1ull << feature)) && + user_shared_data->ProcessorFeatures[feature]); +#elif defined _WIN64 return feature < PROCESSOR_FEATURE_MAX && user_shared_data->ProcessorFeatures[feature]; #else return NtWow64IsProcessorFeaturePresent( feature ); diff --git a/dlls/ntdll/tests/wow64.c b/dlls/ntdll/tests/wow64.c index 111ea4ffa96..eff3ff59dc2 100644 --- a/dlls/ntdll/tests/wow64.c +++ b/dlls/ntdll/tests/wow64.c @@ -21,6 +21,7 @@ #include "ntdll_test.h" #include "winioctl.h" +#include "ddk/wdm.h" static NTSTATUS (WINAPI *pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS,void*,ULONG,ULONG*); static NTSTATUS (WINAPI *pNtQuerySystemInformationEx)(SYSTEM_INFORMATION_CLASS,void*,ULONG,void*,ULONG,ULONG*); @@ -1003,6 +1004,10 @@ static void test_nt_wow64(void) if (native_machine == IMAGE_FILE_MACHINE_ARM64) { + KSHARED_USER_DATA *user_shared_data = ULongToPtr( 0x7ffe0000 ); + + ok( user_shared_data->ProcessorFeatures[PF_ARM_V8_INSTRUCTIONS_AVAILABLE], "no ARM_V8\n" ); + ok( user_shared_data->ProcessorFeatures[PF_MMX_INSTRUCTIONS_AVAILABLE], "no MMX\n" ); ok( !pNtWow64IsProcessorFeaturePresent( PF_ARM_V8_INSTRUCTIONS_AVAILABLE ), "ARM_V8 present\n" ); ok( pNtWow64IsProcessorFeaturePresent( PF_MMX_INSTRUCTIONS_AVAILABLE ), "MMX not present\n" ); } diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index f89852e3f17..c05ce580298 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -260,6 +260,8 @@ static void create_user_shared_data(void) UNICODE_STRING name = RTL_CONSTANT_STRING( L"\\KernelObjects\\__wine_user_shared_data" ); NTSTATUS status; HANDLE handle; + ULONG i, machines[8]; + HANDLE process = 0; InitializeObjectAttributes( &attr, &name, OBJ_OPENIF, NULL, NULL ); if ((status = NtOpenSection( &handle, SECTION_ALL_ACCESS, &attr ))) @@ -320,15 +322,46 @@ static void create_user_shared_data(void) features[PF_AVX_INSTRUCTIONS_AVAILABLE] = !!(sci.ProcessorFeatureBits & CPU_FEATURE_AVX); features[PF_AVX2_INSTRUCTIONS_AVAILABLE] = !!(sci.ProcessorFeatureBits & CPU_FEATURE_AVX2); break; + case PROCESSOR_ARCHITECTURE_ARM: features[PF_ARM_VFP_32_REGISTERS_AVAILABLE] = !!(sci.ProcessorFeatureBits & CPU_FEATURE_ARM_VFP_32); features[PF_ARM_NEON_INSTRUCTIONS_AVAILABLE] = !!(sci.ProcessorFeatureBits & CPU_FEATURE_ARM_NEON); features[PF_ARM_V8_INSTRUCTIONS_AVAILABLE] = (sci.ProcessorLevel >= 8); break; + case PROCESSOR_ARCHITECTURE_ARM64: features[PF_ARM_V8_INSTRUCTIONS_AVAILABLE] = TRUE; features[PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE] = !!(sci.ProcessorFeatureBits & CPU_FEATURE_ARM_V8_CRC32); features[PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE] = !!(sci.ProcessorFeatureBits & CPU_FEATURE_ARM_V8_CRYPTO); + features[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE; + features[PF_NX_ENABLED] = TRUE; + features[PF_FASTFAIL_AVAILABLE] = TRUE; + /* add features for other architectures supported by wow64 */ + if (!NtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process), + machines, sizeof(machines), NULL )) + { + for (i = 0; machines[i]; i++) + { + switch (LOWORD(machines[i])) + { + case IMAGE_FILE_MACHINE_ARMNT: + features[PF_ARM_VFP_32_REGISTERS_AVAILABLE] = TRUE; + features[PF_ARM_NEON_INSTRUCTIONS_AVAILABLE] = TRUE; + break; + case IMAGE_FILE_MACHINE_I386: + features[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE; + features[PF_XMMI_INSTRUCTIONS_AVAILABLE] = TRUE; + features[PF_RDTSC_INSTRUCTION_AVAILABLE] = TRUE; + features[PF_XMMI64_INSTRUCTIONS_AVAILABLE] = TRUE; + features[PF_SSE3_INSTRUCTIONS_AVAILABLE] = TRUE; + features[PF_RDTSCP_INSTRUCTION_AVAILABLE] = TRUE; + features[PF_SSSE3_INSTRUCTIONS_AVAILABLE] = TRUE; + features[PF_SSE4_1_INSTRUCTIONS_AVAILABLE] = TRUE; + features[PF_SSE4_2_INSTRUCTIONS_AVAILABLE] = TRUE; + break; + } + } + } break; } data->ActiveProcessorCount = NtCurrentTeb()->Peb->NumberOfProcessors;
1
0
0
0
Alexandre Julliard : wow64: Forward NtWow64IsProcessorFeaturePresent() to the CPU backend.
by Alexandre Julliard
15 Mar '23
15 Mar '23
Module: wine Branch: master Commit: 911cdcda04b3da478cdcf2b431637d8982a399a1 URL:
https://gitlab.winehq.org/wine/wine/-/commit/911cdcda04b3da478cdcf2b431637d…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Mar 15 11:50:46 2023 +0100 wow64: Forward NtWow64IsProcessorFeaturePresent() to the CPU backend. --- dlls/wow64/syscall.c | 4 +++- dlls/wow64cpu/cpu.c | 10 ++++++++++ dlls/wow64cpu/wow64cpu.spec | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/dlls/wow64/syscall.c b/dlls/wow64/syscall.c index e79b8cd9ff6..d057fcc256e 100644 --- a/dlls/wow64/syscall.c +++ b/dlls/wow64/syscall.c @@ -102,6 +102,7 @@ static WOW64INFO *wow64info; /* cpu backend dll functions */ static void * (WINAPI *pBTCpuGetBopCode)(void); static NTSTATUS (WINAPI *pBTCpuGetContext)(HANDLE,HANDLE,void *,void *); +static BOOLEAN (WINAPI *pBTCpuIsProcessorFeaturePresent)(UINT); static void (WINAPI *pBTCpuProcessInit)(void); static NTSTATUS (WINAPI *pBTCpuSetContext)(HANDLE,HANDLE,void *,void *); static void (WINAPI *pBTCpuThreadInit)(void); @@ -629,7 +630,7 @@ NTSTATUS WINAPI wow64_NtWow64IsProcessorFeaturePresent( UINT *args ) { UINT feature = get_ulong( &args ); - return RtlIsProcessorFeaturePresent( feature ); + return pBTCpuIsProcessorFeaturePresent && pBTCpuIsProcessorFeaturePresent( feature ); } @@ -835,6 +836,7 @@ static DWORD WINAPI process_init( RTL_RUN_ONCE *once, void *param, void **contex module = load_64bit_module( get_cpu_dll_name() ); GET_PTR( BTCpuGetBopCode ); GET_PTR( BTCpuGetContext ); + GET_PTR( BTCpuIsProcessorFeaturePresent ); GET_PTR( BTCpuProcessInit ); GET_PTR( BTCpuThreadInit ); GET_PTR( BTCpuResetToConsistentState ); diff --git a/dlls/wow64cpu/cpu.c b/dlls/wow64cpu/cpu.c index 7911f7e8b72..aacd3ea4b85 100644 --- a/dlls/wow64cpu/cpu.c +++ b/dlls/wow64cpu/cpu.c @@ -352,6 +352,16 @@ void * WINAPI __wine_get_unix_opcode(void) } +/********************************************************************** + * BTCpuIsProcessorFeaturePresent (wow64cpu.@) + */ +BOOLEAN WINAPI BTCpuIsProcessorFeaturePresent( UINT feature ) +{ + /* assume CPU features are the same for 32- and 64-bit */ + return RtlIsProcessorFeaturePresent( feature ); +} + + /********************************************************************** * BTCpuGetContext (wow64cpu.@) */ diff --git a/dlls/wow64cpu/wow64cpu.spec b/dlls/wow64cpu/wow64cpu.spec index 48c4800a611..179f050687b 100644 --- a/dlls/wow64cpu/wow64cpu.spec +++ b/dlls/wow64cpu/wow64cpu.spec @@ -1,5 +1,6 @@ @ stdcall BTCpuGetBopCode() @ stdcall BTCpuGetContext(long long ptr ptr) +@ stdcall BTCpuIsProcessorFeaturePresent(long) @ stdcall BTCpuProcessInit() @ stdcall BTCpuResetToConsistentState(ptr) @ stdcall BTCpuSetContext(long long ptr ptr)
1
0
0
0
Alexandre Julliard : ntdll: Implement NtWow64IsProcessorFeaturePresent().
by Alexandre Julliard
15 Mar '23
15 Mar '23
Module: wine Branch: master Commit: 5a1d431b4bf93424a415d5e3d113b1f16431fcb1 URL:
https://gitlab.winehq.org/wine/wine/-/commit/5a1d431b4bf93424a415d5e3d113b1…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Mar 15 09:48:40 2023 +0100 ntdll: Implement NtWow64IsProcessorFeaturePresent(). --- dlls/ntdll/ntdll.spec | 2 ++ dlls/ntdll/rtl.c | 4 ++++ dlls/ntdll/tests/wow64.c | 18 ++++++++++++++++++ dlls/ntdll/unix/loader.c | 1 + dlls/ntdll/unix/virtual.c | 10 ++++++++++ dlls/wow64/syscall.c | 11 +++++++++++ dlls/wow64/syscall.h | 1 + include/winnt.h | 4 ++++ include/winternl.h | 1 + 9 files changed, 52 insertions(+) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index b0186eb7641..d5f6737e1aa 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -446,6 +446,7 @@ # @ stub NtWaitLowEventPair @ stdcall -syscall -arch=win32 NtWow64AllocateVirtualMemory64(long ptr int64 ptr long long) @ stdcall -syscall -arch=win32 NtWow64GetNativeSystemInformation(long ptr long ptr) +@ stdcall -syscall -arch=win32 NtWow64IsProcessorFeaturePresent(long) @ stdcall -syscall -arch=win32 NtWow64ReadVirtualMemory64(long int64 ptr int64 ptr) @ stdcall -syscall -arch=win32 NtWow64WriteVirtualMemory64(long int64 ptr int64 ptr) @ stdcall -syscall NtWriteFile(long long ptr ptr ptr ptr long ptr ptr) @@ -1478,6 +1479,7 @@ # @ stub ZwWaitLowEventPair @ stdcall -syscall -arch=win32 ZwWow64AllocateVirtualMemory64(long ptr int64 ptr long long) NtWow64AllocateVirtualMemory64 @ stdcall -syscall -arch=win32 ZwWow64GetNativeSystemInformation(long ptr long ptr) NtWow64GetNativeSystemInformation +@ stdcall -syscall -arch=win32 ZwWow64IsProcessorFeaturePresent(long) NtWow64IsProcessorFeaturePresent @ stdcall -syscall -arch=win32 ZwWow64ReadVirtualMemory64(long int64 ptr int64 ptr) NtWow64ReadVirtualMemory64 @ stdcall -syscall -arch=win32 ZwWow64WriteVirtualMemory64(long int64 ptr int64 ptr) NtWow64WriteVirtualMemory64 @ stdcall -private -syscall ZwWriteFile(long long ptr ptr ptr ptr long ptr ptr) NtWriteFile diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index 25927afce54..3305d770c13 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -2128,7 +2128,11 @@ void WINAPI RtlGetCurrentProcessorNumberEx(PROCESSOR_NUMBER *processor) */ BOOLEAN WINAPI RtlIsProcessorFeaturePresent( UINT feature ) { +#ifdef _WIN64 return feature < PROCESSOR_FEATURE_MAX && user_shared_data->ProcessorFeatures[feature]; +#else + return NtWow64IsProcessorFeaturePresent( feature ); +#endif } /*********************************************************************** diff --git a/dlls/ntdll/tests/wow64.c b/dlls/ntdll/tests/wow64.c index ddb63b7cae8..111ea4ffa96 100644 --- a/dlls/ntdll/tests/wow64.c +++ b/dlls/ntdll/tests/wow64.c @@ -35,6 +35,7 @@ static NTSTATUS (WINAPI *pRtlWow64GetThreadSelectorEntry)(HANDLE,THREAD_DESCRIPT #else static NTSTATUS (WINAPI *pNtWow64AllocateVirtualMemory64)(HANDLE,ULONG64*,ULONG64,ULONG64*,ULONG,ULONG); static NTSTATUS (WINAPI *pNtWow64GetNativeSystemInformation)(SYSTEM_INFORMATION_CLASS,void*,ULONG,ULONG*); +static NTSTATUS (WINAPI *pNtWow64IsProcessorFeaturePresent)(ULONG); static NTSTATUS (WINAPI *pNtWow64ReadVirtualMemory64)(HANDLE,ULONG64,void*,ULONG64,ULONG64*); static NTSTATUS (WINAPI *pNtWow64WriteVirtualMemory64)(HANDLE,ULONG64,const void *,ULONG64,ULONG64*); #endif @@ -80,6 +81,7 @@ static void init(void) #else GET_PROC( NtWow64AllocateVirtualMemory64 ); GET_PROC( NtWow64GetNativeSystemInformation ); + GET_PROC( NtWow64IsProcessorFeaturePresent ); GET_PROC( NtWow64ReadVirtualMemory64 ); GET_PROC( NtWow64WriteVirtualMemory64 ); #endif @@ -991,6 +993,22 @@ static void test_nt_wow64(void) } else win_skip( "NtWow64GetNativeSystemInformation not supported\n" ); + if (pNtWow64IsProcessorFeaturePresent) + { + ULONG i; + + for (i = 0; i < 64; i++) + ok( pNtWow64IsProcessorFeaturePresent( i ) == IsProcessorFeaturePresent( i ), + "mismatch %lu wow64 returned %lx\n", i, pNtWow64IsProcessorFeaturePresent( i )); + + if (native_machine == IMAGE_FILE_MACHINE_ARM64) + { + ok( !pNtWow64IsProcessorFeaturePresent( PF_ARM_V8_INSTRUCTIONS_AVAILABLE ), "ARM_V8 present\n" ); + ok( pNtWow64IsProcessorFeaturePresent( PF_MMX_INSTRUCTIONS_AVAILABLE ), "MMX not present\n" ); + } + } + else win_skip( "NtWow64IsProcessorFeaturePresent not supported\n" ); + NtClose( process ); } diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index cde37c48b0d..1cadd2b10b6 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -350,6 +350,7 @@ static void * const syscalls[] = #ifndef _WIN64 NtWow64AllocateVirtualMemory64, NtWow64GetNativeSystemInformation, + NtWow64IsProcessorFeaturePresent, NtWow64ReadVirtualMemory64, NtWow64WriteVirtualMemory64, #endif diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index b1267ff0db5..c5318a3282d 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -69,6 +69,7 @@ #include "windef.h" #include "winnt.h" #include "winternl.h" +#include "ddk/wdm.h" #include "wine/list.h" #include "wine/rbtree.h" #include "unix_private.h" @@ -5334,4 +5335,13 @@ NTSTATUS WINAPI NtWow64GetNativeSystemInformation( SYSTEM_INFORMATION_CLASS clas } } +/*********************************************************************** + * NtWow64IsProcessorFeaturePresent (NTDLL.@) + * ZwWow64IsProcessorFeaturePresent (NTDLL.@) + */ +NTSTATUS WINAPI NtWow64IsProcessorFeaturePresent( UINT feature ) +{ + return feature < PROCESSOR_FEATURE_MAX && user_shared_data->ProcessorFeatures[feature]; +} + #endif /* _WIN64 */ diff --git a/dlls/wow64/syscall.c b/dlls/wow64/syscall.c index d1c7421fabd..e79b8cd9ff6 100644 --- a/dlls/wow64/syscall.c +++ b/dlls/wow64/syscall.c @@ -622,6 +622,17 @@ NTSTATUS WINAPI wow64_NtSetDefaultUILanguage( UINT *args ) } +/********************************************************************** + * wow64_NtWow64IsProcessorFeaturePresent + */ +NTSTATUS WINAPI wow64_NtWow64IsProcessorFeaturePresent( UINT *args ) +{ + UINT feature = get_ulong( &args ); + + return RtlIsProcessorFeaturePresent( feature ); +} + + /********************************************************************** * get_syscall_num */ diff --git a/dlls/wow64/syscall.h b/dlls/wow64/syscall.h index e91be71ebac..59586d3fbfa 100644 --- a/dlls/wow64/syscall.h +++ b/dlls/wow64/syscall.h @@ -251,6 +251,7 @@ SYSCALL_ENTRY( NtWaitForSingleObject ) \ SYSCALL_ENTRY( NtWow64AllocateVirtualMemory64 ) \ SYSCALL_ENTRY( NtWow64GetNativeSystemInformation ) \ + SYSCALL_ENTRY( NtWow64IsProcessorFeaturePresent ) \ SYSCALL_ENTRY( NtWow64ReadVirtualMemory64 ) \ SYSCALL_ENTRY( NtWow64WriteVirtualMemory64 ) \ SYSCALL_ENTRY( NtWriteFile ) \ diff --git a/include/winnt.h b/include/winnt.h index a7c69070a2c..66f6b7ad809 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -1072,6 +1072,10 @@ typedef enum _HEAP_INFORMATION_CLASS { #define PF_AVX_INSTRUCTIONS_AVAILABLE 39 #define PF_AVX2_INSTRUCTIONS_AVAILABLE 40 #define PF_AVX512F_INSTRUCTIONS_AVAILABLE 41 +#define PF_ERMS_AVAILABLE 42 +#define PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE 43 +#define PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE 44 +#define PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE 45 /* Execution state flags */ diff --git a/include/winternl.h b/include/winternl.h index ae7f0218b4a..339d3d86f78 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -4675,6 +4675,7 @@ NTSYSAPI NTSTATUS WINAPI RtlWow64SetThreadContext(HANDLE,const WOW64_CONTEXT*); #else NTSYSAPI NTSTATUS WINAPI NtWow64AllocateVirtualMemory64(HANDLE,ULONG64*,ULONG64,ULONG64*,ULONG,ULONG); NTSYSAPI NTSTATUS WINAPI NtWow64GetNativeSystemInformation(SYSTEM_INFORMATION_CLASS,void*,ULONG,ULONG*); +NTSYSAPI NTSTATUS WINAPI NtWow64IsProcessorFeaturePresent(UINT); NTSYSAPI NTSTATUS WINAPI NtWow64ReadVirtualMemory64(HANDLE,ULONG64,void*,ULONG64,ULONG64*); NTSYSAPI NTSTATUS WINAPI NtWow64WriteVirtualMemory64(HANDLE,ULONG64,const void*,ULONG64,ULONG64*); NTSYSAPI LONGLONG WINAPI RtlConvertLongToLargeInteger(LONG);
1
0
0
0
Alexandre Julliard : ntdll/tests: Update some todos that succeed with the new wow64 architecture.
by Alexandre Julliard
15 Mar '23
15 Mar '23
Module: wine Branch: master Commit: 6114944106b9493485f0e5ba4eab9d3e3129e100 URL:
https://gitlab.winehq.org/wine/wine/-/commit/6114944106b9493485f0e5ba4eab9d…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Mar 15 10:59:05 2023 +0100 ntdll/tests: Update some todos that succeed with the new wow64 architecture. --- dlls/ntdll/tests/wow64.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dlls/ntdll/tests/wow64.c b/dlls/ntdll/tests/wow64.c index 8150ee0fff1..ddb63b7cae8 100644 --- a/dlls/ntdll/tests/wow64.c +++ b/dlls/ntdll/tests/wow64.c @@ -40,6 +40,7 @@ static NTSTATUS (WINAPI *pNtWow64WriteVirtualMemory64)(HANDLE,ULONG64,const void #endif static BOOL is_wow64; +static BOOL old_wow64; /* Wine old-style wow64 */ static void *code_mem; #ifdef __i386__ @@ -99,6 +100,7 @@ static void init(void) native_machine = IMAGE_FILE_MACHINE_AMD64; break; case PROCESSOR_ARCHITECTURE_INTEL: + old_wow64 = TRUE; native_machine = IMAGE_FILE_MACHINE_AMD64; break; } @@ -715,7 +717,7 @@ static void enum_modules64( void (*func)(ULONG64,const WCHAR *) ) ok( process != 0, "failed to open current process %lu\n", GetLastError() ); status = pNtWow64ReadVirtualMemory64( process, teb64->Peb, &peb64, sizeof(peb64), NULL ); ok( !status, "NtWow64ReadVirtualMemory64 failed %lx\n", status ); - todo_wine + todo_wine_if( old_wow64 ) ok( peb64.LdrData, "LdrData not initialized\n" ); if (!peb64.LdrData) goto done; status = pNtWow64ReadVirtualMemory64( process, peb64.LdrData, &ldr, sizeof(ldr), NULL ); @@ -816,7 +818,7 @@ static void test_modules(void) if (!is_wow64) return; if (!pNtWow64ReadVirtualMemory64) return; enum_modules64( check_module ); - todo_wine + todo_wine_if( old_wow64 ) { ok( main_module, "main module not found\n" ); ok( ntdll_module, "64-bit ntdll not found\n" ); @@ -913,7 +915,7 @@ static void test_nt_wow64(void) ptr = 0x9876543210ull; status = pNtWow64AllocateVirtualMemory64( process, &ptr, 0, &size, MEM_RESERVE | MEM_COMMIT, PAGE_READONLY ); - todo_wine + todo_wine_if( !is_wow64 || old_wow64 ) ok( !status || broken( status == STATUS_CONFLICTING_ADDRESSES ), "NtWow64AllocateVirtualMemory64 failed %lx\n", status ); if (!status) ok( ptr == 0x9876540000ull || broken(ptr == 0x76540000), /* win 8.1 */ @@ -942,7 +944,7 @@ static void test_nt_wow64(void) ok( len == sizeof(sbi2), "wrong length %ld\n", len ); ok( sbi.HighestUserAddress == (void *)0x7ffeffff, "wrong limit %p\n", sbi.HighestUserAddress); - todo_wine_if( is_wow64 ) + todo_wine_if( old_wow64 ) ok( sbi2.HighestUserAddress == (is_wow64 ? (void *)0xfffeffff : (void *)0x7ffeffff), "wrong limit %p\n", sbi.HighestUserAddress); @@ -1093,7 +1095,8 @@ static void test_init_block(void) CHECK_FUNC( block64[6], "KiUserCallbackDispatcher" ); CHECK_FUNC( block64[7], "RtlUserThreadStart" ); CHECK_FUNC( block64[8], "RtlpQueryProcessDebugInformationRemote" ); - todo_wine ok( block64[9] == (ULONG_PTR)ntdll, "got %p for ntdll %p\n", + todo_wine_if( old_wow64 ) + ok( block64[9] == (ULONG_PTR)ntdll, "got %p for ntdll %p\n", (void *)(ULONG_PTR)block64[9], ntdll ); CHECK_FUNC( block64[10], "LdrSystemDllInitBlock" ); CHECK_FUNC( block64[11], "RtlpFreezeTimeBias" );
1
0
0
0
Alexandre Julliard : ntdll/tests: Fix Wow64 tests failures on Windows 11 ARM64.
by Alexandre Julliard
15 Mar '23
15 Mar '23
Module: wine Branch: master Commit: 6f2cf11da35abcbb8ca8125ba961d8baee44401d URL:
https://gitlab.winehq.org/wine/wine/-/commit/6f2cf11da35abcbb8ca8125ba961d8…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Mar 15 10:44:45 2023 +0100 ntdll/tests: Fix Wow64 tests failures on Windows 11 ARM64. --- dlls/ntdll/tests/wow64.c | 86 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 59 insertions(+), 27 deletions(-) diff --git a/dlls/ntdll/tests/wow64.c b/dlls/ntdll/tests/wow64.c index 08660b608b4..8150ee0fff1 100644 --- a/dlls/ntdll/tests/wow64.c +++ b/dlls/ntdll/tests/wow64.c @@ -42,6 +42,23 @@ static NTSTATUS (WINAPI *pNtWow64WriteVirtualMemory64)(HANDLE,ULONG64,const void static BOOL is_wow64; static void *code_mem; +#ifdef __i386__ +static USHORT current_machine = IMAGE_FILE_MACHINE_I386; +static USHORT native_machine = IMAGE_FILE_MACHINE_I386; +#elif defined __x86_64__ +static USHORT current_machine = IMAGE_FILE_MACHINE_AMD64; +static USHORT native_machine = IMAGE_FILE_MACHINE_AMD64; +#elif defined __arm__ +static USHORT current_machine = IMAGE_FILE_MACHINE_ARMNT; +static USHORT native_machine = IMAGE_FILE_MACHINE_ARMNT; +#elif defined __aarch64__ +static USHORT current_machine = IMAGE_FILE_MACHINE_ARM64; +static USHORT native_machine = IMAGE_FILE_MACHINE_ARM64; +#else +static USHORT current_machine; +static USHORT native_machine; +#endif + static void init(void) { HMODULE ntdll = GetModuleHandleA( "ntdll.dll" ); @@ -67,7 +84,28 @@ static void init(void) #endif #undef GET_PROC - code_mem = VirtualAlloc( NULL, 65536, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE ); + if (is_wow64) + { + SYSTEM_CPU_INFORMATION info; + ULONG len; + + pRtlGetNativeSystemInformation( SystemCpuInformation, &info, sizeof(info), &len ); + switch (info.ProcessorArchitecture) + { + case PROCESSOR_ARCHITECTURE_ARM64: + native_machine = IMAGE_FILE_MACHINE_ARM64; + break; + case PROCESSOR_ARCHITECTURE_AMD64: + native_machine = IMAGE_FILE_MACHINE_AMD64; + break; + case PROCESSOR_ARCHITECTURE_INTEL: + native_machine = IMAGE_FILE_MACHINE_AMD64; + break; + } + } + + if (native_machine == IMAGE_FILE_MACHINE_AMD64) + code_mem = VirtualAlloc( NULL, 65536, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE ); } static void test_process_architecture( HANDLE process, USHORT expect_machine, USHORT expect_native ) @@ -122,22 +160,6 @@ static void test_process_architecture( HANDLE process, USHORT expect_machine, US static void test_query_architectures(void) { -#ifdef __i386__ - USHORT current_machine = IMAGE_FILE_MACHINE_I386; - USHORT native_machine = is_wow64 ? IMAGE_FILE_MACHINE_AMD64 : IMAGE_FILE_MACHINE_I386; -#elif defined __x86_64__ - USHORT current_machine = IMAGE_FILE_MACHINE_AMD64; - USHORT native_machine = IMAGE_FILE_MACHINE_AMD64; -#elif defined __arm__ - USHORT current_machine = IMAGE_FILE_MACHINE_ARMNT; - USHORT native_machine = is_wow64 ? IMAGE_FILE_MACHINE_ARM64 : IMAGE_FILE_MACHINE_ARMNT; -#elif defined __aarch64__ - USHORT current_machine = IMAGE_FILE_MACHINE_ARM64; - USHORT native_machine = IMAGE_FILE_MACHINE_ARM64; -#else - USHORT current_machine = 0; - USHORT native_machine = 0; -#endif PROCESS_INFORMATION pi; STARTUPINFOA si = { sizeof(si) }; NTSTATUS status; @@ -209,11 +231,11 @@ static void test_query_architectures(void) ret = 0xcc; status = pRtlWow64IsWowGuestMachineSupported( IMAGE_FILE_MACHINE_ARMNT, &ret ); ok( !status, "failed %lx\n", status ); - ok( ret == (native_machine == IMAGE_FILE_MACHINE_ARM64), "wrong result %u\n", ret ); + ok( !ret || native_machine == IMAGE_FILE_MACHINE_ARM64, "wrong result %u\n", ret ); ret = 0xcc; status = pRtlWow64IsWowGuestMachineSupported( IMAGE_FILE_MACHINE_AMD64, &ret ); ok( !status, "failed %lx\n", status ); - ok( !ret, "wrong result %u\n", ret ); + ok( !ret || native_machine == IMAGE_FILE_MACHINE_ARM64, "wrong result %u\n", ret ); ret = 0xcc; status = pRtlWow64IsWowGuestMachineSupported( IMAGE_FILE_MACHINE_ARM64, &ret ); ok( !status, "failed %lx\n", status ); @@ -439,13 +461,14 @@ static void test_selectors(void) if (!pRtlWow64GetThreadContext || pRtlWow64GetThreadContext( GetCurrentThread(), &context )) { /* hardcoded values */ - context.SegCs = 0x23; #ifdef __x86_64__ + context.SegCs = 0x23; __asm__( "movw %%fs,%0" : "=m" (context.SegFs) ); __asm__( "movw %%ss,%0" : "=m" (context.SegSs) ); #else - context.SegSs = 0x2b; - context.SegFs = 0x53; + context.SegCs = 0x1b; + context.SegSs = 0x23; + context.SegFs = 0x3b; #endif } #define GET_ENTRY(info,size,ret) \ @@ -570,7 +593,7 @@ static void test_cpu_area(void) { USHORT machine; NTSTATUS expect; - ULONG align, size, offset, flag; + ULONG_PTR align, size, offset, flag; } tests[] = { { IMAGE_FILE_MACHINE_I386, 0, 4, 0x2cc, 0x00, 0x00010000 }, @@ -663,7 +686,7 @@ static NTSTATUS call_func64( ULONG64 func64, int nb_args, ULONG64 *args ) } static ULONG64 main_module, ntdll_module, wow64_module, wow64base_module, wow64con_module, - wow64cpu_module, wow64win_module; + wow64cpu_module, xtajit_module, wow64win_module; static void enum_modules64( void (*func)(ULONG64,const WCHAR *) ) { @@ -774,13 +797,16 @@ static void check_module( ULONG64 base, const WCHAR *name ) main_module = base; return; } -#define CHECK_MODULE(mod) if (!wcsicmp( name, L"" #mod ".dll" )) { mod ## _module = base; return; } +#define CHECK_MODULE(mod) do { if (!wcsicmp( name, L"" #mod ".dll" )) { mod ## _module = base; return; } } while(0) CHECK_MODULE(ntdll); CHECK_MODULE(wow64); CHECK_MODULE(wow64base); CHECK_MODULE(wow64con); - CHECK_MODULE(wow64cpu); CHECK_MODULE(wow64win); + if (native_machine == IMAGE_FILE_MACHINE_ARM64) + CHECK_MODULE(xtajit); + else + CHECK_MODULE(wow64cpu); #undef CHECK_MODULE ok( 0, "unknown module %s %s found\n", wine_dbgstr_longlong(base), wine_dbgstr_w(name)); } @@ -795,7 +821,10 @@ static void test_modules(void) ok( main_module, "main module not found\n" ); ok( ntdll_module, "64-bit ntdll not found\n" ); ok( wow64_module, "wow64.dll not found\n" ); - ok( wow64cpu_module, "wow64cpu.dll not found\n" ); + if (native_machine == IMAGE_FILE_MACHINE_ARM64) + ok( xtajit_module, "xtajit.dll not found\n" ); + else + ok( wow64cpu_module, "wow64cpu.dll not found\n" ); ok( wow64win_module, "wow64win.dll not found\n" ); } } @@ -1111,6 +1140,7 @@ static void test_iosb(void) ULONG64 args[] = { 0, 0, 0, 0, (ULONG_PTR)&iosb64, FSCTL_PIPE_LISTEN, 0, 0, 0, 0 }; if (!is_wow64) return; + if (!code_mem) return; if (!ntdll_module) return; func = get_proc_address64( ntdll_module, "NtFsControlFile" ); @@ -1217,6 +1247,7 @@ static void test_syscalls(void) NTSTATUS status; if (!is_wow64) return; + if (!code_mem) return; if (!ntdll_module) return; func = get_proc_address64( wow64_module, "Wow64SystemServiceEx" ); @@ -1300,6 +1331,7 @@ static void test_cpu_area(void) NTSTATUS status; if (!is_wow64) return; + if (!code_mem) return; if (!ntdll_module) return; if ((ptr = get_proc_address64( ntdll_module, "RtlWow64GetCurrentCpuArea" )))
1
0
0
0
Alexandre Julliard : ntdll/tests: Handle another possible status when SystemProcessorFeaturesInformation is not supported.
by Alexandre Julliard
15 Mar '23
15 Mar '23
Module: wine Branch: master Commit: 29cd79829c5c8ea32a5ce6a9c9fef6a48dab813c URL:
https://gitlab.winehq.org/wine/wine/-/commit/29cd79829c5c8ea32a5ce6a9c9fef6…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Mar 15 09:05:47 2023 +0100 ntdll/tests: Handle another possible status when SystemProcessorFeaturesInformation is not supported. --- dlls/ntdll/tests/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c index 9a1e790e673..f500fc09092 100644 --- a/dlls/ntdll/tests/info.c +++ b/dlls/ntdll/tests/info.c @@ -377,7 +377,7 @@ static void test_query_cpu(void) len = 0xdeadbeef; status = pNtQuerySystemInformation( SystemProcessorFeaturesInformation, &features, sizeof(features), &len ); - if (status != STATUS_NOT_SUPPORTED) + if (status != STATUS_NOT_SUPPORTED && status != STATUS_INVALID_INFO_CLASS) { ok( !status, "SystemProcessorFeaturesInformation failed %lx\n", status ); ok( len == sizeof(features), "wrong len %lu\n", len );
1
0
0
0
← Newer
1
...
56
57
58
59
60
61
62
...
91
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
91
Results per page:
10
25
50
100
200