Sync to trunk revision 63875.
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Tue, 12 Aug 2014 18:49:17 +0000 (18:49 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Tue, 12 Aug 2014 18:49:17 +0000 (18:49 +0000)
svn path=/branches/condrv_restructure/; revision=63876

base/setup/usetup/cabinet.c
dll/win32/rpcrt4/ndr_marshall.c
dll/win32/shell32/folders/fs.cpp
dll/win32/shell32/folders/fs.h
dll/win32/syssetup/security.c
win32ss/user/ntuser/focus.c

index 9f02425..1d16ac0 100644 (file)
@@ -1098,7 +1098,7 @@ CabinetExtractFile(PCAB_SEARCH Search)
         Size -= OutputLength;
         /* reduce remaining block size by bytes consumed */
         RemainingBlock -= InputLength;
-        if (RemainingBlock == 0)
+        if (Size > 0 && RemainingBlock == 0)
         {
             /* used up this block, move on to the next */
             DPRINT("Out of block data\n");
index 6f19cb3..5179546 100644 (file)
@@ -1120,7 +1120,7 @@ static void PointerFree(PMIDL_STUB_MESSAGE pStubMsg,
    * BufferStart and BufferEnd won't be reset when allocating memory for
    * sending the response. we don't have to check for the new buffer here as
    * it won't be used a type memory, only for buffer memory */
-  if (Pointer >= pStubMsg->BufferStart && Pointer < pStubMsg->BufferEnd)
+  if (Pointer >= pStubMsg->BufferStart && Pointer <= pStubMsg->BufferEnd)
       goto notfree;
 
   if (attr & RPC_FC_P_ONSTACK) {
index 76e19a0..3ee29df 100644 (file)
@@ -1431,20 +1431,17 @@ HRESULT WINAPI CFSFolder::Drop(IDataObject *pDataObject,
             _DoDropData *data = static_cast<_DoDropData*>(HeapAlloc(GetProcessHeap(), 0, sizeof(_DoDropData)));
             data->This = this;
             // Need to maintain this class in case the window is closed or the class exists temporarily (when dropping onto a folder).
+            pDataObject->AddRef();
+            pAsyncOperation->StartOperation(NULL);
+            CoMarshalInterThreadInterfaceInStream(IID_IDataObject, pDataObject, &data->pStream);
             this->AddRef();
-            data->pDataObject = pDataObject;
-            data->pAsyncOperation = pAsyncOperation;
             data->dwKeyState = dwKeyState;
             data->pt = pt;
             // Need to dereference as pdweffect gets freed.
             data->pdwEffect = *pdwEffect;
-            data->pDataObject->AddRef();
-            data->pAsyncOperation->StartOperation(NULL);
             SHCreateThread(CFSFolder::_DoDropThreadProc, data, NULL, NULL);
             return S_OK;
         }
-        else
-            pAsyncOperation->Release();
     }
     return this->_DoDrop(pDataObject, dwKeyState, pt, pdwEffect);
 }
@@ -1745,12 +1742,22 @@ HRESULT WINAPI CFSFolder::_DoDrop(IDataObject *pDataObject,
 }
 
 DWORD WINAPI CFSFolder::_DoDropThreadProc(LPVOID lpParameter) {
+    CoInitialize(NULL);
     _DoDropData *data = static_cast<_DoDropData*>(lpParameter);
-    HRESULT hr = data->This->_DoDrop(data->pDataObject, data->dwKeyState, data->pt, &data->pdwEffect);
+    IDataObject *pDataObject;
+    HRESULT hr = CoGetInterfaceAndReleaseStream (data->pStream, IID_IDataObject, (void**) &pDataObject);
+
+    if (SUCCEEDED(hr))
+    {
+        CComPtr<IAsyncOperation> pAsyncOperation;
+        hr = data->This->_DoDrop(pDataObject, data->dwKeyState, data->pt, &data->pdwEffect);
+        if (SUCCEEDED(pDataObject->QueryInterface(IID_PPV_ARG(IAsyncOperation, &pAsyncOperation))))
+        {
+            pAsyncOperation->EndOperation(hr, NULL, data->pdwEffect);
+        }
+        pDataObject->Release();
+    }
     //Release the CFSFolder and data object holds in the copying thread.
-    data->pAsyncOperation->EndOperation(hr, NULL, data->pdwEffect);
-    data->pAsyncOperation->Release();
-    data->pDataObject->Release();
     data->This->Release();
     //Release the parameter from the heap.
     HeapFree(GetProcessHeap(), 0, data);
index 95ca362..ac7b2cd 100644 (file)
@@ -123,8 +123,7 @@ class CFSFolder :
 
 struct _DoDropData {
     CFSFolder *This;
-    IDataObject *pDataObject;
-    IAsyncOperation *pAsyncOperation;
+    IStream *pStream;
     DWORD dwKeyState;
     POINTL pt; 
     DWORD pdwEffect;
index 2f866f4..09c42f5 100644 (file)
@@ -170,7 +170,11 @@ InstallBuiltinAccounts(VOID)
 
     for (i = 0; i < 10; i++)
     {
-        ConvertStringSidToSid(BuiltinAccounts[i], &AccountSid);
+        if (!ConvertStringSidToSid(BuiltinAccounts[i], &AccountSid))
+        {
+            DPRINT1("ConvertStringSidToSid(%S) failed: %lu\n", BuiltinAccounts[i], GetLastError());
+            continue;
+        }
 
         Status = LsaCreateAccount(PolicyHandle,
                                   AccountSid,
@@ -277,7 +281,11 @@ InstallPrivileges(VOID)
             }
             DPRINT("SID: %S\n", szSidString);
 
-            ConvertStringSidToSid(szSidString, &AccountSid);
+            if (!ConvertStringSidToSid(szSidString, &AccountSid))
+            {
+                DPRINT1("ConvertStringSidToSid(%S) failed: %lu\n", szSidString, GetLastError());
+                continue;
+            }
 
             Status = LsaOpenAccount(PolicyHandle,
                                     AccountSid,
index c2d39a2..a5e8724 100644 (file)
@@ -315,28 +315,22 @@ FindRemoveAsyncMsg(PWND Wnd, WPARAM wParam)
 
    pti = Wnd->head.pti;
 
-   if (!IsListEmpty(&pti->SentMessagesListHead))
+   Entry = pti->SentMessagesListHead.Flink;
+   while (Entry != &pti->SentMessagesListHead)
    {
       // Scan sent queue messages to see if we received async messages.
-      Entry = pti->SentMessagesListHead.Flink;
       Message = CONTAINING_RECORD(Entry, USER_SENT_MESSAGE, ListEntry);
-      do
-      {
-         if (IsListEmpty(Entry)) return;
-         if (!Message) return;
-         Entry = Message->ListEntry.Flink;
+      Entry = Entry->Flink;
 
-         if (Message->Msg.message == WM_ASYNC_SETACTIVEWINDOW &&
-             Message->Msg.hwnd == UserHMGetHandle(Wnd) &&
-             Message->Msg.wParam == wParam )
-         {
-             ERR("ASYNC SAW: Found one in the Sent Msg Queue! %p Activate/Deactivate %d\n", Message->Msg.hwnd,!!wParam);
-             RemoveEntryList(&Message->ListEntry); // Purge the entry.
-             ExFreePoolWithTag(Message, TAG_USRMSG);
-         }
-         Message = CONTAINING_RECORD(Entry, USER_SENT_MESSAGE, ListEntry);
+      if (Message->Msg.message == WM_ASYNC_SETACTIVEWINDOW &&
+          Message->Msg.hwnd == UserHMGetHandle(Wnd) &&
+          Message->Msg.wParam == wParam)
+      {
+         ERR("ASYNC SAW: Found one in the Sent Msg Queue! %p Activate/Deactivate %d\n", Message->Msg.hwnd, !!wParam);
+         RemoveEntryList(&Message->ListEntry); // Purge the entry.
+         ClearMsgBitsMask(pti, Message->QS_Flags);
+         ExFreePoolWithTag(Message, TAG_USRMSG);
       }
-      while (Entry != &pti->SentMessagesListHead);
    }
 }