ntdll/tests: Free library after use.

This commit is contained in:
Paul Vriens 2008-05-19 14:00:10 +02:00 committed by Alexandre Julliard
parent 362f2ceeaf
commit 446243b1d9
1 changed files with 17 additions and 14 deletions

View File

@ -118,26 +118,27 @@ static BOOL init_function_ptrs(void)
{ {
hntdll = LoadLibraryA("ntdll.dll"); hntdll = LoadLibraryA("ntdll.dll");
if (hntdll) if (!hntdll)
{ return FALSE;
pNtCompleteConnectPort = (void *)GetProcAddress(hntdll, "NtCompleteConnectPort");
pNtAcceptConnectPort = (void *)GetProcAddress(hntdll, "NtAcceptConnectPort"); pNtCompleteConnectPort = (void *)GetProcAddress(hntdll, "NtCompleteConnectPort");
pNtReplyPort = (void *)GetProcAddress(hntdll, "NtReplyPort"); pNtAcceptConnectPort = (void *)GetProcAddress(hntdll, "NtAcceptConnectPort");
pNtReplyWaitReceivePort = (void *)GetProcAddress(hntdll, "NtReplyWaitReceivePort"); pNtReplyPort = (void *)GetProcAddress(hntdll, "NtReplyPort");
pNtCreatePort = (void *)GetProcAddress(hntdll, "NtCreatePort"); pNtReplyWaitReceivePort = (void *)GetProcAddress(hntdll, "NtReplyWaitReceivePort");
pNtRequestWaitReplyPort = (void *)GetProcAddress(hntdll, "NtRequestWaitReplyPort"); pNtCreatePort = (void *)GetProcAddress(hntdll, "NtCreatePort");
pNtRequestPort = (void *)GetProcAddress(hntdll, "NtRequestPort"); pNtRequestWaitReplyPort = (void *)GetProcAddress(hntdll, "NtRequestWaitReplyPort");
pNtRegisterThreadTerminatePort = (void *)GetProcAddress(hntdll, "NtRegisterThreadTerminatePort"); pNtRequestPort = (void *)GetProcAddress(hntdll, "NtRequestPort");
pNtConnectPort = (void *)GetProcAddress(hntdll, "NtConnectPort"); pNtRegisterThreadTerminatePort = (void *)GetProcAddress(hntdll, "NtRegisterThreadTerminatePort");
pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString"); pNtConnectPort = (void *)GetProcAddress(hntdll, "NtConnectPort");
pNtWaitForSingleObject = (void *)GetProcAddress(hntdll, "NtWaitForSingleObject"); pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString");
} pNtWaitForSingleObject = (void *)GetProcAddress(hntdll, "NtWaitForSingleObject");
if (!pNtCompleteConnectPort || !pNtAcceptConnectPort || if (!pNtCompleteConnectPort || !pNtAcceptConnectPort ||
!pNtReplyWaitReceivePort || !pNtCreatePort || !pNtRequestWaitReplyPort || !pNtReplyWaitReceivePort || !pNtCreatePort || !pNtRequestWaitReplyPort ||
!pNtRequestPort || !pNtRegisterThreadTerminatePort || !pNtRequestPort || !pNtRegisterThreadTerminatePort ||
!pNtConnectPort || !pRtlInitUnicodeString) !pNtConnectPort || !pRtlInitUnicodeString)
{ {
FreeLibrary(hntdll);
return FALSE; return FALSE;
} }
@ -309,4 +310,6 @@ START_TEST(port)
test_ports_server(); test_ports_server();
CloseHandle(thread); CloseHandle(thread);
FreeLibrary(hntdll);
} }