[NTDSAPI_WINETEST] Sync with Wine Staging 1.7.55. CORE-10536
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 21 Nov 2015 09:22:06 +0000 (09:22 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 21 Nov 2015 09:22:06 +0000 (09:22 +0000)
svn path=/trunk/; revision=69973

rostests/winetests/ntdsapi/ntdsapi.c

index 8290ed2..3d95d1b 100644 (file)
@@ -84,7 +84,38 @@ static void test_DsMakeSpn(void)
     ok(spn_length == lstrlenW(wszSpn5) + 1, "DsMakeSpnW should have returned spn_length of %d instead of %d\n", lstrlenW(wszSpn5) + 1, spn_length);
 }
 
+static void test_DsClientMakeSpnForTargetServer(void)
+{
+    static const WCHAR classW[] = {'c','l','a','s','s',0};
+    static const WCHAR hostW[] = {'h','o','s','t','.','d','o','m','a','i','n',0};
+    static const WCHAR resultW[] = {'c','l','a','s','s','/','h','o','s','t','.','d','o','m','a','i','n',0};
+    DWORD ret, len;
+    WCHAR buf[256];
+
+    ret = DsClientMakeSpnForTargetServerW( NULL, NULL, NULL, NULL );
+    ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
+
+    ret = DsClientMakeSpnForTargetServerW( classW, NULL, NULL, NULL );
+    ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
+
+    ret = DsClientMakeSpnForTargetServerW( classW, hostW, NULL, NULL );
+    ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
+
+    len = 0;
+    ret = DsClientMakeSpnForTargetServerW( classW, hostW, &len, NULL );
+    ok( ret == ERROR_BUFFER_OVERFLOW, "got %u\n", ret );
+    ok( len == lstrlenW(resultW) + 1, "got %u\n", len );
+
+    len = sizeof(buf)/sizeof(buf[0]);
+    buf[0] = 0;
+    ret = DsClientMakeSpnForTargetServerW( classW, hostW, &len, buf );
+    ok( ret == ERROR_SUCCESS, "got %u\n", ret );
+    ok( len == lstrlenW(resultW) + 1, "got %u\n", len );
+    ok( !lstrcmpW( buf, resultW ), "wrong data\n" );
+}
+
 START_TEST( ntdsapi )
 {
     test_DsMakeSpn();
+    test_DsClientMakeSpnForTargetServer();
 }