Author: tfaber
Date: Tue May 1 16:19:17 2012
New Revision: 56468
URL:
http://svn.reactos.org/svn/reactos?rev=56468&view=rev
Log:
[NTDLL_APITEST]
- Add initial tests for RtlDosSearchPath_U & RtlDosSearchPath_Ustr
- Work around Wine ok() silliness
- Fix 64 bit warnings
Added:
trunk/rostests/apitests/ntdll/RtlDosSearchPath_U.c (with props)
trunk/rostests/apitests/ntdll/RtlDosSearchPath_Ustr.c (with props)
Modified:
trunk/rostests/apitests/ntdll/CMakeLists.txt
trunk/rostests/apitests/ntdll/RtlGetFullPathName_U.c
trunk/rostests/apitests/ntdll/RtlGetFullPathName_Ustr.c
trunk/rostests/apitests/ntdll/RtlGetFullPathName_UstrEx.c
trunk/rostests/apitests/ntdll/testlist.c
Modified: trunk/rostests/apitests/ntdll/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/CMakeLists…
==============================================================================
--- trunk/rostests/apitests/ntdll/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/ntdll/CMakeLists.txt [iso-8859-1] Tue May 1 16:19:17 2012
@@ -4,6 +4,8 @@
NtFreeVirtualMemory.c
RtlDetermineDosPathNameType.c
RtlDoesFileExists.c
+ RtlDosSearchPath_U.c
+ RtlDosSearchPath_Ustr.c
RtlGetFullPathName_U.c
RtlGetFullPathName_Ustr.c
RtlGetFullPathName_UstrEx.c
Added: trunk/rostests/apitests/ntdll/RtlDosSearchPath_U.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/RtlDosSear…
==============================================================================
--- trunk/rostests/apitests/ntdll/RtlDosSearchPath_U.c (added)
+++ trunk/rostests/apitests/ntdll/RtlDosSearchPath_U.c [iso-8859-1] Tue May 1 16:19:17
2012
@@ -1,0 +1,219 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPLv2+ - See COPYING in the top level directory
+ * PURPOSE: Test for RtlDosSearchPath_U
+ * PROGRAMMER: Thomas Faber <thfabba(a)gmx.de>
+ */
+
+#define WIN32_NO_STATUS
+#define UNICODE
+#include <stdio.h>
+#include <wine/test.h>
+#include <pseh/pseh2.h>
+#include <ndk/rtlfuncs.h>
+
+/*
+ULONG
+NTAPI
+RtlDosSearchPath_U(
+ IN PCWSTR Path,
+ IN PCWSTR FileName,
+ IN PCWSTR Extension,
+ IN ULONG BufferSize,
+ OUT PWSTR Buffer,
+ OUT PWSTR *PartName
+);
+*/
+
+#define StartSeh() ExceptionStatus = STATUS_SUCCESS; _SEH2_TRY {
+#define EndSeh(ExpectedStatus) } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
ExceptionStatus = _SEH2_GetExceptionCode(); } _SEH2_END; ok(ExceptionStatus ==
ExpectedStatus, "Exception %lx, expected %lx\n", ExceptionStatus,
ExpectedStatus)
+
+static
+BOOLEAN
+CheckStringBuffer(
+ PCWSTR Buffer,
+ SIZE_T Length,
+ SIZE_T MaximumLength,
+ PCWSTR Expected)
+{
+ SIZE_T ExpectedLength = wcslen(Expected) * sizeof(WCHAR);
+ SIZE_T EqualLength;
+ BOOLEAN Result = TRUE;
+ SIZE_T i;
+
+ if (Length != ExpectedLength)
+ {
+ ok(0, "String length is %lu, expected %lu\n", (ULONG)Length,
(ULONG)ExpectedLength);
+ 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;
+}
+
+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;
+}
+
+#define InvalidPointer ((PVOID)0x0123456789ABCDEFULL)
+
+START_TEST(RtlDosSearchPath_U)
+{
+ NTSTATUS ExceptionStatus;
+ ULONG Length;
+ WCHAR Buffer[MAX_PATH];
+ PWSTR PartName;
+ BOOLEAN Okay;
+ BOOL Success;
+ WCHAR FileName[MAX_PATH];
+ WCHAR CustomPath[MAX_PATH] = L"RtlDosSearchPath_U_TestPath";
+ HANDLE Handle;
+
+ swprintf(FileName, L"C:\\%ls", CustomPath);
+ /* Make sure this directory doesn't exist */
+ while (GetFileAttributes(FileName) != INVALID_FILE_ATTRIBUTES)
+ {
+ wcscat(CustomPath, L"X");
+ swprintf(FileName, L"C:\\%ls", CustomPath);
+ }
+ Success = CreateDirectory(FileName, NULL);
+ ok(Success, "CreateDirectory failed, results might not be accurate\n");
+ swprintf(FileName, L"C:\\%ls\\ThisFolderExists", CustomPath);
+ Success = CreateDirectory(FileName, NULL);
+ ok(Success, "CreateDirectory failed, results might not be accurate\n");
+ swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\ThisFileExists",
CustomPath);
+ Handle = CreateFile(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);
+
+ /* 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);
+
+ /* Empty strings - first one that doesn't crash */
+ StartSeh()
+ Length = RtlDosSearchPath_U(L"", L"", NULL, 0, NULL, NULL);
+ ok(Length == 0, "Length %lu\n", Length);
+ EndSeh(STATUS_SUCCESS);
+
+ /* Check what's initialized */
+ PartName = InvalidPointer;
+ StartSeh()
+ Length = RtlDosSearchPath_U(L"", L"", NULL, 0, NULL,
&PartName);
+ ok(Length == 0, "Length = %lu\n", Length);
+ EndSeh(STATUS_SUCCESS);
+ ok(PartName == InvalidPointer, "PartName = %p\n", PartName);
+
+ RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
+ StartSeh()
+ Length = RtlDosSearchPath_U(L"", L"", NULL, sizeof(Buffer),
Buffer, NULL);
+ ok(Length == 0, "Length %lu\n", Length);
+ EndSeh(STATUS_SUCCESS);
+ Okay = CheckBuffer(Buffer, sizeof(Buffer), 0x55);
+ ok(Okay, "CheckBuffer failed\n");
+
+ PartName = InvalidPointer;
+ RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
+ StartSeh()
+ Length = RtlDosSearchPath_U(L"", L"", NULL, sizeof(Buffer),
Buffer, &PartName);
+ ok(Length == 0, "Length %lu\n", Length);
+ EndSeh(STATUS_SUCCESS);
+ ok(PartName == InvalidPointer, "PartName = %p\n", PartName);
+ 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 = SetCurrentDirectory(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");
+
+ /* 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 */
+ SetCurrentDirectory(L"C:\\");
+ swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\ThisFileExists",
CustomPath);
+ Success = DeleteFile(FileName);
+ ok(Success, "DeleteFile failed, test might leave stale file\n");
+ swprintf(FileName, L"C:\\%ls\\ThisFolderExists", CustomPath);
+ Success = RemoveDirectory(FileName);
+ ok(Success, "RemoveDirectory failed %(lu), test might leave stale
directory\n", GetLastError());
+ swprintf(FileName, L"C:\\%ls", CustomPath);
+ Success = RemoveDirectory(FileName);
+ ok(Success, "RemoveDirectory failed (%lu), test might leave stale
directory\n", GetLastError());
+}
Propchange: trunk/rostests/apitests/ntdll/RtlDosSearchPath_U.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/apitests/ntdll/RtlDosSearchPath_Ustr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/RtlDosSear…
==============================================================================
--- trunk/rostests/apitests/ntdll/RtlDosSearchPath_Ustr.c (added)
+++ trunk/rostests/apitests/ntdll/RtlDosSearchPath_Ustr.c [iso-8859-1] Tue May 1 16:19:17
2012
@@ -1,0 +1,226 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPLv2+ - See COPYING in the top level directory
+ * PURPOSE: Test for RtlDosSearchPath_Ustr
+ * PROGRAMMER: Thomas Faber <thfabba(a)gmx.de>
+ */
+
+#define WIN32_NO_STATUS
+#include <wine/test.h>
+#include <pseh/pseh2.h>
+#include <ndk/rtlfuncs.h>
+
+/*
+NTSTATUS
+NTAPI
+RtlDosSearchPath_Ustr(
+ IN ULONG Flags,
+ IN PUNICODE_STRING PathString,
+ IN PUNICODE_STRING FileNameString,
+ IN PUNICODE_STRING ExtensionString,
+ IN PUNICODE_STRING CallerBuffer,
+ IN OUT PUNICODE_STRING DynamicString OPTIONAL,
+ OUT PUNICODE_STRING *FullNameOut OPTIONAL,
+ OUT PSIZE_T FilePartSize OPTIONAL,
+ OUT PSIZE_T LengthNeeded OPTIONAL
+);
+*/
+
+#define StartSeh() ExceptionStatus = STATUS_SUCCESS; _SEH2_TRY {
+#define EndSeh(ExpectedStatus) } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
ExceptionStatus = _SEH2_GetExceptionCode(); } _SEH2_END; ok(ExceptionStatus ==
ExpectedStatus, "Exception %lx, expected %lx\n", ExceptionStatus,
ExpectedStatus)
+
+#define ok_eq_ulong(value, expected) ok((value) == (expected), #value " = %lu,
expected %lu\n", value, expected)
+#define ok_eq_hex(value, expected) ok((value) == (expected), #value " = 0x%lx,
expected 0x%lx\n", value, expected)
+#define ok_eq_pointer(value, expected) ok((value) == (expected), #value " = %p,
expected %p\n", value, expected)
+
+#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)
+
+#define InvalidPointer ((PVOID)0x0123456789ABCDEFULL)
+
+START_TEST(RtlDosSearchPath_Ustr)
+{
+ NTSTATUS ExceptionStatus;
+ NTSTATUS Status;
+ UNICODE_STRING PathString;
+ UNICODE_STRING FileNameString;
+ UNICODE_STRING ExtensionString;
+ UNICODE_STRING CallerBuffer;
+ UNICODE_STRING DynamicString;
+ PUNICODE_STRING FullNameOut;
+ UNICODE_STRING EmptyString;
+ SIZE_T FilePartSize;
+ SIZE_T LengthNeeded;
+ INT i;
+
+ RtlInitUnicodeString(&EmptyString, NULL);
+
+ /* NULLs */
+ StartSeh()
+ Status = RtlDosSearchPath_Ustr(0, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL);
+ ok_eq_hex(Status, STATUS_INVALID_PARAMETER);
+ EndSeh(STATUS_SUCCESS);
+
+ RtlInitUnicodeString(&FileNameString, NULL);
+ StartSeh()
+ Status = RtlDosSearchPath_Ustr(0, NULL, &FileNameString, NULL, NULL, NULL,
NULL, NULL, NULL);
+ ok_eq_hex(Status, STATUS_INVALID_PARAMETER);
+ EndSeh(STATUS_SUCCESS);
+
+ RtlInitUnicodeString(&PathString, NULL);
+ StartSeh()
+ Status = RtlDosSearchPath_Ustr(0, &PathString, NULL, NULL, NULL, NULL, NULL,
NULL, NULL);
+ ok_eq_hex(Status, STATUS_INVALID_PARAMETER);
+ EndSeh(STATUS_SUCCESS);
+ ok_eq_ustr(&PathString, &EmptyString);
+
+ /* Minimal valid set of parameters */
+ RtlInitUnicodeString(&PathString, NULL);
+ RtlInitUnicodeString(&FileNameString, NULL);
+ StartSeh()
+ Status = RtlDosSearchPath_Ustr(0, &PathString, &FileNameString, NULL,
NULL, NULL, NULL, NULL, NULL);
+ ok_eq_hex(Status, STATUS_NO_SUCH_FILE);
+ EndSeh(STATUS_SUCCESS);
+ ok_eq_ustr(&PathString, &EmptyString);
+ ok_eq_ustr(&FileNameString, &EmptyString);
+
+ /* Check valid flags */
+ for (i = 0; i < 32; i++)
+ {
+ RtlInitUnicodeString(&PathString, NULL);
+ RtlInitUnicodeString(&FileNameString, NULL);
+ StartSeh()
+ Status = RtlDosSearchPath_Ustr(1 << i, &PathString,
&FileNameString, NULL, NULL, NULL, NULL, NULL, NULL);
+ ok_eq_hex(Status, i > 2 ? STATUS_INVALID_PARAMETER :
STATUS_NO_SUCH_FILE);
+ EndSeh(STATUS_SUCCESS);
+ ok_eq_ustr(&PathString, &EmptyString);
+ ok_eq_ustr(&FileNameString, &EmptyString);
+ }
+
+ RtlInitUnicodeString(&PathString, NULL);
+ RtlInitUnicodeString(&FileNameString, NULL);
+ StartSeh()
+ Status = RtlDosSearchPath_Ustr(7, &PathString, &FileNameString, NULL,
NULL, NULL, NULL, NULL, NULL);
+ ok_eq_hex(Status, STATUS_NO_SUCH_FILE);
+ EndSeh(STATUS_SUCCESS);
+ ok_eq_ustr(&PathString, &EmptyString);
+ ok_eq_ustr(&FileNameString, &EmptyString);
+
+ /* Everything except PathString */
+ RtlInitUnicodeString(&FileNameString, NULL);
+ RtlInitUnicodeString(&ExtensionString, NULL);
+ RtlInitUnicodeString(&CallerBuffer, NULL);
+ RtlInitUnicodeString(&DynamicString, NULL);
+ FullNameOut = InvalidPointer;
+ FilePartSize = (SIZE_T)-1;
+ LengthNeeded = (SIZE_T)-1;
+ StartSeh()
+ Status = RtlDosSearchPath_Ustr(0,
+ NULL,
+ &FileNameString,
+ &ExtensionString,
+ &CallerBuffer,
+ &DynamicString,
+ &FullNameOut,
+ &FilePartSize,
+ &LengthNeeded);
+ ok_eq_hex(Status, STATUS_INVALID_PARAMETER);
+ EndSeh(STATUS_SUCCESS);
+ ok_eq_ustr(&FileNameString, &EmptyString);
+ ok_eq_ustr(&ExtensionString, &EmptyString);
+ ok_eq_ustr(&CallerBuffer, &EmptyString);
+ ok_eq_ustr(&DynamicString, &EmptyString);
+ ok_eq_pointer(FullNameOut, NULL);
+ ok_eq_ulong(FilePartSize, 0);
+ ok_eq_ulong(LengthNeeded, 0);
+
+ /* Everything except FileNameString */
+ RtlInitUnicodeString(&PathString, NULL);
+ RtlInitUnicodeString(&ExtensionString, NULL);
+ RtlInitUnicodeString(&CallerBuffer, NULL);
+ RtlInitUnicodeString(&DynamicString, NULL);
+ FullNameOut = InvalidPointer;
+ FilePartSize = (SIZE_T)-1;
+ LengthNeeded = (SIZE_T)-1;
+ StartSeh()
+ Status = RtlDosSearchPath_Ustr(0,
+ &PathString,
+ NULL,
+ &ExtensionString,
+ &CallerBuffer,
+ &DynamicString,
+ &FullNameOut,
+ &FilePartSize,
+ &LengthNeeded);
+ ok_eq_hex(Status, STATUS_INVALID_PARAMETER);
+ EndSeh(STATUS_SUCCESS);
+ ok_eq_ustr(&PathString, &EmptyString);
+ ok_eq_ustr(&ExtensionString, &EmptyString);
+ ok_eq_ustr(&CallerBuffer, &EmptyString);
+ ok_eq_ustr(&DynamicString, &EmptyString);
+ ok_eq_pointer(FullNameOut, NULL);
+ ok_eq_ulong(FilePartSize, 0);
+ ok_eq_ulong(LengthNeeded, 0);
+
+ /* Passing CallerBuffer and DynamicString, but not FullNameOut is invalid */
+ RtlInitUnicodeString(&PathString, NULL);
+ RtlInitUnicodeString(&FileNameString, NULL);
+ RtlInitUnicodeString(&ExtensionString, NULL);
+ RtlInitUnicodeString(&CallerBuffer, NULL);
+ RtlInitUnicodeString(&DynamicString, NULL);
+ FullNameOut = InvalidPointer;
+ FilePartSize = (SIZE_T)-1;
+ LengthNeeded = (SIZE_T)-1;
+ StartSeh()
+ Status = RtlDosSearchPath_Ustr(0,
+ &PathString,
+ &FileNameString,
+ &ExtensionString,
+ &CallerBuffer,
+ &DynamicString,
+ NULL,
+ &FilePartSize,
+ &LengthNeeded);
+ ok_eq_hex(Status, STATUS_INVALID_PARAMETER);
+ EndSeh(STATUS_SUCCESS);
+ ok_eq_ustr(&PathString, &EmptyString);
+ ok_eq_ustr(&FileNameString, &EmptyString);
+ ok_eq_ustr(&ExtensionString, &EmptyString);
+ ok_eq_ustr(&CallerBuffer, &EmptyString);
+ ok_eq_ustr(&DynamicString, &EmptyString);
+ ok_eq_ulong(FilePartSize, 0);
+ ok_eq_ulong(LengthNeeded, 0);
+
+ /* All parameters given */
+ RtlInitUnicodeString(&PathString, NULL);
+ RtlInitUnicodeString(&FileNameString, NULL);
+ RtlInitUnicodeString(&ExtensionString, NULL);
+ RtlInitUnicodeString(&CallerBuffer, NULL);
+ RtlInitUnicodeString(&DynamicString, NULL);
+ FullNameOut = InvalidPointer;
+ FilePartSize = (SIZE_T)-1;
+ LengthNeeded = (SIZE_T)-1;
+ StartSeh()
+ Status = RtlDosSearchPath_Ustr(0,
+ &PathString,
+ &FileNameString,
+ &ExtensionString,
+ &CallerBuffer,
+ &DynamicString,
+ &FullNameOut,
+ &FilePartSize,
+ &LengthNeeded);
+ ok_eq_hex(Status, STATUS_NO_SUCH_FILE);
+ EndSeh(STATUS_SUCCESS);
+ ok_eq_ustr(&PathString, &EmptyString);
+ ok_eq_ustr(&FileNameString, &EmptyString);
+ ok_eq_ustr(&ExtensionString, &EmptyString);
+ ok_eq_ustr(&CallerBuffer, &EmptyString);
+ ok_eq_ustr(&DynamicString, &EmptyString);
+ ok_eq_pointer(FullNameOut, NULL);
+ ok_eq_ulong(FilePartSize, 0);
+ ok_eq_ulong(LengthNeeded, 0);
+}
Propchange: trunk/rostests/apitests/ntdll/RtlDosSearchPath_Ustr.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/apitests/ntdll/RtlGetFullPathName_U.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/RtlGetFull…
==============================================================================
--- trunk/rostests/apitests/ntdll/RtlGetFullPathName_U.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/ntdll/RtlGetFullPathName_U.c [iso-8859-1] Tue May 1 16:19:17
2012
@@ -28,18 +28,18 @@
BOOLEAN
CheckStringBuffer(
PCWSTR Buffer,
- ULONG Length,
+ SIZE_T Length,
SIZE_T MaximumLength,
PCWSTR Expected)
{
- USHORT ExpectedLength = wcslen(Expected) * sizeof(WCHAR);
+ SIZE_T ExpectedLength = wcslen(Expected) * sizeof(WCHAR);
SIZE_T EqualLength;
BOOLEAN Result = TRUE;
SIZE_T i;
if (Length != ExpectedLength)
{
- ok(0, "String length is %u, expected %u\n", Length, ExpectedLength);
+ ok(0, "String length is %lu, expected %lu\n", (ULONG)Length,
(ULONG)ExpectedLength);
Result = FALSE;
}
@@ -141,6 +141,7 @@
SIZE_T ExpectedFilePartSize;
const INT TestCount = sizeof(TestCases) / sizeof(TestCases[0]);
INT i;
+ BOOLEAN Okay;
for (i = 0; i < TestCount; i++)
{
@@ -173,8 +174,8 @@
&ShortName);
EndSeh(STATUS_SUCCESS);
- ok(CheckStringBuffer(FullPathNameBuffer, Length, sizeof(FullPathNameBuffer),
ExpectedPathName),
- "Wrong path name '%S', expected '%S'\n",
FullPathNameBuffer, ExpectedPathName);
+ Okay = CheckStringBuffer(FullPathNameBuffer, Length, sizeof(FullPathNameBuffer),
ExpectedPathName);
+ ok(Okay, "Wrong path name '%S', expected '%S'\n",
FullPathNameBuffer, ExpectedPathName);
if (!ShortName)
FilePartSize = 0;
Modified: trunk/rostests/apitests/ntdll/RtlGetFullPathName_Ustr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/RtlGetFull…
==============================================================================
--- trunk/rostests/apitests/ntdll/RtlGetFullPathName_Ustr.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/ntdll/RtlGetFullPathName_Ustr.c [iso-8859-1] Tue May 1
16:19:17 2012
@@ -43,6 +43,7 @@
OUT PATH_TYPE_AND_UNKNOWN *PathType
)
//= (PVOID)0x7c83086c // 2003 sp1 x86
+//= (PVOID)0x77ef49f0 // 2003 sp1 x64
//= (PVOID)0x7769a3dd // win7 sp1 wow64
;
@@ -59,18 +60,18 @@
BOOLEAN
CheckStringBuffer(
PCWSTR Buffer,
- ULONG Length,
+ SIZE_T Length,
SIZE_T MaximumLength,
PCWSTR Expected)
{
- USHORT ExpectedLength = wcslen(Expected) * sizeof(WCHAR);
+ SIZE_T ExpectedLength = wcslen(Expected) * sizeof(WCHAR);
SIZE_T EqualLength;
BOOLEAN Result = TRUE;
SIZE_T i;
if (Length != ExpectedLength)
{
- ok(0, "String length is %u, expected %u\n", Length, ExpectedLength);
+ ok(0, "String length is %lu, expected %lu\n", (ULONG)Length,
(ULONG)ExpectedLength);
Result = FALSE;
}
@@ -197,6 +198,7 @@
const WCHAR *ExpectedShortName;
const INT TestCount = sizeof(TestCases) / sizeof(TestCases[0]);
INT i;
+ BOOLEAN Okay;
for (i = 0; i < TestCount; i++)
{
@@ -240,8 +242,8 @@
&PathType);
EndSeh(STATUS_SUCCESS);
ok_eq_ustr(&FileName, &TempString);
- ok(CheckStringBuffer(FullPathNameBuffer, Length, sizeof(FullPathNameBuffer),
ExpectedPathName),
- "Wrong path name '%S', expected '%S'\n",
FullPathNameBuffer, ExpectedPathName);
+ Okay = CheckStringBuffer(FullPathNameBuffer, Length, sizeof(FullPathNameBuffer),
ExpectedPathName);
+ ok(Okay, "Wrong path name '%S', expected '%S'\n",
FullPathNameBuffer, ExpectedPathName);
switch (TestCases[i].FilePartPrefixType)
{
case PrefixNone:
@@ -306,6 +308,7 @@
BOOLEAN NameInvalid;
BOOLEAN NameInvalidArray[sizeof(ULONGLONG)];
PATH_TYPE_AND_UNKNOWN PathType;
+ BOOLEAN Okay;
if (!RtlGetFullPathName_Ustr)
{
@@ -414,7 +417,8 @@
ok(PathType.Unknown == 1234 ||
broken(PathType.Unknown == 0) /* Win7 */, "Unknown = %d\n",
PathType.Unknown);
ok(NameInvalidArray[0] == FALSE, "NameInvalid = %u\n",
NameInvalidArray[0]);
- ok(CheckBuffer(NameInvalidArray + 1, sizeof(NameInvalidArray) -
sizeof(NameInvalidArray[0]), 0x55), "CheckBuffer failed\n");
+ Okay = CheckBuffer(NameInvalidArray + 1, sizeof(NameInvalidArray) -
sizeof(NameInvalidArray[0]), 0x55);
+ ok(Okay, "CheckBuffer failed\n");
/* Give it a valid path */
RtlInitUnicodeString(&FileName, L"C:\\test");
Modified: trunk/rostests/apitests/ntdll/RtlGetFullPathName_UstrEx.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/RtlGetFull…
==============================================================================
--- trunk/rostests/apitests/ntdll/RtlGetFullPathName_UstrEx.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/ntdll/RtlGetFullPathName_UstrEx.c [iso-8859-1] Tue May 1
16:19:17 2012
@@ -40,19 +40,19 @@
PCUNICODE_STRING String,
PCWSTR Expected)
{
- USHORT Length = wcslen(Expected) * sizeof(WCHAR);
+ SIZE_T ExpectedLength = wcslen(Expected) * sizeof(WCHAR);
SIZE_T EqualLength;
BOOLEAN Result = TRUE;
SIZE_T i;
- if (String->Length != Length)
- {
- ok(0, "String length is %u, expected %u\n", String->Length,
Length);
+ if (String->Length != ExpectedLength)
+ {
+ ok(0, "String length is %u, expected %lu\n", String->Length,
(ULONG)ExpectedLength);
Result = FALSE;
}
- EqualLength = RtlCompareMemory(String->Buffer, Expected, Length);
- if (EqualLength != Length)
+ EqualLength = RtlCompareMemory(String->Buffer, Expected, ExpectedLength);
+ if (EqualLength != ExpectedLength)
{
ok(0, "String is '%wZ', expected '%S'\n", String,
Expected);
Result = FALSE;
@@ -175,6 +175,7 @@
SIZE_T ExpectedFilePartSize;
const INT TestCount = sizeof(TestCases) / sizeof(TestCases[0]);
INT i;
+ BOOLEAN Okay;
for (i = 0; i < TestCount; i++)
{
@@ -224,8 +225,8 @@
ok_eq_ustr(&FileName, &TempString);
ok(FullPathName.Buffer == FullPathNameBuffer, "Buffer
modified\n");
ok(FullPathName.MaximumLength == sizeof(FullPathNameBuffer), "MaximumLength
modified\n");
- ok(CheckStringBuffer(&FullPathName, ExpectedPathName),
- "Wrong path name '%wZ', expected '%S'\n",
&FullPathName, ExpectedPathName);
+ Okay = CheckStringBuffer(&FullPathName, ExpectedPathName);
+ ok(Okay, "Wrong path name '%wZ', expected '%S'\n",
&FullPathName, ExpectedPathName);
ok(StringUsed == &FullPathName, "StringUsed = %p, expected %p\n",
StringUsed, &FullPathName);
switch (TestCases[i].FilePartPrefixType)
{
@@ -284,6 +285,7 @@
BOOLEAN NameInvalidArray[sizeof(ULONGLONG)];
RTL_PATH_TYPE PathType;
SIZE_T LengthNeeded;
+ BOOLEAN Okay;
/* NULL parameters */
StartSeh()
@@ -376,7 +378,8 @@
ok_eq_ustr(&FileName, &TempString);
ok(PathType == RtlPathTypeUnknown, "PathType = %d\n", PathType);
ok(NameInvalidArray[0] == FALSE, "NameInvalid = %u\n",
NameInvalidArray[0]);
- ok(CheckBuffer(NameInvalidArray + 1, sizeof(NameInvalidArray) -
sizeof(NameInvalidArray[0]), 0x55), "CheckBuffer failed\n");
+ Okay = CheckBuffer(NameInvalidArray + 1, sizeof(NameInvalidArray) -
sizeof(NameInvalidArray[0]), 0x55);
+ ok(Okay, "CheckBuffer failed\n");
/* Give it a valid path */
RtlInitUnicodeString(&FileName, L"C:\\test");
Modified: trunk/rostests/apitests/ntdll/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/testlist.c…
==============================================================================
--- trunk/rostests/apitests/ntdll/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/ntdll/testlist.c [iso-8859-1] Tue May 1 16:19:17 2012
@@ -10,6 +10,8 @@
extern void func_NtSystemInformation(void);
extern void func_RtlDetermineDosPathNameType(void);
extern void func_RtlDoesFileExists(void);
+extern void func_RtlDosSearchPath_U(void);
+extern void func_RtlDosSearchPath_Ustr(void);
extern void func_RtlGetFullPathName_U(void);
extern void func_RtlGetFullPathName_Ustr(void);
extern void func_RtlGetFullPathName_UstrEx(void);
@@ -24,6 +26,8 @@
{ "NtSystemInformation", func_NtSystemInformation },
{ "RtlDetermineDosPathNameType", func_RtlDetermineDosPathNameType },
{ "RtlDoesFileExists", func_RtlDoesFileExists },
+ { "RtlDosSearchPath_U", func_RtlDosSearchPath_U },
+ { "RtlDosSearchPath_Ustr", func_RtlDosSearchPath_Ustr },
{ "RtlGetFullPathName_U", func_RtlGetFullPathName_U },
{ "RtlGetFullPathName_Ustr", func_RtlGetFullPathName_Ustr },
{ "RtlGetFullPathName_UstrEx", func_RtlGetFullPathName_UstrEx },