Update ntdll_winetest to Wine-23052006
authorAleksey Bragin <aleksey@reactos.org>
Tue, 23 May 2006 20:05:14 +0000 (20:05 +0000)
committerAleksey Bragin <aleksey@reactos.org>
Tue, 23 May 2006 20:05:14 +0000 (20:05 +0000)
svn path=/trunk/; revision=21992

reactos/regtests/winetests/ntdll/atom.c
reactos/regtests/winetests/ntdll/error.c
reactos/regtests/winetests/ntdll/info.c
reactos/regtests/winetests/ntdll/large_int.c
reactos/regtests/winetests/ntdll/om.c
reactos/regtests/winetests/ntdll/path.c
reactos/regtests/winetests/ntdll/reg.c
reactos/regtests/winetests/ntdll/rtl.c
reactos/regtests/winetests/ntdll/rtlstr.c
reactos/regtests/winetests/ntdll/time.c

index e2563df..c0a8e2d 100755 (executable)
  * windows.
  */
 
-#define _WIN32_WINNT 0x0501
-
 #include <stdio.h>
 #include <stdarg.h>
+
 #include "ntstatus.h"
+/* Define WIN32_NO_STATUS so MSVC does not give us duplicate macro 
+ * definition errors when we get to winnt.h
+ */
 #define WIN32_NO_STATUS
-#include "windows.h"
+
+#include "windef.h"
+#include "winbase.h"
+#include "winreg.h"
+#include "winnls.h"
 #include "wine/test.h"
 #include "wine/unicode.h"
 #include "winternl.h"
 
+#ifndef __WINE_WINTERNL_H
+typedef unsigned short RTL_ATOM, *PRTL_ATOM;
+typedef struct atom_table *RTL_ATOM_TABLE, **PRTL_ATOM_TABLE;
+#endif
+
 /* Function pointers for ntdll calls */
 static HMODULE hntdll = 0;
 static NTSTATUS (WINAPI *pRtlCreateAtomTable)(ULONG,PRTL_ATOM_TABLE);
@@ -43,6 +54,9 @@ static NTSTATUS (WINAPI *pRtlLookupAtomInAtomTable)(RTL_ATOM_TABLE,PCWSTR,PRTL_A
 static NTSTATUS (WINAPI *pRtlPinAtomInAtomTable)(RTL_ATOM_TABLE,RTL_ATOM);
 static NTSTATUS (WINAPI *pRtlQueryAtomInAtomTable)(RTL_ATOM_TABLE,RTL_ATOM,PULONG,PULONG,PWSTR,PULONG);
 
+static NTSTATUS (WINAPI* pNtAddAtom)(LPCWSTR,ULONG,RTL_ATOM*);
+static NTSTATUS (WINAPI* pNtQueryInformationAtom)(RTL_ATOM,DWORD,void*,ULONG,PULONG);
+
 static const WCHAR EmptyAtom[] = {0};
 static const WCHAR testAtom1[] = {'H','e','l','l','o',' ','W','o','r','l','d',0};
 static const WCHAR testAtom2[] = {'H','e','l','l','o',' ','W','o','r','l','d','2',0};
@@ -70,6 +84,9 @@ static void InitFunctionPtr(void)
         pRtlLookupAtomInAtomTable = (void *)GetProcAddress(hntdll, "RtlLookupAtomInAtomTable");
         pRtlPinAtomInAtomTable = (void *)GetProcAddress(hntdll, "RtlPinAtomInAtomTable");
         pRtlQueryAtomInAtomTable = (void *)GetProcAddress(hntdll, "RtlQueryAtomInAtomTable");
+
+        pNtAddAtom = (void *)GetProcAddress(hntdll, "NtAddAtom");
+        pNtQueryInformationAtom = (void *)GetProcAddress(hntdll, "NtQueryInformationAtom");
     }
 }
 
@@ -181,6 +198,24 @@ static void test_NtAtom(void)
         ok(!strcmpW(Name, testAtom2), "We found wrong atom\n");
         ok((strlenW(testAtom2) * sizeof(WCHAR)) == Len, "Returned wrong length %ld\n", Len);
 
+        Len = 8;
+        Name[0] = Name[1] = Name[2] = Name[3] = Name[4] = 0x55AA;
+        res = pRtlQueryAtomInAtomTable(AtomTable, Atom2, NULL, NULL, Name, &Len);
+        ok(!res, "query atom %lx\n", res);
+        ok(Len == 6, "wrong length %lu\n", Len);
+        ok(!memcmp(Name, testAtom2, Len), "wrong atom string\n");
+        ok(!Name[3], "wrong string termination\n");
+        ok(Name[4] == 0x55AA, "buffer overwrite\n");
+
+        Len = lstrlenW(testAtom2) * sizeof(WCHAR);
+        memset(Name, '.', sizeof(Name));
+        res = pRtlQueryAtomInAtomTable( AtomTable, Atom2, NULL, NULL, Name, &Len );
+        ok(!res, "query atom %lx\n", res);
+        ok(Len == (lstrlenW(testAtom2) - 1) * sizeof(WCHAR), "wrong length %lu\n", Len);
+        ok(!memcmp(testAtom2, Name, (lstrlenW(testAtom2) - 1) * sizeof(WCHAR)), "wrong atom name\n");
+        ok(Name[lstrlenW(testAtom2) - 1] == '\0', "wrong char\n");
+        ok(Name[lstrlenW(testAtom2)] == ('.' << 8) + '.', "wrong char\n");
+
         res = pRtlLookupAtomInAtomTable(AtomTable, testAtom2, &testAtom);
         ok(!res, "We can't find our pinned atom!! retval: %lx\n", res);
         ok(testAtom == Atom2, "We found wrong atom!!!\n");
