From 720c15e46d3159d582966313063f1e31a014c452 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 25 Mar 2010 01:06:20 +0000 Subject: [PATCH] Merge from amd64-branch: 36898 (sserapion) - Fix 64bit advapi32 build. 35655 (sserapion) Misc WIN64 fixes. Implement InitializeCriticalSectionEx 43836 (sserapion) Fix avicap32 build. 44510 (tkreuzer) [IPHLPAPI] Don't redefine _WIN32_WINNT to 0x500. When using the NDK we need at least 0x503 when compiling for 64 bit (XP64 is 502) 39335 (tkreuzer) [IPHLPAPI] Fix prototype of RtlAllocateHeap 38092 (sserapion) [RPCRT4] Fix 64bit-warnings. 44499 (sserapion) [SYSSETUP] Eliminate warning. 38100 (sserapion) [ADVAPI32] ULONG -> ULONG_PTR svn path=/trunk/; revision=46418 --- reactos/dll/win32/advapi32/reg/reg.c | 4 +-- reactos/dll/win32/advapi32/sec/misc.c | 6 ++--- reactos/dll/win32/avicap32/avicap32.c | 2 +- reactos/dll/win32/iphlpapi/iphlpapi_private.h | 2 -- reactos/dll/win32/iphlpapi/resinfo_reactos.c | 2 +- reactos/dll/win32/kernel32/misc/dllmain.c | 6 +++++ reactos/dll/win32/kernel32/misc/toolhelp.c | 8 +++--- reactos/dll/win32/kernel32/synch/critical.c | 26 +++++++++++++++++++ reactos/dll/win32/rpcrt4/rpc_transport.c | 8 +++--- reactos/dll/win32/shell32/autocomplete.c | 2 +- reactos/dll/win32/syssetup/install.c | 2 +- .../dll/win32/user32/include/dde_private.h | 2 +- reactos/dll/win32/user32/include/user32.h | 2 +- reactos/dll/win32/user32/windows/draw.c | 2 +- reactos/dll/win32/ws2_32/misc/stubs.c | 2 +- 15 files changed, 53 insertions(+), 23 deletions(-) diff --git a/reactos/dll/win32/advapi32/reg/reg.c b/reactos/dll/win32/advapi32/reg/reg.c index 686101e7f1b..e131cf2e43b 100644 --- a/reactos/dll/win32/advapi32/reg/reg.c +++ b/reactos/dll/win32/advapi32/reg/reg.c @@ -42,9 +42,9 @@ static VOID CloseDefaultKeys(VOID); NtClose(Handle); \ } #define IsPredefKey(HKey) \ - (((ULONG)(HKey) & 0xF0000000) == 0x80000000) + (((ULONG_PTR)(HKey) & 0xF0000000) == 0x80000000) #define GetPredefKeyIndex(HKey) \ - ((ULONG)(HKey) & 0x0FFFFFFF) + ((ULONG_PTR)(HKey) & 0x0FFFFFFF) static NTSTATUS OpenClassesRootKey(PHANDLE KeyHandle); static NTSTATUS OpenLocalMachineKey (PHANDLE KeyHandle); diff --git a/reactos/dll/win32/advapi32/sec/misc.c b/reactos/dll/win32/advapi32/sec/misc.c index 51cf09e1512..d5976974c58 100644 --- a/reactos/dll/win32/advapi32/sec/misc.c +++ b/reactos/dll/win32/advapi32/sec/misc.c @@ -289,7 +289,7 @@ CheckNtMartaPresent(VOID) { DWORD ErrorCode; - if (InterlockedCompareExchangePointer(&NtMarta, + if (InterlockedCompareExchangePointer((PVOID)&NtMarta, NULL, NULL) == NULL) { @@ -300,7 +300,7 @@ CheckNtMartaPresent(VOID) if (ErrorCode == ERROR_SUCCESS) { /* try change the NtMarta pointer */ - if (InterlockedCompareExchangePointer(&NtMarta, + if (InterlockedCompareExchangePointer((PVOID)&NtMarta, &NtMartaStatic, NULL) != NULL) { @@ -329,7 +329,7 @@ CheckNtMartaPresent(VOID) VOID UnloadNtMarta(VOID) { - if (InterlockedExchangePointer(&NtMarta, + if (InterlockedExchangePointer((PVOID)&NtMarta, NULL) != NULL) { FreeLibrary(NtMartaStatic.hDllInstance); diff --git a/reactos/dll/win32/avicap32/avicap32.c b/reactos/dll/win32/avicap32/avicap32.c index 7220f7a2e6d..f4ed19b6e11 100644 --- a/reactos/dll/win32/avicap32/avicap32.c +++ b/reactos/dll/win32/avicap32/avicap32.c @@ -86,7 +86,7 @@ capCreateCaptureWindowW(LPCWSTR lpszWindowName, nWidth, nHeight, hWnd, - (HMENU)nID, + ULongToHandle(nID), hInstance, NULL); } diff --git a/reactos/dll/win32/iphlpapi/iphlpapi_private.h b/reactos/dll/win32/iphlpapi/iphlpapi_private.h index 90efff74da0..766f7f4e6ee 100644 --- a/reactos/dll/win32/iphlpapi/iphlpapi_private.h +++ b/reactos/dll/win32/iphlpapi/iphlpapi_private.h @@ -19,8 +19,6 @@ # include #endif -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x500 #define WIN32_NO_STATUS #include #include diff --git a/reactos/dll/win32/iphlpapi/resinfo_reactos.c b/reactos/dll/win32/iphlpapi/resinfo_reactos.c index 2b551949b57..02bcb3b9129 100644 --- a/reactos/dll/win32/iphlpapi/resinfo_reactos.c +++ b/reactos/dll/win32/iphlpapi/resinfo_reactos.c @@ -58,7 +58,7 @@ NTAPI RtlAllocateHeap ( HANDLE Heap, ULONG Flags, - ULONG Size + SIZE_T Size ); NTSYSAPI diff --git a/reactos/dll/win32/kernel32/misc/dllmain.c b/reactos/dll/win32/kernel32/misc/dllmain.c index a828f72ef5a..02199f9349d 100644 --- a/reactos/dll/win32/kernel32/misc/dllmain.c +++ b/reactos/dll/win32/kernel32/misc/dllmain.c @@ -402,6 +402,12 @@ DllMain(HANDLE hDll, return TRUE; } +#undef InterlockedIncrement +#undef InterlockedDecrement +#undef InterlockedExchange +#undef InterlockedExchangeAdd +#undef InterlockedCompareExchange + LONG WINAPI InterlockedIncrement(IN OUT LONG volatile *lpAddend) diff --git a/reactos/dll/win32/kernel32/misc/toolhelp.c b/reactos/dll/win32/kernel32/misc/toolhelp.c index ad2f2b7db2a..ab591b1d9f9 100644 --- a/reactos/dll/win32/kernel32/misc/toolhelp.c +++ b/reactos/dll/win32/kernel32/misc/toolhelp.c @@ -400,11 +400,11 @@ TH32CreateSnapshotSectionInitialize(DWORD dwFlags, ProcessListEntry->dwSize = sizeof(PROCESSENTRY32W); ProcessListEntry->cntUsage = 0; /* no longer used */ - ProcessListEntry->th32ProcessID = (ULONG)ProcessInfo->UniqueProcessId; + ProcessListEntry->th32ProcessID = (ULONG_PTR)ProcessInfo->UniqueProcessId; ProcessListEntry->th32DefaultHeapID = 0; /* no longer used */ ProcessListEntry->th32ModuleID = 0; /* no longer used */ ProcessListEntry->cntThreads = ProcessInfo->NumberOfThreads; - ProcessListEntry->th32ParentProcessID = (ULONG)ProcessInfo->InheritedFromUniqueProcessId; + ProcessListEntry->th32ParentProcessID = (ULONG_PTR)ProcessInfo->InheritedFromUniqueProcessId; ProcessListEntry->pcPriClassBase = ProcessInfo->BasePriority; ProcessListEntry->dwFlags = 0; /* no longer used */ if(ProcessInfo->ImageName.Buffer != NULL) @@ -447,8 +447,8 @@ TH32CreateSnapshotSectionInitialize(DWORD dwFlags, { ThreadListEntry->dwSize = sizeof(THREADENTRY32); ThreadListEntry->cntUsage = 0; /* no longer used */ - ThreadListEntry->th32ThreadID = (ULONG)ThreadInfo->ClientId.UniqueThread; - ThreadListEntry->th32OwnerProcessID = (ULONG)ThreadInfo->ClientId.UniqueProcess; + ThreadListEntry->th32ThreadID = (ULONG_PTR)ThreadInfo->ClientId.UniqueThread; + ThreadListEntry->th32OwnerProcessID = (ULONG_PTR)ThreadInfo->ClientId.UniqueProcess; ThreadListEntry->tpBasePri = ThreadInfo->BasePriority; ThreadListEntry->tpDeltaPri = 0; /* no longer used */ ThreadListEntry->dwFlags = 0; /* no longer used */ diff --git a/reactos/dll/win32/kernel32/synch/critical.c b/reactos/dll/win32/kernel32/synch/critical.c index 474a5d6c543..ac5280a60bd 100644 --- a/reactos/dll/win32/kernel32/synch/critical.c +++ b/reactos/dll/win32/kernel32/synch/critical.c @@ -55,4 +55,30 @@ InitializeCriticalSectionAndSpinCount(OUT LPCRITICAL_SECTION lpCriticalSection, return TRUE; } +/* + * @implemented + */ +BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection, + IN DWORD dwSpinCount, + IN DWORD flags ) +{ + NTSTATUS Status; + + /* FIXME: Flags ignored */ + + /* Initialize the critical section */ + Status = RtlInitializeCriticalSectionAndSpinCount( + (PRTL_CRITICAL_SECTION)lpCriticalSection, + dwSpinCount); + if (!NT_SUCCESS(Status)) + { + /* Set failure code */ + SetLastErrorByStatus(Status); + return FALSE; + } + + /* Success */ + return TRUE; +} + /* EOF */ diff --git a/reactos/dll/win32/rpcrt4/rpc_transport.c b/reactos/dll/win32/rpcrt4/rpc_transport.c index b9077a3dc1a..2da72909c23 100644 --- a/reactos/dll/win32/rpcrt4/rpc_transport.c +++ b/reactos/dll/win32/rpcrt4/rpc_transport.c @@ -762,7 +762,7 @@ typedef struct _RpcConnection_tcp { RpcConnection common; int sock; - int cancel_fds[2]; + SOCKET cancel_fds[2]; } RpcConnection_tcp; static RpcConnection *rpcrt4_conn_tcp_alloc(void) @@ -814,7 +814,7 @@ static RPC_STATUS rpcrt4_ncacn_ip_tcp_open(RpcConnection* Connection) for (ai_cur = ai; ai_cur; ai_cur = ai_cur->ai_next) { - int val; + char val; if (TRACE_ON(rpc)) { @@ -1091,7 +1091,7 @@ static int rpcrt4_conn_tcp_close(RpcConnection *Connection) static void rpcrt4_conn_tcp_cancel_call(RpcConnection *Connection) { RpcConnection_tcp *tcpc = (RpcConnection_tcp *) Connection; - char dummy = 1; + SOCKET dummy = 1; TRACE("%p\n", Connection); @@ -1271,7 +1271,7 @@ static RpcServerProtseq *rpcrt4_protseq_sock_alloc(void) RpcServerProtseq_sock *ps = HeapAlloc(GetProcessHeap(), 0, sizeof(*ps)); if (ps) { - int fds[2]; + SOCKET fds[2]; if (!socketpair(PF_UNIX, SOCK_DGRAM, 0, fds)) { fcntl(fds[0], F_SETFL, O_NONBLOCK); diff --git a/reactos/dll/win32/shell32/autocomplete.c b/reactos/dll/win32/shell32/autocomplete.c index a637988939f..a0ace20c051 100644 --- a/reactos/dll/win32/shell32/autocomplete.c +++ b/reactos/dll/win32/shell32/autocomplete.c @@ -214,7 +214,7 @@ static HRESULT WINAPI IAutoComplete_fnInit( static const WCHAR lbName[] = {'L','i','s','t','B','o','x',0}; TRACE("(%p)->(0x%08lx, %p, %s, %s)\n", - This, (long)hwndEdit, punkACL, debugstr_w(pwzsRegKeyPath), debugstr_w(pwszQuickComplete)); + This, hwndEdit, punkACL, debugstr_w(pwzsRegKeyPath), debugstr_w(pwszQuickComplete)); if (This->options & ACO_AUTOSUGGEST) TRACE(" ACO_AUTOSUGGEST\n"); if (This->options & ACO_AUTOAPPEND) TRACE(" ACO_AUTOAPPEND\n"); diff --git a/reactos/dll/win32/syssetup/install.c b/reactos/dll/win32/syssetup/install.c index 6a1a1f7dac6..c212916252b 100644 --- a/reactos/dll/win32/syssetup/install.c +++ b/reactos/dll/win32/syssetup/install.c @@ -511,7 +511,7 @@ cleanup: } -static BOOL CALLBACK +static INT_PTR CALLBACK StatusMessageWindowProc( IN HWND hwndDlg, IN UINT uMsg, diff --git a/reactos/dll/win32/user32/include/dde_private.h b/reactos/dll/win32/user32/include/dde_private.h index 8583efdc3b0..beca7483ac5 100644 --- a/reactos/dll/win32/user32/include/dde_private.h +++ b/reactos/dll/win32/user32/include/dde_private.h @@ -208,7 +208,7 @@ extern WDML_CONV* WDML_GetConvFromWnd(HWND hWnd); extern WDML_CONV* WDML_FindConv(WDML_INSTANCE* pInstance, WDML_SIDE side, HSZ hszService, HSZ hszTopic); extern BOOL WDML_PostAck(WDML_CONV* pConv, WDML_SIDE side, WORD appRetCode, - BOOL fBusy, BOOL fAck, UINT pmt, LPARAM lParam, UINT oldMsg); + BOOL fBusy, BOOL fAck, UINT_PTR pmt, LPARAM lParam, UINT oldMsg); extern void WDML_AddLink(WDML_INSTANCE* pInstance, HCONV hConv, WDML_SIDE side, UINT wType, HSZ hszItem, UINT wFmt); extern WDML_LINK* WDML_FindLink(WDML_INSTANCE* pInstance, HCONV hConv, WDML_SIDE side, diff --git a/reactos/dll/win32/user32/include/user32.h b/reactos/dll/win32/user32/include/user32.h index 174d71ebb3b..99f48a1a9a2 100644 --- a/reactos/dll/win32/user32/include/user32.h +++ b/reactos/dll/win32/user32/include/user32.h @@ -153,7 +153,7 @@ DesktopPtrToUser(PVOID Ptr) /* NOTE: This is slow as it requires a call to win32k. This should only be neccessary if a thread wants to access an object on a different desktop */ - return NtUserGetDesktopMapping(Ptr); + return (PVOID)NtUserGetDesktopMapping(Ptr); } } diff --git a/reactos/dll/win32/user32/windows/draw.c b/reactos/dll/win32/user32/windows/draw.c index cb67e30f46b..2eb68d11988 100644 --- a/reactos/dll/win32/user32/windows/draw.c +++ b/reactos/dll/win32/user32/windows/draw.c @@ -1574,7 +1574,7 @@ FillRect(HDC hDC, CONST RECT *lprc, HBRUSH hbr) if (hbr <= (HBRUSH)(COLOR_MENUBAR + 1)) { - hbr = GetSysColorBrush((int)hbr - 1); + hbr = GetSysColorBrush(PtrToUlong(hbr) - 1); } if ((prevhbr = SelectObject(hDC, hbr)) == NULL) { diff --git a/reactos/dll/win32/ws2_32/misc/stubs.c b/reactos/dll/win32/ws2_32/misc/stubs.c index 408f28294a6..10dd98e1ded 100644 --- a/reactos/dll/win32/ws2_32/misc/stubs.c +++ b/reactos/dll/win32/ws2_32/misc/stubs.c @@ -30,7 +30,7 @@ getpeername(IN SOCKET s, return SOCKET_ERROR; } - if (!ReferenceProviderByHandle((HANDLE)s, &Provider)) + if (!ReferenceProviderByHandle((HANDLE)(ULONG_PTR)(s), &Provider)) { WSASetLastError(WSAENOTSOCK); return SOCKET_ERROR; -- 2.17.1