Replace more PROFILE_ functions by RegQueryValueExA

Dmitry Timoshkov dmitry at baikal.ru
Thu Jun 14 02:28:48 CDT 2001


Hello.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Replace more PROFILE_ functions by RegQueryValueExA.

diff -u cvs/hq/wine/windows/nonclient.c wine/windows/nonclient.c
--- cvs/hq/wine/windows/nonclient.c	Sat Jun  9 14:12:33 2001
+++ wine/windows/nonclient.c	Thu Jun 14 15:20:03 2001
@@ -20,7 +20,6 @@
 #include "hook.h"
 #include "nonclient.h"
 #include "debugtools.h"
-#include "options.h"
 #include "shellapi.h"
 #include "bitmap.h"
 
diff -u cvs/hq/wine/windows/spy.c wine/windows/spy.c
--- cvs/hq/wine/windows/spy.c	Sat Jun  9 14:12:34 2001
+++ wine/windows/spy.c	Thu Jun 14 15:18:52 2001
@@ -10,10 +10,10 @@
 #include <stdio.h>
 #include "windef.h"
 #include "wingdi.h"
+#include "winreg.h"
 #include "wine/winuser16.h"
 #include "wine/winbase16.h"
 #include "win.h"
-#include "options.h"
 #include "debugtools.h"
 #include "spy.h"
 #include "commctrl.h"
@@ -1756,10 +1756,17 @@
     int i;
     char buffer[1024];
     const SPY_NOTIFY *p;
+    HKEY hkey;
 
     if (!TRACE_ON(message)) return TRUE;
 
-    PROFILE_GetWineIniString( "Spy", "Include", "", buffer, sizeof(buffer) );
+    buffer[0] = 0;
+    if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Spy", &hkey))
+    {
+	DWORD type, count = sizeof(buffer);
+	RegQueryValueExA(hkey, "Include", 0, &type, buffer, &count);
+	RegCloseKey(hkey);
+    }
     if (buffer[0] && strcmp( buffer, "INCLUDEALL" ))
     {
         TRACE("Include=%s\n", buffer );
@@ -1767,7 +1774,13 @@
             SPY_Exclude[i] = (MessageTypeNames[i] && !strstr(buffer,MessageTypeNames[i]));
     }
 
-    PROFILE_GetWineIniString( "Spy", "Exclude", "", buffer, sizeof(buffer) );
+    buffer[0] = 0;
+    if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Spy", &hkey))
+    {
+	DWORD type, count = sizeof(buffer);
+	RegQueryValueExA(hkey, "Exclude", 0, &type, buffer, &count);
+	RegCloseKey(hkey);
+    }
     if (buffer[0])
     {
         TRACE("Exclude=%s\n", buffer );
@@ -1778,7 +1791,14 @@
                 SPY_Exclude[i] = (MessageTypeNames[i] && strstr(buffer,MessageTypeNames[i]));
     }
 
-    SPY_ExcludeDWP = PROFILE_GetWineIniInt( "Spy", "ExcludeDWP", 0 );
+    SPY_ExcludeDWP = 0;
+    if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Spy", &hkey))
+    {
+	DWORD type, count = sizeof(buffer);
+	if(!RegQueryValueExA(hkey, "ExcludeDWP", 0, &type, buffer, &count))
+	    SPY_ExcludeDWP = atoi(buffer);
+	RegCloseKey(hkey);
+    }
 
     /* find last good entry in spy notify array and save addr for b-search */
     p = &spnfy_array[0];
diff -u cvs/hq/wine/windows/sysmetrics.c wine/windows/sysmetrics.c
--- cvs/hq/wine/windows/sysmetrics.c	Thu Jan 25 03:47:57 2001
+++ wine/windows/sysmetrics.c	Thu Jun 14 15:19:02 2001
@@ -6,19 +6,40 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <assert.h>
 
 #include "windef.h"
 #include "wingdi.h"
 #include "wine/winuser16.h"
 #include "winbase.h"
+#include "winreg.h"
 #include "winuser.h"
-#include "options.h"
 #include "user.h"
 #include "sysmetrics.h"
 
 static int sysMetrics[SM_WINE_CMETRICS+1];
 
