iphlpapi: Implement ConvertStringToGuidW().

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2021-07-08 09:00:01 +01:00 committed by Alexandre Julliard
parent 8f12e295ff
commit 2e7353dce9
3 changed files with 18 additions and 2 deletions

View file

@ -32,7 +32,7 @@
#@ stub ConvertRemoteInterfaceLuidToGuid
#@ stub ConvertRemoteInterfaceLuidToIndex
#@ stub ConvertStringToGuidA
#@ stub ConvertStringToGuidW
@ stdcall ConvertStringToGuidW( ptr ptr )
#@ stub ConvertStringToInterfacePhysicalAddress
#@ stub CPNatfwtCreateProviderInstance
#@ stub CPNatfwtDeregisterProviderInstance

View file

@ -97,6 +97,14 @@ DWORD WINAPI ConvertGuidToStringW( const GUID *guid, WCHAR *str, DWORD len )
return ERROR_SUCCESS;
}
DWORD WINAPI ConvertStringToGuidW( const WCHAR *str, GUID *guid )
{
UNICODE_STRING ustr;
RtlInitUnicodeString( &ustr, str );
return RtlNtStatusToDosError( RtlGUIDFromString( &ustr, guid ) );
}
/******************************************************************
* AddIPAddress (IPHLPAPI.@)
*

View file

@ -69,6 +69,7 @@ static DWORD (WINAPI *pCancelMibChangeNotify2)(HANDLE);
DWORD WINAPI ConvertGuidToStringA( const GUID *, char *, DWORD );
DWORD WINAPI ConvertGuidToStringW( const GUID *, WCHAR *, DWORD );
DWORD WINAPI ConvertStringToGuidW( const WCHAR *, GUID * );
static void loadIPHlpApi(void)
{
@ -2339,7 +2340,7 @@ static void test_ConvertGuidToString( void )
DWORD err;
char bufA[39];
WCHAR bufW[39];
GUID guid = { 0xa, 0xb, 0xc, { 0xd, 0, 0xe, 0xf } };
GUID guid = { 0xa, 0xb, 0xc, { 0xd, 0, 0xe, 0xf } }, guid2;
err = ConvertGuidToStringA( &guid, bufA, 38 );
ok( err, "got %d\n", err );
@ -2352,6 +2353,13 @@ static void test_ConvertGuidToString( void )
err = ConvertGuidToStringW( &guid, bufW, 39 );
ok( !err, "got %d\n", err );
ok( !wcscmp( bufW, L"{0000000A-000B-000C-0D00-0E0F00000000}" ), "got %s\n", debugstr_w( bufW ) );
err = ConvertStringToGuidW( bufW, &guid2 );
ok( !err, "got %d\n", err );
ok( IsEqualGUID( &guid, &guid2 ), "guid mismatch\n" );
err = ConvertStringToGuidW( L"foo", &guid2 );
ok( err == ERROR_INVALID_PARAMETER, "got %d\n", err );
}
START_TEST(iphlpapi)