ntdll: Add few tests for object manager
Vitaliy Margolen
wine-patch at kievinfo.com
Wed Sep 21 15:39:35 CDT 2005
All of them are to-do. Thanks to Robert Shearman for examples. ;-)
Can't really test nothing more since most of the om functions are stubs.
Vitaliy Margolen
changelog:
Add few tests for object manager
-------------- next part --------------
Index: dlls/ntdll/tests/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/tests/Makefile.in,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile.in
--- dlls/ntdll/tests/Makefile.in 11 May 2005 15:56:09 -0000 1.14
+++ dlls/ntdll/tests/Makefile.in 19 Sep 2005 17:31:35 -0000
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = ntdll.dll
-IMPORTS = kernel32
+IMPORTS = kernel32 ntdll
CTESTS = \
atom.c \
@@ -13,6 +13,7 @@ CTESTS = \
info.c \
large_int.c \
path.c \
+ om.c \
reg.c \
rtl.c \
rtlbitmap.c \
--- /dev/null 2005-03-19 12:36:14.000000000 -0700
+++ dlls/ntdll/tests/om.c 2005-09-21 14:36:22.000000000 -0600
@@ -0,0 +1,82 @@
+/*
+ * Unit test suite for object manager functions
+ *
+ * Copyright 2005 Robert Shearman
+ * Copyright 2005 Vitaliy Margolen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "ntdll_test.h"
+#include "winternl.h"
+#include "stdio.h"
+#include "winnt.h"
+#include "stdlib.h"
+
+void test_case_sensitive (void)
+{
+ WCHAR buffer1[] = {'\\','B','a','s','e','N','a','m','e','d','O','b','j','e','c','t','s','\\','t','e','s','t',0};
+ WCHAR buffer2[] = {'\\','B','a','s','e','N','a','m','e','d','O','b','j','e','c','t','s','\\','T','e','s','t',0};
+ WCHAR buffer3[] = {'\\','B','a','s','e','N','a','m','e','d','O','b','j','e','c','t','s','\\','T','E','s','t',0};
+ WCHAR buffer4[] = {'\\','B','A','S','E','N','a','m','e','d','O','b','j','e','c','t','s','\\','t','e','s','t',0};
+ HANDLE Event, Mutant, h;
+ NTSTATUS status;
+ OBJECT_ATTRIBUTES attr;
+ UNICODE_STRING str;
+
+ RtlInitUnicodeString(&str, buffer1);
+ InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
+ status = NtCreateMutant(&Mutant, GENERIC_ALL, &attr, FALSE);
+ ok(status == STATUS_SUCCESS, "Failed to create Mutant(%08lx)\n", status);
+
+ status = NtCreateEvent(&Event, GENERIC_ALL, &attr, FALSE, FALSE);
+ ok(status == STATUS_OBJECT_NAME_COLLISION,
+ "NtCreateEvent should have failed with STATUS_OBJECT_NAME_COLLISION got(%08lx)\n", status);
+
+ RtlInitUnicodeString(&str, buffer2);
+ InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
+ status = NtCreateEvent(&Event, GENERIC_ALL, &attr, FALSE, FALSE);
+ ok(status == STATUS_SUCCESS, "Failed to create Event(%08lx)\n", status);
+
+ RtlInitUnicodeString(&str, buffer3);
+ InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, 0, NULL);
+ status = NtOpenMutant(&h, GENERIC_ALL, &attr);
+ todo_wine ok(status == STATUS_OBJECT_TYPE_MISMATCH,
+ "NtOpenMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08lx)\n", status);
+
+ NtClose(Mutant);
+
+ RtlInitUnicodeString(&str, buffer4);
+ InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, 0, NULL);
+ status = NtCreateMutant(&Mutant, GENERIC_ALL, &attr, FALSE);
+ todo_wine ok(status == STATUS_OBJECT_NAME_COLLISION,
+ "NtCreateMutant should have failed with STATUS_OBJECT_NAME_COLLISION got(%08lx)\n", status);
+
+ status = NtCreateEvent(&h, GENERIC_ALL, &attr, FALSE, FALSE);
+ todo_wine ok(status == STATUS_OBJECT_NAME_COLLISION,
+ "NtCreateEvent should have failed with STATUS_OBJECT_NAME_COLLISION got(%08lx)\n", status);
+
+ attr.Attributes = 0;
+ status = NtCreateMutant(&Mutant, GENERIC_ALL, &attr, FALSE);
+ todo_wine ok(status == STATUS_OBJECT_PATH_NOT_FOUND,
+ "NtCreateMutant should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08lx)\n", status);
+
+ NtClose(Event);
+}
+
+START_TEST(om)
+{
+ test_case_sensitive();
+}
More information about the wine-patches
mailing list