From c71617e216f9e314557b8db4a47acab4e9ab3bbd Mon Sep 17 00:00:00 2001 From: Stefan Ginsberg Date: Mon, 3 Aug 2009 16:59:43 +0000 Subject: [PATCH] - Fix some msvc issues in rostests svn path=/trunk/; revision=42365 --- .../gdi32api/tests/GetCurrentObject.c | 2 +- rostests/apitests/gdi32api/tests/GetObject.c | 3 +- .../w32knapi/ntgdi/NtGdiCreateDIBSection.c | 8 ++--- .../ntuser/NtUserSystemParametersInfo.c | 2 +- rostests/dibtests/bltrop/bltrop.c | 3 +- rostests/drivers/kmtest/deviface_test.c | 4 +-- rostests/drivers/kmtest/ntos_ex.c | 2 +- rostests/tests/DxHalTest/main.c | 32 +++++++++++-------- rostests/tests/Imagelistviewer/main.c | 1 + rostests/tests/global_mem/global_mem.c | 4 +-- rostests/tests/miditest/miditest.c | 6 ++-- rostests/tests/winhello/winhello.c | 15 ++++----- 12 files changed, 45 insertions(+), 37 deletions(-) diff --git a/rostests/apitests/gdi32api/tests/GetCurrentObject.c b/rostests/apitests/gdi32api/tests/GetCurrentObject.c index e41a46897f4..b49f15cc7d7 100644 --- a/rostests/apitests/gdi32api/tests/GetCurrentObject.c +++ b/rostests/apitests/gdi32api/tests/GetCurrentObject.c @@ -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); diff --git a/rostests/apitests/gdi32api/tests/GetObject.c b/rostests/apitests/gdi32api/tests/GetObject.c index 2b5fe2a1bc5..ae5d5560440 100644 --- a/rostests/apitests/gdi32api/tests/GetObject.c +++ b/rostests/apitests/gdi32api/tests/GetObject.c @@ -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); diff --git a/rostests/apitests/w32knapi/ntgdi/NtGdiCreateDIBSection.c b/rostests/apitests/w32knapi/ntgdi/NtGdiCreateDIBSection.c index b96dcbb7e7f..e032bb44c23 100644 --- a/rostests/apitests/w32knapi/ntgdi/NtGdiCreateDIBSection.c +++ b/rostests/apitests/w32knapi/ntgdi/NtGdiCreateDIBSection.c @@ -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, diff --git a/rostests/apitests/w32knapi/ntuser/NtUserSystemParametersInfo.c b/rostests/apitests/w32knapi/ntuser/NtUserSystemParametersInfo.c index 1f470559786..8eda902c0a6 100644 --- a/rostests/apitests/w32knapi/ntuser/NtUserSystemParametersInfo.c +++ b/rostests/apitests/w32knapi/ntuser/NtUserSystemParametersInfo.c @@ -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); diff --git a/rostests/dibtests/bltrop/bltrop.c b/rostests/dibtests/bltrop/bltrop.c index 76cbe52eb2e..8b73cf9018a 100644 --- a/rostests/dibtests/bltrop/bltrop.c +++ b/rostests/dibtests/bltrop/bltrop.c @@ -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); diff --git a/rostests/drivers/kmtest/deviface_test.c b/rostests/drivers/kmtest/deviface_test.c index 3dcb580528a..4d92e06df24 100644 --- a/rostests/drivers/kmtest/deviface_test.c +++ b/rostests/drivers/kmtest/deviface_test.c @@ -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, diff --git a/rostests/drivers/kmtest/ntos_ex.c b/rostests/drivers/kmtest/ntos_ex.c index 73f47c65f66..84d6859ab51 100644 --- a/rostests/drivers/kmtest/ntos_ex.c +++ b/rostests/drivers/kmtest/ntos_ex.c @@ -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)++; } diff --git a/rostests/tests/DxHalTest/main.c b/rostests/tests/DxHalTest/main.c index af89cd9f4c9..99840bf6e1e 100644 --- a/rostests/tests/DxHalTest/main.c +++ b/rostests/tests/DxHalTest/main.c @@ -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,7 +82,21 @@ 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"); @@ -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)) { diff --git a/rostests/tests/Imagelistviewer/main.c b/rostests/tests/Imagelistviewer/main.c index 043171b786f..8c745853b2c 100644 --- a/rostests/tests/Imagelistviewer/main.c +++ b/rostests/tests/Imagelistviewer/main.c @@ -1,6 +1,7 @@ #include #include #include +#include // FIXME-DONTCOMMIT: Why is this needed? #include "resource.h" typedef BOOL (WINAPI * SH_GIL_PROC)(HIMAGELIST *phLarge, HIMAGELIST *phSmall); diff --git a/rostests/tests/global_mem/global_mem.c b/rostests/tests/global_mem/global_mem.c index 9d5ba22d9eb..c7804dda5ff 100644 --- a/rostests/tests/global_mem/global_mem.c +++ b/rostests/tests/global_mem/global_mem.c @@ -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()); diff --git a/rostests/tests/miditest/miditest.c b/rostests/tests/miditest/miditest.c index 1310be32569..e58b4acdc09 100644 --- a/rostests/tests/miditest/miditest.c +++ b/rostests/tests/miditest/miditest.c @@ -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: diff --git a/rostests/tests/winhello/winhello.c b/rostests/tests/winhello/winhello.c index 02037cfffb2..e31a5ffc85b 100644 --- a/rostests/tests/winhello/winhello.c +++ b/rostests/tests/winhello/winhello.c @@ -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. */