From 0d2d36c7de304d66a418e7bea582a051741e3293 Mon Sep 17 00:00:00 2001 From: Samuel Serapion Date: Mon, 7 Dec 2009 23:09:35 +0000 Subject: [PATCH] Fix building some modules. special thanks to Basil Gello. svn path=/branches/ros-amd64-bringup/; revision=44462 --- rostests/drivers/kmtest/ntos_io.c | 8 ++--- rostests/drivers/kmtest/ntos_ob.c | 2 +- rostests/drivers/kmtest/reghelper.c | 2 +- rostests/tests/global_mem/global_mem.c | 36 +++++++++---------- rostests/tests/isotest/isotest.c | 4 +-- .../tests/map_dup_inherit/map_dup_inherit.c | 2 +- rostests/tests/mdi/mdi.c | 2 +- rostests/tests/miditest/miditest.c | 2 +- rostests/tests/multithrdwin/multithrdwin.c | 2 +- rostests/tests/p_dup_handle/p_dup_handle.c | 4 +-- rostests/win32/user32/kbdlayout/kbdlayout.c | 6 ++-- rostests/winetests/msvcrt/printf.c | 4 ++- 12 files changed, 38 insertions(+), 36 deletions(-) diff --git a/rostests/drivers/kmtest/ntos_io.c b/rostests/drivers/kmtest/ntos_io.c index 986098edc7d..aad2404ca73 100644 --- a/rostests/drivers/kmtest/ntos_io.c +++ b/rostests/drivers/kmtest/ntos_io.c @@ -48,7 +48,7 @@ VOID NtoskrnlIoMdlTest() ok(Mdl == NULL, "IoAllocateMdl should fail allocation of 2Gb or more, but got Mdl=0x%X", - (UINT32)Mdl); + (UINT_PTR)Mdl); if (Mdl) IoFreeMdl(Mdl); @@ -59,10 +59,10 @@ VOID NtoskrnlIoMdlTest() ok(Mdl != NULL, "Mdl allocation failed"); // Check fields of the allocated struct ok(Mdl->Next == NULL, "Mdl->Next should be NULL, but is 0x%X", - (UINT32)Mdl->Next); + (UINT_PTR)Mdl->Next); ok(Mdl->ByteCount == MdlSize, "Mdl->ByteCount should be equal to MdlSize, but is 0x%X", - (UINT32)Mdl->ByteCount); + (UINT_PTR)Mdl->ByteCount); // TODO: Check other fields of MDL struct IoFreeMdl(Mdl); @@ -72,7 +72,7 @@ VOID NtoskrnlIoMdlTest() Mdl = IoAllocateMdl(VirtualAddress, MdlSize, FALSE, FALSE, Irp); ok(Mdl != NULL, "Mdl allocation failed"); ok(Irp->MdlAddress == Mdl, "Irp->MdlAddress should be 0x%X, but is 0x%X", - (UINT32)Mdl, (UINT32)Irp->MdlAddress); + (UINT_PTR)Mdl, (UINT_PTR)Irp->MdlAddress); IoFreeMdl(Mdl); diff --git a/rostests/drivers/kmtest/ntos_ob.c b/rostests/drivers/kmtest/ntos_ob.c index a7c62fa5641..0de360383d3 100644 --- a/rostests/drivers/kmtest/ntos_ob.c +++ b/rostests/drivers/kmtest/ntos_ob.c @@ -324,7 +324,7 @@ ObtCreateObjects() "Object insertion should have failed, but got 0x%lX", Status); ok(ObBody[0] == ObBody1[1], "Object bodies doesn't match, 0x%p != 0x%p", ObBody[0], ObBody1[1]); - ok(ObHandle2[0] != NULL, "Bad handle returned 0x%lX", (ULONG)ObHandle2[0]); + ok(ObHandle2[0] != NULL, "Bad handle returned 0x%lX", (ULONG_PTR)ObHandle2[0]); DPRINT1("%d %d %d %d %d %d %d\n", DumpCount, OpenCount, // deletecount+1 CloseCount, DeleteCount, ParseCount, OkayToCloseCount, QueryNameCount); diff --git a/rostests/drivers/kmtest/reghelper.c b/rostests/drivers/kmtest/reghelper.c index c3a54d67ef3..a33e84a452c 100644 --- a/rostests/drivers/kmtest/reghelper.c +++ b/rostests/drivers/kmtest/reghelper.c @@ -75,7 +75,7 @@ PWCHAR CreateLowerDeviceRegistryKey(PUNICODE_STRING RegistryPath, PWCHAR NewDriv /* Remove the current driver name from the string */ /* FIXME: Dont use hard coded driver name, determine it from the string returned from the above Query */ Length = (wcslen((PWCHAR)ValuePartialInfo->Data) * 2) - (wcslen(L"kmtest.sys") * 2); - RtlZeroMemory((PVOID)((ULONG)ValuePartialInfo->Data + Length), + RtlZeroMemory((PVOID)((ULONG_PTR)ValuePartialInfo->Data + Length), wcslen(L"drvtests.sys") * 2); ZwClose(ServiceKey); diff --git a/rostests/tests/global_mem/global_mem.c b/rostests/tests/global_mem/global_mem.c index c7804dda5ff..14801bbae86 100644 --- a/rostests/tests/global_mem/global_mem.c +++ b/rostests/tests/global_mem/global_mem.c @@ -139,7 +139,7 @@ void OUTPUT_Result(TEST_STATUS status) /*--------------------------------------------------------------------------- ** */ -void OUTPUT_HexDword(DWORD dw) +void OUTPUT_HexDword(ULONG_PTR dw) { char buffer[32]; sprintf(buffer, "0x%lX",dw); @@ -412,9 +412,9 @@ TEST_STATUS TestGlobalReAllocFixed() else { OUTPUT_Line("Alloced Handle: "); - OUTPUT_HexDword((DWORD)hMem); + OUTPUT_HexDword((ULONG_PTR)hMem); OUTPUT_Line("ReAlloced Handle: "); - OUTPUT_HexDword((DWORD)hReAlloced); + OUTPUT_HexDword((ULONG_PTR)hReAlloced); if (hMem == hReAlloced) { OUTPUT_Line("GlobalReAlloc returned the same pointer. The documentation states that this is wrong, but Windows NT works this way."); @@ -455,9 +455,9 @@ TEST_STATUS TestGlobalReAllocFixed() else { OUTPUT_Line("Alloced Handle: "); - OUTPUT_HexDword((DWORD)hMem); + OUTPUT_HexDword((ULONG_PTR)hMem); OUTPUT_Line("ReAlloced Handle: "); - OUTPUT_HexDword((DWORD)hReAlloced); + OUTPUT_HexDword((ULONG_PTR)hReAlloced); if (hMem != hReAlloced) { OUTPUT_Line("GlobalReAlloc returned a different."); @@ -516,9 +516,9 @@ TEST_STATUS TestGlobalReAllocMovable() else { OUTPUT_Line("Alloced Handle: "); - OUTPUT_HexDword((DWORD)hMem); + OUTPUT_HexDword((ULONG_PTR)hMem); OUTPUT_Line("ReAlloced Handle: "); - OUTPUT_HexDword((DWORD)hReAlloced); + OUTPUT_HexDword((ULONG_PTR)hReAlloced); pMem = GlobalLock(hReAlloced); hMem = hReAlloced; @@ -559,9 +559,9 @@ TEST_STATUS TestGlobalReAllocMovable() else { OUTPUT_Line("Alloced Handle: "); - OUTPUT_HexDword((DWORD)hMem); + OUTPUT_HexDword((ULONG_PTR)hMem); OUTPUT_Line("ReAlloced Handle: "); - OUTPUT_HexDword((DWORD)hReAlloced); + OUTPUT_HexDword((ULONG_PTR)hReAlloced); if (hMem != hReAlloced) { OUTPUT_Line("GlobalReAlloc returned a different block."); @@ -638,7 +638,7 @@ TEST_STATUS TestGlobalFlagsMoveable() OUTPUT_Result(result); OUTPUT_Line("Pointer from handle: "); - OUTPUT_HexDword((DWORD)GlobalLock(hMem)); + OUTPUT_HexDword((ULONG_PTR)GlobalLock(hMem)); OUTPUT_Line("Testing after a lock"); OUTPUT_Line("Testing for a lock of 1"); @@ -679,7 +679,7 @@ TEST_STATUS TestGlobalFlagsMoveable() if (0 != hMem) { OUTPUT_Line("Allocation handle: "); - OUTPUT_HexDword((DWORD)hMem); + OUTPUT_HexDword((ULONG_PTR)hMem); OUTPUT_Line("Testing for a discarded flag"); uFlags = GlobalFlags(hMem); if (0 != (uFlags & GMEM_DISCARDED)) /*discarded*/ @@ -720,7 +720,7 @@ TEST_STATUS TestGlobalFlagsFixed() { OUTPUT_Line("Allocation handle: "); - OUTPUT_HexDword((DWORD)hMem); + OUTPUT_HexDword((ULONG_PTR)hMem); OUTPUT_Line("Testing initial allocation"); OUTPUT_Line("Testing for non-discarded and lock of 0"); @@ -737,7 +737,7 @@ TEST_STATUS TestGlobalFlagsFixed() OUTPUT_Result(result); OUTPUT_Line("Pointer from handle: "); - OUTPUT_HexDword((DWORD)GlobalLock(hMem)); + OUTPUT_HexDword((ULONG_PTR)GlobalLock(hMem)); OUTPUT_Line("Testing after a lock"); OUTPUT_Line("Testing for non-discarded and lock of 0"); uFlags = GlobalFlags(hMem); @@ -796,7 +796,7 @@ TEST_STATUS TestGlobalHandle() { OUTPUT_Line("Allocation handle: "); - OUTPUT_HexDword((DWORD)hMem); + OUTPUT_HexDword((ULONG_PTR)hMem); hTest = GlobalHandle(hMem); if (hMem == hTest) @@ -806,7 +806,7 @@ TEST_STATUS TestGlobalHandle() else { OUTPUT_Line("GlobalHandle returned:"); - OUTPUT_HexDword((DWORD)hTest); + OUTPUT_HexDword((ULONG_PTR)hTest); subtest = TEST_CombineStatus(subtest, FAILED); } @@ -830,7 +830,7 @@ TEST_STATUS TestGlobalHandle() { OUTPUT_Line("Allocation handle: "); - OUTPUT_HexDword((DWORD)hMem); + OUTPUT_HexDword((ULONG_PTR)hMem); pMem = GlobalLock(hMem); hTest = GlobalHandle(pMem); if (hMem == hTest) @@ -840,7 +840,7 @@ TEST_STATUS TestGlobalHandle() else { OUTPUT_Line("GlobalHandle returned:"); - OUTPUT_HexDword((DWORD)hTest); + OUTPUT_HexDword((ULONG_PTR)hTest); subtest = TEST_CombineStatus(subtest, FAILED); } @@ -979,7 +979,7 @@ TEST_STATUS TestGlobalDiscard() if (0 != hMem) { OUTPUT_Line("Allocation handle: "); - OUTPUT_HexDword((DWORD)hMem); + OUTPUT_HexDword((ULONG_PTR)hMem); hTest = GlobalDiscard(hMem); if (0 == hTest) diff --git a/rostests/tests/isotest/isotest.c b/rostests/tests/isotest/isotest.c index a0c4921e5e3..d2f78513edf 100644 --- a/rostests/tests/isotest/isotest.c +++ b/rostests/tests/isotest/isotest.c @@ -21,7 +21,7 @@ void HexDump(char *buffer, ULONG size) while (offset < (size & ~15)) { - ptr = (unsigned char*)((ULONG)buffer + offset); + ptr = (unsigned char*)((ULONG_PTR)buffer + offset); printf("%08lx %02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx-%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx", offset, ptr[0], @@ -62,7 +62,7 @@ void HexDump(char *buffer, ULONG size) offset += 16; } - ptr = (unsigned char*)((ULONG)buffer + offset); + ptr = (unsigned char*)((ULONG_PTR)buffer + offset); if (offset < size) { printf("%08lx ", offset); diff --git a/rostests/tests/map_dup_inherit/map_dup_inherit.c b/rostests/tests/map_dup_inherit/map_dup_inherit.c index 59077fd19fc..3e78ad204f2 100644 --- a/rostests/tests/map_dup_inherit/map_dup_inherit.c +++ b/rostests/tests/map_dup_inherit/map_dup_inherit.c @@ -17,7 +17,7 @@ int main( int argc, char **argv ) { if( argc == 2 ) { #ifdef WIN64 - file_map = (void *)atoi64(argv[1]); + file_map = (void *)_atoi64(argv[1]); #else file_map = (void *)UlongToPtr(atoi(argv[1])); #endif diff --git a/rostests/tests/mdi/mdi.c b/rostests/tests/mdi/mdi.c index d3f2aaf7bea..67cf1a9e51b 100644 --- a/rostests/tests/mdi/mdi.c +++ b/rostests/tests/mdi/mdi.c @@ -160,7 +160,7 @@ HWND CreateNewMDIChild(HWND hMDIClient) mcs.y = mcs.cy = CW_USEDEFAULT; mcs.style = MDIS_ALLCHILDSTYLES; - hChild = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0, (LONG)&mcs); + hChild = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs); if(!hChild) { MessageBox(hMDIClient, "MDI Child creation failed.", "Oh Oh...", diff --git a/rostests/tests/miditest/miditest.c b/rostests/tests/miditest/miditest.c index e58b4acdc09..54a9edc641d 100644 --- a/rostests/tests/miditest/miditest.c +++ b/rostests/tests/miditest/miditest.c @@ -36,7 +36,7 @@ int main() printf("Opening MIDI output #0\n"); Result = midiOutOpen(&Handle, 0, 0, 0, CALLBACK_NULL); - printf("Result == %d Handle == %d\n", Result, (int)Handle); + printf("Result == %d Handle == %x\n", Result, Handle); // play something: midiOutShortMsg(Handle, 0x007f3090); diff --git a/rostests/tests/multithrdwin/multithrdwin.c b/rostests/tests/multithrdwin/multithrdwin.c index e0f885355c5..0d4fc5e98f1 100644 --- a/rostests/tests/multithrdwin/multithrdwin.c +++ b/rostests/tests/multithrdwin/multithrdwin.c @@ -157,7 +157,7 @@ LRESULT CALLBACK MultiWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) HDC hDC; RECT Client; HBRUSH Brush; - DWORD Ret; + DWORD_PTR Ret; static COLORREF Colors[] = { diff --git a/rostests/tests/p_dup_handle/p_dup_handle.c b/rostests/tests/p_dup_handle/p_dup_handle.c index 6aa5f7d1c05..38cc094a68f 100644 --- a/rostests/tests/p_dup_handle/p_dup_handle.c +++ b/rostests/tests/p_dup_handle/p_dup_handle.c @@ -15,7 +15,7 @@ int main( int argc, char **argv ) { fprintf( stderr, "%lu: Starting\n", GetCurrentProcessId() ); if( argc == 2 ) { - h_process = (HANDLE)atoi(argv[1]); + h_process = (HANDLE)(ULONG_PTR)atoi(argv[1]); } else { if( !DuplicateHandle( GetCurrentProcess(), GetCurrentProcess(), @@ -38,7 +38,7 @@ int main( int argc, char **argv ) { memset( &si, 0, sizeof( si ) ); memset( &pi, 0, sizeof( pi ) ); - sprintf( cmdline, "%s %lu", argv[0], (DWORD)h_process ); + sprintf( cmdline, "%s %x", argv[0], h_process ); if( !CreateProcess(NULL, cmdline, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi ) ) { fprintf( stderr, "%lu: Could not create child process.\n", diff --git a/rostests/win32/user32/kbdlayout/kbdlayout.c b/rostests/win32/user32/kbdlayout/kbdlayout.c index 28dc32fe791..a4bf4f0ed3a 100644 --- a/rostests/win32/user32/kbdlayout/kbdlayout.c +++ b/rostests/win32/user32/kbdlayout/kbdlayout.c @@ -122,7 +122,7 @@ void FormatBox(HWND hWnd, DWORD Flags, WCHAR *Caption, WCHAR *Format, ...) LRESULT CALLBACK WndSubclassProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - WND_DATA *data = (WND_DATA*)GetWindowLong(hwnd, GWL_USERDATA); + WND_DATA *data = (WND_DATA*)GetWindowLongPtr(hwnd, GWL_USERDATA); if(uMsg == WM_INPUTLANGCHANGE) { @@ -143,9 +143,9 @@ LRESULT CALLBACK WndSubclassProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP void SubclassWnd(HWND hWnd, WCHAR* Name) { WND_DATA *data = HeapAlloc(GetProcessHeap(), 0, sizeof(WND_DATA)); - data->OrigProc = (WNDPROC)SetWindowLong( hWnd, GWL_WNDPROC, (LONG)WndSubclassProc); + data->OrigProc = (WNDPROC)SetWindowLongPtr( hWnd, GWL_WNDPROC, (LONG_PTR)WndSubclassProc); wcsncpy(data->WndName, Name, 25); - SetWindowLong(hWnd, GWL_USERDATA, (LONG)data); + SetWindowLong(hWnd, GWL_USERDATA, (LONG_PTR)data); return; } diff --git a/rostests/winetests/msvcrt/printf.c b/rostests/winetests/msvcrt/printf.c index a4d5b0b5f0d..7c648ecf823 100644 --- a/rostests/winetests/msvcrt/printf.c +++ b/rostests/winetests/msvcrt/printf.c @@ -23,8 +23,10 @@ /* With Visual Studio >= 2005, swprintf() takes an extra parameter unless * the following macro is defined. */ +#ifdef _MSC_VER #define _CRT_NON_CONFORMING_SWPRINTFS - +#endif + #include #include "windef.h"