2012-04-25 09:52:38 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS api tests
|
|
|
|
* LICENSE: GPLv2+ - See COPYING in the top level directory
|
|
|
|
* PURPOSE: Test for RtlGetFullPathName_Ustr
|
2013-10-12 16:05:54 +00:00
|
|
|
* PROGRAMMER: Thomas Faber <thomas.faber@reactos.org>
|
2012-04-25 09:52:38 +00:00
|
|
|
*/
|
|
|
|
|
2013-09-22 19:07:35 +00:00
|
|
|
#include <apitest.h>
|
|
|
|
|
2012-04-25 09:52:38 +00:00
|
|
|
#define WIN32_NO_STATUS
|
|
|
|
#include <ndk/rtlfuncs.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
ULONG
|
|
|
|
NTAPI
|
|
|
|
RtlGetFullPathName_Ustr(
|
|
|
|
IN PCUNICODE_STRING FileName,
|
|
|
|
IN ULONG Size,
|
|
|
|
IN PWSTR Buffer,
|
|
|
|
OUT PCWSTR *ShortName,
|
|
|
|
OUT PBOOLEAN InvalidName,
|
|
|
|
OUT RTL_PATH_TYPE* PathType
|
|
|
|
);
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* This seems to be a struct of some kind in Windows 7... returns 0 or 32 in the second member */
|
|
|
|
typedef struct _PATH_TYPE_AND_UNKNOWN
|
|
|
|
{
|
|
|
|
RTL_PATH_TYPE Type;
|
|
|
|
ULONG Unknown;
|
|
|
|
} PATH_TYPE_AND_UNKNOWN;
|
|
|
|
|
|
|
|
static
|
|
|
|
ULONG
|
|
|
|
(NTAPI
|
|
|
|
*RtlGetFullPathName_Ustr)(
|
|
|
|
IN PCUNICODE_STRING FileName,
|
|
|
|
IN ULONG Size,
|
|
|
|
IN PWSTR Buffer,
|
|
|
|
OUT PCWSTR *ShortName,
|
|
|
|
OUT PBOOLEAN InvalidName,
|
2012-04-25 12:13:38 +00:00
|
|
|
OUT PATH_TYPE_AND_UNKNOWN *PathType
|
2012-04-25 09:52:38 +00:00
|
|
|
)
|
|
|
|
//= (PVOID)0x7c83086c // 2003 sp1 x86
|
2012-05-01 16:19:17 +00:00
|
|
|
//= (PVOID)0x77ef49f0 // 2003 sp1 x64
|
2012-04-25 09:52:38 +00:00
|
|
|
//= (PVOID)0x7769a3dd // win7 sp1 wow64
|
|
|
|
;
|
|
|
|
|
|
|
|
#define ok_eq_ustr(str1, str2) do { \
|
|
|
|
ok((str1)->Buffer == (str2)->Buffer, "Buffer modified\n"); \
|
|
|
|
ok((str1)->Length == (str2)->Length, "Length modified\n"); \
|
|
|
|
ok((str1)->MaximumLength == (str2)->MaximumLength, "MaximumLength modified\n"); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
static
|
|
|
|
BOOLEAN
|
|
|
|
CheckStringBuffer(
|
|
|
|
PCWSTR Buffer,
|
2012-05-01 16:19:17 +00:00
|
|
|
SIZE_T Length,
|
2012-04-25 09:52:38 +00:00
|
|
|
SIZE_T MaximumLength,
|
|
|
|
PCWSTR Expected)
|
|
|
|
{
|
2012-05-01 16:19:17 +00:00
|
|
|
SIZE_T ExpectedLength = wcslen(Expected) * sizeof(WCHAR);
|
2012-04-25 09:52:38 +00:00
|
|
|
SIZE_T EqualLength;
|
|
|
|
BOOLEAN Result = TRUE;
|
|
|
|
SIZE_T i;
|
|
|
|
|
|
|
|
if (Length != ExpectedLength)
|
|
|
|
{
|
2012-05-01 16:19:17 +00:00
|
|
|
ok(0, "String length is %lu, expected %lu\n", (ULONG)Length, (ULONG)ExpectedLength);
|
2012-04-25 09:52:38 +00:00
|
|
|
Result = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EqualLength = RtlCompareMemory(Buffer, Expected, Length);
|
|
|
|
if (EqualLength != Length)
|
|
|
|
{
|
|
|
|
ok(0, "String is '%S', expected '%S'\n", Buffer, Expected);
|
|
|
|
Result = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Buffer[Length / sizeof(WCHAR)] != UNICODE_NULL)
|
|
|
|
{
|
|
|
|
ok(0, "Not null terminated\n");
|
|
|
|
Result = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The function nulls the rest of the buffer! */
|
|
|
|
for (i = Length + sizeof(UNICODE_NULL); i < MaximumLength; i++)
|
|
|
|
{
|
|
|
|
UCHAR Char = ((PUCHAR)Buffer)[i];
|
|
|
|
if (Char != 0)
|
|
|
|
{
|
|
|
|
ok(0, "Found 0x%x at offset %lu, expected 0x%x\n", Char, (ULONG)i, 0);
|
|
|
|
/* Don't count this as a failure unless the string was actually wrong */
|
|
|
|
//Result = FALSE;
|
|
|
|
/* Don't flood the log */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return Result;
|
|
|
|
}
|
|
|
|
|
2012-04-25 12:13:38 +00:00
|
|
|
static
|
|
|
|
BOOLEAN
|
|
|
|
CheckBuffer(
|
|
|
|
PVOID Buffer,
|
|
|
|
SIZE_T Size,
|
|
|
|
UCHAR Value)
|
|
|
|
{
|
|
|
|
PUCHAR Array = Buffer;
|
|
|
|
SIZE_T i;
|
|
|
|
|
|
|
|
for (i = 0; i < Size; i++)
|
|
|
|
if (Array[i] != Value)
|
|
|
|
{
|
|
|
|
trace("Expected %x, found %x at offset %lu\n", Value, Array[i], (ULONG)i);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2012-04-25 09:52:38 +00:00
|
|
|
#define RtlPathTypeNotSet 123
|
|
|
|
|
|
|
|
/* winetest_platform is "windows" for us, so broken() doesn't do what it should :( */
|
|
|
|
#undef broken
|
|
|
|
#define broken(x) 0
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
PrefixNone,
|
|
|
|
PrefixCurrentDrive,
|
|
|
|
PrefixCurrentPath,
|
|
|
|
PrefixCurrentPathWithoutLastPart
|
|
|
|
} PREFIX_TYPE;
|
|
|
|
|
|
|
|
static
|
|
|
|
VOID
|
|
|
|
RunTestCases(VOID)
|
|
|
|
{
|
2012-04-25 12:13:38 +00:00
|
|
|
/* TODO: don't duplicate this in the other tests */
|
|
|
|
/* TODO: Drive Relative tests don't work yet if the current drive isn't C: */
|
2012-04-25 09:52:38 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
PCWSTR FileName;
|
|
|
|
PREFIX_TYPE PrefixType;
|
|
|
|
PCWSTR FullPathName;
|
|
|
|
RTL_PATH_TYPE PathType;
|
|
|
|
PREFIX_TYPE FilePartPrefixType;
|
|
|
|
SIZE_T FilePartSize;
|
|
|
|
} TestCases[] =
|
|
|
|
{
|
|
|
|
{ L"C:", PrefixCurrentPath, L"", RtlPathTypeDriveRelative, PrefixCurrentPathWithoutLastPart },
|
|
|
|
{ L"C:\\", PrefixNone, L"C:\\", RtlPathTypeDriveAbsolute },
|
|
|
|
{ L"C:\\test", PrefixNone, L"C:\\test", RtlPathTypeDriveAbsolute, PrefixCurrentDrive },
|
|
|
|
{ L"C:\\test\\", PrefixNone, L"C:\\test\\", RtlPathTypeDriveAbsolute },
|
|
|
|
{ L"C:/test/", PrefixNone, L"C:\\test\\", RtlPathTypeDriveAbsolute },
|
|
|
|
|
|
|
|
{ L"C:\\\\test", PrefixNone, L"C:\\test", RtlPathTypeDriveAbsolute, PrefixCurrentDrive },
|
|
|
|
{ L"test", PrefixCurrentPath, L"\\test", RtlPathTypeRelative, PrefixCurrentPath, sizeof(WCHAR) },
|
|
|
|
{ L"\\test", PrefixCurrentDrive, L"test", RtlPathTypeRooted, PrefixCurrentDrive },
|
|
|
|
{ L"/test", PrefixCurrentDrive, L"test", RtlPathTypeRooted, PrefixCurrentDrive },
|
|
|
|
{ L".\\test", PrefixCurrentPath, L"\\test", RtlPathTypeRelative, PrefixCurrentPath, sizeof(WCHAR) },
|
|
|
|
|
|
|
|
{ L"\\.", PrefixCurrentDrive, L"", RtlPathTypeRooted },
|
|
|
|
{ L"\\.\\", PrefixCurrentDrive, L"", RtlPathTypeRooted },
|
|
|
|
{ L"\\\\.", PrefixNone, L"\\\\.\\", RtlPathTypeRootLocalDevice },
|
|
|
|
{ L"\\\\.\\", PrefixNone, L"\\\\.\\", RtlPathTypeLocalDevice },
|
|
|
|
{ L"\\\\.\\Something\\", PrefixNone, L"\\\\.\\Something\\", RtlPathTypeLocalDevice },
|
|
|
|
|
|
|
|
{ L"\\??\\", PrefixCurrentDrive, L"??\\", RtlPathTypeRooted },
|
|
|
|
{ L"\\??\\C:", PrefixCurrentDrive, L"??\\C:", RtlPathTypeRooted, PrefixCurrentDrive, 3 * sizeof(WCHAR) },
|
|
|
|
{ L"\\??\\C:\\", PrefixCurrentDrive, L"??\\C:\\", RtlPathTypeRooted },
|
|
|
|
{ L"\\??\\C:\\test", PrefixCurrentDrive, L"??\\C:\\test", RtlPathTypeRooted, PrefixCurrentDrive, 6 * sizeof(WCHAR) },
|
|
|
|
{ L"\\??\\C:\\test\\", PrefixCurrentDrive, L"??\\C:\\test\\", RtlPathTypeRooted },
|
|
|
|
|
|
|
|
{ L"\\\\??\\", PrefixNone, L"\\\\??\\", RtlPathTypeUncAbsolute },
|
|
|
|
{ L"\\\\??\\C:", PrefixNone, L"\\\\??\\C:", RtlPathTypeUncAbsolute },
|
|
|
|
{ L"\\\\??\\C:\\", PrefixNone, L"\\\\??\\C:\\", RtlPathTypeUncAbsolute },
|
|
|
|
{ L"\\\\??\\C:\\test", PrefixNone, L"\\\\??\\C:\\test", RtlPathTypeUncAbsolute, PrefixNone, sizeof(L"\\\\??\\C:\\") },
|
|
|
|
{ L"\\\\??\\C:\\test\\", PrefixNone, L"\\\\??\\C:\\test\\", RtlPathTypeUncAbsolute },
|
|
|
|
};
|
|
|
|
ULONG Length;
|
|
|
|
UNICODE_STRING FileName;
|
|
|
|
WCHAR FullPathNameBuffer[MAX_PATH];
|
|
|
|
UNICODE_STRING TempString;
|
|
|
|
const WCHAR *ShortName;
|
|
|
|
BOOLEAN NameInvalid;
|
|
|
|
PATH_TYPE_AND_UNKNOWN PathType;
|
|
|
|
WCHAR ExpectedPathName[MAX_PATH];
|
|
|
|
SIZE_T ExpectedFilePartSize;
|
|
|
|
const WCHAR *ExpectedShortName;
|
|
|
|
const INT TestCount = sizeof(TestCases) / sizeof(TestCases[0]);
|
|
|
|
INT i;
|
2012-05-01 16:19:17 +00:00
|
|
|
BOOLEAN Okay;
|
2012-04-25 09:52:38 +00:00
|
|
|
|
|
|
|
for (i = 0; i < TestCount; i++)
|
|
|
|
{
|
|
|
|
trace("i = %d\n", i);
|
|
|
|
switch (TestCases[i].PrefixType)
|
|
|
|
{
|
|
|
|
case PrefixNone:
|
|
|
|
ExpectedPathName[0] = UNICODE_NULL;
|
|
|
|
break;
|
|
|
|
case PrefixCurrentDrive:
|
|
|
|
GetCurrentDirectoryW(sizeof(ExpectedPathName) / sizeof(WCHAR), ExpectedPathName);
|
|
|
|
ExpectedPathName[3] = UNICODE_NULL;
|
|
|
|
break;
|
|
|
|
case PrefixCurrentPath:
|
|
|
|
{
|
|
|
|
ULONG Length;
|
|
|
|
Length = GetCurrentDirectoryW(sizeof(ExpectedPathName) / sizeof(WCHAR), ExpectedPathName);
|
|
|
|
if (Length == 3 && TestCases[i].FullPathName[0])
|
|
|
|
ExpectedPathName[2] = UNICODE_NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2014-03-26 12:07:25 +00:00
|
|
|
skip("Invalid test!\n");
|
2012-04-25 09:52:38 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
wcscat(ExpectedPathName, TestCases[i].FullPathName);
|
|
|
|
RtlInitUnicodeString(&FileName, TestCases[i].FileName);
|
|
|
|
RtlFillMemory(FullPathNameBuffer, sizeof(FullPathNameBuffer), 0xAA);
|
|
|
|
TempString = FileName;
|
|
|
|
PathType.Type = RtlPathTypeNotSet;
|
|
|
|
PathType.Unknown = 1234;
|
|
|
|
ShortName = InvalidPointer;
|
|
|
|
NameInvalid = (BOOLEAN)-1;
|
|
|
|
Length = 1234;
|
|
|
|
StartSeh()
|
|
|
|
Length = RtlGetFullPathName_Ustr(&FileName,
|
|
|
|
sizeof(FullPathNameBuffer),
|
|
|
|
FullPathNameBuffer,
|
|
|
|
&ShortName,
|
|
|
|
&NameInvalid,
|
|
|
|
&PathType);
|
|
|
|
EndSeh(STATUS_SUCCESS);
|
|
|
|
ok_eq_ustr(&FileName, &TempString);
|
2012-05-01 16:19:17 +00:00
|
|
|
Okay = CheckStringBuffer(FullPathNameBuffer, Length, sizeof(FullPathNameBuffer), ExpectedPathName);
|
|
|
|
ok(Okay, "Wrong path name '%S', expected '%S'\n", FullPathNameBuffer, ExpectedPathName);
|
2012-04-25 09:52:38 +00:00
|
|
|
switch (TestCases[i].FilePartPrefixType)
|
|
|
|
{
|
|
|
|
case PrefixNone:
|
|
|
|
ExpectedFilePartSize = 0;
|
|
|
|
break;
|
|
|
|
case PrefixCurrentDrive:
|
|
|
|
ExpectedFilePartSize = sizeof(L"C:\\");
|
|
|
|
break;
|
|
|
|
case PrefixCurrentPath:
|
|
|
|
ExpectedFilePartSize = GetCurrentDirectoryW(0, NULL) * sizeof(WCHAR);
|
|
|
|
if (ExpectedFilePartSize == sizeof(L"C:\\"))
|
|
|
|
ExpectedFilePartSize -= sizeof(WCHAR);
|
|
|
|
break;
|
|
|
|
case PrefixCurrentPathWithoutLastPart:
|
|
|
|
{
|
|
|
|
WCHAR CurrentPath[MAX_PATH];
|
|
|
|
PCWSTR BackSlash;
|
|
|
|
ExpectedFilePartSize = GetCurrentDirectoryW(sizeof(CurrentPath) / sizeof(WCHAR), CurrentPath) * sizeof(WCHAR) + sizeof(UNICODE_NULL);
|
|
|
|
if (ExpectedFilePartSize == sizeof(L"C:\\"))
|
|
|
|
ExpectedFilePartSize = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
BackSlash = wcsrchr(CurrentPath, L'\\');
|
|
|
|
if (BackSlash)
|
|
|
|
ExpectedFilePartSize -= wcslen(BackSlash + 1) * sizeof(WCHAR);
|
|
|
|
else
|
|
|
|
ok(0, "GetCurrentDirectory returned %S\n", CurrentPath);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2014-03-26 12:07:25 +00:00
|
|
|
skip("Invalid test!\n");
|
2012-04-25 09:52:38 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
ExpectedFilePartSize += TestCases[i].FilePartSize;
|
|
|
|
if (ExpectedFilePartSize == 0)
|
|
|
|
{
|
|
|
|
ExpectedShortName = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ExpectedFilePartSize = (ExpectedFilePartSize - sizeof(UNICODE_NULL)) / sizeof(WCHAR);
|
|
|
|
ExpectedShortName = FullPathNameBuffer + ExpectedFilePartSize;
|
|
|
|
}
|
|
|
|
ok(ShortName == ExpectedShortName,
|
|
|
|
"ShortName = %p, expected %p\n", ShortName, ExpectedShortName);
|
|
|
|
ok(NameInvalid == FALSE, "NameInvalid = %u\n", NameInvalid);
|
|
|
|
ok(PathType.Type == TestCases[i].PathType, "PathType = %d, expected %d\n", PathType.Type, TestCases[i].PathType);
|
|
|
|
ok(PathType.Unknown == 1234 ||
|
|
|
|
broken(PathType.Unknown == 0) ||
|
2014-03-26 12:07:25 +00:00
|
|
|
broken(PathType.Unknown == 32), "Unknown = %lu\n", PathType.Unknown);
|
2012-04-25 09:52:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
START_TEST(RtlGetFullPathName_Ustr)
|
|
|
|
{
|
|
|
|
ULONG Length;
|
|
|
|
UNICODE_STRING FileName;
|
|
|
|
UNICODE_STRING TempString;
|
|
|
|
PCWSTR ShortName;
|
|
|
|
BOOLEAN NameInvalid;
|
2012-04-25 12:13:38 +00:00
|
|
|
BOOLEAN NameInvalidArray[sizeof(ULONGLONG)];
|
2012-04-25 09:52:38 +00:00
|
|
|
PATH_TYPE_AND_UNKNOWN PathType;
|
2012-05-01 16:19:17 +00:00
|
|
|
BOOLEAN Okay;
|
2012-04-25 09:52:38 +00:00
|
|
|
|
|
|
|
if (!RtlGetFullPathName_Ustr)
|
2012-04-25 13:06:30 +00:00
|
|
|
{
|
2013-09-22 19:07:35 +00:00
|
|
|
RtlGetFullPathName_Ustr = (PVOID)GetProcAddress(GetModuleHandleW(L"ntdll"), "RtlGetFullPathName_Ustr");
|
2012-04-25 13:06:30 +00:00
|
|
|
if (!RtlGetFullPathName_Ustr)
|
|
|
|
{
|
|
|
|
skip("RtlGetFullPathName_Ustr unavailable\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2012-04-25 09:52:38 +00:00
|
|
|
|
|
|
|
/* NULL parameters */
|
|
|
|
StartSeh()
|
|
|
|
RtlGetFullPathName_Ustr(NULL, 0, NULL, NULL, NULL, NULL);
|
|
|
|
EndSeh(STATUS_ACCESS_VIOLATION);
|
|
|
|
|
|
|
|
RtlInitUnicodeString(&FileName, NULL);
|
|
|
|
TempString = FileName;
|
|
|
|
StartSeh()
|
|
|
|
RtlGetFullPathName_Ustr(&FileName, 0, NULL, NULL, NULL, NULL);
|
|
|
|
EndSeh(STATUS_ACCESS_VIOLATION);
|
|
|
|
ok_eq_ustr(&FileName, &TempString);
|
|
|
|
|
|
|
|
RtlInitUnicodeString(&FileName, L"");
|
|
|
|
TempString = FileName;
|
|
|
|
StartSeh()
|
|
|
|
RtlGetFullPathName_Ustr(&FileName, 0, NULL, NULL, NULL, NULL);
|
|
|
|
EndSeh(STATUS_ACCESS_VIOLATION);
|
|
|
|
ok_eq_ustr(&FileName, &TempString);
|
|
|
|
|
|
|
|
PathType.Type = RtlPathTypeNotSet;
|
|
|
|
PathType.Unknown = 1234;
|
|
|
|
StartSeh()
|
|
|
|
RtlGetFullPathName_Ustr(NULL, 0, NULL, NULL, NULL, &PathType);
|
|
|
|
EndSeh(STATUS_ACCESS_VIOLATION);
|
2012-04-25 12:13:38 +00:00
|
|
|
ok(PathType.Type == RtlPathTypeUnknown, "PathType = %d\n", PathType.Type);
|
2012-04-25 09:52:38 +00:00
|
|
|
ok(PathType.Unknown == 1234 ||
|
2014-03-26 12:07:25 +00:00
|
|
|
broken(PathType.Unknown == 0) /* Win7 */, "Unknown = %lu\n", PathType.Unknown);
|
2012-04-25 09:52:38 +00:00
|
|
|
|
|
|
|
/* check what else is initialized before it crashes */
|
|
|
|
PathType.Type = RtlPathTypeNotSet;
|
|
|
|
PathType.Unknown = 1234;
|
|
|
|
ShortName = InvalidPointer;
|
|
|
|
NameInvalid = (BOOLEAN)-1;
|
|
|
|
StartSeh()
|
|
|
|
RtlGetFullPathName_Ustr(NULL, 0, NULL, &ShortName, &NameInvalid, &PathType);
|
|
|
|
EndSeh(STATUS_ACCESS_VIOLATION);
|
|
|
|
ok(NameInvalid == FALSE, "NameInvalid = %u\n", NameInvalid);
|
|
|
|
ok(ShortName == InvalidPointer ||
|
2012-04-25 12:13:38 +00:00
|
|
|
broken(ShortName == NULL) /* Win7 */, "ShortName = %p\n", ShortName);
|
|
|
|
ok(PathType.Type == RtlPathTypeUnknown, "PathType = %d\n", PathType.Type);
|
2012-04-25 09:52:38 +00:00
|
|
|
ok(PathType.Unknown == 1234 ||
|
2014-03-26 12:07:25 +00:00
|
|
|
broken(PathType.Unknown == 0) /* Win7 */, "Unknown = %lu\n", PathType.Unknown);
|
2012-04-25 09:52:38 +00:00
|
|
|
|
|
|
|
RtlInitUnicodeString(&FileName, L"");
|
|
|
|
TempString = FileName;
|
|
|
|
ShortName = InvalidPointer;
|
|
|
|
NameInvalid = (BOOLEAN)-1;
|
|
|
|
StartSeh()
|
|
|
|
RtlGetFullPathName_Ustr(&FileName, 0, NULL, &ShortName, &NameInvalid, NULL);
|
|
|
|
EndSeh(STATUS_ACCESS_VIOLATION);
|
|
|
|
ok_eq_ustr(&FileName, &TempString);
|
|
|
|
ok(ShortName == InvalidPointer ||
|
2012-04-25 12:13:38 +00:00
|
|
|
broken(ShortName == NULL) /* Win7 */, "ShortName = %p\n", ShortName);
|
|
|
|
ok(NameInvalid == FALSE, "NameInvalid = %u\n", NameInvalid);
|
2012-04-25 09:52:38 +00:00
|
|
|
|
|
|
|
/* This is the first one that doesn't crash. FileName and PathType cannot be NULL */
|
|
|
|
RtlInitUnicodeString(&FileName, NULL);
|
|
|
|
TempString = FileName;
|
|
|
|
PathType.Type = RtlPathTypeNotSet;
|
|
|
|
PathType.Unknown = 1234;
|
|
|
|
StartSeh()
|
|
|
|
Length = RtlGetFullPathName_Ustr(&FileName, 0, NULL, NULL, NULL, &PathType);
|
|
|
|
ok(Length == 0, "Length = %lu\n", Length);
|
|
|
|
EndSeh(STATUS_SUCCESS);
|
|
|
|
ok_eq_ustr(&FileName, &TempString);
|
|
|
|
ok(PathType.Type == RtlPathTypeUnknown, "PathType = %d\n", PathType.Type);
|
|
|
|
ok(PathType.Unknown == 1234 ||
|
2014-03-26 12:07:25 +00:00
|
|
|
broken(PathType.Unknown == 0) /* Win7 */, "Unknown = %lu\n", PathType.Unknown);
|
2012-04-25 09:52:38 +00:00
|
|
|
|
|
|
|
RtlInitUnicodeString(&FileName, L"");
|
|
|
|
TempString = FileName;
|
|
|
|
PathType.Type = RtlPathTypeNotSet;
|
|
|
|
PathType.Unknown = 1234;
|
|
|
|
StartSeh()
|
|
|
|
Length = RtlGetFullPathName_Ustr(&FileName, 0, NULL, NULL, NULL, &PathType);
|
|
|
|
ok(Length == 0, "Length = %lu\n", Length);
|
|
|
|
EndSeh(STATUS_SUCCESS);
|
|
|
|
ok_eq_ustr(&FileName, &TempString);
|
|
|
|
ok(PathType.Type == RtlPathTypeUnknown, "PathType = %d\n", PathType.Type);
|
|
|
|
ok(PathType.Unknown == 1234 ||
|
2014-03-26 12:07:25 +00:00
|
|
|
broken(PathType.Unknown == 0) /* Win7 */, "Unknown = %lu\n", PathType.Unknown);
|
2012-04-25 09:52:38 +00:00
|
|
|
|
2012-04-25 12:13:38 +00:00
|
|
|
/* Show that NameInvalid is indeed BOOLEAN */
|
|
|
|
RtlInitUnicodeString(&FileName, L"");
|
|
|
|
TempString = FileName;
|
|
|
|
PathType.Type = RtlPathTypeNotSet;
|
|
|
|
PathType.Unknown = 1234;
|
|
|
|
RtlFillMemory(NameInvalidArray, sizeof(NameInvalidArray), 0x55);
|
|
|
|
StartSeh()
|
|
|
|
Length = RtlGetFullPathName_Ustr(&FileName, 0, NULL, NULL, NameInvalidArray, &PathType);
|
|
|
|
ok(Length == 0, "Length = %lu\n", Length);
|
|
|
|
EndSeh(STATUS_SUCCESS);
|
|
|
|
ok_eq_ustr(&FileName, &TempString);
|
|
|
|
ok(PathType.Type == RtlPathTypeUnknown, "PathType = %d\n", PathType.Type);
|
|
|
|
ok(PathType.Unknown == 1234 ||
|
2014-03-26 12:07:25 +00:00
|
|
|
broken(PathType.Unknown == 0) /* Win7 */, "Unknown = %lu\n", PathType.Unknown);
|
2012-04-25 12:13:38 +00:00
|
|
|
ok(NameInvalidArray[0] == FALSE, "NameInvalid = %u\n", NameInvalidArray[0]);
|
2012-05-01 16:19:17 +00:00
|
|
|
Okay = CheckBuffer(NameInvalidArray + 1, sizeof(NameInvalidArray) - sizeof(NameInvalidArray[0]), 0x55);
|
|
|
|
ok(Okay, "CheckBuffer failed\n");
|
2012-04-25 12:13:38 +00:00
|
|
|
|
2012-04-25 09:52:38 +00:00
|
|
|
/* Give it a valid path */
|
|
|
|
RtlInitUnicodeString(&FileName, L"C:\\test");
|
|
|
|
TempString = FileName;
|
|
|
|
PathType.Type = RtlPathTypeNotSet;
|
|
|
|
PathType.Unknown = 1234;
|
|
|
|
StartSeh()
|
|
|
|
Length = RtlGetFullPathName_Ustr(&FileName, 0, NULL, NULL, NULL, &PathType);
|
|
|
|
ok(Length == sizeof(L"C:\\test"), "Length = %lu\n", Length);
|
|
|
|
EndSeh(STATUS_SUCCESS);
|
|
|
|
ok_eq_ustr(&FileName, &TempString);
|
|
|
|
ok(PathType.Type == RtlPathTypeDriveAbsolute, "PathType = %d\n", PathType.Type);
|
|
|
|
ok(PathType.Unknown == 1234 ||
|
2014-03-26 12:07:25 +00:00
|
|
|
broken(PathType.Unknown == 0) /* Win7 */, "Unknown = %lu\n", PathType.Unknown);
|
2012-04-25 09:52:38 +00:00
|
|
|
|
|
|
|
/* check the actual functionality with different paths */
|
|
|
|
RunTestCases();
|
|
|
|
}
|