@@ -234,19 +269,6 @@ static void test_NtAtom(void)
         ok(res == STATUS_BUFFER_TOO_SMALL, "Got wrong retval, retval: %lx\n", res);
         ok((strlenW(testAtom1) * sizeof(WCHAR)) == Len, "Got wrong length %lx\n", Len);
 
-        res = pRtlQueryAtomInAtomTable(AtomTable, Atom1, NULL, NULL, NULL, &Len);
-        ok(!res, "Failed to retrieve atom length, retval: %lx\n", res);
-        ok(Len == strlenW(testAtom1) * sizeof(WCHAR), "Invalid atom length got %lu expected %u\n",
-           Len, strlenW(testAtom1) * sizeof(WCHAR));
-
-        Len = strlenW(testAtom1) * sizeof(WCHAR);
-        Name[strlenW(testAtom1)] = '*';
-        res = pRtlQueryAtomInAtomTable(AtomTable, Atom1, NULL, NULL, Name, &Len);
-        ok(!res, "Failed with exactly long enough buffer, retval: %lx\n", res);
-        ok(Name[strlenW(testAtom1)] == '*', "Writing outside buffer\n");
-        ok(0 == memcmp(Name, testAtom1, (strlenW(testAtom1) - 1) * sizeof(WCHAR)),
-           "We found wrong atom!!\n");
-
         res = pRtlPinAtomInAtomTable(AtomTable, Atom1);
         ok(!res, "Unable to pin atom in atom table, retval: %lx\n", res);
 
@@ -404,6 +426,47 @@ static void test_NtRefPinAtom(void)
     }
 }
 
+static void test_Global(void)
+{
+    NTSTATUS    res;
+    RTL_ATOM    atom;
+    char        ptr[sizeof(ATOM_BASIC_INFORMATION) + 255 * sizeof(WCHAR)];
+    ATOM_BASIC_INFORMATION*     abi = (ATOM_BASIC_INFORMATION*)ptr;
+    ULONG       ptr_size = sizeof(ATOM_BASIC_INFORMATION) + 255 * sizeof(WCHAR);
+
+    res = pNtAddAtom(testAtom1, lstrlenW(testAtom1) * sizeof(WCHAR), &atom);
+    ok(!res, "Added atom (%lx)\n", res);
+
+    memset(abi->Name, 0x55, 255 * sizeof(WCHAR));
+    res = pNtQueryInformationAtom( atom, AtomBasicInformation, (void*)ptr, ptr_size, NULL );
+    ok(!res, "atom lookup\n");
+    ok(!lstrcmpW(abi->Name, testAtom1), "ok strings\n");
+    ok(abi->NameLength == lstrlenW(testAtom1) * sizeof(WCHAR), "wrong string length\n");
+    ok(abi->Name[lstrlenW(testAtom1)] == 0, "wrong string termination %x\n", abi->Name[lstrlenW(testAtom1)]);
+    ok(abi->Name[lstrlenW(testAtom1) + 1] == 0x5555, "buffer overwrite %x\n", abi->Name[lstrlenW(testAtom1) + 1]);
+
+    ptr_size = sizeof(ATOM_BASIC_INFORMATION);
+    res = pNtQueryInformationAtom( atom, AtomBasicInformation, (void*)ptr, ptr_size, NULL );
+    ok(res == STATUS_BUFFER_TOO_SMALL, "wrong return status (%lx)\n", res);
+    ok(abi->NameLength == lstrlenW(testAtom1) * sizeof(WCHAR), "ok string length\n");
+
+    memset(abi->Name, 0x55, lstrlenW(testAtom1) * sizeof(WCHAR));
+    ptr_size = sizeof(ATOM_BASIC_INFORMATION) + lstrlenW(testAtom1) * sizeof(WCHAR);
+    res = pNtQueryInformationAtom( atom, AtomBasicInformation, (void*)ptr, ptr_size, NULL );
+    ok(!res, "atom lookup %lx\n", res);
+    ok(!lstrcmpW(abi->Name, testAtom1), "strings don't match\n");
+    ok(abi->NameLength == lstrlenW(testAtom1) * sizeof(WCHAR), "wrong string length\n");
+    ok(abi->Name[lstrlenW(testAtom1)] == 0, "buffer overwrite %x\n", abi->Name[lstrlenW(testAtom1)]);
+    ok(abi->Name[lstrlenW(testAtom1) + 1] == 0x5555, "buffer overwrite %x\n", abi->Name[lstrlenW(testAtom1) + 1]);
+
+    ptr_size = sizeof(ATOM_BASIC_INFORMATION) + 4 * sizeof(WCHAR);
+    abi->Name[0] = abi->Name[1] = abi->Name[2] = abi->Name[3] = '\0';
+    res = pNtQueryInformationAtom( atom, AtomBasicInformation, (void*)ptr, ptr_size, NULL );
+    ok(!res, "couldn't find atom\n");
+    ok(abi->NameLength == 8, "wrong string length %u\n", abi->NameLength);
+    ok(!memcmp(abi->Name, testAtom1, 8), "strings don't match\n");
+}
+
 START_TEST(atom)
 {
     InitFunctionPtr();
@@ -412,5 +475,6 @@ START_TEST(atom)
         test_NtAtom();
         test_NtIntAtom();
         test_NtRefPinAtom();
+        test_Global();
     }
 }
