Merge from amd64-branch:
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Thu, 25 Mar 2010 01:06:20 +0000 (01:06 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Thu, 25 Mar 2010 01:06:20 +0000 (01:06 +0000)
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

15 files changed:
reactos/dll/win32/advapi32/reg/reg.c
reactos/dll/win32/advapi32/sec/misc.c
reactos/dll/win32/avicap32/avicap32.c
reactos/dll/win32/iphlpapi/iphlpapi_private.h
reactos/dll/win32/iphlpapi/resinfo_reactos.c
reactos/dll/win32/kernel32/misc/dllmain.c
reactos/dll/win32/kernel32/misc/toolhelp.c
reactos/dll/win32/kernel32/synch/critical.c
reactos/dll/win32/rpcrt4/rpc_transport.c
reactos/dll/win32/shell32/autocomplete.c
reactos/dll/win32/syssetup/install.c
reactos/dll/win32/user32/include/dde_private.h
reactos/dll/win32/user32/include/user32.h
reactos/dll/win32/user32/windows/draw.c
reactos/dll/win32/ws2_32/misc/stubs.c

index 686101e..e131cf2 100644 (file)
@@ -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);
index 51cf09e..d597697 100644 (file)
@@ -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);
index 7220f7a..f4ed19b 100644 (file)
@@ -86,7 +86,7 @@ capCreateCaptureWindowW(LPCWSTR lpszWindowName,
                            nWidth,
                            nHeight,
                            hWnd,
-                           (HMENU)nID,
+                           ULongToHandle(nID),
                            hInstance,
                            NULL);
 }
index 90efff7..766f7f4 100644 (file)
@@ -19,8 +19,6 @@
 # include <resolv.h>
 #endif
 
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x500
 #define WIN32_NO_STATUS
 #include <winsock2.h>
 #include <ws2tcpip.h>
index 2b55194..02bcb3b 100644 (file)
@@ -58,7 +58,7 @@ NTAPI
 RtlAllocateHeap (
        HANDLE  Heap,
        ULONG   Flags,
-       ULONG   Size
+       SIZE_T  Size
        );
 
 NTSYSAPI
index a828f72..02199f9 100644 (file)
@@ -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)
index ad2f2b7..ab591b1 100644 (file)
@@ -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 */
index 474a5d6..ac5280a 100644 (file)
@@ -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 */
index b9077a3..2da7290 100644 (file)
@@ -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);
index a637988..a0ace20 100644 (file)
@@ -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");
index 6a1a1f7..c212916 100644 (file)
@@ -511,7 +511,7 @@ cleanup:
 }
 
 
-static BOOL CALLBACK
+static INT_PTR CALLBACK
 StatusMessageWindowProc(
     IN HWND hwndDlg,
     IN UINT uMsg,
index 8583efd..beca748 100644 (file)
@@ -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,
index 174d71e..99f48a1 100644 (file)
@@ -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);
     }
 }
 
index cb67e30..2eb68d1 100644 (file)
@@ -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)
     {
index 408f282..10dd98e 100644 (file)
@@ -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;