Update ntdll_winetest to Wine-23052006

svn path=/trunk/; revision=21992
This commit is contained in:
Aleksey Bragin
2006-05-23 20:05:14 +00:00
parent f2725683f8
commit 69713a9bc1
10 changed files with 196 additions and 87 deletions
+80 -16
View File
@@ -21,17 +21,28 @@
* 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();
}
}
-4
View File
@@ -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"
+4 -4
View File
@@ -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++;
}
+4 -4
View File
@@ -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);
}
+39 -41
View File
@@ -90,7 +90,7 @@ void test_case_sensitive (void)
attr.Attributes = 0;
status = pNtCreateMutant(&Mutant, GENERIC_ALL, &attr, FALSE);
todo_wine ok(status == STATUS_OBJECT_PATH_NOT_FOUND,
ok(status == STATUS_OBJECT_PATH_NOT_FOUND,
"NtCreateMutant should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08lx)\n", status);
pNtClose(Event);
@@ -126,7 +126,7 @@ void test_namespace_pipe(void)
InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
status = pNtCreateNamedPipeFile(&pipe, GENERIC_READ|GENERIC_WRITE, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE,
FILE_CREATE, FILE_PIPE_FULL_DUPLEX, FALSE, FALSE, FALSE, 1, 256, 256, &timeout);
todo_wine ok(status == STATUS_INSTANCE_NOT_AVAILABLE,
ok(status == STATUS_INSTANCE_NOT_AVAILABLE,
"NtCreateNamedPipeFile should have failed with STATUS_INSTANCE_NOT_AVAILABLE got(%08lx)\n", status);
attr.Attributes = OBJ_CASE_INSENSITIVE;
@@ -137,7 +137,7 @@ void test_namespace_pipe(void)
pRtlInitUnicodeString(&str, buffer3);
InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
status = pNtOpenFile(&h, GENERIC_READ, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN);
todo_wine ok(status == STATUS_OBJECT_PATH_NOT_FOUND || status == STATUS_PIPE_NOT_AVAILABLE,
ok(status == STATUS_OBJECT_PATH_NOT_FOUND || status == STATUS_PIPE_NOT_AVAILABLE,
"pNtOpenFile should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08lx)\n", status);
pRtlInitUnicodeString(&str, buffer4);
@@ -185,21 +185,19 @@ static void test_name_collisions(void)
InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
pRtlCreateUnicodeStringFromAsciiz(&str, "\\");
h = 0;
todo_wine{ DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_NAME_COLLISION) }
ok(h == 0, "Failed create returned valid handle! (%p)\n", h);
DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_NAME_COLLISION)
InitializeObjectAttributes(&attr, &str, OBJ_OPENIF, 0, NULL);
todo_wine{ DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_NAME_EXISTS) }
DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_NAME_EXISTS)
pNtClose(h);
status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
todo_wine ok(status == STATUS_OBJECT_TYPE_MISMATCH,
ok(status == STATUS_OBJECT_TYPE_MISMATCH,
"NtCreateMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08lx)\n", status);
pRtlFreeUnicodeString(&str);
pRtlCreateUnicodeStringFromAsciiz(&str, "\\??\\PIPE\\om.c-mutant");
status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
todo_wine ok(status == STATUS_OBJECT_TYPE_MISMATCH,
ok(status == STATUS_OBJECT_TYPE_MISMATCH || status == STATUS_OBJECT_PATH_NOT_FOUND,
"NtCreateMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08lx)\n", status);
pRtlFreeUnicodeString(&str);
@@ -289,22 +287,22 @@ void test_directory(void)
/* No name and/or no attributes */
status = pNtCreateDirectoryObject(NULL, DIRECTORY_QUERY, &attr);
todo_wine ok(status == STATUS_ACCESS_VIOLATION,
ok(status == STATUS_ACCESS_VIOLATION,
"NtCreateDirectoryObject should have failed with STATUS_ACCESS_VIOLATION got(%08lx)\n", status);
status = pNtOpenDirectoryObject(NULL, DIRECTORY_QUERY, &attr);
todo_wine ok(status == STATUS_ACCESS_VIOLATION,
ok(status == STATUS_ACCESS_VIOLATION,
"NtOpenDirectoryObject should have failed with STATUS_ACCESS_VIOLATION got(%08lx)\n", status);
status = pNtCreateDirectoryObject(&h, DIRECTORY_QUERY, NULL);
ok(status == STATUS_SUCCESS, "Failed to create Directory without attributes(%08lx)\n", status);
pNtClose(h);
status = pNtOpenDirectoryObject(&h, DIRECTORY_QUERY, NULL);
todo_wine ok(status == STATUS_INVALID_PARAMETER,
ok(status == STATUS_INVALID_PARAMETER,
"NtOpenDirectoryObject should have failed with STATUS_INVALID_PARAMETER got(%08lx)\n", status);
InitializeObjectAttributes(&attr, NULL, 0, 0, NULL);
DIR_TEST_CREATE_SUCCESS(&dir)
todo_wine{ DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD) }
DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD)
/* Bad name */
InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
@@ -312,15 +310,15 @@ void test_directory(void)
pRtlCreateUnicodeStringFromAsciiz(&str, "");
DIR_TEST_CREATE_SUCCESS(&h)
pNtClose(h);
todo_wine{ DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD) }
DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD)
pRtlFreeUnicodeString(&str);
pNtClose(dir);
todo_wine{ DIR_TEST_CREATE_OPEN_FAILURE(&h, "BaseNamedObjects", STATUS_OBJECT_PATH_SYNTAX_BAD) }
todo_wine{ DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\", STATUS_OBJECT_NAME_INVALID) }
todo_wine{ DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\\\BaseNamedObjects", STATUS_OBJECT_NAME_INVALID) }
todo_wine{ DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\\\om.c-test", STATUS_OBJECT_NAME_INVALID) }
todo_wine{ DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\om.c-test\\", STATUS_OBJECT_PATH_NOT_FOUND) }
DIR_TEST_CREATE_OPEN_FAILURE(&h, "BaseNamedObjects", STATUS_OBJECT_PATH_SYNTAX_BAD)
DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\", STATUS_OBJECT_NAME_INVALID)
DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\\\BaseNamedObjects", STATUS_OBJECT_NAME_INVALID)
DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\\\om.c-test", STATUS_OBJECT_NAME_INVALID)
DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\om.c-test\\", STATUS_OBJECT_PATH_NOT_FOUND)
pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\om.c-test");
DIR_TEST_CREATE_SUCCESS(&h)
@@ -336,11 +334,11 @@ void test_directory(void)
pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Local");
InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
status = pNtOpenSymbolicLinkObject(&dir, SYMBOLIC_LINK_QUERY, &attr);\
todo_wine ok(status == STATUS_SUCCESS, "Failed to open SymbolicLink(%08lx)\n", status);
ok(status == STATUS_SUCCESS, "Failed to open SymbolicLink(%08lx)\n", status);
pRtlFreeUnicodeString(&str);
InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
pRtlCreateUnicodeStringFromAsciiz(&str, "one more level");
todo_wine{ DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_TYPE_MISMATCH) }
DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_TYPE_MISMATCH)
pRtlFreeUnicodeString(&str);
pNtClose(h);
pNtClose(dir);
@@ -351,14 +349,14 @@ void test_directory(void)
pRtlFreeUnicodeString(&str);
InitializeObjectAttributes(&attr, NULL, 0, dir, NULL);
todo_wine{ DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_NAME_INVALID) }
DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_NAME_INVALID)
InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
DIR_TEST_CREATE_OPEN_SUCCESS(&h, "")
todo_wine{ DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\", STATUS_OBJECT_PATH_SYNTAX_BAD) }
todo_wine{ DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\om.c-test", STATUS_OBJECT_PATH_SYNTAX_BAD) }
todo_wine{ DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\om.c-test\\", STATUS_OBJECT_PATH_SYNTAX_BAD) }
todo_wine{ DIR_TEST_CREATE_OPEN_FAILURE(&h, "om.c-test\\", STATUS_OBJECT_PATH_NOT_FOUND) }
DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\", STATUS_OBJECT_PATH_SYNTAX_BAD)
DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\om.c-test", STATUS_OBJECT_PATH_SYNTAX_BAD)
DIR_TEST_CREATE_OPEN_FAILURE(&h, "\\om.c-test\\", STATUS_OBJECT_PATH_SYNTAX_BAD)
DIR_TEST_CREATE_OPEN_FAILURE(&h, "om.c-test\\", STATUS_OBJECT_PATH_NOT_FOUND)
pRtlCreateUnicodeStringFromAsciiz(&str, "om.c-test");
DIR_TEST_CREATE_SUCCESS(&dir1)
@@ -374,7 +372,7 @@ void test_directory(void)
InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
DIR_TEST_OPEN_SUCCESS(&dir)
InitializeObjectAttributes(&attr, &str, 0, dir, NULL);
todo_wine{ DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD) }
DIR_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD)
pRtlFreeUnicodeString(&str);
pNtClose(dir);
@@ -422,18 +420,18 @@ void test_directory(void)
/* Test inavalid paths */
pRtlCreateUnicodeStringFromAsciiz(&str, "\\om.c-mutant");
status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
todo_wine ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD,
ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD,
"NtCreateMutant should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08lx)\n", status);
pRtlFreeUnicodeString(&str);
pRtlCreateUnicodeStringFromAsciiz(&str, "\\om.c-mutant\\");
status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
todo_wine ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD,
ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD,
"NtCreateMutant should have failed with STATUS_OBJECT_PATH_SYNTAX_BAD got(%08lx)\n", status);
pRtlFreeUnicodeString(&str);
pRtlCreateUnicodeStringFromAsciiz(&str, "om.c\\-mutant");
status = pNtCreateMutant(&h, GENERIC_ALL, &attr, FALSE);
todo_wine ok(status == STATUS_OBJECT_PATH_NOT_FOUND,
ok(status == STATUS_OBJECT_PATH_NOT_FOUND,
"NtCreateMutant should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08lx)\n", status);
pRtlFreeUnicodeString(&str);
@@ -476,18 +474,18 @@ void test_symboliclink(void)
IO_STATUS_BLOCK iosb;
/* No name and/or no attributes */
todo_wine{ SYMLNK_TEST_CREATE_OPEN_FAILURE(NULL, "", "", STATUS_ACCESS_VIOLATION) }
SYMLNK_TEST_CREATE_OPEN_FAILURE(NULL, "", "", STATUS_ACCESS_VIOLATION)
status = pNtCreateSymbolicLinkObject(&h, SYMBOLIC_LINK_QUERY, NULL, NULL);
todo_wine ok(status == STATUS_ACCESS_VIOLATION,
ok(status == STATUS_ACCESS_VIOLATION,
"NtCreateSymbolicLinkObject should have failed with STATUS_ACCESS_VIOLATION got(%08lx)\n", status);
status = pNtOpenSymbolicLinkObject(&h, SYMBOLIC_LINK_QUERY, NULL);
todo_wine ok(status == STATUS_INVALID_PARAMETER,
ok(status == STATUS_INVALID_PARAMETER,
"NtOpenSymbolicLinkObject should have failed with STATUS_INVALID_PARAMETER got(%08lx)\n", status);
InitializeObjectAttributes(&attr, NULL, 0, 0, NULL);
todo_wine{ SYMLNK_TEST_CREATE_FAILURE(&link, STATUS_INVALID_PARAMETER) }
todo_wine{ SYMLNK_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD) }
SYMLNK_TEST_CREATE_FAILURE(&link, STATUS_INVALID_PARAMETER)
SYMLNK_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD)
/* Bad name */
pRtlCreateUnicodeStringFromAsciiz(&target, "anywhere");
@@ -495,7 +493,7 @@ void test_symboliclink(void)
pRtlCreateUnicodeStringFromAsciiz(&str, "");
SYMLNK_TEST_CREATE_SUCCESS(&link)
todo_wine{ SYMLNK_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD) }
SYMLNK_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD)
pNtClose(link);
pRtlFreeUnicodeString(&str);
@@ -504,11 +502,11 @@ void test_symboliclink(void)
pRtlFreeUnicodeString(&str);
pRtlFreeUnicodeString(&target);
todo_wine{ SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "BaseNamedObjects", "->Somewhere", STATUS_OBJECT_PATH_SYNTAX_BAD) }
todo_wine{ SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\", "->Somewhere", STATUS_OBJECT_NAME_INVALID) }
todo_wine{ SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\\\BaseNamedObjects", "->Somewhere", STATUS_OBJECT_NAME_INVALID) }
todo_wine{ SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\\\om.c-test", "->Somewhere", STATUS_OBJECT_NAME_INVALID) }
todo_wine{ SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\om.c-test\\", "->Somewhere", STATUS_OBJECT_NAME_INVALID) }
SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "BaseNamedObjects", "->Somewhere", STATUS_OBJECT_PATH_SYNTAX_BAD)
SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\", "->Somewhere", STATUS_OBJECT_NAME_INVALID)
SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\\\BaseNamedObjects", "->Somewhere", STATUS_OBJECT_NAME_INVALID)
SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\\\om.c-test", "->Somewhere", STATUS_OBJECT_NAME_INVALID)
SYMLNK_TEST_CREATE_OPEN_FAILURE(&h, "\\BaseNamedObjects\\om.c-test\\", "->Somewhere", STATUS_OBJECT_NAME_INVALID)
/* Compaund test */
+2 -2
View File
@@ -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);
}
+11 -5
View File
@@ -24,12 +24,10 @@
#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);
}
+46 -1
View File
@@ -25,6 +25,26 @@
#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();
}
+9 -9
View File
@@ -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','-',
+1 -1
View File
@@ -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;