index a912d55..b12897b 100755 (executable)
@@ -18,8 +18,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define _WIN32_WINNT 0x0501
-
 #include <stdarg.h>
 #include <stdio.h>
 
@@ -28,8 +26,6 @@
 
 #include "wine/test.h"
 
-#include "windows.h"
-
 #include "windef.h"
 #include "winbase.h"
 #include "rpcnterr.h"
index 5992712..e5bb9b4 100755 (executable)
@@ -216,7 +216,7 @@ static void test_query_process(void)
     DWORD status;
     DWORD last_pid;
     ULONG ReturnLength;
-    int i = 0, j = 0, k = 0;
+    int i = 0, k = 0;
     int is_nt = 0;
     SYSTEM_BASIC_INFORMATION sbi;
 
@@ -297,6 +297,7 @@ static void test_query_process(void)
         
         if (!is_nt)
         {
+            DWORD j;
             for ( j = 0; j < spi->dwThreadCount; j++) 
             {
                 k++;
@@ -362,8 +363,7 @@ static void test_query_module(void)
 {
     DWORD status;
     ULONG ReturnLength;
-    DWORD ModuleCount;
-    int i;
+    ULONG ModuleCount, i;
 
     ULONG SystemInformationLength = sizeof(SYSTEM_MODULE_INFORMATION);
     SYSTEM_MODULE_INFORMATION* smi = HeapAlloc(GetProcessHeap(), 0, SystemInformationLength); 
@@ -389,7 +389,7 @@ static void test_query_module(void)
     /* Loop through all the modules/drivers, Wine doesn't get here (yet) */
     for (i = 0; i < ModuleCount ; i++)
     {
-        ok( i == sm->Id, "Id (%d) should have matched %d\n", sm->Id, i);
+        ok( i == sm->Id, "Id (%d) should have matched %lu\n", sm->Id, i);
         sm++;
     }
 
index 6eb809f..52c9d8f 100755 (executable)
@@ -391,22 +391,22 @@ static void test_RtlLargeIntegerToChar(void)
     result = pRtlLargeIntegerToChar(&value, 20, largeint2str[0].MaximumLength, NULL);
     ok(result == STATUS_INVALID_PARAMETER,
        "(test a): RtlLargeIntegerToChar(%llu, %d, %d, NULL) has result %lx, expected: %lx\n",
-       largeint2str[0].value, 20, largeint2str[0].MaximumLength, result, (DWORD) STATUS_INVALID_PARAMETER);
+       largeint2str[0].value, 20, largeint2str[0].MaximumLength, result, STATUS_INVALID_PARAMETER);
 
     result = pRtlLargeIntegerToChar(&value, 20, 0, NULL);
     ok(result == STATUS_INVALID_PARAMETER,
        "(test b): RtlLargeIntegerToChar(%llu, %d, %d, NULL) has result %lx, expected: %lx\n",
-       largeint2str[0].value, 20, largeint2str[0].MaximumLength, result, (DWORD) STATUS_INVALID_PARAMETER);
+       largeint2str[0].value, 20, largeint2str[0].MaximumLength, result, STATUS_INVALID_PARAMETER);
 
     result = pRtlLargeIntegerToChar(&value, largeint2str[0].base, 0, NULL);
     ok(result == STATUS_BUFFER_OVERFLOW,
        "(test c): RtlLargeIntegerToChar(%llu, %d, %d, NULL) has result %lx, expected: %lx\n",
-       largeint2str[0].value, largeint2str[0].base, 0, result, (DWORD) STATUS_BUFFER_OVERFLOW);
+       largeint2str[0].value, largeint2str[0].base, 0, result, STATUS_BUFFER_OVERFLOW);
 
     result = pRtlLargeIntegerToChar(&value, largeint2str[0].base, largeint2str[0].MaximumLength, NULL);
     ok(result == STATUS_ACCESS_VIOLATION,
        "(test d): RtlLargeIntegerToChar(%llu, %d, %d, NULL) has result %lx, expected: %lx\n",
-       largeint2str[0].value, largeint2str[0].base, largeint2str[0].MaximumLength, result, (DWORD) STATUS_ACCESS_VIOLATION);
+       largeint2str[0].value, largeint2str[0].base, largeint2str[0].MaximumLength, result, STATUS_ACCESS_VIOLATION);
 }
 
 
index 8e96162..3ce779d 100644 (file)
@@ -90,7 +90,7 @@ void test_case_sensitive (void)
 \r
     attr.Attributes = 0;\r
     status = pNtCreateMutant(&Mutant, GENERIC_ALL, &attr, FALSE);\r
