[NTDLL_APITEST]

Add/refine RtlDoesFileExists* and RtlDosSearchPath_U APIs tests.
CORE-6373 #comment Tests for RtlDoesFileExists* and RtlDosSearchPath_U APIs added in revision 62640.

svn path=/trunk/; revision=62640
This commit is contained in:
Hermès Bélusca-Maïto 2014-04-05 23:58:54 +00:00
parent 9483e8b29c
commit df6836cce4
2 changed files with 300 additions and 63 deletions

View file

@ -139,11 +139,27 @@ START_TEST(RtlDoesFileExists)
{ L"C:\\/\\%ls", TRUE },
{ L"C:\\%ls\\", TRUE },
{ L"C:\\%ls\\ThisFolderExists", TRUE },
{ L"C:\\%ls\\ThisFolderExists ", TRUE },
{ L"C:\\%ls\\ThisFolderExists ", TRUE },
{ L"C:\\%ls\\ThisFolderExists ", TRUE },
{ L"C:\\%ls\\ThisFolderExists:", FALSE },
{ L"C:\\%ls\\ThisFolderExists\t", FALSE },
{ L"C:\\%ls\\ThisFolderExists\n", FALSE },
{ L"C:\\%ls\\ThisFolderExists\r", FALSE },
{ L" C:\\%ls\\ThisFolderExists", FALSE },
{ L"C:\\%ls\\ ThisFolderExists", FALSE },
{ L"C:\\%ls \\ThisFolderExists", FALSE },
{ L"C:\\%ls\\ThisDoesntExist", FALSE },
{ L"C:\\\\%ls\\\\ThisFolderExists", TRUE },
{ L"C:\\%ls\\ThisFolderExists\\ThisFileExists", TRUE },
{ L"c:\\%ls\\thisfolderexists\\thisfileexists", TRUE },
{ L"C:\\%ls\\THISFOLDEREXISTS\\THISFILEEXISTS", TRUE },
{ L"C:\\%ls\\ThisFolderExists\\SomeProgram.exe",TRUE },
{ L"C:\\%ls\\ThisFolderExists\\SomeProgram", FALSE },
{ L"C:\\%ls\\ThisFolderExists\\With", FALSE },
{ L"C:\\%ls\\ThisFolderExists\\With Space", TRUE },
{ L"C:\\%ls\\ThisFolderExists\\Without", TRUE },
{ L"C:\\%ls\\ThisFolderExists\\Without Space", FALSE },
{ L"C:\\%ls abc", FALSE },
{ L"\"C:\\%ls\" abc", FALSE },
{ L"\"C:\\\"", FALSE },
@ -251,6 +267,21 @@ START_TEST(RtlDoesFileExists)
CloseHandle(Handle);
}
swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\SomeProgram.exe", CustomPath);
Handle = CreateFileW(FileName, 0, 0, NULL, CREATE_NEW, 0, NULL);
ok(Handle != INVALID_HANDLE_VALUE, "CreateFile failed, results might not be accurate\n");
if (Handle != INVALID_HANDLE_VALUE) CloseHandle(Handle);
swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\With Space", CustomPath);
Handle = CreateFileW(FileName, 0, 0, NULL, CREATE_NEW, 0, NULL);
ok(Handle != INVALID_HANDLE_VALUE, "CreateFile failed, results might not be accurate\n");
if (Handle != INVALID_HANDLE_VALUE) CloseHandle(Handle);
swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\Without", CustomPath);
Handle = CreateFileW(FileName, 0, 0, NULL, CREATE_NEW, 0, NULL);
ok(Handle != INVALID_HANDLE_VALUE, "CreateFile failed, results might not be accurate\n");
if (Handle != INVALID_HANDLE_VALUE) CloseHandle(Handle);
for (i = 0; i < sizeof(Tests) / sizeof(Tests[0]); i++)
{
swprintf(FileName, Tests[i].FileName, CustomPath);
@ -301,13 +332,23 @@ START_TEST(RtlDoesFileExists)
}
}
swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\Without", CustomPath);
Success = DeleteFileW(FileName);
ok(Success, "DeleteFile failed (%lu), test might leave stale file\n", GetLastError());
swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\With Space", CustomPath);
Success = DeleteFileW(FileName);
ok(Success, "DeleteFile failed (%lu), test might leave stale file\n", GetLastError());
swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\SomeProgram.exe", CustomPath);
Success = DeleteFileW(FileName);
ok(Success, "DeleteFile failed (%lu), test might leave stale file\n", GetLastError());
swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\ThisFileExists", CustomPath);
Success = DeleteFileW(FileName);
ok(Success, "DeleteFile failed, test might leave stale file\n");
ok(Success, "DeleteFile failed (%lu), test might leave stale file\n", GetLastError());
swprintf(FileName, L"C:\\%ls\\ThisFolderExists", CustomPath);
Success = RemoveDirectoryW(FileName);
ok(Success, "RemoveDirectory failed, test might leave stale directory\n");
ok(Success, "RemoveDirectory failed (%lu), test might leave stale directory\n", GetLastError());
swprintf(FileName, L"C:\\%ls", CustomPath);
Success = RemoveDirectoryW(FileName);
ok(Success, "RemoveDirectory failed, test might leave stale directory\n");
ok(Success, "RemoveDirectory failed (%lu), test might leave stale directory\n", GetLastError());
}

