shell32/tests: Fix crash on ancient Win95.

This commit is contained in:
Paul Vriens 2010-01-19 16:02:26 +01:00 committed by Alexandre Julliard
parent 72393c55e9
commit 83c422e111
1 changed files with 25 additions and 5 deletions

View File

@ -102,6 +102,30 @@ static BOOL use_common(void)
return TRUE;
}
static BOOL full_title(void)
{
CABINETSTATE cs;
memset(&cs, 0, sizeof(cs));
if (pReadCabinetState)
{
pReadCabinetState(&cs, sizeof(cs));
}
else
{
HKEY key;
DWORD size;
win_skip("ReadCabinetState is not available, reading registry directly\n");
RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CabinetState", &key);
size = sizeof(cs);
RegQueryValueExA(key, "Settings", NULL, NULL, (LPBYTE)&cs, &size);
RegCloseKey(key);
}
return (cs.fFullPathTitle == -1);
}
static char ProgramsDir[MAX_PATH];
static char Group1Title[MAX_PATH] = "Group1";
@ -115,8 +139,6 @@ static void init_strings(void)
char commonprograms[MAX_PATH];
char programs[MAX_PATH];
CABINETSTATE cs;
if (pSHGetSpecialFolderPathA)
{
pSHGetSpecialFolderPathA(NULL, programs, CSIDL_PROGRAMS, FALSE);
@ -153,9 +175,7 @@ static void init_strings(void)
else
lstrcpyA(ProgramsDir, programs);
memset(&cs, 0, sizeof(cs));
pReadCabinetState(&cs, sizeof(cs));
if (cs.fFullPathTitle == -1)
if (full_title())
{
lstrcpyA(Group1Title, ProgramsDir);
lstrcatA(Group1Title, "\\Group1");