- Fix some msvc issues in rostests
authorStefan Ginsberg <stefanginsberg@gmail.com>
Mon, 3 Aug 2009 16:59:43 +0000 (16:59 +0000)
committerStefan Ginsberg <stefanginsberg@gmail.com>
Mon, 3 Aug 2009 16:59:43 +0000 (16:59 +0000)
svn path=/trunk/; revision=42365

12 files changed:
rostests/apitests/gdi32api/tests/GetCurrentObject.c
rostests/apitests/gdi32api/tests/GetObject.c
rostests/apitests/w32knapi/ntgdi/NtGdiCreateDIBSection.c
rostests/apitests/w32knapi/ntuser/NtUserSystemParametersInfo.c
rostests/dibtests/bltrop/bltrop.c
rostests/drivers/kmtest/deviface_test.c
rostests/drivers/kmtest/ntos_ex.c
rostests/tests/DxHalTest/main.c
rostests/tests/Imagelistviewer/main.c
rostests/tests/global_mem/global_mem.c
rostests/tests/miditest/miditest.c
rostests/tests/winhello/winhello.c

index e41a468..b49f15c 100644 (file)
@@ -4,6 +4,7 @@ Test_GetCurrentObject(PTESTINFO pti)
 {
        HWND hWnd;
        HDC hDC;
+       HBITMAP hBmp;
 
        /* Create a window */
        hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
@@ -70,7 +71,6 @@ Test_GetCurrentObject(PTESTINFO pti)
 
        /* Default bitmap */
        SetLastError(ERROR_SUCCESS);
-       HBITMAP hBmp;
        hBmp = GetCurrentObject(hDC, OBJ_BITMAP);
        RTEST(GDI_HANDLE_GET_TYPE(hBmp) == GDI_OBJECT_TYPE_BITMAP);
        RTEST(GetLastError() == ERROR_SUCCESS);
index 2b5fe2a..ae5d556 100644 (file)
@@ -103,9 +103,10 @@ Test_Dibsection(PTESTINFO pti)
        BITMAP bitmap;
        DIBSECTION dibsection;
        PVOID pData;
+       HDC hDC;
 
        FillMemory(&dibsection, sizeof(DIBSECTION), 0x77);
-       HDC hDC = GetDC(0);
+       hDC = GetDC(0);
        hBitmap = CreateDIBSection(hDC, &bmi, DIB_RGB_COLORS, &pData, NULL, 0);
        ASSERT(hBitmap);
 
index b96dcbb..e032bb4 100644 (file)
@@ -46,6 +46,10 @@ Test_NtGdiCreateDIBSection(PTESTINFO pti)
     PBITMAPV4HEADER pbV4h = (PBITMAPV4HEADER)&bmi.bmiHeader;
     PBITMAPV5HEADER pbV5h = (PBITMAPV5HEADER)&bmi.bmiHeader;
 
+    HANDLE hSection;
+    NTSTATUS Status;
+    LARGE_INTEGER MaximumSize;
+
     hDC = GetDC(0);
     pbih->biSize = sizeof(BITMAPINFOHEADER);
     pbih->biWidth = 2;
@@ -441,10 +445,6 @@ printf("dib with bitfileds: %p\n", hbmp);
     if (hbmp) DeleteObject(hbmp);
 
     /* Test section */
-    HANDLE hSection;
-    NTSTATUS Status;
-    LARGE_INTEGER MaximumSize;
-    
     MaximumSize.QuadPart = 4096;
     Status = ZwCreateSection(&hSection,
                              SECTION_ALL_ACCESS,
index 1f47055..8eda902 100644 (file)
@@ -66,6 +66,7 @@ Test_NtUserSystemParametersInfo_Params(PTESTINFO pti)
 //     UINT uint;
        DWORD data[1000];
        UINT i, uint;
+       ACCESSTIMEOUT ato;
 #if 1
        /* Test normal */
        SetLastError(ERROR_SUCCESS);
@@ -78,7 +79,6 @@ Test_NtUserSystemParametersInfo_Params(PTESTINFO pti)
        TEST(GetLastError() == ERROR_INVALID_PARAMETER);
 
        /* Test wrong cbSize member */
-       ACCESSTIMEOUT ato;
        ato.cbSize = 1;
        SetLastError(ERROR_SUCCESS);
        TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &ato, 0) == FALSE);
