for details see https://bugs.winehq.org/show_bug.cgi?id=56065 This change adds an implementation of Win32 API function GetAnycastIpAddressTable() that is used by Adoptium OpenJDK 21 and later to initialize Secure Random Generator. This implementation does not return real information, it just says "no entries found".
-- v2: iphlpapi: formatting. iphlpapi: more compact code in GetAnycastIpAddressTable(). iphlpapi: changed TRACE() and FIXME() in GetAnycastIpAddressTable().
From: Rastislav Stanik git@rastos.org
for details see https://bugs.winehq.org/show_bug.cgi?id=56065 --- dlls/iphlpapi/iphlpapi.spec | 2 +- dlls/iphlpapi/iphlpapi_main.c | 25 +++++++++++++++++++++++++ include/netioapi.h | 13 +++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/dlls/iphlpapi/iphlpapi.spec b/dlls/iphlpapi/iphlpapi.spec index ef2c576947d..feb46c2b35f 100644 --- a/dlls/iphlpapi/iphlpapi.spec +++ b/dlls/iphlpapi/iphlpapi.spec @@ -73,7 +73,7 @@ @ stdcall GetAdaptersAddresses( long long ptr ptr ptr ) @ stdcall GetAdaptersInfo( ptr ptr ) #@ stub GetAnycastIpAddressEntry -#@ stub GetAnycastIpAddressTable +@ stdcall GetAnycastIpAddressTable(long ptr) @ stdcall GetBestInterface( long ptr ) @ stdcall GetBestInterfaceEx( ptr ptr ) @ stub GetBestInterfaceFromStack diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index 9c7582b71fb..4ee377f0d0e 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -3597,6 +3597,31 @@ static void unicast_row_fill( MIB_UNICASTIPADDRESS_ROW *row, USHORT fam, void *k row->CreationTimeStamp.QuadPart = stat->creation_time; }
+DWORD WINAPI GetAnycastIpAddressTable(ADDRESS_FAMILY family, MIB_ANYCASTIPADDRESS_TABLE **table) +{ + DWORD err, size; + TRACE( "%u, %p\n", family, table ); + + if (!table || (family != AF_INET && family != AF_INET6 && family != AF_UNSPEC)) + return ERROR_INVALID_PARAMETER; + + FIXME(":stub - returning empty MIB_ANYCASTIPADDRESS_TABLE\n"); + + size = FIELD_OFFSET(MIB_ANYCASTIPADDRESS_TABLE, Table[0]); + *table = heap_alloc( size ); + if (!*table) + { + err = ERROR_NOT_ENOUGH_MEMORY; + goto err; + } + (*table)->NumEntries = 0; + err = NO_ERROR; + +err: + return err; +} + + DWORD WINAPI GetUnicastIpAddressEntry(MIB_UNICASTIPADDRESS_ROW *row) { struct nsi_ipv4_unicast_key key4; diff --git a/include/netioapi.h b/include/netioapi.h index 8c1491f9efa..24b4f42d645 100644 --- a/include/netioapi.h +++ b/include/netioapi.h @@ -166,12 +166,25 @@ typedef struct _MIB_UNICASTIPADDRESS_ROW LARGE_INTEGER CreationTimeStamp; } MIB_UNICASTIPADDRESS_ROW, *PMIB_UNICASTIPADDRESS_ROW;
+typedef struct _MIB_ANYCASTIPADDRESS_ROW { + SOCKADDR_INET Address; + NET_LUID InterfaceLuid; + NET_IFINDEX InterfaceIndex; + SCOPE_ID ScopeId; +} MIB_ANYCASTIPADDRESS_ROW, *PMIB_ANYCASTIPADDRESS_ROW; + typedef struct _MIB_UNICASTIPADDRESS_TABLE { ULONG NumEntries; MIB_UNICASTIPADDRESS_ROW Table[1]; } MIB_UNICASTIPADDRESS_TABLE, *PMIB_UNICASTIPADDRESS_TABLE;
+typedef struct _MIB_ANYCASTIPADDRESS_TABLE +{ + ULONG NumEntries; + MIB_ANYCASTIPADDRESS_ROW Table[ANY_SIZE]; +} MIB_ANYCASTIPADDRESS_TABLE, *PMIB_ANYCASTIPADDRESS_TABLE; + typedef struct _IP_ADDRESS_PREFIX { SOCKADDR_INET Prefix;
From: Rastislav Stanik git@rastos.org
--- dlls/iphlpapi/iphlpapi_main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index 4ee377f0d0e..43a93e70c8d 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -3600,13 +3600,11 @@ static void unicast_row_fill( MIB_UNICASTIPADDRESS_ROW *row, USHORT fam, void *k DWORD WINAPI GetAnycastIpAddressTable(ADDRESS_FAMILY family, MIB_ANYCASTIPADDRESS_TABLE **table) { DWORD err, size; - TRACE( "%u, %p\n", family, table ); + FIXME( "(%u, %p) stub\n", family, table );
if (!table || (family != AF_INET && family != AF_INET6 && family != AF_UNSPEC)) return ERROR_INVALID_PARAMETER;
- FIXME(":stub - returning empty MIB_ANYCASTIPADDRESS_TABLE\n"); - size = FIELD_OFFSET(MIB_ANYCASTIPADDRESS_TABLE, Table[0]); *table = heap_alloc( size ); if (!*table)
From: Rastislav Stanik git@rastos.org
--- dlls/iphlpapi/iphlpapi_main.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index 43a93e70c8d..6b9d3408e07 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -3599,7 +3599,7 @@ static void unicast_row_fill( MIB_UNICASTIPADDRESS_ROW *row, USHORT fam, void *k
DWORD WINAPI GetAnycastIpAddressTable(ADDRESS_FAMILY family, MIB_ANYCASTIPADDRESS_TABLE **table) { - DWORD err, size; + DWORD size; FIXME( "(%u, %p) stub\n", family, table );
if (!table || (family != AF_INET && family != AF_INET6 && family != AF_UNSPEC)) @@ -3607,16 +3607,9 @@ DWORD WINAPI GetAnycastIpAddressTable(ADDRESS_FAMILY family, MIB_ANYCASTIPADDRES
size = FIELD_OFFSET(MIB_ANYCASTIPADDRESS_TABLE, Table[0]); *table = heap_alloc( size ); - if (!*table) - { - err = ERROR_NOT_ENOUGH_MEMORY; - goto err; - } + if (!*table) return ERROR_NOT_ENOUGH_MEMORY (*table)->NumEntries = 0; - err = NO_ERROR; - -err: - return err; + return NO_ERROR; }
From: Rastislav Stanik git@rastos.org
--- dlls/iphlpapi/iphlpapi.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/iphlpapi/iphlpapi.spec b/dlls/iphlpapi/iphlpapi.spec index feb46c2b35f..dcc15a2753e 100644 --- a/dlls/iphlpapi/iphlpapi.spec +++ b/dlls/iphlpapi/iphlpapi.spec @@ -73,7 +73,7 @@ @ stdcall GetAdaptersAddresses( long long ptr ptr ptr ) @ stdcall GetAdaptersInfo( ptr ptr ) #@ stub GetAnycastIpAddressEntry -@ stdcall GetAnycastIpAddressTable(long ptr) +@ stdcall GetAnycastIpAddressTable( long ptr ) @ stdcall GetBestInterface( long ptr ) @ stdcall GetBestInterfaceEx( ptr ptr ) @ stub GetBestInterfaceFromStack
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=142376
Your paranoid android.
=== debian11 (build log) ===
../wine/include/winerror.h:120:60: error: called object is not a function or function pointer Task: The win32 Wine build failed
=== debian11b (build log) ===
../wine/include/winerror.h:120:60: error: called object is not a function or function pointer Task: The wow64 Wine build failed
On Thu Jan 25 21:46:09 2024 +0000, Aida Jonikienė wrote:
Also for the commit message you should use the `<Wine component>: <change message>.` format with the dot included to meet Julliard's standards (like `mfc42: Add stub DLL.` or `ntdll/tests: Add more CONTEXT_EX tests.`) For linked bug reports the standard practice is to add a Wine-Bug header to the bottom with the bug report URL (like `Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53093%60)
Um. I'm sorry about that. What do I do now? Fork again and do it the right way? Should the Wine-Bug be included in each commit related to the issue?
On Thu Jan 25 21:43:32 2024 +0000, Rastislav Stanik wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/4940/diffs?diff_id=95859&start_sha=9b0a2c1b2a77b40367c04c719bdeb90fc9e70054#f5177724934620bf34a61d786cf373a3caac591d_3621_3612)
Ok.
On Thu Jan 25 21:43:31 2024 +0000, Rastislav Stanik wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/4940/diffs?diff_id=95859&start_sha=9b0a2c1b2a77b40367c04c719bdeb90fc9e70054#f5177724934620bf34a61d786cf373a3caac591d_3608_3608)
Done.
On Thu Jan 25 21:43:30 2024 +0000, Rastislav Stanik wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/4940/diffs?diff_id=95859&start_sha=9b0a2c1b2a77b40367c04c719bdeb90fc9e70054#f5177724934620bf34a61d786cf373a3caac591d_3603_3602)
Done.
On Thu Jan 25 21:38:32 2024 +0000, Rastislav Stanik wrote:
Again I took inspiration from existing function GetUnicastIpAddressTable(). Basically the new code is supposed to return a structure that has member "NumEntries" and that member says how many structures of type MIB_ANYCASTIPADDRESS_ROW follow. Since I'm going to return zero rows, then the array of rows is zero-length. Of course I can allocate one row (rather then zero) that will not be used/populated with any data. Is that acceptable?
@rastos I'm trying to fix the build error on Linux (and warnings on other systems)
On Thu Jan 25 21:46:09 2024 +0000, Rastislav Stanik wrote:
Um. I'm sorry about that. What do I do now? Fork again and do it the right way? Should the Wine-Bug be included in each commit related to the issue?
@rastos Just squash all of your commits into a single commit (and update that commit with my changes) and force push for a cleaner MR