From d0d1f1505e186e1439f44072f4436852f139ed5d Mon Sep 17 00:00:00 2001 From: Juergen Schmied Date: Sun, 11 Apr 1999 11:39:17 +0000 Subject: [PATCH] Loading the color schema for registry. --- windows/syscolor.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/windows/syscolor.c b/windows/syscolor.c index eade0c342ee..9ff633608dc 100644 --- a/windows/syscolor.c +++ b/windows/syscolor.c @@ -13,6 +13,8 @@ #include "winuser.h" #include "debug.h" #include "tweak.h" +#include "winreg.h" +#include "winversion.h" static const char * const DefSysColors[] = { @@ -114,9 +116,26 @@ void SYSCOLOR_Init(void) char buffer[100]; p = (TWEAK_WineLook == WIN31_LOOK) ? DefSysColors : DefSysColors95; - for (i = 0; i < NUM_SYS_COLORS; i++, p += 2) - { - GetProfileStringA( "colors", p[0], p[1], buffer, 100 ); + + /* first, try to read the values from the registry */ + if (VERSION_GetVersion() != WIN31) + { HKEY hKey; + DWORD dwDataSize = 100; + + if (RegCreateKeyExA(HKEY_CURRENT_USER, "Control Panel\\Colors", 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) + return; + + for (i = 0; i < NUM_SYS_COLORS; i++) + { if (!(RegQueryValueExA(hKey, (LPSTR)(p[i*2]), 0, 0, (LPBYTE) &buffer[0], &dwDataSize))) + { if (sscanf( buffer, "%d %d %d", &r, &g, &b ) != 3) r = g = b = 0; + SYSCOLOR_SetColor( i, RGB(r,g,b) ); + } + } + RegCloseKey(hKey); + } + + for (i = 0; i < NUM_SYS_COLORS; i++) + { GetProfileStringA( "colors", p[i*2], p[i*2+1], buffer, 100 ); if (sscanf( buffer, " %d %d %d", &r, &g, &b ) != 3) r = g = b = 0; SYSCOLOR_SetColor( i, RGB(r,g,b) ); }