mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
[USER32_DYNAMIC]
- Show that user32 keeps an extra reference to itself CORE-10540 svn path=/trunk/; revision=69962
This commit is contained in:
parent
1ad760737b
commit
1d90274758
1 changed files with 83 additions and 1 deletions
|
@ -6,6 +6,8 @@
|
|||
*/
|
||||
|
||||
#include <apitest.h>
|
||||
#include <ndk/pstypes.h>
|
||||
#include <ndk/rtlfuncs.h>
|
||||
|
||||
START_TEST(load)
|
||||
{
|
||||
|
@ -13,6 +15,15 @@ START_TEST(load)
|
|||
HMODULE hUser32_2;
|
||||
BOOL Ret;
|
||||
DWORD Error;
|
||||
PPEB Peb = NtCurrentPeb();
|
||||
PTEB Teb = NtCurrentTeb();
|
||||
|
||||
/* Before init */
|
||||
hUser32 = GetModuleHandleW(L"user32");
|
||||
ok(hUser32 == NULL, "hUser32 = %p\n", hUser32);
|
||||
ok(Peb->KernelCallbackTable == NULL, "KernelCallbackTable = %p\n", Peb->KernelCallbackTable);
|
||||
ok(Peb->PostProcessInitRoutine == NULL, "PostProcessInitRoutine = %p\n", Peb->PostProcessInitRoutine);
|
||||
ok(Teb->Win32ClientInfo != NULL, "Win32ClientInfo = %p\n", Teb->Win32ClientInfo);
|
||||
|
||||
SetLastError(12345);
|
||||
hUser32 = LoadLibraryW(L"user32");
|
||||
|
@ -20,30 +31,101 @@ START_TEST(load)
|
|||
ok(hUser32 != NULL, "LoadLibrary failed\n");
|
||||
ok(Error != 12345, "Error = %lu\n", Error);
|
||||
|
||||
/* Initialized */
|
||||
hUser32_2 = GetModuleHandleW(L"user32");
|
||||
ok(hUser32_2 == hUser32, "hUser32 = %p\n", hUser32);
|
||||
ok(Peb->KernelCallbackTable != NULL, "KernelCallbackTable = %p\n", Peb->KernelCallbackTable);
|
||||
ok(Peb->PostProcessInitRoutine == NULL, "PostProcessInitRoutine = %p\n", Peb->PostProcessInitRoutine);
|
||||
ok(Teb->Win32ClientInfo != NULL, "Win32ClientInfo = %p\n", Teb->Win32ClientInfo);
|
||||
|
||||
SetLastError(12345);
|
||||
hUser32_2 = LoadLibraryW(L"user32");
|
||||
Error = GetLastError();
|
||||
ok(hUser32_2 == hUser32, "LoadLibrary failed\n");
|
||||
ok(Error == 12345, "Error = %lu\n", Error);
|
||||
|
||||
/* Still initialized */
|
||||
hUser32_2 = GetModuleHandleW(L"user32");
|
||||
ok(hUser32_2 == hUser32, "hUser32 = %p\n", hUser32);
|
||||
ok(Peb->KernelCallbackTable != NULL, "KernelCallbackTable = %p\n", Peb->KernelCallbackTable);
|
||||
ok(Peb->PostProcessInitRoutine == NULL, "PostProcessInitRoutine = %p\n", Peb->PostProcessInitRoutine);
|
||||
ok(Teb->Win32ClientInfo != NULL, "Win32ClientInfo = %p\n", Teb->Win32ClientInfo);
|
||||
|
||||
SetLastError(12345);
|
||||
Ret = FreeLibrary(hUser32);
|
||||
Error = GetLastError();
|
||||
ok(Ret == TRUE, "FreeLibrary returned %d\n", Ret);
|
||||
ok(Error == 12345, "Error = %lu\n", Error);
|
||||
|
||||
/* Still initialized */
|
||||
hUser32_2 = GetModuleHandleW(L"user32");
|
||||
ok(hUser32_2 == hUser32, "hUser32 = %p\n", hUser32);
|
||||
ok(Peb->KernelCallbackTable != NULL, "KernelCallbackTable = %p\n", Peb->KernelCallbackTable);
|
||||
ok(Peb->PostProcessInitRoutine == NULL, "PostProcessInitRoutine = %p\n", Peb->PostProcessInitRoutine);
|
||||
ok(Teb->Win32ClientInfo != NULL, "Win32ClientInfo = %p\n", Teb->Win32ClientInfo);
|
||||
|
||||
SetLastError(12345);
|
||||
Ret = FreeLibrary(hUser32);
|
||||
Error = GetLastError();
|
||||
ok(Ret == TRUE, "FreeLibrary returned %d\n", Ret);
|
||||
ok(Error == 12345, "Error = %lu\n", Error);
|
||||
|
||||
/* Somebody kept an extra reference! */
|
||||
hUser32_2 = GetModuleHandleW(L"user32");
|
||||
ok(hUser32_2 == hUser32, "hUser32 = %p\n", hUser32);
|
||||
ok(Peb->KernelCallbackTable != NULL, "KernelCallbackTable = %p\n", Peb->KernelCallbackTable);
|
||||
ok(Peb->PostProcessInitRoutine == NULL, "PostProcessInitRoutine = %p\n", Peb->PostProcessInitRoutine);
|
||||
ok(Teb->Win32ClientInfo != NULL, "Win32ClientInfo = %p\n", Teb->Win32ClientInfo);
|
||||
|
||||
SetLastError(12345);
|
||||
Ret = FreeLibrary(hUser32);
|
||||
Error = GetLastError();
|
||||
ok(Ret == TRUE, "FreeLibrary returned %d\n", Ret);
|
||||
ok(Error == 12345, "Error = %lu\n", Error);
|
||||
|
||||
/* Uninitialized */
|
||||
hUser32 = GetModuleHandleW(L"user32");
|
||||
ok(hUser32 == NULL, "hUser32 = %p\n", hUser32);
|
||||
ok(Peb->KernelCallbackTable != NULL, "KernelCallbackTable = %p\n", Peb->KernelCallbackTable);
|
||||
ok(Peb->PostProcessInitRoutine == NULL, "PostProcessInitRoutine = %p\n", Peb->PostProcessInitRoutine);
|
||||
ok(Teb->Win32ClientInfo != NULL, "Win32ClientInfo = %p\n", Teb->Win32ClientInfo);
|
||||
|
||||
SetLastError(12345);
|
||||
hUser32 = LoadLibraryW(L"user32");
|
||||
Error = GetLastError();
|
||||
ok(hUser32 != NULL, "LoadLibrary failed\n");
|
||||
ok(Error == 12345, "Error = %lu\n", Error);
|
||||
ok(Error != 12345, "Error = %lu\n", Error);
|
||||
|
||||
/* Initialized again */
|
||||
hUser32_2 = GetModuleHandleW(L"user32");
|
||||
ok(hUser32_2 == hUser32, "hUser32 = %p\n", hUser32);
|
||||
ok(Peb->KernelCallbackTable != NULL, "KernelCallbackTable = %p\n", Peb->KernelCallbackTable);
|
||||
ok(Peb->PostProcessInitRoutine == NULL, "PostProcessInitRoutine = %p\n", Peb->PostProcessInitRoutine);
|
||||
ok(Teb->Win32ClientInfo != NULL, "Win32ClientInfo = %p\n", Teb->Win32ClientInfo);
|
||||
|
||||
SetLastError(12345);
|
||||
Ret = FreeLibrary(hUser32);
|
||||
Error = GetLastError();
|
||||
ok(Ret == TRUE, "FreeLibrary returned %d\n", Ret);
|
||||
ok(Error == 12345, "Error = %lu\n", Error);
|
||||
|
||||
/* Extra reference again */
|
||||
hUser32_2 = GetModuleHandleW(L"user32");
|
||||
ok(hUser32_2 == hUser32, "hUser32 = %p\n", hUser32);
|
||||
ok(Peb->KernelCallbackTable != NULL, "KernelCallbackTable = %p\n", Peb->KernelCallbackTable);
|
||||
ok(Peb->PostProcessInitRoutine == NULL, "PostProcessInitRoutine = %p\n", Peb->PostProcessInitRoutine);
|
||||
ok(Teb->Win32ClientInfo != NULL, "Win32ClientInfo = %p\n", Teb->Win32ClientInfo);
|
||||
|
||||
SetLastError(12345);
|
||||
Ret = FreeLibrary(hUser32);
|
||||
Error = GetLastError();
|
||||
ok(Ret == TRUE, "FreeLibrary returned %d\n", Ret);
|
||||
ok(Error == 12345, "Error = %lu\n", Error);
|
||||
|
||||
/* Uninitialized again */
|
||||
hUser32 = GetModuleHandleW(L"user32");
|
||||
ok(hUser32 == NULL, "hUser32 = %p\n", hUser32);
|
||||
ok(Peb->KernelCallbackTable != NULL, "KernelCallbackTable = %p\n", Peb->KernelCallbackTable);
|
||||
ok(Peb->PostProcessInitRoutine == NULL, "PostProcessInitRoutine = %p\n", Peb->PostProcessInitRoutine);
|
||||
ok(Teb->Win32ClientInfo != NULL, "Win32ClientInfo = %p\n", Teb->Win32ClientInfo);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue