From 43e99d6e0c5c34ea61b48a745ae1d0dc86ef9bd8 Mon Sep 17 00:00:00 2001 From: Andrew Nguyen Date: Mon, 11 Oct 2010 05:16:16 -0500 Subject: [PATCH] kernel32: Implement GetSystemRegistryQuota as a semi-stub. --- dlls/kernel32/kernel32.spec | 2 +- dlls/kernel32/kernel_main.c | 16 ++++++++++++++++ dlls/kernel32/tests/process.c | 31 +++++++++++++++++++++++++++++++ include/winbase.h | 1 + 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index e4ce77ebe05..8381ae82d96 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -630,7 +630,7 @@ @ stdcall GetSystemDirectoryW(ptr long) @ stdcall GetSystemInfo(ptr) @ stdcall GetSystemPowerStatus(ptr) -# @ stub GetSystemRegistryQuota +@ stdcall GetSystemRegistryQuota(ptr ptr) @ stdcall GetSystemTime(ptr) @ stdcall GetSystemTimeAdjustment(ptr ptr ptr) @ stdcall GetSystemTimeAsFileTime(ptr) diff --git a/dlls/kernel32/kernel_main.c b/dlls/kernel32/kernel_main.c index 42d038e7bfb..8bdd1d34fb7 100644 --- a/dlls/kernel32/kernel_main.c +++ b/dlls/kernel32/kernel_main.c @@ -207,3 +207,19 @@ DWORD WINAPI GetTickCount(void) { return GetTickCount64(); } + +/****************************************************************************** + * GetSystemRegistryQuota (KERNEL32.@) + */ +BOOL WINAPI GetSystemRegistryQuota(PDWORD pdwQuotaAllowed, PDWORD pdwQuotaUsed) +{ + FIXME("(%p, %p) faking reported quota values\n", pdwQuotaAllowed, pdwQuotaUsed); + + if (pdwQuotaAllowed) + *pdwQuotaAllowed = 2 * 1000 * 1000 * 1000; /* 2 GB */ + + if (pdwQuotaUsed) + *pdwQuotaUsed = 100 * 1000 * 1000; /* 100 MB */ + + return TRUE; +} diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index 77a303c788a..76cc3ed5e5d 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -56,6 +56,7 @@ static HINSTANCE hkernel32; static void (WINAPI *pGetNativeSystemInfo)(LPSYSTEM_INFO); +static BOOL (WINAPI *pGetSystemRegistryQuota)(PDWORD, PDWORD); static BOOL (WINAPI *pIsWow64Process)(HANDLE,PBOOL); static LPVOID (WINAPI *pVirtualAllocEx)(HANDLE, LPVOID, SIZE_T, DWORD, DWORD); static BOOL (WINAPI *pVirtualFreeEx)(HANDLE, LPVOID, SIZE_T, DWORD); @@ -197,6 +198,7 @@ static int init(void) hkernel32 = GetModuleHandleA("kernel32"); pGetNativeSystemInfo = (void *) GetProcAddress(hkernel32, "GetNativeSystemInfo"); + pGetSystemRegistryQuota = (void *) GetProcAddress(hkernel32, "GetSystemRegistryQuota"); pIsWow64Process = (void *) GetProcAddress(hkernel32, "IsWow64Process"); pVirtualAllocEx = (void *) GetProcAddress(hkernel32, "VirtualAllocEx"); pVirtualFreeEx = (void *) GetProcAddress(hkernel32, "VirtualFreeEx"); @@ -1831,6 +1833,34 @@ static void test_SystemInfo(void) } } +static void test_RegistryQuota(void) +{ + BOOL ret; + DWORD max_quota, used_quota; + + if (!pGetSystemRegistryQuota) + { + win_skip("GetSystemRegistryQuota is not available\n"); + return; + } + + ret = pGetSystemRegistryQuota(NULL, NULL); + ok(ret == TRUE, + "Expected GetSystemRegistryQuota to return TRUE, got %d\n", ret); + + ret = pGetSystemRegistryQuota(&max_quota, NULL); + ok(ret == TRUE, + "Expected GetSystemRegistryQuota to return TRUE, got %d\n", ret); + + ret = pGetSystemRegistryQuota(NULL, &used_quota); + ok(ret == TRUE, + "Expected GetSystemRegistryQuota to return TRUE, got %d\n", ret); + + ret = pGetSystemRegistryQuota(&max_quota, &used_quota); + ok(ret == TRUE, + "Expected GetSystemRegistryQuota to return TRUE, got %d\n", ret); +} + START_TEST(process) { int b = init(); @@ -1856,6 +1886,7 @@ START_TEST(process) test_ProcessName(); test_Handles(); test_SystemInfo(); + test_RegistryQuota(); /* things that can be tested: * lookup: check the way program to be executed is searched * handles: check the handle inheritance stuff (+sec options) diff --git a/include/winbase.h b/include/winbase.h index 24f6f33d18a..05f3a2a3375 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -1755,6 +1755,7 @@ WINBASEAPI UINT WINAPI GetSystemDirectoryW(LPWSTR,UINT); #define GetSystemDirectory WINELIB_NAME_AW(GetSystemDirectory) WINBASEAPI VOID WINAPI GetSystemInfo(LPSYSTEM_INFO); WINBASEAPI BOOL WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS); +WINBASEAPI BOOL WINAPI GetSystemRegistryQuota(PDWORD,PDWORD); WINBASEAPI VOID WINAPI GetSystemTime(LPSYSTEMTIME); WINBASEAPI BOOL WINAPI GetSystemTimeAdjustment(PDWORD,PDWORD,PBOOL); WINBASEAPI VOID WINAPI GetSystemTimeAsFileTime(LPFILETIME); -- 2.11.4.GIT