index 76cbe52..8b73cf9 100644 (file)
@@ -30,6 +30,7 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
             HDC hdc, hdcMem;
             BITMAP bitmap;
             HBRUSH brush, brush2;
+            INT l;
 
             hdc = BeginPaint(hWnd, &ps);
             hdcMem = CreateCompatibleDC(hdc);
@@ -42,7 +43,7 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
             PatBlt(hdc, 30, 0, 4*bitmap.bmWidth*2, 4*bitmap.bmHeight, PATCOPY);
 
             /* hatched brushes */
-            INT l = 66;
+            l = 66;
             brush = CreateHatchBrush(HS_DIAGCROSS, RGB(255,0,0));
             SelectObject(hdc, brush);
             PatBlt(hdc, 0, 0, 30, l, PATCOPY);
index 3dcb580..4d92e06 100644 (file)
@@ -31,8 +31,8 @@
 
 /* PRIVATE FUNCTIONS **********************************************************/
 
-NTSTATUS NTAPI
-(*IoGetDeviceInterfaces_Func)(
+NTSTATUS
+(NTAPI *IoGetDeviceInterfaces_Func)(
    IN CONST GUID *InterfaceClassGuid,
    IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
    IN ULONG Flags,
index 73f47c6..84d6859 100644 (file)
@@ -39,8 +39,8 @@ TestTimerApcRoutine(IN PVOID TimerContext,
                     IN LONG TimerHighValue)
 
 {
-    DPRINT("Timer Apc called!\n");
     ULONG *ApcCount = (ULONG *)TimerContext;
+    DPRINT("Timer Apc called!\n");
     (*ApcCount)++;
 }
 
index af89cd9..99840bf 100644 (file)
@@ -70,14 +70,6 @@ typedef struct _DD_MISCELLANEOUSCALLBACKS {
 int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
                                        LPSTR lpCmdLine, int nCmdShow)
 {
-       /* get the functions we need */
-//     DD_GETDRIVERINFODATA drv;
-       HMODULE lib = LoadLibrary("gdi32.dll");
-       DdCreateDirectDrawObject = (BOOL (APIENTRY*)(LPDDRAWI_DIRECTDRAW_GBL,   HDC))GetProcAddress(lib, "GdiEntry1");
-       DdQueryDirectDrawObject  = (BOOL (APIENTRY*)(LPDDRAWI_DIRECTDRAW_GBL,   LPDDHALINFO,LPDDHAL_DDCALLBACKS,LPDDHAL_DDSURFACECALLBACKS,LPDDHAL_DDPALETTECALLBACKS,LPD3DHAL_CALLBACKS,LPD3DHAL_GLOBALDRIVERDATA,LPDDHAL_DDEXEBUFCALLBACKS,LPDDSURFACEDESC,LPDWORD,LPVIDMEM))GetProcAddress(lib, "GdiEntry2");
-    DdAttachSurface          = (BOOL (APIENTRY*)(LPDDRAWI_DDRAWSURFACE_LCL, LPDDRAWI_DDRAWSURFACE_LCL))GetProcAddress(lib, "GdiEntry11");
-    DdResetVisrgn            = (BOOL (APIENTRY*)(LPDDRAWI_DDRAWSURFACE_LCL, HWND))GetProcAddress(lib, "GdiEntry6");
-
     /* HAL Startup process */
     DEVMODE devmode;
     HBITMAP hbmp;
@@ -90,8 +82,22 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
        //DWORD Status; /* for create surface */
        UINT i;
        UINT j;
+       UINT cSurfaces;
+
+       DDHAL_CANCREATESURFACEDATA mDdCanCreateSurface;
+       DDHAL_UPDATEOVERLAYDATA mDdUpdateOverlay;
+       DDRAWI_DDRAWSURFACE_LCL *pDDSurface;
+       DDHAL_CREATESURFACEDATA mDdCreateSurface;
 
 
+       /* get the functions we need */
+//     DD_GETDRIVERINFODATA drv;
+       HMODULE lib = LoadLibrary("gdi32.dll");
+       DdCreateDirectDrawObject = (BOOL (APIENTRY*)(LPDDRAWI_DIRECTDRAW_GBL,   HDC))GetProcAddress(lib, "GdiEntry1");
+       DdQueryDirectDrawObject  = (BOOL (APIENTRY*)(LPDDRAWI_DIRECTDRAW_GBL,   LPDDHALINFO,LPDDHAL_DDCALLBACKS,LPDDHAL_DDSURFACECALLBACKS,LPDDHAL_DDPALETTECALLBACKS,LPD3DHAL_CALLBACKS,LPD3DHAL_GLOBALDRIVERDATA,LPDDHAL_DDEXEBUFCALLBACKS,LPDDSURFACEDESC,LPDWORD,LPVIDMEM))GetProcAddress(lib, "GdiEntry2");
+    DdAttachSurface          = (BOOL (APIENTRY*)(LPDDRAWI_DDRAWSURFACE_LCL, LPDDRAWI_DDRAWSURFACE_LCL))GetProcAddress(lib, "GdiEntry11");
+    DdResetVisrgn            = (BOOL (APIENTRY*)(LPDDRAWI_DDRAWSURFACE_LCL, HWND))GetProcAddress(lib, "GdiEntry6");
+
        printf("This apps showing how to start up directx draw/d3d interface and some other as well\n");
        printf("This code have been releae to some close applactons with my premtions, if any company\n");
     printf("want use part or whole code, you need contact the orginal author to ask for premtions\n");
@@ -364,7 +370,7 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
    mddsdPrimary.dwFlags     = DDSD_CAPS;
    mddsdPrimary.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_VIDEOMEMORY | DDSCAPS_VISIBLE;
 
-   DDHAL_CANCREATESURFACEDATA   mDdCanCreateSurface;
+   mDdCanCreateSurface;
    mDdCanCreateSurface.lpDD = &mDDrawGlobal;
    mDdCanCreateSurface.CanCreateSurface = mCallbacks.HALDD.CanCreateSurface;
    mDdCanCreateSurface.bIsDifferentPixelFormat = FALSE; //isDifferentPixelFormat;
@@ -405,7 +411,7 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
 
   mpPrimaryLocals[0] = &mPrimaryLocal;
 
-  DDHAL_CREATESURFACEDATA      mDdCreateSurface;
+  mDdCreateSurface;
   mDdCreateSurface.lpDD = &mDDrawGlobal;
   mDdCreateSurface.CreateSurface = mCallbacks.HALDD.CreateSurface;
   mDdCreateSurface.lpDDSurfaceDesc = &mddsdPrimary;//pDDSD;
@@ -500,7 +506,7 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
   mOverlayGlobal.ddpfSurface = mddsdOverlay.ddpfPixelFormat;
 
   // setup front- and backbuffer surfaces
-  UINT cSurfaces = mddsdOverlay.dwBackBufferCount + 1;
+  cSurfaces = mddsdOverlay.dwBackBufferCount + 1;
   for ( i = 0; i < cSurfaces; i++)
   {
      memset(&mOverlayMore[i], 0, sizeof(DDRAWI_DDRAWSURFACE_MORE));
@@ -565,7 +571,7 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
   }
 
 
-  DDHAL_UPDATEOVERLAYDATA      mDdUpdateOverlay;
+  mDdUpdateOverlay;
   mDdUpdateOverlay.lpDD = &mDDrawGlobal;
   mDdUpdateOverlay.UpdateOverlay = mCallbacks.HALDDSurface.UpdateOverlay;
   mDdUpdateOverlay.lpDDDestSurface = mpPrimaryLocals[0];
@@ -607,7 +613,7 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
   /* blt */
 
 
-  DDRAWI_DDRAWSURFACE_LCL *pDDSurface = mpPrimaryLocals[0];
+  pDDSurface = mpPrimaryLocals[0];
 
   if (!DdResetVisrgn(pDDSurface, NULL))
   {
index 043171b..8c74585 100644 (file)
@@ -1,6 +1,7 @@
 #include <windows.h>\r
 #include <setupapi.h>\r
 #include <tchar.h>\r
+#include <stdlib.h> // FIXME-DONTCOMMIT: Why is this needed?\r
 #include "resource.h"\r
 \r
 typedef BOOL (WINAPI * SH_GIL_PROC)(HIMAGELIST *phLarge, HIMAGELIST *phSmall);\r
index 9d5ba22..c7804dd 100644 (file)
@@ -597,8 +597,8 @@ TEST_STATUS TestGlobalReAllocMovable()
 */
 TEST_STATUS TestGlobalReAlloc()
 {
-    OUTPUT_Banner("Testing GlobalReAlloc()");
     TEST_STATUS result = SKIPPED;
+    OUTPUT_Banner("Testing GlobalReAlloc()");
 
     result = TEST_CombineStatus(result, TestGlobalReAllocFixed());
     result = TEST_CombineStatus(result, TestGlobalReAllocMovable());
@@ -767,8 +767,8 @@ TEST_STATUS TestGlobalFlagsFixed()
 */
 TEST_STATUS TestGlobalFlags()
 {
-    OUTPUT_Banner("Testing GlobalFlags()");
     TEST_STATUS result = SKIPPED;
+    OUTPUT_Banner("Testing GlobalFlags()");
 
     result = TEST_CombineStatus(result, TestGlobalFlagsFixed());
     result = TEST_CombineStatus(result, TestGlobalFlagsMoveable());
index 1310be3..e58b4ac 100644 (file)
@@ -22,6 +22,9 @@ int main()
 
     int c;
 
+    HMIDIOUT Handle = NULL;
+    UINT Result;
+
     printf("MIDI output devices: %d\n", outs);
 
     for (c = 0; c < outs; c ++)
@@ -32,8 +35,7 @@ int main()
 
     printf("Opening MIDI output #0\n");
 
-    HMIDIOUT Handle = NULL;
-    UINT Result = midiOutOpen(&Handle, 0, 0, 0, CALLBACK_NULL);
+    Result = midiOutOpen(&Handle, 0, 0, 0, CALLBACK_NULL);
     printf("Result == %d Handle == %d\n", Result, (int)Handle);
 
     // play something:
index 02037cf..e31a5ff 100644 (file)
@@ -110,7 +110,7 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
         PAINTSTRUCT   ps;    /* Also used during window drawing */
         HDC hDC;             /* A device context used for drawing */
-       RECT rc, clr, wir;   /* A rectangle used during drawing */
+        RECT rc = {0,0,0,0}, clr, wir;   /* A rectangle used during drawing */
         char spr[100], sir[100];
        static HBRUSH hbrWhite=NULL, hbrGray=NULL, hbrBlack=NULL, hbrRed=NULL, hbrBlue=NULL, hbrYellow=NULL;
 
@@ -123,9 +123,8 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
          case WM_CHAR:
          {
-
-          hDC = GetDC(hWnd);
           TCHAR text[2];
+          hDC = GetDC(hWnd);
           text[0] = (TCHAR)wParam;
           text[1] = _T('\0');
 
@@ -170,10 +169,9 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
          case WM_KEYDOWN:
          {
-
-          hDC = GetDC(hWnd);
           RECT Rect;
           TCHAR text[2];
+          hDC = GetDC(hWnd);
           text[0] = (TCHAR)wParam;
           text[1] = _T('\0');
 
@@ -201,10 +199,9 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
          case WM_KEYUP:
          {
-
-          hDC = GetDC(hWnd);
           RECT Rect;
           TCHAR text[2];
+          hDC = GetDC(hWnd);
           text[0] = (TCHAR)wParam;
           text[1] = _T('\0');
 
@@ -594,6 +591,8 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
        case WM_CREATE:
         {
+         SCROLLINFO si;
+         TEXTMETRIC tm;
          /* Register a Ctrl+Alt+C hotkey*/
          RegisterHotKey(hWnd, CTRLC, MOD_CONTROL, VK_C);
          RegisterHotKey(hWnd, ALTF1, MOD_CONTROL | MOD_ALT, VK_F1);
@@ -605,7 +604,6 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
          hbrBlue = CreateSolidBrush ( RGB(0x00, 0x00, 0xFF));
          hbrYellow = CreateSolidBrush ( RGB(0xFF, 0xFF, 0x00));
 
-         SCROLLINFO si;
          si.cbSize = sizeof(si);
          si.fMask = SIF_ALL;
           si.nMin = 0;
@@ -619,7 +617,6 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
          /* The window is being created. Create our button
           * window now. */
-         TEXTMETRIC        tm;
 
          /* First we use the system fixed font size to choose
           * a nice button size. */