-    todo_wine ok(status == STATUS_OBJECT_PATH_NOT_FOUND,\r
+    ok(status == STATUS_OBJECT_PATH_NOT_FOUND,\r
         "NtCreateMutant should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08lx)\n", status);\r
 \r
     pNtClose(Event);\r
@@ -126,7 +126,7 @@ void test_namespace_pipe(void)
     InitializeObjectAttributes(&attr, &str, 0, 0, NULL);\r
     status = pNtCreateNamedPipeFile(&pipe, GENERIC_READ|GENERIC_WRITE, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE,\r
                                     FILE_CREATE, FILE_PIPE_FULL_DUPLEX, FALSE, FALSE, FALSE, 1, 256, 256, &timeout);\r
-    todo_wine ok(status == STATUS_INSTANCE_NOT_AVAILABLE,\r
+    ok(status == STATUS_INSTANCE_NOT_AVAILABLE,\r
         "NtCreateNamedPipeFile should have failed with STATUS_INSTANCE_NOT_AVAILABLE got(%08lx)\n", status);\r
 \r
     attr.Attributes = OBJ_CASE_INSENSITIVE;\r
@@ -137,7 +137,7 @@ void test_namespace_pipe(void)
     pRtlInitUnicodeString(&str, buffer3);\r
     InitializeObjectAttributes(&attr, &str, 0, 0, NULL);\r
     status = pNtOpenFile(&h, GENERIC_READ, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN);\r
-    todo_wine ok(status == STATUS_OBJECT_PATH_NOT_FOUND || status == STATUS_PIPE_NOT_AVAILABLE,\r
+    ok(status == STATUS_OBJECT_PATH_NOT_FOUND || status == STATUS_PIPE_NOT_AVAILABLE,\r
         "pNtOpenFile should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08lx)\n", status);\r
 \r
     pRtlInitUnicodeString(&str, buffer4);\r
@@ -185,21 +185,19 @@ static void test_name_collisions(void)
 \r
     InitializeObjectAttributes(&attr, &str, 0, 0, NULL);\r
     pRtlCreateUnicodeStringFromAsciiz(&str, "\\");\r
-    h = 0;\r
-    todo_wine{ DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_NAME_COLLISION) }\r
-    ok(h == 0, "Failed create returned valid handle! (%p)\n", h);\r
+    DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_NAME_COLLISION)\r
     InitializeObjectAttributes(&attr, &str, OBJ_OPENIF, 0, NULL);\r
 \r
-    todo_wine{ DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_NAME_EXISTS) }\r
+    DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_NAME_EXISTS)\r
     pNtClose(h);\r
     status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);\r
-    todo_wine ok(status == STATUS_OBJECT_TYPE_MISMATCH,\r
+    ok(status == STATUS_OBJECT_TYPE_MISMATCH,\r
         "NtCreateMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08lx)\n", status);\r
     pRtlFreeUnicodeString(&str);\r
 \r
     pRtlCreateUnicodeStringFromAsciiz(&str, "\\??\\PIPE\\om.c-mutant");\r
     status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);\r
-    todo_wine ok(status == STATUS_OBJECT_TYPE_MISMATCH,\r
+    ok(status == STATUS_OBJECT_TYPE_MISMATCH || status == STATUS_OBJECT_PATH_NOT_FOUND,\r
         "NtCreateMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08lx)\n", status);\r
     pRtlFreeUnicodeString(&str);\r
 \r
@@ -289,22 +287,22 @@ void test_directory(void)
 \r
     /* No name and/or no attributes */\r
     status = pNtCreateDirectoryObject(NULL, DIRECTORY_QUERY, &attr);\r
-    todo_wine ok(status == STATUS_ACCESS_VIOLATION,\r
+    ok(status == STATUS_ACCESS_VIOLATION,\r
         "NtCreateDirectoryObject should have failed with STATUS_ACCESS_VIOLATION got(%08lx)\n", status);\r
     status = pNtOpenDirectoryObject(NULL, DIRECTORY_QUERY, &attr);\r
-    todo_wine ok(status == STATUS_ACCESS_VIOLATION,\r
+    ok(status == STATUS_ACCESS_VIOLATION,\r
         "NtOpenDirectoryObject should have failed with STATUS_ACCESS_VIOLATION got(%08lx)\n", status);\r
 \r
     status = pNtCreateDirectoryObject(&h, DIRECTORY_QUERY, NULL);\r
     ok(status == STATUS_SUCCESS, "Failed to create Directory without attributes(%08lx)\n", status);\r
     pNtClose(h);\r
     status = pNtOpenDirectoryObject(&h, DIRECTORY_QUERY, NULL);\r
-    todo_wine ok(status == STATUS_INVALID_PARAMETER,\r
+    ok(status == STATUS_INVALID_PARAMETER,\r
         "NtOpenDirectoryObject should have failed with STATUS_INVALID_PARAMETER got(%08lx)\n", status);\r
 \r
     InitializeObjectAttributes(&attr, NULL, 0, 0, NULL);\r
     DIR_TEST_CREATE_SUCCESS(&dir)\r
-    todo_wine{ DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD) }\r
+    DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD)\r
 \r
     /* Bad name */\r
     InitializeObjectAttributes(&attr, &str, 0, 0, NULL);\r
@@ -312,15 +310,15 @@ void test_directory(void)
     pRtlCreateUnicodeStringFromAsciiz(&str, "");\r
     DIR_TEST_CREATE_SUCCESS(&h)\r
     pNtClose(h);\r
-    todo_wine{ DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD) }\r
+    DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD)\r
     pRtlFreeUnicodeString(&str);\r
     pNtClose(dir);\r
 \r