View file

@ -24,6 +24,8 @@ RtlDosSearchPath_U(
);
*/
#define PrintablePointer(p) ((p) == InvalidPointer ? NULL : (p))
static
BOOLEAN
CheckStringBuffer(
@ -92,6 +94,218 @@ CheckBuffer(
return TRUE;
}
static
VOID
RunTestCases(
PCWSTR CustomPath)
{
struct
{
PCWSTR SearchPath;
PCWSTR FileName;
PCWSTR Extension;
PCWSTR ResultPath;
PCWSTR ResultFileName;
} Tests[] =
{
{ L"", L"", NULL, NULL, NULL },
{ L"C:\\%ls\\Folder1", L"File1", NULL, L"C:\\%ls\\Folder1\\", L"File1" },
/* No path: current directory */
{ L"", L"File1", NULL, L"C:\\%ls\\CurrentDirectory\\", L"File1" },
/* Full path as FileName */
{ L"", L"C:\\", NULL, L"C:\\", NULL },
{ L"", L"C:\\%ls\\Folder1", NULL, L"C:\\%ls\\", L"Folder1" },
/* No FileName */
{ L"C:\\", L"", NULL, L"C:\\", NULL },
{ L"C:\\%ls\\Folder1", L"", NULL, L"C:\\%ls\\Folder1\\", NULL },
/* Full path as FileName */
{ L"", L"C:\\%ls\\Folder1\\SomeProgram.exe", NULL, L"C:\\%ls\\Folder1\\", L"SomeProgram.exe" },
{ L"", L"C:\\%ls\\Folder1\\SomeProgram.exe", L".exe", L"C:\\%ls\\Folder1\\", L"SomeProgram.exe" },
{ L"", L"C:\\%ls\\Folder1\\SomeProgram", NULL, NULL, NULL },
// 10
{ L"", L"C:\\%ls\\Folder1\\SomeProgram", L".exe", NULL, NULL },
/* Both SearchPath and FileName */
{ L"C:\\%ls\\Folder1\\", L"SomeProgram.exe", NULL, L"C:\\%ls\\Folder1\\", L"SomeProgram.exe" },
{ L"C:\\%ls\\Folder1\\", L"SomeProgram.exe", L".exe", L"C:\\%ls\\Folder1\\", L"SomeProgram.exe" },
{ L"C:\\%ls\\Folder1\\", L"SomeProgram", NULL, NULL, NULL },
{ L"C:\\%ls\\Folder1\\", L"SomeProgram", L".exe", L"C:\\%ls\\Folder1\\", L"SomeProgram.exe" },
{ L"C:\\%ls\\Folder1", L"SomeProgram.exe", NULL, L"C:\\%ls\\Folder1\\", L"SomeProgram.exe" },
{ L"C:\\%ls\\Folder1", L"SomeProgram.exe", L".exe", L"C:\\%ls\\Folder1\\", L"SomeProgram.exe" },
{ L"C:\\%ls\\Folder1", L"SomeProgram", NULL, NULL, NULL },
{ L"C:\\%ls\\Folder1", L"SomeProgram", L".exe", L"C:\\%ls\\Folder1\\", L"SomeProgram.exe" },
/* Full path to file in SearchPath doesn't work */
{ L"C:\\%ls\\Folder1\\SomeProgram.exe", L"", NULL, NULL, NULL },
// 20
{ L"C:\\%ls\\Folder1\\SomeProgram.exe", L"", L".exe", NULL, NULL },
{ L"C:\\%ls\\Folder1\\SomeProgram", L"", NULL, NULL, NULL },
{ L"C:\\%ls\\Folder1\\SomeProgram", L"", L".exe", NULL, NULL },
/* */
{ L"C:\\%ls\\Folder1", L"File1", NULL, L"C:\\%ls\\Folder1\\", L"File1" },
{ L"C:\\%ls\\CurrentDirectory", L"File1", NULL, L"C:\\%ls\\CurrentDirectory\\", L"File1" },
{ L"C:\\%ls\\Folder1 ", L"File1", NULL, NULL, NULL },
{ L"C:\\%ls\\CurrentDirectory ",L"File1", NULL, NULL, NULL },
{ L" C:\\%ls\\Folder1", L"File1", NULL, NULL, NULL },
{ L" C:\\%ls\\CurrentDirectory",L"File1", NULL, NULL, NULL },
{ L" C:\\%ls\\Folder1 ", L"File1", NULL, NULL, NULL },
// 30
{ L" C:\\%ls\\CurrentDirectory ",L"File1", NULL, NULL, NULL },
/* Multiple search paths */
{ L"C:\\%ls\\Folder1;C:\\%ls\\CurrentDirectory",
L"File1", NULL, L"C:\\%ls\\Folder1\\", L"File1" },
{ L"C:\\%ls\\CurrentDirectory;C:\\%ls\\Folder1",
L"File1", NULL, L"C:\\%ls\\CurrentDirectory\\", L"File1" },
{ L"C:\\%ls\\CurrentDirectory ; C:\\%ls\\Folder1",
L"File1", NULL, NULL, NULL },
{ L"C:\\%ls\\CurrentDirectory ;C:\\%ls\\Folder1",
L"File1", NULL, L"C:\\%ls\\Folder1\\", L"File1" },
{ L"C:\\%ls\\CurrentDirectory; C:\\%ls\\Folder1",
L"File1", NULL, L"C:\\%ls\\CurrentDirectory\\", L"File1" },
{ L";C:\\%ls\\Folder1", L"File1", NULL, L"C:\\%ls\\CurrentDirectory\\", L"File1" },
{ L";C:\\%ls\\Folder1;", L"File1", NULL, L"C:\\%ls\\CurrentDirectory\\", L"File1" },
{ L";C:\\%ls\\Folder1;", L"File1", NULL, L"C:\\%ls\\CurrentDirectory\\", L"File1" },
{ L"C:\\%ls\\Folder1", L"OnlyInCurr", NULL, NULL, NULL },
// 40
{ L"", L"OnlyInCurr", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
{ L"", L"OnlyInCurr ", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
{ L"", L" OnlyInCurr", NULL, NULL, NULL },
{ L" ", L"OnlyInCurr", NULL, NULL, NULL },
{ L";", L"OnlyInCurr", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
{ L"; ", L"OnlyInCurr", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
{ L" ;", L"OnlyInCurr", NULL, NULL, NULL },
{ L" ; ", L"OnlyInCurr", NULL, NULL, NULL },
{ L";C:\\%ls\\Folder1", L"OnlyInCurr", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
{ L"C:\\%ls\\Folder1;", L"OnlyInCurr", NULL, NULL, NULL },
// 50
{ L"C:\\%ls\\Folder1;;", L"OnlyInCurr", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
{ L";C:\\%ls\\Folder1;", L"OnlyInCurr", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
{ L"C:\\%ls\\Folder1;C:\\%ls\\Folder2",
L"OnlyInCurr", NULL, NULL, NULL },
{ L";C:\\%ls\\Folder1;C:\\%ls\\Folder2",
L"OnlyInCurr", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
{ L"C:\\%ls\\Folder1;;C:\\%ls\\Folder2",
L"OnlyInCurr", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
{ L"C:\\%ls\\Folder1;C:\\%ls\\Folder2;",
L"OnlyInCurr", NULL, NULL, NULL },
{ L"C:\\%ls\\Folder1;C:\\%ls\\Folder2;;",
L"OnlyInCurr", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
/* Spaces in FileName! */
{ L"", L"C:\\%ls\\Folder1\\SomeProgram With Spaces",
L".exe", NULL, NULL },
{ L"", L"C:\\%ls\\Folder1\\SomeProgram With Spaces.exe",
L".exe", NULL, NULL },
{ L"", L"C:\\%ls\\Folder1\\Program", L".exe", NULL, NULL },
// 60
{ L"", L"C:\\%ls\\Folder1\\Program.exe", L".exe", L"C:\\%ls\\Folder1\\", L"Program.exe" },
{ L"", L"C:\\%ls\\Folder1\\Program With", L".exe", NULL, NULL },
{ L"", L"C:\\%ls\\Folder1\\Program With.exe", L".exe", L"C:\\%ls\\Folder1\\", L"Program With.exe" },
{ L"", L"C:\\%ls\\Folder1\\Program With Spaces",L".exe", NULL, NULL },
{ L"", L"C:\\%ls\\Folder1\\Program With Spaces.exe",
L".exe", L"C:\\%ls\\Folder1\\", L"Program With Spaces.exe" },
/* Same tests with path in SearchPath - now extensions are appended */
{ L"C:\\%ls\\Folder1", L"SomeProgram With Spaces",
L".exe", NULL, NULL },
{ L"C:\\%ls\\Folder1", L"SomeProgram With Spaces.exe",
L".exe", NULL, NULL },
{ L"C:\\%ls\\Folder1", L"Program", L".exe", L"C:\\%ls\\Folder1\\", L"Program.exe" },
{ L"C:\\%ls\\Folder1", L"Program.exe", L".exe", L"C:\\%ls\\Folder1\\", L"Program.exe" },
{ L"C:\\%ls\\Folder1", L"Program With", L".exe", L"C:\\%ls\\Folder1\\", L"Program With.exe" },
// 70
{ L"C:\\%ls\\Folder1", L"Program With.exe", L".exe", L"C:\\%ls\\Folder1\\", L"Program With.exe" },
{ L"C:\\%ls\\Folder1", L"Program With Spaces", L".exe", L"C:\\%ls\\Folder1\\", L"Program With Spaces.exe" },
{ L"C:\\%ls\\Folder1", L"Program With Spaces.exe",
L".exe", L"C:\\%ls\\Folder1\\", L"Program With Spaces.exe" },
};
ULONG i;
ULONG Length;
PWSTR PartName;
WCHAR SearchPath[MAX_PATH];
WCHAR FileName[MAX_PATH];
WCHAR ResultPath[MAX_PATH];
WCHAR Buffer[MAX_PATH];
BOOLEAN Okay;
for (i = 0; i < sizeof(Tests) / sizeof(Tests[0]); i++)
{
swprintf(SearchPath, Tests[i].SearchPath, CustomPath, CustomPath, CustomPath, CustomPath);
swprintf(FileName, Tests[i].FileName, CustomPath, CustomPath, CustomPath, CustomPath);
RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
PartName = InvalidPointer;
StartSeh()
Length = RtlDosSearchPath_U(SearchPath,
FileName,
Tests[i].Extension,
sizeof(Buffer),
Buffer,
&PartName);
EndSeh(STATUS_SUCCESS);
if (Tests[i].ResultPath)
{
swprintf(ResultPath, Tests[i].ResultPath, CustomPath, CustomPath, CustomPath, CustomPath);
if (Tests[i].ResultFileName)
{
ok(PartName == &Buffer[wcslen(ResultPath)],
"PartName = %p (%ls), expected %p\n",
PartName, PrintablePointer(PartName), &Buffer[wcslen(ResultPath)]);
wcscat(ResultPath, Tests[i].ResultFileName);
}
else
{
ok(PartName == NULL,
"PartName = %p (%ls), expected NULL\n",
PartName, PrintablePointer(PartName));
}
Okay = CheckStringBuffer(Buffer, Length, sizeof(Buffer), ResultPath);
ok(Okay == TRUE, "CheckStringBuffer failed. Got '%ls', expected '%ls'\n", Buffer, ResultPath);
}
else
{
Okay = CheckBuffer(Buffer, sizeof(Buffer), 0x55);
ok(Okay == TRUE, "CheckBuffer failed\n");
ok(Length == 0, "Length = %lu\n", Length);
ok(PartName == InvalidPointer,
"PartName = %p (%ls), expected %p\n",
PartName, PrintablePointer(PartName), InvalidPointer);
}
}
}
#define MAKE_DIRECTORY(path) \
do { \
swprintf(FileName, path, CustomPath); \
Success = CreateDirectoryW(FileName, NULL); \
ok(Success, "CreateDirectory failed, results might not be accurate\n"); \
} while (0)
#define MAKE_FILE(path) \
do { \
swprintf(FileName, path, CustomPath); \
Handle = CreateFileW(FileName, 0, 0, NULL, CREATE_NEW, 0, NULL); \
ok(Handle != INVALID_HANDLE_VALUE, \
"CreateFile failed, results might not be accurate\n"); \
if (Handle != INVALID_HANDLE_VALUE) CloseHandle(Handle); \
} while (0)
#define DELETE_DIRECTORY(path) \
do { \
swprintf(FileName, path, CustomPath); \
Success = RemoveDirectoryW(FileName); \
ok(Success, \
"RemoveDirectory failed (%lu), test might leave stale directory\n", \
GetLastError()); \
} while (0)
#define DELETE_FILE(path) \
do { \
swprintf(FileName, path, CustomPath); \
Success = DeleteFileW(FileName); \
ok(Success, \
"DeleteFile failed (%lu), test might leave stale file\n", \
GetLastError()); \
} while (0)
START_TEST(RtlDosSearchPath_U)
{
ULONG Length = 0;
@ -112,22 +326,30 @@ START_TEST(RtlDosSearchPath_U)
}
Success = CreateDirectoryW(FileName, NULL);
ok(Success, "CreateDirectory failed, results might not be accurate\n");
swprintf(FileName, L"C:\\%ls\\ThisFolderExists", CustomPath);
Success = CreateDirectoryW(FileName, NULL);
ok(Success, "CreateDirectory failed, results might not be accurate\n");
swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\ThisFileExists", CustomPath);
Handle = CreateFileW(FileName, 0, 0, NULL, CREATE_NEW, 0, NULL);
ok(Handle != INVALID_HANDLE_VALUE, "CreateFile failed, results might not be accurate\n");
if (Handle != INVALID_HANDLE_VALUE)
CloseHandle(Handle);
MAKE_DIRECTORY(L"C:\\%ls\\Folder1");
MAKE_DIRECTORY(L"C:\\%ls\\Folder2");
MAKE_DIRECTORY(L"C:\\%ls\\CurrentDirectory");
Success = SetCurrentDirectoryW(FileName);
ok(Success, "SetCurrentDirectory failed\n");
MAKE_FILE(L"C:\\%ls\\Folder1\\File1");
MAKE_FILE(L"C:\\%ls\\Folder1\\SomeProgram.exe");
MAKE_FILE(L"C:\\%ls\\Folder1\\SomeProgram2.exe");
MAKE_FILE(L"C:\\%ls\\Folder1\\SomeProgram2.exe.exe");
MAKE_FILE(L"C:\\%ls\\Folder1\\SomeProgram3.exe.exe");
MAKE_FILE(L"C:\\%ls\\Folder1\\Program.exe");
MAKE_FILE(L"C:\\%ls\\Folder1\\Program With.exe");
MAKE_FILE(L"C:\\%ls\\Folder1\\Program With Spaces.exe");
MAKE_FILE(L"C:\\%ls\\CurrentDirectory\\File1");
MAKE_FILE(L"C:\\%ls\\CurrentDirectory\\OnlyInCurr");
/* NULL parameters */
StartSeh() RtlDosSearchPath_U(NULL, NULL, NULL, 0, NULL, NULL); EndSeh(STATUS_ACCESS_VIOLATION);
StartSeh() Length = RtlDosSearchPath_U(NULL, L"", NULL, 0, NULL, NULL); EndSeh(STATUS_ACCESS_VIOLATION);
StartSeh() Length = RtlDosSearchPath_U(NULL, L"", NULL, 0, Buffer, NULL); EndSeh(STATUS_ACCESS_VIOLATION);
StartSeh() Length = RtlDosSearchPath_U(NULL, L"", NULL, 1, Buffer, NULL); EndSeh(STATUS_ACCESS_VIOLATION);
StartSeh() Length = RtlDosSearchPath_U(NULL, L"", NULL, 2, Buffer, NULL); EndSeh(STATUS_ACCESS_VIOLATION);
StartSeh() Length = RtlDosSearchPath_U(L"", NULL, NULL, 0, NULL, NULL); EndSeh(STATUS_ACCESS_VIOLATION);
StartSeh() RtlDosSearchPath_U(NULL, NULL, NULL, 0, NULL , NULL); EndSeh(STATUS_ACCESS_VIOLATION);
StartSeh() RtlDosSearchPath_U(NULL, L"" , NULL, 0, NULL , NULL); EndSeh(STATUS_ACCESS_VIOLATION);
StartSeh() RtlDosSearchPath_U(NULL, L"" , NULL, 0, Buffer, NULL); EndSeh(STATUS_ACCESS_VIOLATION);
StartSeh() RtlDosSearchPath_U(NULL, L"" , NULL, 1, Buffer, NULL); EndSeh(STATUS_ACCESS_VIOLATION);
StartSeh() RtlDosSearchPath_U(NULL, L"" , NULL, 2, Buffer, NULL); EndSeh(STATUS_ACCESS_VIOLATION);
StartSeh() RtlDosSearchPath_U(L"" , NULL, NULL, 0, NULL , NULL); EndSeh(STATUS_ACCESS_VIOLATION);
/* Empty strings - first one that doesn't crash */
StartSeh()
@ -161,52 +383,26 @@ START_TEST(RtlDosSearchPath_U)
Okay = CheckBuffer(Buffer, sizeof(Buffer), 0x55);
ok(Okay, "CheckBuffer failed\n");
/* Empty path string searches in current directory */
swprintf(FileName, L"C:\\%ls\\ThisFolderExists", CustomPath);
Success = SetCurrentDirectoryW(FileName);
ok(Success, "SetCurrentDirectory failed\n");
PartName = InvalidPointer;
RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
StartSeh()
Length = RtlDosSearchPath_U(L"", L"ThisFileExists", NULL, sizeof(Buffer), Buffer, &PartName);
ok(Length == wcslen(FileName) * sizeof(WCHAR) + sizeof(L"\\ThisFileExists") - sizeof(UNICODE_NULL), "Length %lu\n", Length);
EndSeh(STATUS_SUCCESS);
ok(PartName == &Buffer[wcslen(FileName) + 1], "PartName = %p\n", PartName);
wcscat(FileName, L"\\ThisFileExists");
Okay = CheckStringBuffer(Buffer, Length, sizeof(Buffer), FileName);
ok(Okay, "CheckStringBuffer failed\n");
/* Now test the actual functionality */
RunTestCases(CustomPath);
/* Absolute path in FileName is also okay */
PartName = InvalidPointer;
RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
StartSeh()
Length = RtlDosSearchPath_U(L"", L"C:\\", NULL, sizeof(Buffer), Buffer, &PartName);
ok(Length == sizeof(L"C:\\") - sizeof(UNICODE_NULL), "Length %lu\n", Length);
EndSeh(STATUS_SUCCESS);
ok(PartName == NULL, "PartName = %p\n", PartName);
Okay = CheckStringBuffer(Buffer, Length, sizeof(Buffer), L"C:\\");
ok(Okay, "CheckStringBuffer failed\n");
/* Empty FileName also works */
PartName = InvalidPointer;
RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
StartSeh()
Length = RtlDosSearchPath_U(L"C:\\", L"", NULL, sizeof(Buffer), Buffer, &PartName);
ok(Length == sizeof(L"C:\\") - sizeof(UNICODE_NULL), "Length %lu\n", Length);
EndSeh(STATUS_SUCCESS);
ok(PartName == NULL, "PartName = %p\n", PartName);
Okay = CheckStringBuffer(Buffer, Length, sizeof(Buffer), L"C:\\");
ok(Okay, "CheckStringBuffer failed\n");
/* Clean up test folder */
/*
* Clean up test folder - We can't delete it
* if our current directory is inside.
*/
SetCurrentDirectoryW(L"C:\\");
swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\ThisFileExists", CustomPath);
Success = DeleteFileW(FileName);
ok(Success, "DeleteFile failed, test might leave stale file\n");
swprintf(FileName, L"C:\\%ls\\ThisFolderExists", CustomPath);
Success = RemoveDirectoryW(FileName);
ok(Success, "RemoveDirectory failed (%lu), test might leave stale directory\n", GetLastError());
swprintf(FileName, L"C:\\%ls", CustomPath);
Success = RemoveDirectoryW(FileName);
ok(Success, "RemoveDirectory failed (%lu), test might leave stale directory\n", GetLastError());
DELETE_FILE(L"C:\\%ls\\CurrentDirectory\\OnlyInCurr");
DELETE_FILE(L"C:\\%ls\\CurrentDirectory\\File1");
DELETE_FILE(L"C:\\%ls\\Folder1\\Program With Spaces.exe");
DELETE_FILE(L"C:\\%ls\\Folder1\\Program With.exe");
DELETE_FILE(L"C:\\%ls\\Folder1\\Program.exe");
DELETE_FILE(L"C:\\%ls\\Folder1\\SomeProgram3.exe.exe");
DELETE_FILE(L"C:\\%ls\\Folder1\\SomeProgram2.exe.exe");
DELETE_FILE(L"C:\\%ls\\Folder1\\SomeProgram2.exe");
DELETE_FILE(L"C:\\%ls\\Folder1\\SomeProgram.exe");
DELETE_FILE(L"C:\\%ls\\Folder1\\File1");
DELETE_DIRECTORY(L"C:\\%ls\\CurrentDirectory");
DELETE_DIRECTORY(L"C:\\%ls\\Folder2");
DELETE_DIRECTORY(L"C:\\%ls\\Folder1");
DELETE_DIRECTORY(L"C:\\%ls");
}