Robert Reif : secur32: Add GetComputerObjectName tests.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Aug 16 06:15:59 CDT 2006


Module: wine
Branch: master
Commit: e86828a072fe70adfd88b8270c696ae1b3cef345
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=e86828a072fe70adfd88b8270c696ae1b3cef345

Author: Robert Reif <reif at earthlink.net>
Date:   Tue Aug 15 19:01:55 2006 -0400

secur32: Add GetComputerObjectName tests.

---

 dlls/secur32/tests/Makefile.in |    3 +-
 dlls/secur32/tests/secur32.c   |   68 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 1 deletions(-)
 create mode 100644 dlls/secur32/tests/secur32.c

diff --git a/dlls/secur32/tests/Makefile.in b/dlls/secur32/tests/Makefile.in
index dfe17a0..8218fa9 100644
--- a/dlls/secur32/tests/Makefile.in
+++ b/dlls/secur32/tests/Makefile.in
@@ -8,7 +8,8 @@ IMPORTS   = crypt32 secur32 advapi32 ker
 CTESTS = \
 	main.c \
 	ntlm.c \
-	schannel.c
+	schannel.c \
+	secur32.c
 
 @MAKE_TEST_RULES@
 
diff --git a/dlls/secur32/tests/secur32.c b/dlls/secur32/tests/secur32.c
new file mode 100644
index 0000000..5c681cd
--- /dev/null
+++ b/dlls/secur32/tests/secur32.c
@@ -0,0 +1,68 @@
+/*
+ * tests
+ *
+ * Copyright 2006 Robert Reif
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+#include <stdio.h>
+#include <stdarg.h>
+#include <windef.h>
+#include <winbase.h>
+#define SECURITY_WIN32
+#include <security.h>
+#include <schannel.h>
+
+#include "wine/test.h"
+
+static void testGetComputerObjectName()
+{
+    char name[256];
+    WCHAR nameW[256];
+    ULONG size;
+    BOOLEAN rc;
+    int i;
+    EXTENDED_NAME_FORMAT formats[] = { NameUnknown, NameFullyQualifiedDN,
+         NameSamCompatible, NameDisplay, NameUniqueId, NameCanonical,
+         NameUserPrincipal, NameCanonicalEx, NameServicePrincipal,
+         NameDnsDomain };
+
+    for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); i++) {
+        size = sizeof(name);
+        ZeroMemory(name, sizeof(name));
+        rc = GetComputerObjectNameA(formats[i], name, &size);
+        ok(rc || ((formats[i] == NameUnknown) &&
+           (GetLastError() == ERROR_INVALID_PARAMETER)) ||
+           (GetLastError() == ERROR_CANT_ACCESS_DOMAIN_INFO),
+           "GetComputerObjectNameA(%d) failed: %ld\n",
+           formats[i], GetLastError());
+        if (rc)
+            trace("GetComputerObjectNameA() returned %s\n", name);
+
+        size = sizeof(nameW)/sizeof(nameW[0]);
+        ZeroMemory(nameW, sizeof(nameW));
+        rc = GetComputerObjectNameW(formats[i], nameW, &size);
+        ok(rc || ((formats[i] == NameUnknown) &&
+           (GetLastError() == ERROR_INVALID_PARAMETER)) ||
+           (GetLastError() == ERROR_CANT_ACCESS_DOMAIN_INFO),
+           "GetComputerObjectNameW(%d) failed: %ld\n",
+           formats[i], GetLastError());
+    }
+}
+
+START_TEST(secur32)
+{
+    testGetComputerObjectName();
+}




More information about the wine-cvs mailing list