-    todo_wine{ DIR_TEST_CREATE_OPEN_FAILURE(&h, "BaseNamedObjects", STATUS_OBJECT_PATH_SYNTAX_BAD) }\r
-    todo_wine{ DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\", STATUS_OBJECT_NAME_INVALID) }\r
-    todo_wine{ DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\\\BaseNamedObjects", STATUS_OBJECT_NAME_INVALID) }\r
-    todo_wine{ DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\\\om.c-test", STATUS_OBJECT_NAME_INVALID) }\r
-    todo_wine{ DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\om.c-test\\", STATUS_OBJECT_PATH_NOT_FOUND) }\r
+    DIR_TEST_CREATE_OPEN_FAILURE(&h, "BaseNamedObjects", STATUS_OBJECT_PATH_SYNTAX_BAD)\r
+    DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\", STATUS_OBJECT_NAME_INVALID)\r
+    DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\\\BaseNamedObjects", STATUS_OBJECT_NAME_INVALID)\r
+    DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\\\om.c-test", STATUS_OBJECT_NAME_INVALID)\r
+    DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\om.c-test\\", STATUS_OBJECT_PATH_NOT_FOUND)\r
 \r
     pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\om.c-test");\r
     DIR_TEST_CREATE_SUCCESS(&h)\r
@@ -336,11 +334,11 @@ void test_directory(void)
     pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Local");\r
     InitializeObjectAttributes(&attr, &str, 0, 0, NULL);\r
     status = pNtOpenSymbolicLinkObject(&dir, SYMBOLIC_LINK_QUERY, &attr);\\r
-    todo_wine ok(status == STATUS_SUCCESS, "Failed to open SymbolicLink(%08lx)\n", status);\r
+    ok(status == STATUS_SUCCESS, "Failed to open SymbolicLink(%08lx)\n", status);\r
     pRtlFreeUnicodeString(&str);\r
     InitializeObjectAttributes(&attr, &str, 0, dir, NULL);\r
     pRtlCreateUnicodeStringFromAsciiz(&str, "one more level");\r
-    todo_wine{ DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_TYPE_MISMATCH) }\r
+    DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_TYPE_MISMATCH)\r
     pRtlFreeUnicodeString(&str);\r
     pNtClose(h);\r
     pNtClose(dir);\r
@@ -351,14 +349,14 @@ void test_directory(void)
     pRtlFreeUnicodeString(&str);\r
 \r
     InitializeObjectAttributes(&attr, NULL, 0, dir, NULL);\r
-    todo_wine{ DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_NAME_INVALID) }\r
+    DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_NAME_INVALID)\r
 \r
     InitializeObjectAttributes(&attr, &str, 0, dir, NULL);\r
     DIR_TEST_CREATE_OPEN_SUCCESS(&h, "")\r
-    todo_wine{ DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\", STATUS_OBJECT_PATH_SYNTAX_BAD) }\r
-    todo_wine{ DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\om.c-test", STATUS_OBJECT_PATH_SYNTAX_BAD) }\r
-    todo_wine{ DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\om.c-test\\", STATUS_OBJECT_PATH_SYNTAX_BAD) }\r
-    todo_wine{ DIR_TEST_CREATE_OPEN_FAILURE(&h, "om.c-test\\", STATUS_OBJECT_PATH_NOT_FOUND) }\r
+    DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\", STATUS_OBJECT_PATH_SYNTAX_BAD)\r
+    DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\om.c-test", STATUS_OBJECT_PATH_SYNTAX_BAD)\r
+    DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\om.c-test\\", STATUS_OBJECT_PATH_SYNTAX_BAD)\r
+    DIR_TEST_CREATE_OPEN_FAILURE(&h, "om.c-test\\", STATUS_OBJECT_PATH_NOT_FOUND)\r
 \r
     pRtlCreateUnicodeStringFromAsciiz(&str, "om.c-test");\r
     DIR_TEST_CREATE_SUCCESS(&dir1)\r
@@ -374,7 +372,7 @@ void test_directory(void)
     InitializeObjectAttributes(&attr, &str, 0, 0, NULL);\r
     DIR_TEST_OPEN_SUCCESS(&dir)\r
     InitializeObjectAttributes(&attr, &str, 0, dir, NULL);\r
-    todo_wine{ DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD) }\r
+    DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD)\r
     pRtlFreeUnicodeString(&str);\r
     pNtClose(dir);\r
 \r
@@ -422,18 +420,18 @@ void test_directory(void)
     /* Test inavalid paths */\r
     pRtlCreateUnicodeStringFromAsciiz(&str, "\\om.c-mutant");\r
     status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);\r
-    todo_wine ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD,\r
+    ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD,\r
         "NtCreateMutant should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08lx)\n", status);\r
     pRtlFreeUnicodeString(&str);\r
     pRtlCreateUnicodeStringFromAsciiz(&str, "\\om.c-mutant\\");\r
     status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);\r
-    todo_wine ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD,\r
+    ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD,\r
         "NtCreateMutant should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08lx)\n", status);\r
     pRtlFreeUnicodeString(&str);\r
 \r
     pRtlCreateUnicodeStringFromAsciiz(&str, "om.c\\-mutant");\r
     status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);\r
