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 2021
----- 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
728 discussions
Start a n
N
ew thread
Alexandre Julliard : ntdll: Rename the SYSTEM_MODULE and SYSTEM_MODULE_INFORMATION structures.
by Alexandre Julliard
27 Jul '21
27 Jul '21
Module: wine Branch: master Commit: eb6fcd3cb9265de0ccf5e9cc767992f5939325c3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=eb6fcd3cb9265de0ccf5e9cc…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Jul 27 16:38:45 2021 +0200 ntdll: Rename the SYSTEM_MODULE and SYSTEM_MODULE_INFORMATION structures. To be consistent with the _EX version. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/loader.c | 4 ++-- dlls/ntdll/tests/info.c | 6 +++--- dlls/ntdll/unix/system.c | 8 ++++---- include/winternl.h | 14 +++++++------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 3339596944a..2b840a864a6 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3119,10 +3119,10 @@ IMAGE_BASE_RELOCATION * WINAPI LdrProcessRelocationBlock( void *page, UINT count * LdrQueryProcessModuleInformation * */ -NTSTATUS WINAPI LdrQueryProcessModuleInformation(PSYSTEM_MODULE_INFORMATION smi, +NTSTATUS WINAPI LdrQueryProcessModuleInformation(RTL_PROCESS_MODULES *smi, ULONG buf_size, ULONG* req_size) { - SYSTEM_MODULE* sm = &smi->Modules[0]; + RTL_PROCESS_MODULE_INFORMATION *sm = &smi->Modules[0]; ULONG size = sizeof(ULONG); NTSTATUS nts = STATUS_SUCCESS; ANSI_STRING str; diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c index c7c849d2537..ccce197206b 100644 --- a/dlls/ntdll/tests/info.c +++ b/dlls/ntdll/tests/info.c @@ -635,7 +635,7 @@ static void test_query_procperf(void) static void test_query_module(void) { const RTL_PROCESS_MODULE_INFORMATION_EX *infoex; - SYSTEM_MODULE_INFORMATION *info; + RTL_PROCESS_MODULES *info; NTSTATUS status; ULONG size, i; char *buffer; @@ -652,7 +652,7 @@ static void test_query_module(void) for (i = 0; i < info->ModulesCount; i++) { - const SYSTEM_MODULE *module = &info->Modules[i]; + RTL_PROCESS_MODULE_INFORMATION *module = &info->Modules[i]; ok(module->LoadOrderIndex == i, "%u: got index %u\n", i, module->LoadOrderIndex); ok(module->ImageBaseAddress || is_wow64, "%u: got NULL address for %s\n", i, module->Name); @@ -678,7 +678,7 @@ static void test_query_module(void) infoex = (const void *)buffer; for (i = 0; infoex->NextOffset; i++) { - const SYSTEM_MODULE *module = &infoex->BaseInfo; + const RTL_PROCESS_MODULE_INFORMATION *module = &infoex->BaseInfo; ok(module->LoadOrderIndex == i, "%u: got index %u\n", i, module->LoadOrderIndex); ok(module->ImageBaseAddress || is_wow64, "%u: got NULL address for %s\n", i, module->Name); diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index fcc0fb6677e..94961ed524e 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -2450,15 +2450,15 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class, }; ULONG i; - SYSTEM_MODULE_INFORMATION *smi = info; + RTL_PROCESS_MODULES *smi = info; - len = offsetof( SYSTEM_MODULE_INFORMATION, Modules[ARRAY_SIZE(fake_modules)] ); + len = offsetof( RTL_PROCESS_MODULES, Modules[ARRAY_SIZE(fake_modules)] ); if (len <= size) { memset( smi, 0, len ); for (i = 0; i < ARRAY_SIZE(fake_modules); i++) { - SYSTEM_MODULE *sm = &smi->Modules[i]; + RTL_PROCESS_MODULE_INFORMATION *sm = &smi->Modules[i]; sm->ImageBaseAddress = (char *)0x10000000 + 0x200000 * i; sm->ImageSize = 0x200000; sm->LoadOrderIndex = i; @@ -2814,7 +2814,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class, memset( info, 0, len ); for (i = 0; i < ARRAY_SIZE(fake_modules); i++) { - SYSTEM_MODULE *sm = &module_info[i].BaseInfo; + RTL_PROCESS_MODULE_INFORMATION *sm = &module_info[i].BaseInfo; sm->ImageBaseAddress = (char *)0x10000000 + 0x200000 * i; sm->ImageSize = 0x200000; sm->LoadOrderIndex = i; diff --git a/include/winternl.h b/include/winternl.h index 20905486766..7d732d895d9 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -3391,7 +3391,7 @@ typedef void (CALLBACK *PLDR_DLL_NOTIFICATION_FUNCTION)(ULONG, LDR_DLL_NOTIFICAT /* FIXME: to be checked */ #define MAXIMUM_FILENAME_LENGTH 256 -typedef struct _SYSTEM_MODULE +typedef struct _RTL_PROCESS_MODULE_INFORMATION { PVOID Section; /* 00/00 */ PVOID MappedBaseAddress; /* 04/08 */ @@ -3403,13 +3403,13 @@ typedef struct _SYSTEM_MODULE WORD LoadCount; /* 18/24 */ WORD NameOffset; /* 1a/26 */ BYTE Name[MAXIMUM_FILENAME_LENGTH]; /* 1c/28 */ -} SYSTEM_MODULE, *PSYSTEM_MODULE; +} RTL_PROCESS_MODULE_INFORMATION, *PRTL_PROCESS_MODULE_INFORMATION; -typedef struct _SYSTEM_MODULE_INFORMATION +typedef struct _RTL_PROCESS_MODULES { ULONG ModulesCount; - SYSTEM_MODULE Modules[1]; /* FIXME: should be Modules[0] */ -} SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION; + RTL_PROCESS_MODULE_INFORMATION Modules[1]; /* FIXME: should be Modules[0] */ +} RTL_PROCESS_MODULES, *PRTL_PROCESS_MODULES; #define PROCESS_CREATE_FLAGS_BREAKAWAY 0x00000001 #define PROCESS_CREATE_FLAGS_NO_DEBUG_INHERIT 0x00000002 @@ -3426,7 +3426,7 @@ typedef struct _SYSTEM_MODULE_INFORMATION typedef struct _RTL_PROCESS_MODULE_INFORMATION_EX { USHORT NextOffset; - SYSTEM_MODULE BaseInfo; + RTL_PROCESS_MODULE_INFORMATION BaseInfo; ULONG ImageCheckSum; ULONG TimeDateStamp; void *DefaultBase; @@ -3779,7 +3779,7 @@ NTSYSAPI NTSTATUS WINAPI LdrLoadDll(LPCWSTR, DWORD, const UNICODE_STRING*, HMOD NTSYSAPI NTSTATUS WINAPI LdrLockLoaderLock(ULONG,ULONG*,ULONG_PTR*); IMAGE_BASE_RELOCATION * WINAPI LdrProcessRelocationBlock(void*,UINT,USHORT*,INT_PTR); NTSYSAPI NTSTATUS WINAPI LdrQueryImageFileExecutionOptions(const UNICODE_STRING*,LPCWSTR,ULONG,void*,ULONG,ULONG*); -NTSYSAPI NTSTATUS WINAPI LdrQueryProcessModuleInformation(SYSTEM_MODULE_INFORMATION*, ULONG, ULONG*); +NTSYSAPI NTSTATUS WINAPI LdrQueryProcessModuleInformation(RTL_PROCESS_MODULES*, ULONG, ULONG*); NTSYSAPI NTSTATUS WINAPI LdrRegisterDllNotification(ULONG,PLDR_DLL_NOTIFICATION_FUNCTION,void*,void**); NTSYSAPI NTSTATUS WINAPI LdrRemoveDllDirectory(void*); NTSYSAPI NTSTATUS WINAPI LdrSetDefaultDllDirectories(ULONG);
1
0
0
0
Alexandre Julliard : ntdll/tests: Add a test for a Wow64-only syscall.
by Alexandre Julliard
27 Jul '21
27 Jul '21
Module: wine Branch: master Commit: a9828988e91d5a0d7f744c1840f3323de2452c3e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a9828988e91d5a0d7f744c18…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Jul 27 13:48:53 2021 +0200 ntdll/tests: Add a test for a Wow64-only syscall. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/tests/wow64.c | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/dlls/ntdll/tests/wow64.c b/dlls/ntdll/tests/wow64.c index 14507623310..90692e66c25 100644 --- a/dlls/ntdll/tests/wow64.c +++ b/dlls/ntdll/tests/wow64.c @@ -1176,24 +1176,16 @@ static void test_iosb(void) static NTSTATUS invoke_syscall( const char *name, ULONG args32[] ) { - NTSTATUS status; ULONG64 args64[] = { -1, PtrToUlong( args32 ) }; - ULONG64 ptr, res, func = get_proc_address64( wow64_module, "Wow64SystemServiceEx" ); - BYTE syscall[32]; + ULONG64 func = get_proc_address64( wow64_module, "Wow64SystemServiceEx" ); + BYTE *syscall = (BYTE *)GetProcAddress( GetModuleHandleA("ntdll.dll"), name ); - if (!(ptr = get_proc_address64( ntdll_module, name ))) return STATUS_NOT_IMPLEMENTED; + ok( syscall != NULL, "syscall %s not found\n", name ); + if (syscall[0] == 0xb8) + args64[0] = *(DWORD *)(syscall + 1); + else + win_skip( "syscall thunk %s not recognized\n", name ); - if (pNtWow64ReadVirtualMemory64) - { - HANDLE process = OpenProcess( PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId() ); - status = pNtWow64ReadVirtualMemory64( process, ptr, syscall, sizeof(syscall), &res ); - ok( !status, "NtWow64ReadVirtualMemory64 failed %x\n", status ); - if (syscall[0] == 0x4c && syscall[1] == 0x8b && syscall[2] == 0xd1 && syscall[3] == 0xb8) - args64[0] = *(DWORD *)(syscall + 4); - else - win_skip( "syscall thunk not recognized\n" ); - NtClose( process ); - } return call_func64( func, ARRAY_SIZE(args64), args64 ); } @@ -1262,6 +1254,25 @@ static void test_syscalls(void) status = NtClose( event ); ok( !status, "NtClose failed %x\n", status ); + + if (pNtWow64ReadVirtualMemory64) + { + TEB64 *teb64 = (TEB64 *)NtCurrentTeb()->GdiBatchCount; + PEB64 peb64, peb64_2; + ULONG64 res, res2; + HANDLE process = OpenProcess( PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId() ); + ULONG args32[] = { HandleToLong( process ), (ULONG)teb64->Peb, teb64->Peb >> 32, + PtrToUlong(&peb64_2), sizeof(peb64_2), 0, PtrToUlong(&res2) }; + + ok( process != 0, "failed to open current process %u\n", GetLastError() ); + status = pNtWow64ReadVirtualMemory64( process, teb64->Peb, &peb64, sizeof(peb64), &res ); + ok( !status, "NtWow64ReadVirtualMemory64 failed %x\n", status ); + status = invoke_syscall( "NtWow64ReadVirtualMemory64", args32 ); + ok( !status, "NtWow64ReadVirtualMemory64 failed %x\n", status ); + ok( res2 == res, "wrong len %s / %s\n", wine_dbgstr_longlong(res), wine_dbgstr_longlong(res2) ); + ok( !memcmp( &peb64, &peb64_2, res ), "data is different\n" ); + NtClose( process ); + } } static void test_cpu_area(void)
1
0
0
0
Alexandre Julliard : wow64: Add thunks for the Wow64-specific virtual memory syscalls.
by Alexandre Julliard
27 Jul '21
27 Jul '21
Module: wine Branch: master Commit: 1d457b14a162c10ae7dca54059fa933ab73695b2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1d457b14a162c10ae7dca540…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Jul 27 12:15:07 2021 +0200 wow64: Add thunks for the Wow64-specific virtual memory syscalls. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wow64/syscall.c | 3 +++ dlls/wow64/syscall.h | 3 +++ dlls/wow64/virtual.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ dlls/wow64/wow64_private.h | 11 +++++++++++ 4 files changed, 63 insertions(+) diff --git a/dlls/wow64/syscall.c b/dlls/wow64/syscall.c index 6803efbd7e9..2f165879195 100644 --- a/dlls/wow64/syscall.c +++ b/dlls/wow64/syscall.c @@ -34,6 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wow); USHORT native_machine = 0; USHORT current_machine = 0; +ULONG_PTR args_alignment = 0; typedef NTSTATUS (WINAPI *syscall_thunk)( UINT *args ); @@ -271,6 +272,8 @@ static void init_syscall_table( HMODULE ntdll ) const USHORT *ordinals; ULONG id, exp_size, exp_pos, wrap_pos; + args_alignment = (current_machine == IMAGE_FILE_MACHINE_I386) ? sizeof(ULONG) : sizeof(ULONG64); + exports = RtlImageDirectoryEntryToData( ntdll, TRUE, IMAGE_DIRECTORY_ENTRY_EXPORT, &exp_size ); ordinals = get_rva( ntdll, exports->AddressOfNameOrdinals ); functions = get_rva( ntdll, exports->AddressOfFunctions ); diff --git a/dlls/wow64/syscall.h b/dlls/wow64/syscall.h index 2cdca8a3e8d..ab25bcb501d 100644 --- a/dlls/wow64/syscall.h +++ b/dlls/wow64/syscall.h @@ -139,6 +139,9 @@ SYSCALL_ENTRY( NtWaitForKeyedEvent ) \ SYSCALL_ENTRY( NtWaitForMultipleObjects ) \ SYSCALL_ENTRY( NtWaitForSingleObject ) \ + SYSCALL_ENTRY( NtWow64AllocateVirtualMemory64 ) \ + SYSCALL_ENTRY( NtWow64ReadVirtualMemory64 ) \ + SYSCALL_ENTRY( NtWow64WriteVirtualMemory64 ) \ SYSCALL_ENTRY( NtWriteVirtualMemory ) \ SYSCALL_ENTRY( NtYieldExecution ) diff --git a/dlls/wow64/virtual.c b/dlls/wow64/virtual.c index e1eaa053109..36bd91d9f8c 100644 --- a/dlls/wow64/virtual.c +++ b/dlls/wow64/virtual.c @@ -443,6 +443,52 @@ NTSTATUS WINAPI wow64_NtUnmapViewOfSection( UINT *args ) } +/********************************************************************** + * wow64_NtWow64AllocateVirtualMemory64 + */ +NTSTATUS WINAPI wow64_NtWow64AllocateVirtualMemory64( UINT *args ) +{ + HANDLE process = get_handle( &args ); + void **addr = get_ptr( &args ); + ULONG_PTR zero_bits = get_ulong64( &args ); + SIZE_T *size = get_ptr( &args ); + ULONG type = get_ulong( &args ); + ULONG protect = get_ulong( &args ); + + return NtAllocateVirtualMemory( process, addr, zero_bits, size, type, protect ); +} + + +/********************************************************************** + * wow64_NtWow64ReadVirtualMemory64 + */ +NTSTATUS WINAPI wow64_NtWow64ReadVirtualMemory64( UINT *args ) +{ + HANDLE process = get_handle( &args ); + void *addr = (void *)(ULONG_PTR)get_ulong64( &args ); + void *buffer = get_ptr( &args ); + SIZE_T size = get_ulong64( &args ); + SIZE_T *ret_size = get_ptr( &args ); + + return NtReadVirtualMemory( process, addr, buffer, size, ret_size ); +} + + +/********************************************************************** + * wow64_NtWow64WriteVirtualMemory64 + */ +NTSTATUS WINAPI wow64_NtWow64WriteVirtualMemory64( UINT *args ) +{ + HANDLE process = get_handle( &args ); + void *addr = (void *)(ULONG_PTR)get_ulong64( &args ); + const void *buffer = get_ptr( &args ); + SIZE_T size = get_ulong64( &args ); + SIZE_T *ret_size = get_ptr( &args ); + + return NtWriteVirtualMemory( process, addr, buffer, size, ret_size ); +} + + /********************************************************************** * wow64_NtWriteVirtualMemory */ diff --git a/dlls/wow64/wow64_private.h b/dlls/wow64/wow64_private.h index f4d195f06fb..6ba77720263 100644 --- a/dlls/wow64/wow64_private.h +++ b/dlls/wow64/wow64_private.h @@ -32,6 +32,7 @@ void WINAPI Wow64ApcRoutine( ULONG_PTR arg1, ULONG_PTR arg2, ULONG_PTR arg3, CON extern USHORT native_machine DECLSPEC_HIDDEN; extern USHORT current_machine DECLSPEC_HIDDEN; +extern ULONG_PTR args_alignment DECLSPEC_HIDDEN; struct object_attr64 { @@ -63,6 +64,16 @@ static inline ULONG get_ulong( UINT **args ) { return *(*args)++; } static inline HANDLE get_handle( UINT **args ) { return LongToHandle( *(*args)++ ); } static inline void *get_ptr( UINT **args ) { return ULongToPtr( *(*args)++ ); } +static inline ULONG64 get_ulong64( UINT **args ) +{ + ULONG64 ret; + + *args = (UINT *)(((ULONG_PTR)*args + args_alignment - 1) & ~(args_alignment - 1)); + ret = *(ULONG64 *)*args; + *args += 2; + return ret; +} + static inline ULONG_PTR get_zero_bits( ULONG_PTR zero_bits ) { return zero_bits ? zero_bits : 0x7fffffff;
1
0
0
0
Alexandre Julliard : wow64: Add a thunk for the NtQueryVirtualMemory syscall.
by Alexandre Julliard
27 Jul '21
27 Jul '21
Module: wine Branch: master Commit: ee2ee4d1ef1a6149a919fcad1f8ef324cbe18672 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ee2ee4d1ef1a6149a919fcad…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Jul 27 12:00:27 2021 +0200 wow64: Add a thunk for the NtQueryVirtualMemory syscall. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wow64/struct32.h | 36 ++++++++++++++++++++++ dlls/wow64/syscall.h | 1 + dlls/wow64/virtual.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+) diff --git a/dlls/wow64/struct32.h b/dlls/wow64/struct32.h index b96fdae80ca..069564948d0 100644 --- a/dlls/wow64/struct32.h +++ b/dlls/wow64/struct32.h @@ -69,6 +69,42 @@ typedef struct UNICODE_STRING32 ObjectTypeName; } DIRECTORY_BASIC_INFORMATION32; +typedef struct +{ + ULONG BaseAddress; + ULONG AllocationBase; + DWORD AllocationProtect; + ULONG RegionSize; + DWORD State; + DWORD Protect; + DWORD Type; +} MEMORY_BASIC_INFORMATION32; + +typedef struct +{ + UNICODE_STRING32 SectionFileName; +} MEMORY_SECTION_NAME32; + +typedef union +{ + ULONG Flags; + struct { + ULONG Valid : 1; + ULONG ShareCount : 3; + ULONG Win32Protection : 11; + ULONG Shared : 1; + ULONG Node : 6; + ULONG Locked : 1; + ULONG LargePage : 1; + }; +} MEMORY_WORKING_SET_EX_BLOCK32; + +typedef struct +{ + ULONG VirtualAddress; + MEMORY_WORKING_SET_EX_BLOCK32 VirtualAttributes; +} MEMORY_WORKING_SET_EX_INFORMATION32; + typedef struct { ULONG BaseAddress; diff --git a/dlls/wow64/syscall.h b/dlls/wow64/syscall.h index 95c2cf646e3..2cdca8a3e8d 100644 --- a/dlls/wow64/syscall.h +++ b/dlls/wow64/syscall.h @@ -105,6 +105,7 @@ SYSCALL_ENTRY( NtQueryTimer ) \ SYSCALL_ENTRY( NtQueryTimerResolution ) \ SYSCALL_ENTRY( NtQueryValueKey ) \ + SYSCALL_ENTRY( NtQueryVirtualMemory ) \ SYSCALL_ENTRY( NtReadVirtualMemory ) \ SYSCALL_ENTRY( NtReleaseKeyedEvent ) \ SYSCALL_ENTRY( NtReleaseMutant ) \ diff --git a/dlls/wow64/virtual.c b/dlls/wow64/virtual.c index fad79a2de60..e1eaa053109 100644 --- a/dlls/wow64/virtual.c +++ b/dlls/wow64/virtual.c @@ -291,6 +291,88 @@ NTSTATUS WINAPI wow64_NtProtectVirtualMemory( UINT *args ) } +/********************************************************************** + * wow64_NtQueryVirtualMemory + */ +NTSTATUS WINAPI wow64_NtQueryVirtualMemory( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + void *addr = get_ptr( &args ); + MEMORY_INFORMATION_CLASS class = get_ulong( &args ); + void *ptr = get_ptr( &args ); + ULONG len = get_ulong( &args ); + ULONG *retlen = get_ptr( &args ); + + SIZE_T res_len = 0; + NTSTATUS status; + + switch (class) + { + case MemoryBasicInformation: /* MEMORY_BASIC_INFORMATION */ + if (len >= sizeof(MEMORY_BASIC_INFORMATION32)) + { + MEMORY_BASIC_INFORMATION info; + MEMORY_BASIC_INFORMATION32 *info32 = ptr; + + if (!(status = NtQueryVirtualMemory( handle, addr, class, &info, sizeof(info), &res_len ))) + { + info32->BaseAddress = PtrToUlong( info.BaseAddress ); + info32->AllocationBase = PtrToUlong( info.AllocationBase ); + info32->AllocationProtect = info.AllocationProtect; + info32->RegionSize = info.RegionSize; + info32->State = info.State; + info32->Protect = info.Protect; + info32->Type = info.Type; + } + } + else status = STATUS_INFO_LENGTH_MISMATCH; + res_len = sizeof(MEMORY_BASIC_INFORMATION32); + break; + + case MemorySectionName: /* MEMORY_SECTION_NAME */ + { + MEMORY_SECTION_NAME *info; + MEMORY_SECTION_NAME32 *info32 = ptr; + SIZE_T size = len + sizeof(*info) - sizeof(*info32); + + info = RtlAllocateHeap( GetProcessHeap(), 0, size ); + if (!(status = NtQueryVirtualMemory( handle, addr, class, info, size, &res_len ))) + { + info32->SectionFileName.Length = info->SectionFileName.Length; + info32->SectionFileName.MaximumLength = info->SectionFileName.MaximumLength; + info32->SectionFileName.Buffer = PtrToUlong( info32 + 1 ); + memcpy( info32 + 1, info->SectionFileName.Buffer, info->SectionFileName.MaximumLength ); + } + res_len += sizeof(*info32) - sizeof(*info); + break; + } + + case MemoryWorkingSetExInformation: /* MEMORY_WORKING_SET_EX_INFORMATION */ + { + MEMORY_WORKING_SET_EX_INFORMATION32 *info32 = ptr; + MEMORY_WORKING_SET_EX_INFORMATION *info; + ULONG i, count = len / sizeof(*info32); + + info = RtlAllocateHeap( GetProcessHeap(), 0, count * sizeof(*info) ); + for (i = 0; i < count; i++) info[i].VirtualAddress = ULongToPtr( info32[i].VirtualAddress ); + if (!(status = NtQueryVirtualMemory( handle, addr, class, info, count * sizeof(*info), &res_len ))) + { + count = res_len / sizeof(*info); + for (i = 0; i < count; i++) info32[i].VirtualAttributes.Flags = info[i].VirtualAttributes.Flags; + res_len = count * sizeof(*info32); + } + break; + } + + default: + FIXME( "unsupported class %u\n", class ); + return STATUS_INVALID_INFO_CLASS; + } + if (!status || status == STATUS_INFO_LENGTH_MISMATCH) put_size( retlen, res_len ); + return status; +} + + /********************************************************************** * wow64_NtReadVirtualMemory */
1
0
0
0
Alexandre Julliard : wow64: Add thunks for the write watch syscalls.
by Alexandre Julliard
27 Jul '21
27 Jul '21
Module: wine Branch: master Commit: e57d5003088f7ea00516bcdaf92bb068a4b442ef URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e57d5003088f7ea00516bcda…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Jul 27 11:24:33 2021 +0200 wow64: Add thunks for the write watch syscalls. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wow64/syscall.h | 2 ++ dlls/wow64/virtual.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/dlls/wow64/syscall.h b/dlls/wow64/syscall.h index 516e0d833c4..95c2cf646e3 100644 --- a/dlls/wow64/syscall.h +++ b/dlls/wow64/syscall.h @@ -64,6 +64,7 @@ SYSCALL_ENTRY( NtFreeVirtualMemory ) \ SYSCALL_ENTRY( NtGetCurrentProcessorNumber ) \ SYSCALL_ENTRY( NtGetNlsSectionPtr ) \ + SYSCALL_ENTRY( NtGetWriteWatch ) \ SYSCALL_ENTRY( NtListenPort ) \ SYSCALL_ENTRY( NtLoadKey ) \ SYSCALL_ENTRY( NtLoadKey2 ) \ @@ -113,6 +114,7 @@ SYSCALL_ENTRY( NtReplyWaitReceivePort ) \ SYSCALL_ENTRY( NtRequestWaitReplyPort ) \ SYSCALL_ENTRY( NtResetEvent ) \ + SYSCALL_ENTRY( NtResetWriteWatch ) \ SYSCALL_ENTRY( NtRestoreKey ) \ SYSCALL_ENTRY( NtSaveKey ) \ SYSCALL_ENTRY( NtSecureConnectPort ) \ diff --git a/dlls/wow64/virtual.c b/dlls/wow64/virtual.c index 27b46ee74e8..fad79a2de60 100644 --- a/dlls/wow64/virtual.c +++ b/dlls/wow64/virtual.c @@ -177,6 +177,38 @@ NTSTATUS WINAPI wow64_NtGetNlsSectionPtr( UINT *args ) } +/********************************************************************** + * wow64_NtGetWriteWatch + */ +NTSTATUS WINAPI wow64_NtGetWriteWatch( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + ULONG flags = get_ulong( &args ); + void *base = get_ptr( &args ); + SIZE_T size = get_ulong( &args ); + ULONG *addr_ptr = get_ptr( &args ); + ULONG *count_ptr = get_ptr( &args ); + ULONG *granularity = get_ptr( &args ); + + ULONG_PTR i, count = *count_ptr; + void **addresses; + NTSTATUS status; + + if (!count || !size) return STATUS_INVALID_PARAMETER; + if (flags & ~WRITE_WATCH_FLAG_RESET) return STATUS_INVALID_PARAMETER; + if (!addr_ptr) return STATUS_ACCESS_VIOLATION; + + addresses = RtlAllocateHeap( GetProcessHeap(), 0, count * sizeof(*addresses) ); + if (!(status = NtGetWriteWatch( handle, flags, base, size, addresses, &count, granularity ))) + { + for (i = 0; i < count; i++) addr_ptr[i] = PtrToUlong( addresses[i] ); + *count_ptr = count; + } + RtlFreeHeap( GetProcessHeap(), 0, addresses ); + return status; +} + + /********************************************************************** * wow64_NtLockVirtualMemory */ @@ -279,6 +311,19 @@ NTSTATUS WINAPI wow64_NtReadVirtualMemory( UINT *args ) } +/********************************************************************** + * wow64_NtResetWriteWatch + */ +NTSTATUS WINAPI wow64_NtResetWriteWatch( UINT *args ) +{ + HANDLE process = get_handle( &args ); + void *base = get_ptr( &args ); + SIZE_T size = get_ulong( &args ); + + return NtResetWriteWatch( process, base, size ); +} + + /********************************************************************** * wow64_NtUnlockVirtualMemory */
1
0
0
0
Alexandre Julliard : wow64: Add thunks for the memory mapping syscalls.
by Alexandre Julliard
27 Jul '21
27 Jul '21
Module: wine Branch: master Commit: 458b859ddf00c91821b7382995a2728775cbc89c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=458b859ddf00c91821b73829…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Jul 27 11:21:23 2021 +0200 wow64: Add thunks for the memory mapping syscalls. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wow64/syscall.h | 4 +++ dlls/wow64/virtual.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/dlls/wow64/syscall.h b/dlls/wow64/syscall.h index 23d36ff3992..516e0d833c4 100644 --- a/dlls/wow64/syscall.h +++ b/dlls/wow64/syscall.h @@ -28,6 +28,7 @@ SYSCALL_ENTRY( NtAllocateUuids ) \ SYSCALL_ENTRY( NtAllocateVirtualMemory ) \ SYSCALL_ENTRY( NtAllocateVirtualMemoryEx ) \ + SYSCALL_ENTRY( NtAreMappedFilesTheSame ) \ SYSCALL_ENTRY( NtCancelTimer ) \ SYSCALL_ENTRY( NtClearEvent ) \ SYSCALL_ENTRY( NtClearPowerRequest ) \ @@ -62,11 +63,13 @@ SYSCALL_ENTRY( NtFlushVirtualMemory ) \ SYSCALL_ENTRY( NtFreeVirtualMemory ) \ SYSCALL_ENTRY( NtGetCurrentProcessorNumber ) \ + SYSCALL_ENTRY( NtGetNlsSectionPtr ) \ SYSCALL_ENTRY( NtListenPort ) \ SYSCALL_ENTRY( NtLoadKey ) \ SYSCALL_ENTRY( NtLoadKey2 ) \ SYSCALL_ENTRY( NtLockVirtualMemory ) \ SYSCALL_ENTRY( NtMakeTemporaryObject ) \ + SYSCALL_ENTRY( NtMapViewOfSection ) \ SYSCALL_ENTRY( NtOpenDirectoryObject ) \ SYSCALL_ENTRY( NtOpenEvent ) \ SYSCALL_ENTRY( NtOpenIoCompletion ) \ @@ -128,6 +131,7 @@ SYSCALL_ENTRY( NtTerminateJobObject ) \ SYSCALL_ENTRY( NtUnloadKey ) \ SYSCALL_ENTRY( NtUnlockVirtualMemory ) \ + SYSCALL_ENTRY( NtUnmapViewOfSection ) \ SYSCALL_ENTRY( NtWaitForDebugEvent ) \ SYSCALL_ENTRY( NtWaitForKeyedEvent ) \ SYSCALL_ENTRY( NtWaitForMultipleObjects ) \ diff --git a/dlls/wow64/virtual.c b/dlls/wow64/virtual.c index aa680a5fd26..27b46ee74e8 100644 --- a/dlls/wow64/virtual.c +++ b/dlls/wow64/virtual.c @@ -89,6 +89,18 @@ NTSTATUS WINAPI wow64_NtAllocateVirtualMemoryEx( UINT *args ) } +/********************************************************************** + * wow64_NtAreMappedFilesTheSame + */ +NTSTATUS WINAPI wow64_NtAreMappedFilesTheSame( UINT *args ) +{ + void *ptr1 = get_ptr( &args ); + void *ptr2 = get_ptr( &args ); + + return NtAreMappedFilesTheSame( ptr1, ptr2 ); +} + + /********************************************************************** * wow64_NtFlushVirtualMemory */ @@ -139,6 +151,32 @@ NTSTATUS WINAPI wow64_NtFreeVirtualMemory( UINT *args ) } +/********************************************************************** + * wow64_NtGetNlsSectionPtr + */ +NTSTATUS WINAPI wow64_NtGetNlsSectionPtr( UINT *args ) +{ + ULONG type = get_ulong( &args ); + ULONG id = get_ulong( &args ); + void *unknown = get_ptr( &args ); + ULONG *addr32 = get_ptr( &args ); + ULONG *size32 = get_ptr( &args ); + + void *addr; + SIZE_T size; + NTSTATUS status; + + status = NtGetNlsSectionPtr( type, id, unknown, addr_32to64( &addr, addr32 ), + size_32to64( &size, size32 )); + if (!status) + { + put_addr( addr32, addr ); + put_size( size32, size ); + } + return status; +} + + /********************************************************************** * wow64_NtLockVirtualMemory */ @@ -164,6 +202,37 @@ NTSTATUS WINAPI wow64_NtLockVirtualMemory( UINT *args ) } +/********************************************************************** + * wow64_NtMapViewOfSection + */ +NTSTATUS WINAPI wow64_NtMapViewOfSection( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + HANDLE process = get_handle( &args ); + ULONG *addr32 = get_ptr( &args ); + ULONG_PTR zero_bits = get_ulong( &args ); + SIZE_T commit = get_ulong( &args ); + const LARGE_INTEGER *offset = get_ptr( &args ); + ULONG *size32 = get_ptr( &args ); + SECTION_INHERIT inherit = get_ulong( &args ); + ULONG alloc = get_ulong( &args ); + ULONG protect = get_ulong( &args ); + + void *addr; + SIZE_T size; + NTSTATUS status; + + status = NtMapViewOfSection( handle, process, addr_32to64( &addr, addr32 ), get_zero_bits( zero_bits ), + commit, offset, size_32to64( &size, size32 ), inherit, alloc, protect ); + if (NT_SUCCESS(status)) + { + put_addr( addr32, addr ); + put_size( size32, size ); + } + return status; +} + + /********************************************************************** * wow64_NtProtectVirtualMemory */ @@ -235,6 +304,18 @@ NTSTATUS WINAPI wow64_NtUnlockVirtualMemory( UINT *args ) } +/********************************************************************** + * wow64_NtUnmapViewOfSection + */ +NTSTATUS WINAPI wow64_NtUnmapViewOfSection( UINT *args ) +{ + HANDLE process = get_handle( &args ); + void *addr = get_ptr( &args ); + + return NtUnmapViewOfSection( process, addr ); +} + + /********************************************************************** * wow64_NtWriteVirtualMemory */
1
0
0
0
Alexandre Julliard : wow64: Add thunks for the virtual memory syscalls.
by Alexandre Julliard
27 Jul '21
27 Jul '21
Module: wine Branch: master Commit: dffe2bf8e225ec3f92c210ba6d4777cd675ea146 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=dffe2bf8e225ec3f92c210ba…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Jul 27 11:15:25 2021 +0200 wow64: Add thunks for the virtual memory syscalls. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wow64/Makefile.in | 3 +- dlls/wow64/syscall.h | 9 ++ dlls/wow64/virtual.c | 255 +++++++++++++++++++++++++++++++++++++++++++++ dlls/wow64/wow64_private.h | 24 +++++ 4 files changed, 290 insertions(+), 1 deletion(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=dffe2bf8e225ec3f92c2…
1
0
0
0
Zebediah Figura : ws2_32: Move the setsockopt(IP_UNICAST_IF) implementation to ntdll.
by Alexandre Julliard
27 Jul '21
27 Jul '21
Module: wine Branch: master Commit: a06bcd03b98dfd82bdc4a72508c8ef6b29634468 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a06bcd03b98dfd82bdc4a725…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Jul 27 00:13:35 2021 -0500 ws2_32: Move the setsockopt(IP_UNICAST_IF) implementation to ntdll. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/socket.c | 3 +++ dlls/ws2_32/socket.c | 5 +---- include/wine/afd.h | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c index 0269c2b78ae..f33fc014f3b 100644 --- a/dlls/ntdll/unix/socket.c +++ b/dlls/ntdll/unix/socket.c @@ -1797,6 +1797,9 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc #ifdef IP_UNICAST_IF case IOCTL_AFD_WINE_GET_IP_UNICAST_IF: return do_getsockopt( handle, io, IPPROTO_IP, IP_UNICAST_IF, out_buffer, out_size ); + + case IOCTL_AFD_WINE_SET_IP_UNICAST_IF: + return do_setsockopt( handle, io, IPPROTO_IP, IP_UNICAST_IF, in_buffer, in_size ); #endif default: diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index f94558520af..d5de709e991 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -3705,11 +3705,8 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname, case WS_IP_UNBLOCK_SOURCE: return server_setsockopt( s, IOCTL_AFD_WINE_SET_IP_UNBLOCK_SOURCE, optval, optlen ); -#ifdef IP_UNICAST_IF case WS_IP_UNICAST_IF: -#endif - convert_sockopt(&level, &optname); - break; + return server_setsockopt( s, IOCTL_AFD_WINE_SET_IP_UNICAST_IF, optval, optlen ); default: FIXME("Unknown IPPROTO_IP optname 0x%08x\n", optname); diff --git a/include/wine/afd.h b/include/wine/afd.h index 18e53706fee..c150e2ce474 100644 --- a/include/wine/afd.h +++ b/include/wine/afd.h @@ -206,6 +206,7 @@ struct afd_get_events_params #define IOCTL_AFD_WINE_SET_IP_TTL WINE_AFD_IOC(261) #define IOCTL_AFD_WINE_SET_IP_UNBLOCK_SOURCE WINE_AFD_IOC(262) #define IOCTL_AFD_WINE_GET_IP_UNICAST_IF WINE_AFD_IOC(263) +#define IOCTL_AFD_WINE_SET_IP_UNICAST_IF WINE_AFD_IOC(264) struct afd_create_params {
1
0
0
0
Zebediah Figura : ws2_32: Move the getsockopt(IP_UNICAST_IF) implementation to ntdll.
by Alexandre Julliard
27 Jul '21
27 Jul '21
Module: wine Branch: master Commit: 5819c52f3ae6e06d082daa518770f9edcb66571c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5819c52f3ae6e06d082daa51…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Jul 27 00:13:34 2021 -0500 ws2_32: Move the getsockopt(IP_UNICAST_IF) implementation to ntdll. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/socket.c | 9 +++++++++ dlls/ws2_32/socket.c | 13 +------------ include/wine/afd.h | 1 + 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c index ffa6a20b0a1..0269c2b78ae 100644 --- a/dlls/ntdll/unix/socket.c +++ b/dlls/ntdll/unix/socket.c @@ -88,6 +88,10 @@ #define TCP_KEEPIDLE TCP_KEEPALIVE #endif +#if defined(linux) && !defined(IP_UNICAST_IF) +#define IP_UNICAST_IF 50 +#endif + WINE_DEFAULT_DEBUG_CHANNEL(winsock); #define FILE_USE_FILE_POINTER_POSITION ((LONGLONG)-2) @@ -1790,6 +1794,11 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc case IOCTL_AFD_WINE_SET_IP_UNBLOCK_SOURCE: return do_setsockopt( handle, io, IPPROTO_IP, IP_UNBLOCK_SOURCE, in_buffer, in_size ); +#ifdef IP_UNICAST_IF + case IOCTL_AFD_WINE_GET_IP_UNICAST_IF: + return do_getsockopt( handle, io, IPPROTO_IP, IP_UNICAST_IF, out_buffer, out_size ); +#endif + default: { if ((code >> 16) == FILE_DEVICE_NETWORK) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 6582f8e0f95..f94558520af 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -2495,19 +2495,8 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level, case WS_IP_TTL: return server_getsockopt( s, IOCTL_AFD_WINE_GET_IP_TTL, optval, optlen ); -#ifdef IP_UNICAST_IF case WS_IP_UNICAST_IF: -#endif - if ( (fd = get_sock_fd( s, 0, NULL )) == -1) - return SOCKET_ERROR; - convert_sockopt(&level, &optname); - if (getsockopt(fd, level, optname, optval, (socklen_t *)optlen) != 0 ) - { - SetLastError(wsaErrno()); - ret = SOCKET_ERROR; - } - release_sock_fd( s, fd ); - return ret; + return server_getsockopt( s, IOCTL_AFD_WINE_GET_IP_UNICAST_IF, optval, optlen ); default: FIXME( "unrecognized IP option %u\n", optname ); diff --git a/include/wine/afd.h b/include/wine/afd.h index a117bd5d3c5..18e53706fee 100644 --- a/include/wine/afd.h +++ b/include/wine/afd.h @@ -205,6 +205,7 @@ struct afd_get_events_params #define IOCTL_AFD_WINE_GET_IP_TTL WINE_AFD_IOC(260) #define IOCTL_AFD_WINE_SET_IP_TTL WINE_AFD_IOC(261) #define IOCTL_AFD_WINE_SET_IP_UNBLOCK_SOURCE WINE_AFD_IOC(262) +#define IOCTL_AFD_WINE_GET_IP_UNICAST_IF WINE_AFD_IOC(263) struct afd_create_params {
1
0
0
0
Zebediah Figura : ws2_32: Move the setsockopt(IP_UNBLOCK_SOURCE) implementation to ntdll.
by Alexandre Julliard
27 Jul '21
27 Jul '21
Module: wine Branch: master Commit: 9715bd258c851ba464af42dd38804d3606342a1b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9715bd258c851ba464af42dd…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Jul 27 00:13:33 2021 -0500 ws2_32: Move the setsockopt(IP_UNBLOCK_SOURCE) implementation to ntdll. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/socket.c | 3 +++ dlls/ws2_32/socket.c | 13 +------------ include/wine/afd.h | 1 + 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c index 9b7e0d47040..ffa6a20b0a1 100644 --- a/dlls/ntdll/unix/socket.c +++ b/dlls/ntdll/unix/socket.c @@ -1787,6 +1787,9 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc case IOCTL_AFD_WINE_SET_IP_TTL: return do_setsockopt( handle, io, IPPROTO_IP, IP_TTL, in_buffer, in_size ); + case IOCTL_AFD_WINE_SET_IP_UNBLOCK_SOURCE: + return do_setsockopt( handle, io, IPPROTO_IP, IP_UNBLOCK_SOURCE, in_buffer, in_size ); + default: { if ((code >> 16) == FILE_DEVICE_NETWORK) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index c86ddee7932..6582f8e0f95 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -3504,7 +3504,6 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname, { int fd; int woptval; - struct ip_mreq_source mreq_source; TRACE("(socket %04lx, %s, optval %s, optlen %d)\n", s, debugstr_sockopt(level, optname), debugstr_optval(optval, optlen), @@ -3715,18 +3714,8 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname, return server_setsockopt( s, IOCTL_AFD_WINE_SET_IP_TTL, optval, optlen ); case WS_IP_UNBLOCK_SOURCE: - { - WS_IP_MREQ_SOURCE* val = (void*)optval; - mreq_source.imr_interface.s_addr = val->imr_interface.S_un.S_addr; - mreq_source.imr_multiaddr.s_addr = val->imr_multiaddr.S_un.S_addr; - mreq_source.imr_sourceaddr.s_addr = val->imr_sourceaddr.S_un.S_addr; - - optval = (char*)&mreq_source; - optlen = sizeof(mreq_source); + return server_setsockopt( s, IOCTL_AFD_WINE_SET_IP_UNBLOCK_SOURCE, optval, optlen ); - convert_sockopt(&level, &optname); - break; - } #ifdef IP_UNICAST_IF case WS_IP_UNICAST_IF: #endif diff --git a/include/wine/afd.h b/include/wine/afd.h index f0b1e8d6e5f..a117bd5d3c5 100644 --- a/include/wine/afd.h +++ b/include/wine/afd.h @@ -204,6 +204,7 @@ struct afd_get_events_params #define IOCTL_AFD_WINE_SET_IP_TOS WINE_AFD_IOC(259) #define IOCTL_AFD_WINE_GET_IP_TTL WINE_AFD_IOC(260) #define IOCTL_AFD_WINE_SET_IP_TTL WINE_AFD_IOC(261) +#define IOCTL_AFD_WINE_SET_IP_UNBLOCK_SOURCE WINE_AFD_IOC(262) struct afd_create_params {
1
0
0
0
← Newer
1
...
10
11
12
13
14
15
16
...
73
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
Results per page:
10
25
50
100
200