| 961 | } |
| 962 | |
| 963 | void DropHandler::CopyDroppedFilesInternal(const std::list<std::wstring> &FullFilenameList, |
| 964 | BOOL bCopy,BOOL bRenameOnCollision) |
| 965 | { |
| 966 | if(FullFilenameList.empty()) |
| 967 | { |
| 968 | return; |
| 969 | } |
| 970 | |
| 971 | auto *ppfi = new PastedFilesInfo_t; |
| 972 | ppfi->pReferenceCount = this; |
| 973 | ppfi->hwnd = m_hwndDrop; |
| 974 | ppfi->FullFilenameList = FullFilenameList; |
| 975 | ppfi->strDestDirectory = m_szDestDirectory; |
| 976 | ppfi->bCopy = bCopy; |
| 977 | ppfi->bRenameOnCollision = bRenameOnCollision; |
| 978 | ppfi->pac = NULL; |
| 979 | ppfi->pDropFilesCallback = m_pDropFilesCallback; |
| 980 | ppfi->pt.x = m_ptl.x; |
| 981 | ppfi->pt.y = m_ptl.y; |
| 982 | |
| 983 | IDataObjectAsyncCapability *pac = NULL; |
| 984 | BOOL bAsyncSupported = FALSE; |
| 985 | |
| 986 | /* Does the drop source support asynchronous copy? */ |
| 987 | HRESULT hr = m_pDataObject->QueryInterface(IID_PPV_ARGS(&pac)); |
| 988 | |
| 989 | if(hr == S_OK) |
| 990 | { |
| 991 | pac->GetAsyncMode(&bAsyncSupported); |
| 992 | |
| 993 | if(!bAsyncSupported) |
| 994 | { |
| 995 | pac->Release(); |
| 996 | } |
| 997 | } |
| 998 | |
| 999 | if(bAsyncSupported) |
| 1000 | { |
| 1001 | pac->StartOperation(NULL); |
| 1002 | |
| 1003 | ppfi->pac = pac; |
| 1004 | |
| 1005 | /* The copy operation is going to occur on a background thread, |
| 1006 | which means that we can't release this object until the background |
| 1007 | thread has completed. Use reference counting to ensure this |
| 1008 | condition is met. */ |
| 1009 | AddRef(); |
| 1010 | |
| 1011 | /* The drop source needs to be notified of the status of the copy |
| 1012 | once it has finished. This notification however, needs to occur on |
| 1013 | the thread that the object was created in. */ |
| 1014 | SetWindowSubclass(m_hwndDrop,DropWindowSubclass,SUBCLASS_ID,NULL); |
| 1015 | |
| 1016 | HANDLE hThread = CreateThread(NULL,0,CopyDroppedFilesInternalAsyncStub, |
| 1017 | reinterpret_cast<LPVOID>(ppfi),0,NULL); |
| 1018 | |
| 1019 | if(hThread != NULL) |
| 1020 | { |
nothing calls this directly
no test coverage detected