-    todo_wine ok(status == STATUS_OBJECT_PATH_NOT_FOUND,\r
+    ok(status == STATUS_OBJECT_PATH_NOT_FOUND,\r
         "NtCreateMutant should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08lx)\n", status);\r
     pRtlFreeUnicodeString(&str);\r
 \r
@@ -476,18 +474,18 @@ void test_symboliclink(void)
     IO_STATUS_BLOCK iosb;\r
 \r
     /* No name and/or no attributes */\r
-    todo_wine{ SYMLNK_TEST_CREATE_OPEN_FAILURE(NULL, "", "", STATUS_ACCESS_VIOLATION) }\r
+    SYMLNK_TEST_CREATE_OPEN_FAILURE(NULL, "", "", STATUS_ACCESS_VIOLATION)\r
 \r
     status = pNtCreateSymbolicLinkObject(&h, SYMBOLIC_LINK_QUERY, NULL, NULL);\r
-    todo_wine ok(status == STATUS_ACCESS_VIOLATION,\r
+    ok(status == STATUS_ACCESS_VIOLATION,\r
         "NtCreateSymbolicLinkObject should have failed with STATUS_ACCESS_VIOLATION got(%08lx)\n", status);\r
     status = pNtOpenSymbolicLinkObject(&h, SYMBOLIC_LINK_QUERY, NULL);\r
-    todo_wine ok(status == STATUS_INVALID_PARAMETER,\r
+    ok(status == STATUS_INVALID_PARAMETER,\r
         "NtOpenSymbolicLinkObject should have failed with STATUS_INVALID_PARAMETER got(%08lx)\n", status);\r
 \r
     InitializeObjectAttributes(&attr, NULL, 0, 0, NULL);\r
-    todo_wine{ SYMLNK_TEST_CREATE_FAILURE(&link, STATUS_INVALID_PARAMETER) }\r
-    todo_wine{ SYMLNK_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD) }\r
+    SYMLNK_TEST_CREATE_FAILURE(&link, STATUS_INVALID_PARAMETER)\r
+    SYMLNK_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD)\r
 \r
     /* Bad name */\r
     pRtlCreateUnicodeStringFromAsciiz(&target, "anywhere");\r
@@ -495,7 +493,7 @@ void test_symboliclink(void)
 \r
     pRtlCreateUnicodeStringFromAsciiz(&str, "");\r
     SYMLNK_TEST_CREATE_SUCCESS(&link)\r
-    todo_wine{ SYMLNK_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD) }\r
+    SYMLNK_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD)\r
     pNtClose(link);\r
     pRtlFreeUnicodeString(&str);\r
 \r
@@ -504,11 +502,11 @@ void test_symboliclink(void)
     pRtlFreeUnicodeString(&str);\r
     pRtlFreeUnicodeString(&target);\r
 \r
