Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/iphlpapi/iphlpapi.spec | 2 +- dlls/iphlpapi/iphlpapi_main.c | 8 ++++++++ dlls/iphlpapi/tests/iphlpapi.c | 10 +++++++++- 3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/dlls/iphlpapi/iphlpapi.spec b/dlls/iphlpapi/iphlpapi.spec index 480b26c9315..6c51548b6e3 100644 --- a/dlls/iphlpapi/iphlpapi.spec +++ b/dlls/iphlpapi/iphlpapi.spec @@ -32,7 +32,7 @@ #@ stub ConvertRemoteInterfaceLuidToGuid #@ stub ConvertRemoteInterfaceLuidToIndex #@ stub ConvertStringToGuidA -#@ stub ConvertStringToGuidW +@ stdcall ConvertStringToGuidW( ptr ptr ) #@ stub ConvertStringToInterfacePhysicalAddress #@ stub CPNatfwtCreateProviderInstance #@ stub CPNatfwtDeregisterProviderInstance diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index ffd0028ff42..079acbf2a9e 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -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.@) * diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c index daf3fec0a98..39aa7123668 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -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)