- combotst: Fix uninitialized variable usage spotted by MSVC
authorStefan Ginsberg <stefanginsberg@gmail.com>
Sat, 22 Aug 2009 14:40:56 +0000 (14:40 +0000)
committerStefan Ginsberg <stefanginsberg@gmail.com>
Sat, 22 Aug 2009 14:40:56 +0000 (14:40 +0000)
- tmrqueue: Don't use empty structures, MSVC doe
- w32knapi: Implement IntSyscall in MSVC assembly, be compatible with C89 variable initialization and use '%' instead of '\%' to avoid a msvc warning.

svn path=/trunk/; revision=42845

rostests/apitests/w32knapi/ntuser/NtUserToUnicodeEx.c
rostests/apitests/w32knapi/w32knapi.c
rostests/tests/combotst/combotst.c
rostests/tests/tmrqueue/tmrqueue.c

index fd129dc..921b660 100644 (file)
@@ -139,7 +139,7 @@ Test_NtUserToUnicodeEx(PTESTINFO pti)
        TEST(NtUserToUnicodeEx(52, 5, KeyState, Buffer, 10, 0, hkl) == 1);
        TEST(Buffer[0] == '$');
        TEST(NtUserToUnicodeEx(53, 6, KeyState, Buffer, 10, 0, hkl) == 1);
-       TEST(Buffer[0] == '\%');
+       TEST(Buffer[0] == '%');
        TEST(NtUserToUnicodeEx(54, 7, KeyState, Buffer, 10, 0, hkl) == 1);      
        TEST(Buffer[0] == '^');
        TEST(NtUserToUnicodeEx(55, 8, KeyState, Buffer, 10, 0, hkl) == 1);
index 1835c83..28240e2 100644 (file)
@@ -49,8 +49,9 @@ GetHandleUserData(HGDIOBJ hobj)
 static DWORD WINAPI
 IntSyscall(FARPROC proc, UINT cParams, PVOID pFirstParam)
 {
-       DWORD ret;
+       DWORD retval;
 
+#ifdef __GNUC__
        asm volatile
        (
                "pushfl;"                               // Save flags
@@ -62,21 +63,37 @@ IntSyscall(FARPROC proc, UINT cParams, PVOID pFirstParam)
                "rep movsd;"                    // Copy params to the stack
                "call *%%edx;"                  // Call function
                "popfl;"                                // Restore flags
-               : "=a" (ret)
+               : "=a" (retval)
                : "S" (pFirstParam), "c" (cParams), "d"(proc)
                : "%edi"
        );
-
-       return ret;
+#else
+       __asm
+       {
+               pushf
+               mov eax, cParams
+               shl eax, 2
+               sub esp, eax
+               mov edi, esp
+               cld
+               rep movsd
+               call proc
+               mov retval, eax
+               popf
+    };
+#endif
+
+       return retval;
 }
 
 DWORD
 Syscall(LPWSTR pszFunction, int cParams, void* pParams)
 {
        char szFunctionName[MAX_PATH];
+       FARPROC proc;
 
        sprintf(szFunctionName, "%ls", pszFunction);
-       FARPROC proc = (FARPROC)GetProcAddress(g_hModule, szFunctionName);
+       proc = (FARPROC)GetProcAddress(g_hModule, szFunctionName);
        if (!proc)
        {
                printf("Couldn't find proc: %s\n", szFunctionName);
index db6effa..561218d 100644 (file)
@@ -115,7 +115,7 @@ static
 VOID
 HandlePrintRect(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam)
     {
-    RECT rect;
+    RECT rect = *(RECT*)lParam;
     TextBuffer[8] = (char)(BUFFERLEN - 8); /* Setting the max size to put chars in first byte */
     SendMessage(handle,Msg,wParam,lParam);
 
index d7c4f4b..0e58393 100644 (file)
@@ -102,7 +102,7 @@ typedef struct _TESTINFO
   {
     struct
     {
-      /* nothing */
+      HANDLE Dummy;
     } Test1;
     struct
     {