-    todo_wine{ SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "BaseNamedObjects", "->Somewhere", STATUS_OBJECT_PATH_SYNTAX_BAD) }\r
-    todo_wine{ SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\", "->Somewhere", STATUS_OBJECT_NAME_INVALID) }\r
-    todo_wine{ SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\\\BaseNamedObjects", "->Somewhere", STATUS_OBJECT_NAME_INVALID) }\r
-    todo_wine{ SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\\\om.c-test", "->Somewhere", STATUS_OBJECT_NAME_INVALID) }\r
-    todo_wine{ SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\om.c-test\\", "->Somewhere", STATUS_OBJECT_NAME_INVALID) }\r
+    SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "BaseNamedObjects", "->Somewhere", STATUS_OBJECT_PATH_SYNTAX_BAD)\r
+    SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\", "->Somewhere", STATUS_OBJECT_NAME_INVALID)\r
+    SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\\\BaseNamedObjects", "->Somewhere", STATUS_OBJECT_NAME_INVALID)\r
+    SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\\\om.c-test", "->Somewhere", STATUS_OBJECT_NAME_INVALID)\r
+    SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\om.c-test\\", "->Somewhere", STATUS_OBJECT_NAME_INVALID)\r
 \r
 \r
     /* Compaund test */\r
index d8ba775..7b2fb73 100755 (executable)
@@ -266,12 +266,12 @@ static void test_RtlGetFullPathName_U(void)
         pRtlMultiByteToUnicodeN(pathbufW , sizeof(pathbufW), NULL, test->path, strlen(test->path)+1 );
         ret = pRtlGetFullPathName_U( pathbufW,MAX_PATH, rbufferW, &file_part);
         ok( ret == len, "Wrong result %ld/%d for \"%s\"\n", ret, len, test->path );
-        ok(pRtlUnicodeToMultiByteN(rbufferA,MAX_PATH,&reslen,rbufferW,MAX_PATH) == STATUS_SUCCESS,
+        ok(pRtlUnicodeToMultiByteN(rbufferA,MAX_PATH,&reslen,rbufferW,(lstrlenW(rbufferW) + 1) * sizeof(WCHAR)) == STATUS_SUCCESS,
            "RtlUnicodeToMultiByteN failed\n");
         ok(lstrcmpiA(rbufferA,test->rname) == 0, "Got \"%s\" expected \"%s\"\n",rbufferA,test->rname);
         if (file_part)
         {
-            ok(pRtlUnicodeToMultiByteN(rfileA,MAX_PATH,&reslen,file_part,MAX_PATH) == STATUS_SUCCESS,
+            ok(pRtlUnicodeToMultiByteN(rfileA,MAX_PATH,&reslen,file_part,(lstrlenW(file_part) + 1) * sizeof(WCHAR)) == STATUS_SUCCESS,
                "RtlUnicodeToMultiByteN failed\n");
             ok(test->rfile && !lstrcmpiA(rfileA,test->rfile), "Got \"%s\" expected \"%s\"\n",rfileA,test->rfile);
         }
index d71e164..b6a0d92 100755 (executable)
 
 #include "ntdll_test.h"
 #include "winternl.h"
-//#include "wine/library.h"
 #include "stdio.h"
 #include "winnt.h"
 #include "winnls.h"
 #include "stdlib.h"
-#include "wine/unicode.h"
 
 #ifndef __WINE_WINTERNL_H
 
@@ -69,6 +67,16 @@ typedef struct _RTL_QUERY_REGISTRY_TABLE {
   ULONG  DefaultLength;
 } RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE;
 
+#define InitializeObjectAttributes(p,n,a,r,s) \
+    do { \
+        (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
+        (p)->RootDirectory = r; \
+        (p)->Attributes = a; \
+        (p)->ObjectName = n; \
+        (p)->SecurityDescriptor = s; \
+        (p)->SecurityQualityOfService = NULL; \
+    } while (0)
+
 #endif
 
 static NTSTATUS (WINAPI * pRtlCreateUnicodeStringFromAsciiz)(PUNICODE_STRING, LPCSTR);
@@ -151,7 +159,7 @@ static NTSTATUS WINAPI QueryRoutine (IN PCWSTR ValueName, IN ULONG ValueType, IN
 
     if(ValueName)
     {
-        ValueNameLength = strlenW(ValueName);
+        ValueNameLength = lstrlenW(ValueName);
 
         ValName = (LPSTR)pRtlAllocateHeap(GetProcessHeap(), 0, ValueNameLength);
 
@@ -286,7 +294,6 @@ static void test_NtCreateKey(void)
 {
     /*Create WineTest*/
     OBJECT_ATTRIBUTES attr;
-    UNICODE_STRING ValName;
     HKEY key;
     ACCESS_MASK am = GENERIC_ALL;
     NTSTATUS status;
@@ -295,7 +302,6 @@ static void test_NtCreateKey(void)
     status = pNtCreateKey(&key, am, &attr, 0, 0, 0, 0);
     ok(status == STATUS_SUCCESS, "NtCreateKey Failed: 0x%08lx\n", status);
 
-    pRtlFreeUnicodeString(&ValName);
     pNtClose(&key);
 }
 
index 8e31032..fe79e36 100755 (executable)
 
 #include "ntdll_test.h"
 
+#ifndef __WINE_WINTERNL_H
+
+typedef struct _RTL_HANDLE
+{
+    struct _RTL_HANDLE * Next;
+} RTL_HANDLE;
+
+typedef struct _RTL_HANDLE_TABLE
+{
+    ULONG MaxHandleCount;
+    ULONG HandleSize;
+    ULONG Unused[2];
+    PVOID NextFree;
+    PVOID FirstHandle;
+    PVOID ReservedMemory;
+    PVOID MaxHandle;
+} RTL_HANDLE_TABLE;
+
+#endif
+
 /* Function ptrs for ntdll calls */
 static HMODULE hntdll = 0;
 static SIZE_T    (WINAPI  *pRtlCompareMemory)(LPCVOID,LPCVOID,SIZE_T);
@@ -44,6 +64,8 @@ static BOOLEAN   (WINAPI * pRtlIsValidIndexHandle)(const RTL_HANDLE_TABLE *, ULO
 static NTSTATUS  (WINAPI * pRtlDestroyHandleTable)(RTL_HANDLE_TABLE *);
 static RTL_HANDLE * (WINAPI * pRtlAllocateHandle)(RTL_HANDLE_TABLE *, ULONG *);
 static BOOLEAN   (WINAPI * pRtlFreeHandle)(RTL_HANDLE_TABLE *, RTL_HANDLE *);
+static NTSTATUS  (WINAPI *pRtlAllocateAndInitializeSid)(PSID_IDENTIFIER_AUTHORITY,BYTE,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,PSID*);
+static NTSTATUS  (WINAPI *pRtlFreeSid)(PSID);
 #define LEN 16
 static const char* src_src = "This is a test!"; /* 16 bytes long, incl NUL */
 static ULONG src_aligned_block[4];
@@ -73,6 +95,8 @@ static void InitFunctionPtrs(void)
        pRtlDestroyHandleTable = (void *)GetProcAddress(hntdll, "RtlDestroyHandleTable");
        pRtlAllocateHandle = (void *)GetProcAddress(hntdll, "RtlAllocateHandle");
        pRtlFreeHandle = (void *)GetProcAddress(hntdll, "RtlFreeHandle");
+        pRtlAllocateAndInitializeSid = (void *)GetProcAddress(hntdll, "RtlAllocateAndInitializeSid");
+        pRtlFreeSid = (void *)GetProcAddress(hntdll, "RtlFreeSid");
     }
     strcpy((char*)src_aligned_block, src_src);
     ok(strlen(src) == 15, "Source must be 16 bytes long!\n");
@@ -820,7 +844,7 @@ static void test_RtlComputeCrc32(void)
   if (!pRtlComputeCrc32)
     return;
 
-  crc = pRtlComputeCrc32(crc, src, LEN);
+  crc = pRtlComputeCrc32(crc, (LPBYTE)src, LEN);
   ok(crc == 0x40861dc2,"Expected 0x40861dc2, got %8lx\n", crc);
 }
 
@@ -858,6 +882,25 @@ static void test_HandleTables(void)
     ok(status == STATUS_SUCCESS, "RtlDestroyHandleTable failed with error 0x%08lx\n", status);
 }
 
+static void test_RtlAllocateAndInitializeSid(void)
+{
+    NTSTATUS ret;
+    SID_IDENTIFIER_AUTHORITY sia = {{ 1, 2, 3, 4, 5, 6 }};
+    PSID psid;
+
+    ret = pRtlAllocateAndInitializeSid(&sia, 0, 1, 2, 3, 4, 5, 6, 7, 8, &psid);
+    ok(!ret, "RtlAllocateAndInitializeSid error %08lx\n", ret);
+    ret = pRtlFreeSid(psid);
+    ok(!ret, "RtlFreeSid error %08lx\n", ret);
+
+    /* these tests crash on XP
+    ret = pRtlAllocateAndInitializeSid(NULL, 0, 1, 2, 3, 4, 5, 6, 7, 8, &psid);
+    ret = pRtlAllocateAndInitializeSid(&sia, 0, 1, 2, 3, 4, 5, 6, 7, 8, NULL);*/
+
+    ret = pRtlAllocateAndInitializeSid(&sia, 9, 1, 2, 3, 4, 5, 6, 7, 8, &psid);
+    ok(ret == STATUS_INVALID_SID, "wrong error %08lx\n", ret);
+}
+
 START_TEST(rtl)
 {
     InitFunctionPtrs();
@@ -888,4 +931,6 @@ START_TEST(rtl)
         test_RtlComputeCrc32();
     if (pRtlInitializeHandleTable)
         test_HandleTables();
+    if (pRtlAllocateAndInitializeSid)
+        test_RtlAllocateAndInitializeSid();
 }
index 80319d1..84bf83d 100755 (executable)
@@ -199,8 +199,8 @@ static void test_RtlInitUnicodeStringEx(void)
     uni.Buffer = (void *) 0xdeadbeef;
     result = pRtlInitUnicodeStringEx(&uni, teststring);
     ok(result == STATUS_SUCCESS,
-       "pRtlInitUnicodeStringEx(&uni, 0) returns %lx, expected %lx\n",
-       result, (DWORD) STATUS_SUCCESS);
+       "pRtlInitUnicodeStringEx(&uni, 0) returns %lx, expected 0\n",
+       result);
     ok(uni.Length == 32,
        "pRtlInitUnicodeStringEx(&uni, 0) sets Length to %u, expected %u\n",
        uni.Length, 32);
@@ -231,7 +231,7 @@ static void test_RtlInitUnicodeStringEx(void)
     result = pRtlInitUnicodeStringEx(&uni, teststring2);
     ok(result == STATUS_NAME_TOO_LONG,
        "pRtlInitUnicodeStringEx(&uni, 0) returns %lx, expected %lx\n",
-       result, (DWORD) STATUS_NAME_TOO_LONG);
+       result, STATUS_NAME_TOO_LONG);
     ok(uni.Length == 12345,
        "pRtlInitUnicodeStringEx(&uni, 0) sets Length to %u, expected %u\n",
        uni.Length, 12345);
@@ -263,8 +263,8 @@ static void test_RtlInitUnicodeStringEx(void)
     uni.Buffer = (void *) 0xdeadbeef;
     result = pRtlInitUnicodeStringEx(&uni, 0);
     ok(result == STATUS_SUCCESS,
-       "pRtlInitUnicodeStringEx(&uni, 0) returns %lx, expected %lx\n",
-       result, (DWORD) STATUS_SUCCESS);
+       "pRtlInitUnicodeStringEx(&uni, 0) returns %lx, expected 0\n",
+       result);
     ok(uni.Length == 0,
        "pRtlInitUnicodeStringEx(&uni, 0) sets Length to %u, expected %u\n",
        uni.Length, 0);
@@ -1651,22 +1651,22 @@ static void test_RtlIntegerToChar(void)
     result = pRtlIntegerToChar(int2str[0].value, 20, int2str[0].MaximumLength, NULL);
     ok(result == STATUS_INVALID_PARAMETER,
        "(test a): RtlIntegerToChar(%lu, %d, %d, NULL) has result %lx, expected: %lx\n",
-       int2str[0].value, 20, int2str[0].MaximumLength, result, (DWORD) STATUS_INVALID_PARAMETER);
+       int2str[0].value, 20, int2str[0].MaximumLength, result, STATUS_INVALID_PARAMETER);
 
     result = pRtlIntegerToChar(int2str[0].value, 20, 0, NULL);
     ok(result == STATUS_INVALID_PARAMETER,
        "(test b): RtlIntegerToChar(%lu, %d, %d, NULL) has result %lx, expected: %lx\n",
-       int2str[0].value, 20, 0, result, (DWORD) STATUS_INVALID_PARAMETER);
+       int2str[0].value, 20, 0, result, STATUS_INVALID_PARAMETER);
 
     result = pRtlIntegerToChar(int2str[0].value, int2str[0].base, 0, NULL);
     ok(result == STATUS_BUFFER_OVERFLOW,
        "(test c): RtlIntegerToChar(%lu, %d, %d, NULL) has result %lx, expected: %lx\n",
-       int2str[0].value, int2str[0].base, 0, result, (DWORD) STATUS_BUFFER_OVERFLOW);
+       int2str[0].value, int2str[0].base, 0, result, STATUS_BUFFER_OVERFLOW);
 
     result = pRtlIntegerToChar(int2str[0].value, int2str[0].base, int2str[0].MaximumLength, NULL);
     ok(result == STATUS_ACCESS_VIOLATION,
        "(test d): RtlIntegerToChar(%lu, %d, %d, NULL) has result %lx, expected: %lx\n",
-       int2str[0].value, int2str[0].base, int2str[0].MaximumLength, result, (DWORD) STATUS_ACCESS_VIOLATION);
+       int2str[0].value, int2str[0].base, int2str[0].MaximumLength, result, STATUS_ACCESS_VIOLATION);
 }
 
 static const WCHAR szGuid[] = { '{','0','1','0','2','0','3','0','4','-',
index 5e1070d..f5c586d 100755 (executable)
@@ -43,7 +43,7 @@ static inline int IsLeapYear(int Year)
 /* start time of the tests */
 TIME_FIELDS tftest = {1889,12,31,23,59,59,0,0};
 
-static void test_pRtlTimeToTimeFields()
+static void test_pRtlTimeToTimeFields(void)
 {
     LARGE_INTEGER litime , liresult;
     TIME_FIELDS tfresult;