Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
8f12e295
Commit
8f12e295
authored
Jul 08, 2021
by
Huw Davies
Committed by
Alexandre Julliard
Jul 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi: Implement ConvertGuidToString[AW]().
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
805e30ee
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
4 deletions
+52
-4
iphlpapi.spec
dlls/iphlpapi/iphlpapi.spec
+2
-2
iphlpapi_main.c
dlls/iphlpapi/iphlpapi_main.c
+26
-2
iphlpapi.c
dlls/iphlpapi/tests/iphlpapi.c
+24
-0
No files found.
dlls/iphlpapi/iphlpapi.spec
View file @
8f12e295
...
@@ -10,8 +10,8 @@
...
@@ -10,8 +10,8 @@
@ stdcall AllocateAndGetUdpTableFromStack( ptr long long long )
@ stdcall AllocateAndGetUdpTableFromStack( ptr long long long )
@ stdcall CancelIPChangeNotify( ptr )
@ stdcall CancelIPChangeNotify( ptr )
@ stdcall CancelMibChangeNotify2( ptr )
@ stdcall CancelMibChangeNotify2( ptr )
#@ stub ConvertGuidToStringA
@ stdcall ConvertGuidToStringA( ptr ptr long )
#@ stub ConvertGuidToStringW
@ stdcall ConvertGuidToStringW( ptr ptr long )
@ stdcall ConvertInterfaceAliasToLuid( ptr ptr )
@ stdcall ConvertInterfaceAliasToLuid( ptr ptr )
@ stdcall ConvertInterfaceGuidToLuid( ptr ptr )
@ stdcall ConvertInterfaceGuidToLuid( ptr ptr )
@ stdcall ConvertInterfaceIndexToLuid( long ptr )
@ stdcall ConvertInterfaceIndexToLuid( long ptr )
...
...
dlls/iphlpapi/iphlpapi_main.c
View file @
8f12e295
...
@@ -73,6 +73,30 @@ WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi);
...
@@ -73,6 +73,30 @@ WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi);
#define INADDR_NONE ~0UL
#define INADDR_NONE ~0UL
#endif
#endif
#define CHARS_IN_GUID 39
DWORD
WINAPI
ConvertGuidToStringA
(
const
GUID
*
guid
,
char
*
str
,
DWORD
len
)
{
if
(
len
<
CHARS_IN_GUID
)
return
ERROR_INSUFFICIENT_BUFFER
;
sprintf
(
str
,
"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}"
,
guid
->
Data1
,
guid
->
Data2
,
guid
->
Data3
,
guid
->
Data4
[
0
],
guid
->
Data4
[
1
],
guid
->
Data4
[
2
],
guid
->
Data4
[
3
],
guid
->
Data4
[
4
],
guid
->
Data4
[
5
],
guid
->
Data4
[
6
],
guid
->
Data4
[
7
]
);
return
ERROR_SUCCESS
;
}
DWORD
WINAPI
ConvertGuidToStringW
(
const
GUID
*
guid
,
WCHAR
*
str
,
DWORD
len
)
{
static
const
WCHAR
fmt
[]
=
{
'{'
,
'%'
,
'0'
,
'8'
,
'X'
,
'-'
,
'%'
,
'0'
,
'4'
,
'X'
,
'-'
,
'%'
,
'0'
,
'4'
,
'X'
,
'-'
,
'%'
,
'0'
,
'2'
,
'X'
,
'%'
,
'0'
,
'2'
,
'X'
,
'-'
,
'%'
,
'0'
,
'2'
,
'X'
,
'%'
,
'0'
,
'2'
,
'X'
,
'%'
,
'0'
,
'2'
,
'X'
,
'%'
,
'0'
,
'2'
,
'X'
,
'%'
,
'0'
,
'2'
,
'X'
,
'%'
,
'0'
,
'2'
,
'X'
,
'}'
,
0
};
if
(
len
<
CHARS_IN_GUID
)
return
ERROR_INSUFFICIENT_BUFFER
;
sprintfW
(
str
,
fmt
,
guid
->
Data1
,
guid
->
Data2
,
guid
->
Data3
,
guid
->
Data4
[
0
],
guid
->
Data4
[
1
],
guid
->
Data4
[
2
],
guid
->
Data4
[
3
],
guid
->
Data4
[
4
],
guid
->
Data4
[
5
],
guid
->
Data4
[
6
],
guid
->
Data4
[
7
]
);
return
ERROR_SUCCESS
;
}
/******************************************************************
/******************************************************************
* AddIPAddress (IPHLPAPI.@)
* AddIPAddress (IPHLPAPI.@)
*
*
...
@@ -989,7 +1013,7 @@ static ULONG adapterAddressesFromIndex(ULONG family, ULONG flags, IF_INDEX index
...
@@ -989,7 +1013,7 @@ static ULONG adapterAddressesFromIndex(ULONG family, ULONG flags, IF_INDEX index
}
}
total_size
=
sizeof
(
IP_ADAPTER_ADDRESSES
);
total_size
=
sizeof
(
IP_ADAPTER_ADDRESSES
);
total_size
+=
39
;
/* "{00000000-0000-0000-0000-000000000000}" */
total_size
+=
CHARS_IN_GUID
;
total_size
+=
IF_NAMESIZE
*
sizeof
(
WCHAR
);
total_size
+=
IF_NAMESIZE
*
sizeof
(
WCHAR
);
if
(
!
(
flags
&
GAA_FLAG_SKIP_FRIENDLY_NAME
))
if
(
!
(
flags
&
GAA_FLAG_SKIP_FRIENDLY_NAME
))
total_size
+=
IF_NAMESIZE
*
sizeof
(
WCHAR
);
total_size
+=
IF_NAMESIZE
*
sizeof
(
WCHAR
);
...
@@ -1030,7 +1054,7 @@ static ULONG adapterAddressesFromIndex(ULONG family, ULONG flags, IF_INDEX index
...
@@ -1030,7 +1054,7 @@ static ULONG adapterAddressesFromIndex(ULONG family, ULONG flags, IF_INDEX index
guid
.
Data4
[
2
],
guid
.
Data4
[
3
],
guid
.
Data4
[
4
],
guid
.
Data4
[
5
],
guid
.
Data4
[
2
],
guid
.
Data4
[
3
],
guid
.
Data4
[
4
],
guid
.
Data4
[
5
],
guid
.
Data4
[
6
],
guid
.
Data4
[
7
]);
guid
.
Data4
[
6
],
guid
.
Data4
[
7
]);
aa
->
AdapterName
=
ptr
;
aa
->
AdapterName
=
ptr
;
ptr
+=
39
;
ptr
+=
CHARS_IN_GUID
;
getInterfaceNameByIndex
(
index
,
name
);
getInterfaceNameByIndex
(
index
,
name
);
if
(
!
(
flags
&
GAA_FLAG_SKIP_FRIENDLY_NAME
))
if
(
!
(
flags
&
GAA_FLAG_SKIP_FRIENDLY_NAME
))
...
...
dlls/iphlpapi/tests/iphlpapi.c
View file @
8f12e295
...
@@ -67,6 +67,9 @@ static DWORD (WINAPI *pNotifyUnicastIpAddressChange)(ADDRESS_FAMILY, PUNICAST_IP
...
@@ -67,6 +67,9 @@ static DWORD (WINAPI *pNotifyUnicastIpAddressChange)(ADDRESS_FAMILY, PUNICAST_IP
PVOID
,
BOOLEAN
,
HANDLE
*
);
PVOID
,
BOOLEAN
,
HANDLE
*
);
static
DWORD
(
WINAPI
*
pCancelMibChangeNotify2
)(
HANDLE
);
static
DWORD
(
WINAPI
*
pCancelMibChangeNotify2
)(
HANDLE
);
DWORD
WINAPI
ConvertGuidToStringA
(
const
GUID
*
,
char
*
,
DWORD
);
DWORD
WINAPI
ConvertGuidToStringW
(
const
GUID
*
,
WCHAR
*
,
DWORD
);
static
void
loadIPHlpApi
(
void
)
static
void
loadIPHlpApi
(
void
)
{
{
hLibrary
=
LoadLibraryA
(
"iphlpapi.dll"
);
hLibrary
=
LoadLibraryA
(
"iphlpapi.dll"
);
...
@@ -2331,6 +2334,26 @@ static void test_NotifyUnicastIpAddressChange(void)
...
@@ -2331,6 +2334,26 @@ static void test_NotifyUnicastIpAddressChange(void)
ok
(
!
CloseHandle
(
handle
),
"CloseHandle() succeeded.
\n
"
);
ok
(
!
CloseHandle
(
handle
),
"CloseHandle() succeeded.
\n
"
);
}
}
static
void
test_ConvertGuidToString
(
void
)
{
DWORD
err
;
char
bufA
[
39
];
WCHAR
bufW
[
39
];
GUID
guid
=
{
0xa
,
0xb
,
0xc
,
{
0xd
,
0
,
0xe
,
0xf
}
};
err
=
ConvertGuidToStringA
(
&
guid
,
bufA
,
38
);
ok
(
err
,
"got %d
\n
"
,
err
);
err
=
ConvertGuidToStringA
(
&
guid
,
bufA
,
39
);
ok
(
!
err
,
"got %d
\n
"
,
err
);
ok
(
!
strcmp
(
bufA
,
"{0000000A-000B-000C-0D00-0E0F00000000}"
),
"got %s
\n
"
,
bufA
);
err
=
ConvertGuidToStringW
(
&
guid
,
bufW
,
38
);
ok
(
err
,
"got %d
\n
"
,
err
);
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
)
);
}
START_TEST
(
iphlpapi
)
START_TEST
(
iphlpapi
)
{
{
...
@@ -2363,6 +2386,7 @@ START_TEST(iphlpapi)
...
@@ -2363,6 +2386,7 @@ START_TEST(iphlpapi)
test_GetUdp6Table
();
test_GetUdp6Table
();
test_ParseNetworkString
();
test_ParseNetworkString
();
test_NotifyUnicastIpAddressChange
();
test_NotifyUnicastIpAddressChange
();
test_ConvertGuidToString
();
freeIPHlpApi
();
freeIPHlpApi
();
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment