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: Also load the Wow64 ntdll for the main exe target machine.
by Alexandre Julliard
07 Jul '21
07 Jul '21
Module: wine Branch: master Commit: 390d71b09186c77755e93c31fe24ac10f4ac0dde URL:
https://source.winehq.org/git/wine.git/?a=commit;h=390d71b09186c77755e93c31…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Jul 7 11:39:41 2021 +0200 ntdll: Also load the Wow64 ntdll for the main exe target machine. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/loader.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 4d286099a2c..2fa3a720d5a 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1758,6 +1758,39 @@ static void load_ntdll(void) } +/*********************************************************************** + * load_wow64_ntdll + */ +static void load_wow64_ntdll( USHORT machine ) +{ + static const WCHAR ntdllW[] = {'n','t','d','l','l','.','d','l','l',0}; + SECTION_IMAGE_INFORMATION info; + UNICODE_STRING nt_name; + void *module; + NTSTATUS status; + SIZE_T size; + WCHAR *path = malloc( sizeof("\\??\\C:\\windows\\system32\\ntdll.dll") * sizeof(WCHAR) ); + + wcscpy( path, get_machine_wow64_dir( machine )); + wcscat( path, ntdllW ); + init_unicode_string( &nt_name, path ); + status = find_builtin_dll( &nt_name, &module, &size, &info, machine, FALSE ); + switch (status) + { + case STATUS_IMAGE_NOT_AT_BASE: + relocate_ntdll( module ); + /* fall through */ + case STATUS_SUCCESS: + TRACE("loaded %s at %p\n", debugstr_w(path), module ); + break; + default: + ERR( "failed to load %s error %x\n", debugstr_w(path), status ); + break; + } + free( path ); +} + + /*********************************************************************** * get_image_address */ @@ -1868,6 +1901,7 @@ static void start_main_thread(void) init_thread_stack( teb, is_win64 ? 0x7fffffff : 0, 0, 0 ); NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 ); load_ntdll(); + if (main_image_info.Machine != current_machine) load_wow64_ntdll( main_image_info.Machine ); status = p__wine_set_unix_funcs( NTDLL_UNIXLIB_VERSION, &unix_funcs ); if (status == STATUS_REVISION_MISMATCH) {
1
0
0
0
Alexandre Julliard : ntdll: Make the ntdll exports and relocations processing more generic.
by Alexandre Julliard
07 Jul '21
07 Jul '21
Module: wine Branch: master Commit: 3190a5bcdd7fc043cf54ac070a5f602cb9dd140f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3190a5bcdd7fc043cf54ac07…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Jul 7 11:39:24 2021 +0200 ntdll: Make the ntdll exports and relocations processing more generic. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/loader.c | 67 ++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 39 deletions(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index b9f1fee6a9d..4d286099a2c 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -710,20 +710,6 @@ static NTSTATUS map_so_dll( const IMAGE_NT_HEADERS *nt_descr, HMODULE module ) return STATUS_SUCCESS; } -static const IMAGE_EXPORT_DIRECTORY *get_export_dir( HMODULE module ) -{ - const IMAGE_DOS_HEADER *dos = (const IMAGE_DOS_HEADER *)module; - const IMAGE_NT_HEADERS *nt; - DWORD addr; - - if (dos->e_magic != IMAGE_DOS_SIGNATURE) return NULL; - nt = (IMAGE_NT_HEADERS *)((const BYTE *)dos + dos->e_lfanew); - if (nt->Signature != IMAGE_NT_SIGNATURE) return NULL; - addr = nt->OptionalHeader.DataDirectory[IMAGE_FILE_EXPORT_DIRECTORY].VirtualAddress; - if (!addr) return NULL; - return (IMAGE_EXPORT_DIRECTORY *)((BYTE *)module + addr); -} - static ULONG_PTR find_ordinal_export( HMODULE module, const IMAGE_EXPORT_DIRECTORY *exports, DWORD ordinal ) { const DWORD *functions = (const DWORD *)((BYTE *)module + exports->AddressOfFunctions); @@ -771,19 +757,29 @@ static inline void *get_rva( void *module, ULONG_PTR addr ) return (BYTE *)module + addr; } +static const void *get_module_data_dir( HMODULE module, ULONG dir, ULONG *size ) +{ + const IMAGE_NT_HEADERS *nt = get_rva( module, ((IMAGE_DOS_HEADER *)module)->e_lfanew ); + const IMAGE_DATA_DIRECTORY *data; + + if (nt->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC) + data = &((const IMAGE_NT_HEADERS64 *)nt)->OptionalHeader.DataDirectory[dir]; + else if (nt->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC) + data = &((const IMAGE_NT_HEADERS32 *)nt)->OptionalHeader.DataDirectory[dir]; + else + return NULL; + if (!data->VirtualAddress || !data->Size) return NULL; + if (size) *size = data->Size; + return get_rva( module, data->VirtualAddress ); +} + static NTSTATUS fixup_ntdll_imports( const char *name, HMODULE module ) { - const IMAGE_NT_HEADERS *nt; const IMAGE_IMPORT_DESCRIPTOR *descr; - const IMAGE_DATA_DIRECTORY *dir; const IMAGE_THUNK_DATA *import_list; IMAGE_THUNK_DATA *thunk_list; - nt = get_rva( module, ((IMAGE_DOS_HEADER *)module)->e_lfanew ); - dir = &nt->OptionalHeader.DataDirectory[IMAGE_FILE_IMPORT_DIRECTORY]; - if (!dir->VirtualAddress || !dir->Size) return STATUS_SUCCESS; - - descr = get_rva( module, dir->VirtualAddress ); + if (!(descr = get_module_data_dir( module, IMAGE_FILE_IMPORT_DIRECTORY, NULL ))) return STATUS_SUCCESS; for (; descr->Name && descr->FirstThunk; descr++) { thunk_list = get_rva( module, descr->FirstThunk ); @@ -824,7 +820,7 @@ static void load_ntdll_functions( HMODULE module ) { void **ptr; - ntdll_exports = get_export_dir( module ); + ntdll_exports = get_module_data_dir( module, IMAGE_FILE_EXPORT_DIRECTORY, NULL ); assert( ntdll_exports ); #define GET_FUNC(name) \ @@ -852,8 +848,8 @@ static void load_ntdll_functions( HMODULE module ) } /* reimplementation of LdrProcessRelocationBlock */ -static IMAGE_BASE_RELOCATION *process_relocation_block( void *module, IMAGE_BASE_RELOCATION *rel, - INT_PTR delta ) +static const IMAGE_BASE_RELOCATION *process_relocation_block( void *module, const IMAGE_BASE_RELOCATION *rel, + INT_PTR delta ) { char *page = get_rva( module, rel->VirtualAddress ); UINT count = (rel->SizeOfBlock - sizeof(*rel)) / sizeof(USHORT); @@ -875,11 +871,9 @@ static IMAGE_BASE_RELOCATION *process_relocation_block( void *module, IMAGE_BASE case IMAGE_REL_BASED_HIGHLOW: *(int *)(page + offset) += delta; break; -#ifdef _WIN64 case IMAGE_REL_BASED_DIR64: - *(INT_PTR *)(page + offset) += delta; + *(INT64 *)(page + offset) += delta; break; -#elif defined(__arm__) case IMAGE_REL_BASED_THUMB_MOV32: { DWORD *inst = (DWORD *)(page + offset); @@ -897,7 +891,6 @@ static IMAGE_BASE_RELOCATION *process_relocation_block( void *module, IMAGE_BASE ((hi << 20) & 0x70000000) + ((hi << 16) & 0xff0000); break; } -#endif default: FIXME("Unknown/unsupported relocation %x\n", *relocs); return NULL; @@ -909,18 +902,15 @@ static IMAGE_BASE_RELOCATION *process_relocation_block( void *module, IMAGE_BASE static void relocate_ntdll( void *module ) { - IMAGE_DOS_HEADER *dos = module; - IMAGE_NT_HEADERS *nt = (IMAGE_NT_HEADERS *)((char *)dos + dos->e_lfanew); - IMAGE_DATA_DIRECTORY *relocs = &nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC]; - IMAGE_BASE_RELOCATION *rel, *end; - IMAGE_SECTION_HEADER *sec; - ULONG protect_old[96], i; + const IMAGE_NT_HEADERS *nt = get_rva( module, ((IMAGE_DOS_HEADER *)module)->e_lfanew ); + const IMAGE_BASE_RELOCATION *rel, *end; + const IMAGE_SECTION_HEADER *sec; + ULONG protect_old[96], i, size; INT_PTR delta; - ERR( "ntdll could not be mapped at preferred address (%p/%p), expect trouble\n", - module, (void *)nt->OptionalHeader.ImageBase ); + ERR( "ntdll could not be mapped at preferred address (%p), expect trouble\n", module ); - if (!relocs->Size || !relocs->VirtualAddress) return; + if (!(rel = get_module_data_dir( module, IMAGE_DIRECTORY_ENTRY_BASERELOC, &size ))) return; sec = (IMAGE_SECTION_HEADER *)((char *)&nt->OptionalHeader + nt->FileHeader.SizeOfOptionalHeader); for (i = 0; i < nt->FileHeader.NumberOfSections; i++) @@ -930,8 +920,7 @@ static void relocate_ntdll( void *module ) NtProtectVirtualMemory( NtCurrentProcess(), &addr, &size, PAGE_READWRITE, &protect_old[i] ); } - rel = get_rva( module, relocs->VirtualAddress ); - end = get_rva( module, relocs->VirtualAddress + relocs->Size ); + end = (IMAGE_BASE_RELOCATION *)((const char *)rel + size); delta = (char *)module - (char *)nt->OptionalHeader.ImageBase; while (rel && rel < end - 1 && rel->SizeOfBlock) rel = process_relocation_block( module, rel, delta );
1
0
0
0
Tim Clem : wininet: Treat dwUrlLength as a maximum in InternetCrackUrlW.
by Alexandre Julliard
07 Jul '21
07 Jul '21
Module: wine Branch: master Commit: d473c09cc17f9daa77b04fb11f96222438f6581d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d473c09cc17f9daa77b04fb1…
Author: Tim Clem <tclem(a)codeweavers.com> Date: Tue Jul 6 12:40:42 2021 -0700 wininet: Treat dwUrlLength as a maximum in InternetCrackUrlW. Signed-off-by: Tim Clem <tclem(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/internet.c | 8 +++++++- dlls/wininet/tests/url.c | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index feb25bbc0c5..00e199b66d5 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -1646,7 +1646,13 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - if (!dwUrlLength) dwUrlLength = lstrlenW(lpszUrl); + + if (!dwUrlLength) + dwUrlLength = lstrlenW(lpszUrl); + else { + /* Windows stops at a null, regardless of what dwUrlLength says. */ + dwUrlLength = wcsnlen(lpszUrl, dwUrlLength); + } if (dwFlags & ICU_DECODE) { diff --git a/dlls/wininet/tests/url.c b/dlls/wininet/tests/url.c index 9476d4309c3..59b66a5404c 100644 --- a/dlls/wininet/tests/url.c +++ b/dlls/wininet/tests/url.c @@ -855,7 +855,6 @@ static void InternetCrackUrlW_test(void) comp.dwHostNameLength = ARRAY_SIZE(host); r = InternetCrackUrlW(url3, 13 /* includes the nul */, 0, &comp); ok(r, "InternetCrackUrlW failed with error %d\n", GetLastError()); - todo_wine ok(comp.dwHostNameLength == 5, "Expected dwHostNameLength of 5, got %d\n", comp.dwHostNameLength); @@ -877,7 +876,6 @@ static void InternetCrackUrlW_test(void) comp.dwUrlPathLength = ARRAY_SIZE(urlpart); r = InternetCrackUrlW(url5, 15, 0, &comp); ok(r, "InternetCrackUrlW failed with error %d\n", GetLastError()); - todo_wine ok(comp.dwUrlPathLength == 0, "Expected dwUrlPathLength of 0, got %d\n", comp.dwUrlPathLength); }
1
0
0
0
Tim Clem : wininet: Make heap_strndupAtoW stop at the first null.
by Alexandre Julliard
07 Jul '21
07 Jul '21
Module: wine Branch: master Commit: 681ce692a006c1ae918d0ab1be3574470e75cbb8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=681ce692a006c1ae918d0ab1…
Author: Tim Clem <tclem(a)codeweavers.com> Date: Fri Jul 2 16:12:04 2021 -0700 wininet: Make heap_strndupAtoW stop at the first null. The analogous heap_strndupW already does this. Fixes InternetCrackUrlA behavior when passed a dwUrlLength that's past the end of the string. Signed-off-by: Tim Clem <tclem(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/internet.h | 5 ++++- dlls/wininet/tests/url.c | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h index 0efea473255..e9d68e2c2d9 100644 --- a/dlls/wininet/internet.h +++ b/dlls/wininet/internet.h @@ -152,7 +152,10 @@ static inline WCHAR *heap_strndupAtoW(const char *str, int len_a, DWORD *len_w) if(str) { size_t len; - if(len_a < 0) len_a = strlen(str); + if(len_a < 0) + len_a = strlen(str); + else if(len_a > 0) + len_a = strnlen(str, len_a); len = MultiByteToWideChar(CP_ACP, 0, str, len_a, NULL, 0); ret = heap_alloc((len+1)*sizeof(WCHAR)); if(ret) { diff --git a/dlls/wininet/tests/url.c b/dlls/wininet/tests/url.c index 6927ca5e6e8..9476d4309c3 100644 --- a/dlls/wininet/tests/url.c +++ b/dlls/wininet/tests/url.c @@ -659,7 +659,6 @@ static void InternetCrackUrl_test(void) copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 1024, 1024); ret = InternetCrackUrlA("
http://x.org
", 13 /* includes the nul */, 0, &urlComponents); ok(ret, "InternetCrackUrlA failed with error %d\n", GetLastError()); - todo_wine ok(urlComponents.dwHostNameLength == 5, "Expected dwHostNameLength of 5, got %d\n", urlComponents.dwHostNameLength); @@ -670,7 +669,6 @@ static void InternetCrackUrl_test(void) copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 1024, 1024); ret = InternetCrackUrlA("
http://x.org\0/x
", 15, 0, &urlComponents); ok(ret, "InternetCrackUrlA failed with error %d\n", GetLastError()); - todo_wine ok(urlComponents.dwUrlPathLength == 0, "Expected dwUrlPathLength of 0, got %d\n", urlComponents.dwUrlPathLength); }
1
0
0
0
Tim Clem : wininet/tests: Test InternetCrackUrl when given a bogus length.
by Alexandre Julliard
07 Jul '21
07 Jul '21
Module: wine Branch: master Commit: d4a417f88566ff26fb18f46f29fe7d62510f551d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d4a417f88566ff26fb18f46f…
Author: Tim Clem <tclem(a)codeweavers.com> Date: Fri Jul 2 16:12:03 2021 -0700 wininet/tests: Test InternetCrackUrl when given a bogus length. Windows will stop processing at the first null, even when given an explicit length. Signed-off-by: Tim Clem <tclem(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/tests/url.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/dlls/wininet/tests/url.c b/dlls/wininet/tests/url.c index bce7dc76c59..6927ca5e6e8 100644 --- a/dlls/wininet/tests/url.c +++ b/dlls/wininet/tests/url.c @@ -653,6 +653,26 @@ static void InternetCrackUrl_test(void) GLE = GetLastError(); ok(ret == FALSE, "Expected InternetCrackUrl to fail\n"); ok(GLE == ERROR_INTERNET_UNRECOGNIZED_SCHEME, "Expected GLE to represent a failure\n"); + + /* Windows treats dwUrlLength as a maximum - if there is a null before + * that length, it stops there. */ + copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 1024, 1024); + ret = InternetCrackUrlA("
http://x.org
", 13 /* includes the nul */, 0, &urlComponents); + ok(ret, "InternetCrackUrlA failed with error %d\n", GetLastError()); + todo_wine + ok(urlComponents.dwHostNameLength == 5, + "Expected dwHostNameLength of 5, got %d\n", urlComponents.dwHostNameLength); + + copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 1024, 1024); + ret = InternetCrackUrlA("http://\0x.org", 13, 0, &urlComponents); + todo_wine ok(ret == FALSE, "Expected InternetCrackUrlA to fail\n"); + + copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 1024, 1024); + ret = InternetCrackUrlA("
http://x.org\0/x
", 15, 0, &urlComponents); + ok(ret, "InternetCrackUrlA failed with error %d\n", GetLastError()); + todo_wine + ok(urlComponents.dwUrlPathLength == 0, + "Expected dwUrlPathLength of 0, got %d\n", urlComponents.dwUrlPathLength); } static void InternetCrackUrlW_test(void) @@ -664,6 +684,8 @@ static void InternetCrackUrlW_test(void) 'U','L','T', 0 }; static const WCHAR url2[] = { '.','.','/','R','i','t','z','.','x','m','l',0 }; static const WCHAR url3[] = { 'h','t','t','p',':','/','/','x','.','o','r','g',0 }; + static const WCHAR url4[] = { 'h','t','t','p',':','/','/',0,'x','.','o','r','g',0 }; + static const WCHAR url5[] = { 'h','t','t','p',':','/','/','x','.','o','r','g',0,'/','x',0 }; URL_COMPONENTSW comp; WCHAR scheme[20], host[20], user[20], pwd[20], urlpart[50], extra[50]; DWORD error; @@ -825,6 +847,41 @@ static void InternetCrackUrlW_test(void) ok(r, "InternetCrackUrlW failed unexpectedly\n"); ok(!strcmp_wa(host, "x.org"), "host is %s, should be x.org\n", wine_dbgstr_w(host)); todo_wine ok(urlpart[0] == 0, "urlpart should be empty\n"); + + /* Windows treats dwUrlLength as a maximum - if there is a null before + * that length, it stops there. */ + host[0] = 0; + memset(&comp, 0, sizeof(comp)); + comp.dwStructSize = sizeof(comp); + comp.lpszHostName = host; + comp.dwHostNameLength = ARRAY_SIZE(host); + r = InternetCrackUrlW(url3, 13 /* includes the nul */, 0, &comp); + ok(r, "InternetCrackUrlW failed with error %d\n", GetLastError()); + todo_wine + ok(comp.dwHostNameLength == 5, + "Expected dwHostNameLength of 5, got %d\n", comp.dwHostNameLength); + + host[0] = 0; + memset(&comp, 0, sizeof(comp)); + comp.dwStructSize = sizeof(comp); + comp.lpszHostName = host; + comp.dwHostNameLength = ARRAY_SIZE(host); + r = InternetCrackUrlW(url4, 13, 0, &comp); + todo_wine ok(r == FALSE, "Expected InternetCrackUrlW to fail\n"); + + host[0] = 0; + urlpart[0] = 0; + memset(&comp, 0, sizeof(comp)); + comp.dwStructSize = sizeof(comp); + comp.lpszHostName = host; + comp.dwHostNameLength = ARRAY_SIZE(host); + comp.lpszUrlPath = urlpart; + comp.dwUrlPathLength = ARRAY_SIZE(urlpart); + r = InternetCrackUrlW(url5, 15, 0, &comp); + ok(r, "InternetCrackUrlW failed with error %d\n", GetLastError()); + todo_wine + ok(comp.dwUrlPathLength == 0, + "Expected dwUrlPathLength of 0, got %d\n", comp.dwUrlPathLength); } static void fill_url_components(URL_COMPONENTSA *lpUrlComponents)
1
0
0
0
Huw Davies : iphlpapi: ConvertInterfaceLuidToNameW/NameToLuidW use names based on the luid's type and index.
by Alexandre Julliard
07 Jul '21
07 Jul '21
Module: wine Branch: master Commit: d1787090328f11f555ef5ba662511aa592ddd1b6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d1787090328f11f555ef5ba6…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Jul 7 09:05:58 2021 +0100 iphlpapi: ConvertInterfaceLuidToNameW/NameToLuidW use names based on the luid's type and index. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/iphlpapi/iphlpapi_main.c | 98 ++++++++++++++++++++++++++++++++---------- dlls/iphlpapi/tests/iphlpapi.c | 50 ++++++++++++++++++--- 2 files changed, 118 insertions(+), 30 deletions(-) diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index e5dc1012cb0..13bfb81e7c9 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -3322,24 +3322,64 @@ DWORD WINAPI ConvertInterfaceLuidToNameA(const NET_LUID *luid, char *name, SIZE_ return err; } +static const WCHAR otherW[] = {'o','t','h','e','r',0}; +static const WCHAR ethernetW[] = {'e','t','h','e','r','n','e','t',0}; +static const WCHAR tokenringW[] = {'t','o','k','e','n','r','i','n','g',0}; +static const WCHAR pppW[] = {'p','p','p',0}; +static const WCHAR loopbackW[] = {'l','o','o','p','b','a','c','k',0}; +static const WCHAR atmW[] = {'a','t','m',0}; +static const WCHAR wirelessW[] = {'w','i','r','e','l','e','s','s',0}; +static const WCHAR tunnelW[] = {'t','u','n','n','e','l',0}; +static const WCHAR ieee1394W[] = {'i','e','e','e','1','3','9','4',0}; + +struct name_prefix +{ + const WCHAR *prefix; + DWORD type; +}; +static const struct name_prefix name_prefixes[] = +{ + { otherW, IF_TYPE_OTHER }, + { ethernetW, IF_TYPE_ETHERNET_CSMACD }, + { tokenringW, IF_TYPE_ISO88025_TOKENRING }, + { pppW, IF_TYPE_PPP }, + { loopbackW, IF_TYPE_SOFTWARE_LOOPBACK }, + { atmW, IF_TYPE_ATM }, + { wirelessW, IF_TYPE_IEEE80211 }, + { tunnelW, IF_TYPE_TUNNEL }, + { ieee1394W, IF_TYPE_IEEE1394 } +}; + /****************************************************************** * ConvertInterfaceLuidToNameW (IPHLPAPI.@) */ DWORD WINAPI ConvertInterfaceLuidToNameW(const NET_LUID *luid, WCHAR *name, SIZE_T len) { - DWORD ret; - MIB_IFROW row; + DWORD i, needed; + const WCHAR *prefix = NULL; + WCHAR buf[IF_MAX_STRING_SIZE + 1]; + static const WCHAR prefix_fmt[] = {'%','s','_','%','d',0}; + static const WCHAR unk_fmt[] = {'i','f','t','y','p','e','%','d','_','%','d',0}; - TRACE("(%p %p %u)\n", luid, name, (DWORD)len); + TRACE( "(%p %p %u)\n", luid, name, (DWORD)len ); if (!luid || !name) return ERROR_INVALID_PARAMETER; - row.dwIndex = luid->Info.NetLuidIndex; - if ((ret = GetIfEntry( &row ))) return ret; + for (i = 0; i < ARRAY_SIZE(name_prefixes); i++) + { + if (luid->Info.IfType == name_prefixes[i].type) + { + prefix = name_prefixes[i].prefix; + break; + } + } - if (len < strlenW( row.wszName ) + 1) return ERROR_NOT_ENOUGH_MEMORY; - strcpyW( name, row.wszName ); - return NO_ERROR; + if (prefix) needed = snprintfW( buf, len, prefix_fmt, prefix, luid->Info.NetLuidIndex ); + else needed = snprintfW( buf, len, unk_fmt, luid->Info.IfType, luid->Info.NetLuidIndex ); + + if (needed >= len) return ERROR_NOT_ENOUGH_MEMORY; + memcpy( name, buf, (needed + 1) * sizeof(WCHAR) ); + return ERROR_SUCCESS; } /****************************************************************** @@ -3363,28 +3403,40 @@ DWORD WINAPI ConvertInterfaceNameToLuidA(const char *name, NET_LUID *luid) */ DWORD WINAPI ConvertInterfaceNameToLuidW(const WCHAR *name, NET_LUID *luid) { - DWORD ret; - IF_INDEX index; - MIB_IFROW row; - char nameA[IF_MAX_STRING_SIZE + 1]; + const WCHAR *sep; + static const WCHAR iftype[] = {'i','f','t','y','p','e',0}; + DWORD type = ~0u, i; + WCHAR buf[IF_MAX_STRING_SIZE + 1]; - TRACE("(%s %p)\n", debugstr_w(name), luid); + TRACE( "(%s %p)\n", debugstr_w(name), luid ); if (!luid) return ERROR_INVALID_PARAMETER; memset( luid, 0, sizeof(*luid) ); - if (!WideCharToMultiByte( CP_UNIXCP, 0, name, -1, nameA, sizeof(nameA), NULL, NULL )) - return ERROR_INVALID_NAME; + if (!name || !(sep = strchrW( name, '_' )) || sep >= name + ARRAY_SIZE(buf)) return ERROR_INVALID_NAME; + memcpy( buf, name, (sep - name) * sizeof(WCHAR) ); + buf[sep - name] = '\0'; - if ((ret = getInterfaceIndexByName( nameA, &index ))) return ret; - - row.dwIndex = index; - if ((ret = GetIfEntry( &row ))) return ret; + if (sep - name > ARRAY_SIZE(iftype) - 1 && !memcmp( buf, iftype, (ARRAY_SIZE(iftype) - 1) * sizeof(WCHAR) )) + { + type = atoiW( buf + ARRAY_SIZE(iftype) - 1 ); + } + else + { + for (i = 0; i < ARRAY_SIZE(name_prefixes); i++) + { + if (!strcmpW( buf, name_prefixes[i].prefix )) + { + type = name_prefixes[i].type; + break; + } + } + } + if (type == ~0u) return ERROR_INVALID_NAME; - luid->Info.Reserved = 0; - luid->Info.NetLuidIndex = index; - luid->Info.IfType = row.dwType; - return NO_ERROR; + luid->Info.NetLuidIndex = atoiW( sep + 1 ); + luid->Info.IfType = type; + return ERROR_SUCCESS; } /****************************************************************** diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c index e43cb9b1f78..54c820e522c 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -1618,6 +1618,41 @@ static DWORD get_interface_index(void) return ret; } +static void convert_luid_to_name( NET_LUID *luid, WCHAR *expect_nameW, int len ) +{ + struct + { + const WCHAR *prefix; + DWORD type; + } prefixes[] = + { + { L"other", IF_TYPE_OTHER }, + { L"ethernet", IF_TYPE_ETHERNET_CSMACD }, + { L"tokenring", IF_TYPE_ISO88025_TOKENRING }, + { L"ppp", IF_TYPE_PPP }, + { L"loopback", IF_TYPE_SOFTWARE_LOOPBACK }, + { L"atm", IF_TYPE_ATM }, + { L"wireless", IF_TYPE_IEEE80211 }, + { L"tunnel", IF_TYPE_TUNNEL }, + { L"ieee1394", IF_TYPE_IEEE1394 } + }; + DWORD i; + const WCHAR *prefix = NULL; + + for (i = 0; i < ARRAY_SIZE(prefixes); i++) + { + if (prefixes[i].type == luid->Info.IfType) + { + prefix = prefixes[i].prefix; + break; + } + } + if (prefix) + swprintf( expect_nameW, len, L"%s_%d", prefix, luid->Info.NetLuidIndex ); + else + swprintf( expect_nameW, len, L"iftype%d_%d", luid->Info.IfType, luid->Info.NetLuidIndex ); +} + static void test_interface_identifier_conversion(void) { DWORD ret, i; @@ -1626,7 +1661,9 @@ static void test_interface_identifier_conversion(void) SIZE_T len; WCHAR nameW[IF_MAX_STRING_SIZE + 1]; WCHAR alias[IF_MAX_STRING_SIZE + 1]; + WCHAR expect_nameW[IF_MAX_STRING_SIZE + 1]; char nameA[IF_MAX_STRING_SIZE + 1], *name; + char expect_nameA[IF_MAX_STRING_SIZE + 1]; NET_IFINDEX index; MIB_IF_TABLE2 *table; @@ -1721,7 +1758,8 @@ static void test_interface_identifier_conversion(void) len = ARRAY_SIZE(nameW); ret = ConvertInterfaceLuidToNameW( &luid, nameW, len ); ok( !ret, "got %u\n", ret ); - ok( nameW[0], "name not set\n" ); + convert_luid_to_name( &luid, expect_nameW, len ); + ok( !wcscmp( nameW, expect_nameW ), "got %s vs %s\n", debugstr_w( nameW ), debugstr_w( expect_nameW ) ); /* ConvertInterfaceLuidToNameA */ ret = ConvertInterfaceLuidToNameA( NULL, NULL, 0 ); @@ -1810,12 +1848,10 @@ static void test_interface_identifier_conversion(void) ok( name == NULL, "got %p\n", name ); nameA[0] = 0; - name = if_indextoname( 1, nameA ); - if (name != NULL) - { - ok( name[0], "empty name\n" ); - ok( name == nameA, "got %p\n", name ); - } + name = if_indextoname( row->InterfaceIndex, nameA ); + ConvertInterfaceLuidToNameA( &row->InterfaceLuid, expect_nameA, ARRAY_SIZE(expect_nameA) ); + ok( name == nameA, "mismatch\n" ); + ok( !strcmp( nameA, expect_nameA ), "mismatch\n" ); } FreeMibTable( table ); }
1
0
0
0
Huw Davies : mountmgr: Retrieve the unix-name from the alias.
by Alexandre Julliard
07 Jul '21
07 Jul '21
Module: wine Branch: master Commit: 76b31a2ed8fa7c160e67076d507ff44c5c7474a6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=76b31a2ed8fa7c160e67076d…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Jul 7 09:05:57 2021 +0100 mountmgr: Retrieve the unix-name from the alias. If, at some point, we change that, we can add a Wine-only nsi table that holds the luid to unix-name mapping. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mountmgr.sys/dbus.c | 2 +- dlls/mountmgr.sys/diskarb.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/mountmgr.sys/dbus.c b/dlls/mountmgr.sys/dbus.c index 6998ef43688..b7624d1cb37 100644 --- a/dlls/mountmgr.sys/dbus.c +++ b/dlls/mountmgr.sys/dbus.c @@ -1003,7 +1003,7 @@ static BOOL map_adapter_name( const NET_LUID *luid, char *unix_name, DWORD len ) { WCHAR unix_nameW[IF_NAMESIZE]; - if (ConvertInterfaceLuidToNameW( luid, unix_nameW, ARRAY_SIZE(unix_nameW) )) return FALSE; + if (ConvertInterfaceLuidToAlias( luid, unix_nameW, ARRAY_SIZE(unix_nameW) )) return FALSE; return WideCharToMultiByte( CP_UNIXCP, 0, unix_nameW, -1, unix_name, len, NULL, NULL ) != 0; } diff --git a/dlls/mountmgr.sys/diskarb.c b/dlls/mountmgr.sys/diskarb.c index 1232f450599..e33365f6301 100644 --- a/dlls/mountmgr.sys/diskarb.c +++ b/dlls/mountmgr.sys/diskarb.c @@ -260,7 +260,7 @@ static UInt8 map_option( ULONG option ) #define IF_NAMESIZE 16 static BOOL map_adapter_name( const NET_LUID *luid, WCHAR *unix_name, DWORD len ) { - return !ConvertInterfaceLuidToNameW( luid, unix_name, len ); + return !ConvertInterfaceLuidToAlias( luid, unix_name, len ); } static CFStringRef find_service_id( const NET_LUID *adapter )
1
0
0
0
Huw Davies : iphlpapi: Implement ConvertInterfaceLuidToAlias().
by Alexandre Julliard
07 Jul '21
07 Jul '21
Module: wine Branch: master Commit: 79c12f15b472e617d0a537e484d19e362d933202 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=79c12f15b472e617d0a537e4…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Jul 7 09:05:56 2021 +0100 iphlpapi: Implement ConvertInterfaceLuidToAlias(). Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/iphlpapi/iphlpapi.spec | 2 +- dlls/iphlpapi/iphlpapi_main.c | 24 ++++++++++++++++++++++++ dlls/iphlpapi/tests/iphlpapi.c | 11 +++++++++++ include/netioapi.h | 1 + 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/dlls/iphlpapi/iphlpapi.spec b/dlls/iphlpapi/iphlpapi.spec index 9180eb84af7..604852a754d 100644 --- a/dlls/iphlpapi/iphlpapi.spec +++ b/dlls/iphlpapi/iphlpapi.spec @@ -15,7 +15,7 @@ @ stdcall ConvertInterfaceAliasToLuid( ptr ptr ) @ stdcall ConvertInterfaceGuidToLuid( ptr ptr ) @ stdcall ConvertInterfaceIndexToLuid( long ptr ) -#@ stub ConvertInterfaceLuidToAlias +@ stdcall ConvertInterfaceLuidToAlias( ptr ptr long ) @ stdcall ConvertInterfaceLuidToGuid( ptr ptr ) @ stdcall ConvertInterfaceLuidToIndex( ptr ptr ) @ stdcall ConvertInterfaceLuidToNameA( ptr ptr long ) diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index 448c1d873af..e5dc1012cb0 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -3241,6 +3241,30 @@ DWORD WINAPI ConvertInterfaceIndexToLuid(NET_IFINDEX index, NET_LUID *luid) return err; } +/****************************************************************** + * ConvertInterfaceLuidToAlias (IPHLPAPI.@) + */ +DWORD WINAPI ConvertInterfaceLuidToAlias( const NET_LUID *luid, WCHAR *alias, SIZE_T len ) +{ + DWORD err; + IF_COUNTED_STRING name; + + TRACE( "(%p %p %u)\n", luid, alias, (DWORD)len ); + + if (!luid || !alias) return ERROR_INVALID_PARAMETER; + + err = NsiGetParameter( 1, &NPI_MS_NDIS_MODULEID, NSI_NDIS_IFINFO_TABLE, luid, sizeof(*luid), + NSI_PARAM_TYPE_RW, &name, sizeof(name), + FIELD_OFFSET(struct nsi_ndis_ifinfo_rw, alias) ); + if (err) return err; + + if (len <= name.Length / sizeof(WCHAR)) return ERROR_NOT_ENOUGH_MEMORY; + memcpy( alias, name.String, name.Length ); + alias[name.Length / sizeof(WCHAR)] = '\0'; + + return err; +} + /****************************************************************** * ConvertInterfaceLuidToGuid (IPHLPAPI.@) */ diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c index 480d6ac06c5..e43cb9b1f78 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -1625,6 +1625,7 @@ static void test_interface_identifier_conversion(void) GUID guid; SIZE_T len; WCHAR nameW[IF_MAX_STRING_SIZE + 1]; + WCHAR alias[IF_MAX_STRING_SIZE + 1]; char nameA[IF_MAX_STRING_SIZE + 1], *name; NET_IFINDEX index; MIB_IF_TABLE2 *table; @@ -1779,6 +1780,16 @@ static void test_interface_identifier_conversion(void) ok( !ret, "got %u\n", ret ); ok( luid.Value == row->InterfaceLuid.Value, "mismatch\n" ); + /* ConvertInterfaceAliasToLuid */ + ret = ConvertInterfaceAliasToLuid( row->Alias, &luid ); + ok( !ret, "got %u\n", ret ); + ok( luid.Value == row->InterfaceLuid.Value, "mismatch\n" ); + + /* ConvertInterfaceLuidToAlias */ + ret = ConvertInterfaceLuidToAlias( &row->InterfaceLuid, alias, ARRAY_SIZE(alias) ); + ok( !ret, "got %u\n", ret ); + ok( !wcscmp( alias, row->Alias ), "got %s vs %s\n", wine_dbgstr_w( alias ), wine_dbgstr_w( row->Alias ) ); + index = if_nametoindex( NULL ); ok( !index, "Got unexpected index %u\n", index ); index = if_nametoindex( nameA ); diff --git a/include/netioapi.h b/include/netioapi.h index 6d08d54a444..055266d946e 100644 --- a/include/netioapi.h +++ b/include/netioapi.h @@ -241,6 +241,7 @@ typedef VOID (WINAPI *PIPFORWARD_CHANGE_CALLBACK)(VOID*,MIB_IPFORWARD_ROW2*,MIB_ DWORD WINAPI ConvertInterfaceAliasToLuid(const WCHAR*,NET_LUID*); DWORD WINAPI ConvertInterfaceGuidToLuid(const GUID*,NET_LUID*); DWORD WINAPI ConvertInterfaceIndexToLuid(NET_IFINDEX,NET_LUID*); +DWORD WINAPI ConvertInterfaceLuidToAlias(const NET_LUID*,WCHAR*,SIZE_T); DWORD WINAPI ConvertInterfaceLuidToGuid(const NET_LUID*,GUID*); DWORD WINAPI ConvertInterfaceLuidToIndex(const NET_LUID*,NET_IFINDEX*); DWORD WINAPI ConvertInterfaceLuidToNameA(const NET_LUID*,char*,SIZE_T);
1
0
0
0
Huw Davies : iphlpapi: Implement ConvertInterfaceAliasToLuid().
by Alexandre Julliard
07 Jul '21
07 Jul '21
Module: wine Branch: master Commit: e62eadadd539fb44e83c88d2bed7cf6f4ea612ea URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e62eadadd539fb44e83c88d2…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Jul 7 09:05:55 2021 +0100 iphlpapi: Implement ConvertInterfaceAliasToLuid(). Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/iphlpapi/iphlpapi.spec | 2 +- dlls/iphlpapi/iphlpapi_main.c | 33 +++++++++++++++++++++++++++++++++ include/netioapi.h | 1 + 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/dlls/iphlpapi/iphlpapi.spec b/dlls/iphlpapi/iphlpapi.spec index ded265f5719..9180eb84af7 100644 --- a/dlls/iphlpapi/iphlpapi.spec +++ b/dlls/iphlpapi/iphlpapi.spec @@ -12,7 +12,7 @@ @ stdcall CancelMibChangeNotify2( ptr ) #@ stub ConvertGuidToStringA #@ stub ConvertGuidToStringW -#@ stub ConvertInterfaceAliasToLuid +@ stdcall ConvertInterfaceAliasToLuid( ptr ptr ) @ stdcall ConvertInterfaceGuidToLuid( ptr ptr ) @ stdcall ConvertInterfaceIndexToLuid( long ptr ) #@ stub ConvertInterfaceLuidToAlias diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index 403b51391af..448c1d873af 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -3159,6 +3159,39 @@ ULONG WINAPI GetTcp6Table2(PMIB_TCP6TABLE2 table, PULONG size, BOOL order) return ERROR_NOT_SUPPORTED; } +/****************************************************************** + * ConvertInterfaceAliasToLuid (IPHLPAPI.@) + */ +DWORD WINAPI ConvertInterfaceAliasToLuid( const WCHAR *alias, NET_LUID *luid ) +{ + struct nsi_ndis_ifinfo_rw *data; + DWORD err, count, i, len; + NET_LUID *keys; + + TRACE( "(%s %p)\n", debugstr_w(alias), luid ); + + if (!alias || !*alias || !luid) return ERROR_INVALID_PARAMETER; + luid->Value = 0; + len = strlenW( alias ); + + err = NsiAllocateAndGetTable( 1, &NPI_MS_NDIS_MODULEID, NSI_NDIS_IFINFO_TABLE, (void **)&keys, sizeof(*keys), + (void **)&data, sizeof(*data), NULL, 0, NULL, 0, &count, 0 ); + if (err) return err; + + err = ERROR_INVALID_PARAMETER; + for (i = 0; i < count; i++) + { + if (data[i].alias.Length == len * 2 && !memcmp( data[i].alias.String, alias, len * 2 )) + { + luid->Value = keys[i].Value; + err = ERROR_SUCCESS; + break; + } + } + NsiFreeTable( keys, data, NULL, NULL ); + return err; +} + /****************************************************************** * ConvertInterfaceGuidToLuid (IPHLPAPI.@) */ diff --git a/include/netioapi.h b/include/netioapi.h index 7238d527ad4..6d08d54a444 100644 --- a/include/netioapi.h +++ b/include/netioapi.h @@ -238,6 +238,7 @@ typedef VOID (WINAPI *PUNICAST_IPADDRESS_CHANGE_CALLBACK)(PVOID, PMIB_UNICASTIPA typedef VOID (WINAPI *PIPFORWARD_CHANGE_CALLBACK)(VOID*,MIB_IPFORWARD_ROW2*,MIB_NOTIFICATION_TYPE); +DWORD WINAPI ConvertInterfaceAliasToLuid(const WCHAR*,NET_LUID*); DWORD WINAPI ConvertInterfaceGuidToLuid(const GUID*,NET_LUID*); DWORD WINAPI ConvertInterfaceIndexToLuid(NET_IFINDEX,NET_LUID*); DWORD WINAPI ConvertInterfaceLuidToGuid(const NET_LUID*,GUID*);
1
0
0
0
Huw Davies : dhcpcsvc: Pass a luid instead of the adapter name.
by Alexandre Julliard
07 Jul '21
07 Jul '21
Module: wine Branch: master Commit: e5b90e93b22a37202fd270470e99a43eaf3209bd URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e5b90e93b22a37202fd27047…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Jul 7 09:05:54 2021 +0100 dhcpcsvc: Pass a luid instead of the adapter name. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dhcpcsvc/Makefile.in | 1 + dlls/dhcpcsvc/dhcpcsvc.c | 35 ++++++++++++++++++++++++++++++----- dlls/mountmgr.sys/dbus.c | 24 +++++++----------------- dlls/mountmgr.sys/diskarb.c | 25 +++++-------------------- dlls/mountmgr.sys/mountmgr.c | 5 ++--- dlls/mountmgr.sys/mountmgr.h | 2 +- include/ddk/mountmgr.h | 4 +++- 7 files changed, 49 insertions(+), 47 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=e5b90e93b22a37202fd2…
1
0
0
0
← Newer
1
...
48
49
50
51
52
53
54
...
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