+static int SYSMETRICS_GetProfileInt(const char *section, const char *key,
+				    int default_value)
+{
+    int ret = default_value;
+    char buffer[1024];
+    HKEY hkey;
+
+    strcpy(buffer, "Software\\Wine\\Wine\\Config\\");
+    strncat(buffer, section, sizeof(buffer) - strlen(buffer));
+
+    if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, buffer, &hkey))
+    {
+	DWORD type, count = sizeof(buffer);
+	if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
+	    ret = atoi(buffer);
+	RegCloseKey(hkey);
+    }
+    return ret;
+}
+
 /***********************************************************************
  *           SYSMETRICS_Init
  *
@@ -48,21 +69,21 @@
     sysMetrics[SM_WINE_BPP] = GetDeviceCaps( hdc, BITSPIXEL );
     if (TWEAK_WineLook > WIN31_LOOK)
 	sysMetrics[SM_CXVSCROLL] =
-	    PROFILE_GetWineIniInt("Tweak.Layout", "ScrollBarWidth", 16);
+	    SYSMETRICS_GetProfileInt("Tweak.Layout", "ScrollBarWidth", 16);
     else
 	sysMetrics[SM_CXVSCROLL] =
-	    PROFILE_GetWineIniInt("Tweak.Layout", "ScrollBarWidth", 17);
+	    SYSMETRICS_GetProfileInt("Tweak.Layout", "ScrollBarWidth", 17);
     sysMetrics[SM_CYHSCROLL] = sysMetrics[SM_CXVSCROLL];
     if (TWEAK_WineLook > WIN31_LOOK)
 	sysMetrics[SM_CYCAPTION] =
-	    PROFILE_GetWineIniInt("Tweak.Layout", "CaptionHeight", 19);
+	    SYSMETRICS_GetProfileInt("Tweak.Layout", "CaptionHeight", 19);
     else
 	sysMetrics[SM_CYCAPTION] =
-	    PROFILE_GetWineIniInt("Tweak.Layout", "CaptionHeight", 20);
+	    SYSMETRICS_GetProfileInt("Tweak.Layout", "CaptionHeight", 20);
     sysMetrics[SM_CXBORDER] = 1;
     sysMetrics[SM_CYBORDER] = sysMetrics[SM_CXBORDER];
     sysMetrics[SM_CXDLGFRAME] =
-	PROFILE_GetWineIniInt("Tweak.Layout", "DialogFrameWidth",
+	SYSMETRICS_GetProfileInt("Tweak.Layout", "DialogFrameWidth",
 			      (TWEAK_WineLook > WIN31_LOOK) ? 3 : 4);
     sysMetrics[SM_CYDLGFRAME] = sysMetrics[SM_CXDLGFRAME];
     sysMetrics[SM_CYVTHUMB] = sysMetrics[SM_CXVSCROLL] - 1;
@@ -71,10 +92,10 @@
     sysMetrics[SM_CYICON] = 32;
     if (TWEAK_WineLook > WIN31_LOOK)
 	sysMetrics[SM_CYMENU] =
-	    PROFILE_GetWineIniInt("Tweak.Layout", "MenuHeight", 19);
+	    SYSMETRICS_GetProfileInt("Tweak.Layout", "MenuHeight", 19);
     else
 	sysMetrics[SM_CYMENU] =
-	    PROFILE_GetWineIniInt("Tweak.Layout", "MenuHeight", 18);
+	    SYSMETRICS_GetProfileInt("Tweak.Layout", "MenuHeight", 18);
     sysMetrics[SM_CXFULLSCREEN] = sysMetrics[SM_CXSCREEN];
     sysMetrics[SM_CYFULLSCREEN] =
 	sysMetrics[SM_CYSCREEN] - sysMetrics[SM_CYCAPTION];
diff -u cvs/hq/wine/windows/win.c wine/windows/win.c
--- cvs/hq/wine/windows/win.c	Sat Jun  9 14:12:34 2001
+++ wine/windows/win.c	Thu Jun 14 15:20:09 2001
@@ -10,7 +10,6 @@
 #include "wine/winbase16.h"
 #include "wine/winuser16.h"
 #include "wine/unicode.h"
-#include "options.h"
 #include "win.h"
 #include "heap.h"
 #include "user.h"
diff -u cvs/hq/wine/windows/winpos.c wine/windows/winpos.c
--- cvs/hq/wine/windows/winpos.c	Sat Jun  9 14:12:34 2001
+++ wine/windows/winpos.c	Thu Jun 14 15:20:15 2001
@@ -19,7 +19,6 @@
 #include "hook.h"
 #include "message.h"
 #include "queue.h"
-#include "options.h"
 #include "winpos.h"
 #include "dce.h"
 #include "nonclient.h"






More information about the wine-patches mailing list