Andrew Nguyen : kernel32: Implement GetSystemRegistryQuota as a semi-stub.

Alexandre Julliard julliard at winehq.org
Mon Oct 11 13:15:14 CDT 2010


Module: wine
Branch: master
Commit: 43e99d6e0c5c34ea61b48a745ae1d0dc86ef9bd8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=43e99d6e0c5c34ea61b48a745ae1d0dc86ef9bd8

Author: Andrew Nguyen <anguyen at codeweavers.com>
Date:   Mon Oct 11 05:16:16 2010 -0500

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 deletions(-)

diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index e4ce77e..8381ae8 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 42d038e..8bdd1d3 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 77a303c..76cc3ed 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 24f6f33..05f3a2a 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);




More information about the wine-cvs mailing list