[SHELL32]

- Fix more casts and stack corruption

svn path=/trunk/; revision=62230
This commit is contained in:
Thomas Faber 2014-02-17 17:01:37 +00:00
parent ed736d630e
commit bb1fa1fd3c
4 changed files with 8 additions and 8 deletions

View file

@ -979,7 +979,7 @@ CFileDefExt::GetSite(REFIID iid, void **ppvSite)
DWORD WINAPI DWORD WINAPI
CFileDefExt::_CountFolderAndFilesThreadProc(LPVOID lpParameter) CFileDefExt::_CountFolderAndFilesThreadProc(LPVOID lpParameter)
{ {
_CountFolderAndFilesData *data = reinterpret_cast<_CountFolderAndFilesData*>(lpParameter); _CountFolderAndFilesData *data = static_cast<_CountFolderAndFilesData*>(lpParameter);
DWORD ticks = 0; DWORD ticks = 0;
data->This->CountFolderAndFiles(data->hwndDlg, data->pwszBuf, data->cchBufMax, &ticks); data->This->CountFolderAndFiles(data->hwndDlg, data->pwszBuf, data->cchBufMax, &ticks);

View file

@ -1427,7 +1427,7 @@ HRESULT WINAPI CFSFolder::Drop(IDataObject *pDataObject,
{ {
if (SUCCEEDED(pAsyncOperation->GetAsyncMode(&fIsOpAsync)) && fIsOpAsync) if (SUCCEEDED(pAsyncOperation->GetAsyncMode(&fIsOpAsync)) && fIsOpAsync)
{ {
_DoDropData *data = reinterpret_cast<_DoDropData*> (HeapAlloc(GetProcessHeap(), 0, sizeof(_DoDropData))); _DoDropData *data = static_cast<_DoDropData*>(HeapAlloc(GetProcessHeap(), 0, sizeof(_DoDropData)));
data->This = this; data->This = this;
// Need to maintain this class in case the window is closed or the class exists temporarily (when dropping onto a folder). // Need to maintain this class in case the window is closed or the class exists temporarily (when dropping onto a folder).
this->AddRef(); this->AddRef();
@ -1439,7 +1439,7 @@ HRESULT WINAPI CFSFolder::Drop(IDataObject *pDataObject,
data->pdwEffect = *pdwEffect; data->pdwEffect = *pdwEffect;
data->pDataObject->AddRef(); data->pDataObject->AddRef();
data->pAsyncOperation->StartOperation(NULL); data->pAsyncOperation->StartOperation(NULL);
SHCreateThread(reinterpret_cast<LPTHREAD_START_ROUTINE> (CFSFolder::_DoDropThreadProc), reinterpret_cast<void *> (data), NULL, NULL); SHCreateThread(CFSFolder::_DoDropThreadProc, data, NULL, NULL);
return S_OK; return S_OK;
} }
else else
@ -1737,8 +1737,8 @@ HRESULT WINAPI CFSFolder::_DoDrop(IDataObject *pDataObject,
return hr; return hr;
} }
DWORD CFSFolder::_DoDropThreadProc(LPVOID lpParameter) { DWORD WINAPI CFSFolder::_DoDropThreadProc(LPVOID lpParameter) {
_DoDropData *data = reinterpret_cast<_DoDropData*>(lpParameter); _DoDropData *data = static_cast<_DoDropData*>(lpParameter);
HRESULT hr = data->This->_DoDrop(data->pDataObject, data->dwKeyState, data->pt, &data->pdwEffect); HRESULT hr = data->This->_DoDrop(data->pDataObject, data->dwKeyState, data->pt, &data->pdwEffect);
//Release the CFSFolder and data object holds in the copying thread. //Release the CFSFolder and data object holds in the copying thread.
data->pAsyncOperation->EndOperation(hr, NULL, data->pdwEffect); data->pAsyncOperation->EndOperation(hr, NULL, data->pdwEffect);

View file

@ -46,7 +46,7 @@ class CFSFolder :
BOOL QueryDrop (DWORD dwKeyState, LPDWORD pdwEffect); BOOL QueryDrop (DWORD dwKeyState, LPDWORD pdwEffect);
void SF_RegisterClipFmt(); void SF_RegisterClipFmt();
BOOL GetUniqueFileName(LPWSTR pwszBasePath, LPCWSTR pwszExt, LPWSTR pwszTarget, BOOL bShortcut); BOOL GetUniqueFileName(LPWSTR pwszBasePath, LPCWSTR pwszExt, LPWSTR pwszTarget, BOOL bShortcut);
static DWORD _DoDropThreadProc(LPVOID lpParameter); static DWORD WINAPI _DoDropThreadProc(LPVOID lpParameter);
virtual HRESULT WINAPI _DoDrop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect); virtual HRESULT WINAPI _DoDrop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
public: public:

View file

@ -600,7 +600,7 @@ EXTERN_C HRESULT WINAPI SHPropStgCreate(IPropertySetStorage *psstg, REFFMTID fmt
case CREATE_ALWAYS: case CREATE_ALWAYS:
if (SUCCEEDED(hres)) if (SUCCEEDED(hres))
{ {
reinterpret_cast<IPropertyStorage*>(*ppstg)->Release(); (*ppstg)->Release();
hres = psstg->Delete(fmtid); hres = psstg->Delete(fmtid);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -620,7 +620,7 @@ EXTERN_C HRESULT WINAPI SHPropStgCreate(IPropertySetStorage *psstg, REFFMTID fmt
{ {
prop.ulKind = PRSPEC_PROPID; prop.ulKind = PRSPEC_PROPID;
prop.propid = PID_CODEPAGE; prop.propid = PID_CODEPAGE;
hres = reinterpret_cast<IPropertyStorage*>(*ppstg)->ReadMultiple(1, &prop, &ret); hres = (*ppstg)->ReadMultiple(1, &prop, &ret);
if (FAILED(hres) || ret.vt!=VT_I2) if (FAILED(hres) || ret.vt!=VT_I2)
*puCodePage = 0; *puCodePage = 0;
else else