shell32/tests: Remove an unneeded HeapAlloc.
This commit is contained in:
parent
1c6f813bc7
commit
e5d83ac625
|
@ -320,56 +320,47 @@ static void CheckWindowCreated(const char *winName, int closeWindow, int testPar
|
||||||
static void CheckFileExistsInProgramGroups(const char *nameToCheck, int shouldExist, int isGroup,
|
static void CheckFileExistsInProgramGroups(const char *nameToCheck, int shouldExist, int isGroup,
|
||||||
const char *groupName, int testParams)
|
const char *groupName, int testParams)
|
||||||
{
|
{
|
||||||
char *path;
|
char path[MAX_PATH];
|
||||||
DWORD attributes;
|
DWORD attributes;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
path = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
|
if (testParams & DDE_TEST_COMMON)
|
||||||
if (path != NULL)
|
lstrcpyA(path, CommonPrograms);
|
||||||
{
|
else
|
||||||
if (testParams & DDE_TEST_COMMON)
|
lstrcpyA(path, Programs);
|
||||||
lstrcpyA(path, CommonPrograms);
|
|
||||||
else
|
|
||||||
lstrcpyA(path, Programs);
|
|
||||||
|
|
||||||
len = strlen(path) + strlen(nameToCheck)+1;
|
len = strlen(path) + strlen(nameToCheck)+1;
|
||||||
|
if (groupName != NULL)
|
||||||
|
{
|
||||||
|
len += strlen(groupName)+1;
|
||||||
|
}
|
||||||
|
ok (len <= MAX_PATH, "Path Too Long.%s\n", GetStringFromTestParams(testParams));
|
||||||
|
if (len <= MAX_PATH)
|
||||||
|
{
|
||||||
if (groupName != NULL)
|
if (groupName != NULL)
|
||||||
{
|
{
|
||||||
len += strlen(groupName)+1;
|
|
||||||
}
|
|
||||||
ok (len <= MAX_PATH, "Path Too Long.%s\n", GetStringFromTestParams(testParams));
|
|
||||||
if (len <= MAX_PATH)
|
|
||||||
{
|
|
||||||
if (groupName != NULL)
|
|
||||||
{
|
|
||||||
strcat(path, "\\");
|
|
||||||
strcat(path, groupName);
|
|
||||||
}
|
|
||||||
strcat(path, "\\");
|
strcat(path, "\\");
|
||||||
strcat(path, nameToCheck);
|
strcat(path, groupName);
|
||||||
attributes = GetFileAttributes(path);
|
}
|
||||||
if (!shouldExist)
|
strcat(path, "\\");
|
||||||
|
strcat(path, nameToCheck);
|
||||||
|
attributes = GetFileAttributes(path);
|
||||||
|
if (!shouldExist)
|
||||||
|
{
|
||||||
|
ok (attributes == INVALID_FILE_ATTRIBUTES , "File exists and shouldn't %s.%s\n",
|
||||||
|
path, GetStringFromTestParams(testParams));
|
||||||
|
} else {
|
||||||
|
if (attributes == INVALID_FILE_ATTRIBUTES)
|
||||||
{
|
{
|
||||||
ok (attributes == INVALID_FILE_ATTRIBUTES , "File exists and shouldn't %s.%s\n",
|
ok (FALSE, "Created File %s doesn't exist.%s\n", path, GetStringFromTestParams(testParams));
|
||||||
path, GetStringFromTestParams(testParams));
|
} else if (isGroup) {
|
||||||
|
ok (attributes & FILE_ATTRIBUTE_DIRECTORY, "%s is not a folder (attr=%x).%s\n",
|
||||||
|
path, attributes, GetStringFromTestParams(testParams));
|
||||||
} else {
|
} else {
|
||||||
if (attributes == INVALID_FILE_ATTRIBUTES)
|
ok (attributes & FILE_ATTRIBUTE_ARCHIVE, "Created File %s has wrong attributes (%x).%s\n",
|
||||||
{
|
path, attributes, GetStringFromTestParams(testParams));
|
||||||
ok (FALSE, "Created File %s doesn't exist.%s\n", path, GetStringFromTestParams(testParams));
|
|
||||||
} else if (isGroup) {
|
|
||||||
ok (attributes & FILE_ATTRIBUTE_DIRECTORY, "%s is not a folder (attr=%x).%s\n",
|
|
||||||
path, attributes, GetStringFromTestParams(testParams));
|
|
||||||
} else {
|
|
||||||
ok (attributes & FILE_ATTRIBUTE_ARCHIVE, "Created File %s has wrong attributes (%x).%s\n",
|
|
||||||
path, attributes, GetStringFromTestParams(testParams));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HeapFree(GetProcessHeap(), 0, path);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ok (FALSE, "Could not Allocate Path Buffer\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue