shell32/tests: Use ReadCabinetState to check title logic.

This commit is contained in:
Paul Vriens 2009-11-27 16:26:22 +01:00 committed by Alexandre Julliard
parent f8134cee10
commit 98fef79f2d
1 changed files with 10 additions and 8 deletions

View File

@ -67,6 +67,7 @@
#define DDE_TEST_NUMMASK 0x0000ffff #define DDE_TEST_NUMMASK 0x0000ffff
static BOOL (WINAPI *pSHGetSpecialFolderPathA)(HWND, LPSTR, int, BOOL); static BOOL (WINAPI *pSHGetSpecialFolderPathA)(HWND, LPSTR, int, BOOL);
static BOOL (WINAPI *pReadCabinetState)(CABINETSTATE *, int);
static void init_function_pointers(void) static void init_function_pointers(void)
{ {
@ -74,6 +75,9 @@ static void init_function_pointers(void)
hmod = GetModuleHandleA("shell32.dll"); hmod = GetModuleHandleA("shell32.dll");
pSHGetSpecialFolderPathA = (void*)GetProcAddress(hmod, "SHGetSpecialFolderPathA"); pSHGetSpecialFolderPathA = (void*)GetProcAddress(hmod, "SHGetSpecialFolderPathA");
pReadCabinetState = (void*)GetProcAddress(hmod, "ReadCabinetState");
if (!pReadCabinetState)
pReadCabinetState = (void*)GetProcAddress(hmod, (LPSTR)651);
} }
static char CommonPrograms[MAX_PATH]; static char CommonPrograms[MAX_PATH];
@ -87,10 +91,8 @@ static char StartupTitle[MAX_PATH] = "Startup";
static void init_strings(void) static void init_strings(void)
{ {
HKEY key;
DWORD fullpath = 0;
DWORD size;
char startup[MAX_PATH]; char startup[MAX_PATH];
CABINETSTATE cs;
if (pSHGetSpecialFolderPathA) if (pSHGetSpecialFolderPathA)
{ {
@ -106,6 +108,8 @@ static void init_strings(void)
} }
else else
{ {
HKEY key;
DWORD size;
LONG res; LONG res;
/* Older Win9x and NT4 */ /* Older Win9x and NT4 */
@ -128,11 +132,9 @@ static void init_strings(void)
RegCloseKey(key); RegCloseKey(key);
} }
RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CabinetState", &key); memset(&cs, 0, sizeof(cs));
size = sizeof(DWORD); pReadCabinetState(&cs, sizeof(cs));
RegQueryValueExA(key, "FullPath", NULL, NULL, (LPBYTE)&fullpath, &size); if (cs.fFullPathTitle == -1)
RegCloseKey(key);
if (fullpath == 1)
{ {
lstrcpyA(Group1Title, CommonPrograms); lstrcpyA(Group1Title, CommonPrograms);
lstrcatA(Group1Title, "\\Group1"); lstrcatA(Group1Title, "\\Group1");