[RPCRT4_WINETEST] Sync with Wine Staging 1.9.23. CORE-12409
[reactos.git] / rostests / winetests / rpcrt4 / rpc.c
index 53602cc..8ee3e12 100644 (file)
@@ -222,10 +222,8 @@ static void test_rpc_ncacn_ip_tcp(void)
     ok(status == RPC_S_OK, "return wrong\n");
 
     status = RpcMgmtStopServerListening(NULL);
-todo_wine {
     ok(status == RPC_S_NOT_LISTENING,
        "wrong RpcMgmtStopServerListening error (%u)\n", status);
-}
 
     status = RpcMgmtWaitServerListen();
     ok(status == RPC_S_NOT_LISTENING,
@@ -242,9 +240,7 @@ todo_wine {
     ok(status == RPC_S_OK, "RpcServerRegisterIf failed (%u)\n", status);
 
     status = RpcServerListen(1, 20, TRUE);
-todo_wine {
     ok(status == RPC_S_OK, "RpcServerListen failed (%u)\n", status);
-}
 
     status = RpcServerListen(1, 20, TRUE);
 todo_wine {
@@ -433,13 +429,10 @@ static void test_I_RpcMapWin32Status(void)
     RPC_STATUS rpc_status;
     BOOL w2k3_up = FALSE;
 
-    /* Windows 2003 and Vista return STATUS_UNSUCCESSFUL if given an unknown status */
+    /* Windows 2003 and above return STATUS_UNSUCCESSFUL if given an unknown status */
     win32status = I_RpcMapWin32Status(9999);
     if (win32status == STATUS_UNSUCCESSFUL)
-    {
-        trace("We are on Windows 2003 or Vista\n");
         w2k3_up = TRUE;
-    }
 
     /* On Windows XP-SP1 and below some statuses are not mapped and return
      * the given status
@@ -663,7 +656,7 @@ static void test_I_RpcExceptionFilter(void)
 
     if (!pI_RpcExceptionFilter)
     {
-        skip("I_RpcExceptionFilter not exported\n");
+        win_skip("I_RpcExceptionFilter not exported\n");
         return;
     }
 
@@ -682,9 +675,9 @@ static void test_I_RpcExceptionFilter(void)
         case STATUS_ACCESS_VIOLATION:
         case STATUS_ILLEGAL_INSTRUCTION:
         case STATUS_PRIVILEGED_INSTRUCTION:
-        case 0xc00000aa /* STATUS_INSTRUCTION_MISALIGNMENT */:
+        case STATUS_INSTRUCTION_MISALIGNMENT:
         case STATUS_STACK_OVERFLOW:
-        case 0xc0000194 /* STATUS_POSSIBLE_DEADLOCK */:
+        case STATUS_POSSIBLE_DEADLOCK:
             ok(retval == EXCEPTION_CONTINUE_SEARCH, "I_RpcExceptionFilter(0x%x) should have returned %d instead of %d\n",
                exception, EXCEPTION_CONTINUE_SEARCH, retval);
             break;
@@ -789,13 +782,17 @@ static void test_UuidCreateSequential(void)
     UUID guid1;
     BYTE version;
     RPC_STATUS (WINAPI *pUuidCreateSequential)(UUID *) = (void *)GetProcAddress(GetModuleHandleA("rpcrt4.dll"), "UuidCreateSequential");
+    RPC_STATUS (WINAPI *pI_UuidCreate)(UUID *) = (void*)GetProcAddress(GetModuleHandleA("rpcrt4.dll"), "I_UuidCreate");
     RPC_STATUS ret;
 
     if (!pUuidCreateSequential)
     {
-        skip("UuidCreateSequential not exported\n");
+        win_skip("UuidCreateSequential not exported\n");
         return;
     }
+
+    ok(pI_UuidCreate != pUuidCreateSequential, "got %p, %p\n", pI_UuidCreate, pUuidCreateSequential);
+
     ret = pUuidCreateSequential(&guid1);
     ok(!ret || ret == RPC_S_UUID_LOCAL_ONLY,
        "expected RPC_S_OK or RPC_S_UUID_LOCAL_ONLY, got %08x\n", ret);
@@ -810,7 +807,7 @@ static void test_UuidCreateSequential(void)
             /* If the call succeeded, there's a valid (non-multicast) MAC
              * address in the uuid:
              */
-            ok(!(guid1.Data4[2] & 0x01),
+            ok(!(guid1.Data4[2] & 0x01) || broken(guid1.Data4[2] & 0x01), /* Win 8.1 */
                "GUID does not appear to contain a MAC address: %s\n",
                wine_dbgstr_guid(&guid1));
         }
@@ -834,6 +831,14 @@ static void test_UuidCreateSequential(void)
         ok(!memcmp(guid1.Data4, guid2.Data4, sizeof(guid2.Data4)),
            "unexpected value in MAC address: %s\n",
            wine_dbgstr_guid(&guid2));
+
+        /* I_UuidCreate does exactly the same */
+        pI_UuidCreate(&guid2);
+        version = (guid2.Data3 & 0xf000) >> 12;
+        ok(version == 1, "unexpected version %d\n", version);
+        ok(!memcmp(guid1.Data4, guid2.Data4, sizeof(guid2.Data4)),
+           "unexpected value in MAC address: %s\n",
+           wine_dbgstr_guid(&guid2));
     }
 }
 
@@ -852,19 +857,12 @@ static void test_RpcServerInqDefaultPrincName(void)
 {
     RPC_STATUS ret;
     RPC_CSTR principal, saved_principal;
-    BOOLEAN (WINAPI *pGetUserNameExA)(EXTENDED_NAME_FORMAT,LPSTR,PULONG);
     char *username;
     ULONG len = 0;
 
-    pGetUserNameExA = (void *)GetProcAddress( LoadLibraryA("secur32.dll"), "GetUserNameExA" );
-    if (!pGetUserNameExA)
-    {
-        win_skip( "GetUserNameExA not exported\n" );
-        return;
-    }
-    pGetUserNameExA( NameSamCompatible, NULL, &len );
+    GetUserNameExA( NameSamCompatible, NULL, &len );
     username = HeapAlloc( GetProcessHeap(), 0, len );
-    pGetUserNameExA( NameSamCompatible, username, &len );
+    GetUserNameExA( NameSamCompatible, username, &len );
 
     ret = RpcServerInqDefaultPrincNameA( 0, NULL );
     ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %u\n", ret );
@@ -901,6 +899,14 @@ static void test_RpcServerInqDefaultPrincName(void)
     HeapFree( GetProcessHeap(), 0, username );
 }
 
+static void test_RpcServerRegisterAuthInfo(void)
+{
+    RPC_STATUS status;
+
+    status = RpcServerRegisterAuthInfoW(NULL, 600, NULL, NULL);
+    ok(status == RPC_S_UNKNOWN_AUTHN_SERVICE, "status = %x\n", status);
+}
+
 START_TEST( rpc )
 {
     UuidConversionAndComparison();
@@ -915,4 +921,5 @@ START_TEST( rpc )
     test_UuidCreateSequential();
     test_RpcBindingFree();
     test_RpcServerInqDefaultPrincName();
+    test_RpcServerRegisterAuthInfo();
 }