10#define WIN32_NO_STATUS
15DEFINE_GUID(MY_TEST_GUID, 0x8D1AB70F, 0xADF0, 0x49FC, 0x9D, 0x07, 0x4E, 0x89, 0x29, 0x2D, 0xC5, 0x2B);
29 GUID UniqueGUID = MY_TEST_GUID;
37 ulOutBufLen =
sizeof(
Name);
39 ApiReturn = pNhGetInterfaceNameFromGuid(
NULL, &
Name, &ulOutBufLen, par1, par2);
45 "GetLastError() returned %ld, expected 0xbeeffeed\n",
47 ok(ulOutBufLen ==
sizeof(
Name),
48 "ulOutBufLen is %ld, expected = sizeof(Name)\n",
55 ApiReturn = pNhGetInterfaceNameFromGuid(&AdapterGUID,
NULL, &ulOutBufLen, par1, par2);
61 "ulOutBufLen is %ld, expected > 0\n",
69 ApiReturn = 0xdeadbeef;
71 ApiReturn = pNhGetInterfaceNameFromGuid(&AdapterGUID, &
Name,
NULL, par1, par2);
75 ok(ApiReturn == 0xdeadbeef,
76 "ApiReturn returned %ld, expected 0xdeadbeef\n",
79 "GetLastError() returned %ld, expected 0xbeeffeed\n",
82 "ulOutBufLen is %ld, expected > 0\n",
89 ulOutBufLen =
sizeof(
Name);
90 ApiReturn = pNhGetInterfaceNameFromGuid(&AdapterGUID, &
Name, &ulOutBufLen, par1, par2);
94 "ApiReturn returned %ld, expected ERROR_SUCCESS\n",
98 "ulOutBufLen is %ld, expected > 0\n",
102 "wcslen(Name) is %ld, expected > 0\n",
110 ulOutBufLen =
sizeof(
Name);
111 ApiReturn = pNhGetInterfaceNameFromGuid((
PVOID)&UniqueGUID, &
Name, &ulOutBufLen, par1, par2);
120 ok(ulOutBufLen ==
sizeof(
Name),
121 "ulOutBufLen is %ld, expected = sizeof(Name)\n",
129 ApiReturn = pNhGetInterfaceNameFromGuid(&AdapterGUID, &
Name, &ulOutBufLen, par1, par2);
148 GUID UniqueGUID = MY_TEST_GUID;
157 ulOutBufLen =
sizeof(
Name);
159 ApiReturn = pNhGetInterfaceNameFromDeviceGuid(
NULL, &
Name, &ulOutBufLen, par1, par2);
165 "GetLastError() returned %ld, expected ERROR_SUCCESS\n",
167 ok(ulOutBufLen ==
sizeof(
Name),
168 "ulOutBufLen is %ld, expected = sizeof(Name)\n",
178 ApiReturn = pNhGetInterfaceNameFromDeviceGuid(&AdapterGUID,
NULL, &ulOutBufLen, par1, par2);
185 "ulOutBufLen is %ld, expected > 0\n",
195 ApiReturn = pNhGetInterfaceNameFromDeviceGuid(&AdapterGUID, &
Name,
NULL, par1, par2);
202 "ulOutBufLen is %ld, expected > 0\n",
209 ulOutBufLen =
sizeof(
Name);
210 ApiReturn = pNhGetInterfaceNameFromDeviceGuid(&AdapterGUID, &
Name, &ulOutBufLen, par1, par2);
214 "ApiReturn returned %ld, expected ERROR_SUCCESS\n",
217 "GetLastError() returned %ld, expected ERROR_SUCCESS\n",
220 "ulOutBufLen is %ld, expected > 0\n",
224 "wcslen(Name) is %ld, expected > 0\n",
232 ulOutBufLen =
sizeof(
Name);
233 ApiReturn = pNhGetInterfaceNameFromDeviceGuid((
PVOID)&UniqueGUID, &
Name, &ulOutBufLen, par1, par2);
238 "GetLastError() returned %ld, expected ERROR_SUCCESS\n",
240 ok(ulOutBufLen ==
sizeof(
Name),
241 "ulOutBufLen is %ld, expected = sizeof(Name)\n",
249 ApiReturn = pNhGetInterfaceNameFromDeviceGuid(&AdapterGUID, &
Name, &ulOutBufLen, par1, par2);
254 "GetLastError() returned %ld, expected ERROR_SUCCESS\n",
265 ULONG ulOutBufLen = 0;
274 "GetInterfaceInfo(pInfo, &ulOutBufLen) returned %ld, expected ERROR_INSUFFICIENT_BUFFER\n",
278 skip(
"Can't determine size of IP_INTERFACE_INFO. Can't proceed\n");
285 skip(
"pInfo is NULL. Can't proceed\n");
291 "GetInterfaceInfo(pInfo, &ulOutBufLen) returned %ld, expected NO_ERROR\n",
293 if (ApiReturn !=
NO_ERROR || ulOutBufLen == 0)
295 skip(
"GetInterfaceInfo failed with error %ld. Can't proceed\n", ApiReturn);
305 skip(
"pInfo->NumAdapters = 0. Can't proceed\n");
314 "wcsncmp(Name, L\"\\DEVICE\\TCPIP_\", 14) returned %ld, expected 0\n",
320 skip(
"pInfo->Adapter[0].Name is empty. Can't proceed\n");
326 trace(
"pInfo->Adapter[0].Name = \"%ls\" is incorrect.\n",
Name);
338 skip(
"RtlGUIDFromString failed. Can't proceed\n");
345 skip(
"Failed to load iphlpapi.dll. Can't proceed\n");
349 pNhGetInterfaceNameFromGuid = (
void *)
GetProcAddress(hIpHlpApi,
"NhGetInterfaceNameFromGuid");
351 if (!pNhGetInterfaceNameFromGuid)
352 skip(
"NhGetInterfaceNameFromGuid not found. Can't proceed\n");
356 pNhGetInterfaceNameFromDeviceGuid = (
void *)
GetProcAddress(hIpHlpApi,
"NhGetInterfaceNameFromDeviceGuid");
358 if (!pNhGetInterfaceNameFromDeviceGuid)
359 skip(
"NhGetInterfaceNameFromDeviceGuid not found. Can't proceed\n");
bool GetInterfaceName(const WCHAR *InterfaceString, WCHAR *buf, size_t size)
static VOID test_NhGetInterfaceNameFromDeviceGuid(GUID AdapterGUID, DWORD par1, DWORD par2)
static VOID test_NhGetInterfaceNameFromGuid(GUID AdapterGUID, DWORD par1, DWORD par2)
static VOID test_GetInterfaceName(VOID)
#define EndSeh(ExpectedStatus)
#define ok_long(expression, result)
#define ERROR_NOT_ENOUGH_MEMORY
#define ERROR_INSUFFICIENT_BUFFER
#define ERROR_INVALID_PARAMETER
#define GetProcAddress(x, y)
#define HeapFree(x, y, z)
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
#define MAX_INTERFACE_NAME_LEN
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSYSAPI NTSTATUS WINAPI RtlGUIDFromString(PUNICODE_STRING, GUID *)
DWORD WINAPI GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable, PULONG dwOutBufLen)
#define ERROR_FILE_NOT_FOUND
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define STATUS_ACCESS_VIOLATION
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
DWORD WINAPI GetVersion()
_Check_return_ _CRTIMP int __cdecl wcsncmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
WCHAR Name[MAX_ADAPTER_NAME]
IP_ADAPTER_INDEX_MAP Adapter[1]
DWORD WINAPI GetLastError(void)