Commit 25a9e2c6 authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

wlanapi: Implement WlanAllocateMemory/WlanFreeMemory with tests.

parent 4371e1c5
......@@ -46,6 +46,31 @@ DWORD WINAPI WlanOpenHandle(DWORD client_version, void *reserved, DWORD *negotia
return ERROR_CALL_NOT_IMPLEMENTED;
}
void WINAPI WlanFreeMemory(void *ptr)
{
TRACE("(%p)\n", ptr);
HeapFree(GetProcessHeap(), 0, ptr);
}
void *WINAPI WlanAllocateMemory(DWORD size)
{
void *ret;
TRACE("(%d)", size);
if (!size)
{
SetLastError(ERROR_INVALID_PARAMETER);
return NULL;
}
ret = HeapAlloc(GetProcessHeap(), 0, size);
if (!ret)
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return ret;
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, void *reserved)
{
......
......@@ -94,6 +94,23 @@ todo_wine {
}
}
static void test_WlanAllocateFreeMemory(void)
{
void *ptr;
SetLastError(0xdeadbeef);
ptr = WlanAllocateMemory(0);
ok(ptr == NULL, "Expected NULL, got %p\n", ptr);
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected 87, got %d\n", GetLastError());
ptr = WlanAllocateMemory(1024);
ok(ptr != NULL, "Expected non-NULL\n");
WlanFreeMemory(ptr);
WlanFreeMemory(NULL); /* return is void, proves that won't crash */
}
START_TEST(wlanapi)
{
HANDLE handle;
......@@ -108,4 +125,5 @@ START_TEST(wlanapi)
}
test_WlanOpenHandle();
test_WlanAllocateFreeMemory();
}
@ stub WlanAllocateMemory
@ stdcall WlanAllocateMemory(long)
@ stdcall WlanCloseHandle(ptr ptr)
@ stub WlanConnect
@ stub WlanDeleteProfile
@ stub WlanDisconnect
@ stdcall WlanEnumInterfaces(long ptr ptr)
@ stub WlanExtractPsdIEDataList
@ stub WlanFreeMemory
@ stdcall WlanFreeMemory(ptr)
@ stub WlanGetAvailableNetworkList
@ stub WlanGetFilterList
@ stub WlanGetInterfaceCapability
......
......@@ -48,5 +48,7 @@ typedef struct _WLAN_INTERFACE_INFO_LIST
DWORD WINAPI WlanCloseHandle(HANDLE, void *);
DWORD WINAPI WlanEnumInterfaces(HANDLE, void *, WLAN_INTERFACE_INFO_LIST **);
DWORD WINAPI WlanOpenHandle(DWORD, void *, DWORD *, HANDLE *);
void *WINAPI WlanAllocateMemory(DWORD);
void WINAPI WlanFreeMemory(void *);
#endif /* _WLAN_WLANAPI_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment