From 2f7504e717f613c6a131857c1448c654c71afb98 Mon Sep 17 00:00:00 2001 From: Saulius Krasuckas Date: Thu, 19 Jan 2006 12:44:02 +0100 Subject: [PATCH] mscms: Check an appropriate registry key. --- dlls/mscms/tests/Makefile.in | 2 +- dlls/mscms/tests/profile.c | 55 ++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/dlls/mscms/tests/Makefile.in b/dlls/mscms/tests/Makefile.in index 70a66959f64..db5e9901112 100644 --- a/dlls/mscms/tests/Makefile.in +++ b/dlls/mscms/tests/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../../.. SRCDIR = @srcdir@ VPATH = @srcdir@ TESTDLL = mscms.dll -IMPORTS = kernel32 +IMPORTS = advapi32 kernel32 CTESTS = \ profile.c diff --git a/dlls/mscms/tests/profile.c b/dlls/mscms/tests/profile.c index 39f90a7302b..5881891a183 100644 --- a/dlls/mscms/tests/profile.c +++ b/dlls/mscms/tests/profile.c @@ -22,6 +22,7 @@ #include "windef.h" #include "winbase.h" +#include "winreg.h" #include "winnls.h" #include "wingdi.h" #include "winuser.h" @@ -496,6 +497,59 @@ static void enum_registered_color_profiles(void) trace("\n"); } +static HKEY reg_open_mscms_key(void) +{ + char win9x[] = "SOFTWARE\\Microsoft\\Windows"; + char winNT[] = "SOFTWARE\\Microsoft\\Windows NT"; + char ICM[] = "CurrentVersion\\ICM\\RegisteredProfiles"; + HKEY win9x_key, winNT_key, ICM_key; + + RegOpenKeyExA( HKEY_LOCAL_MACHINE, win9x, 0, KEY_READ, &win9x_key ); + RegOpenKeyExA( HKEY_LOCAL_MACHINE, winNT, 0, KEY_READ, &winNT_key ); + + if (RegOpenKeyExA( winNT_key, ICM, 0, KEY_READ, &ICM_key )) + RegOpenKeyExA( win9x_key, ICM, 0, KEY_READ, &ICM_key ); + RegCloseKey( win9x_key ); + RegCloseKey( winNT_key ); + + if ( !ICM_key ) return NULL; + return ICM_key; +} + +static void check_registry(void) +{ + HKEY hkIcmKey; + LONG res; + DWORD i, dwValCount; + char szName[16383]; + char szData[MAX_PATH+1]; + DWORD dwNameLen, dwDataLen, dwType; + + hkIcmKey = reg_open_mscms_key(); + if (!hkIcmKey) + { + trace("Key 'HKLM\\SOFTWARE\\Microsoft\\Windows*\\CurrentVersion\\ICM\\RegisteredProfiles' not found\n" ); + return; + } + + res = RegQueryInfoKeyA(hkIcmKey, NULL, NULL, NULL, NULL, NULL, NULL, &dwValCount, NULL, NULL, NULL, NULL); + trace("Count of profile entries found directly in the registry: %ld\n", dwValCount); + if (dwValCount<1) return; + + for (i = 0; i