mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 00:45:24 +00:00
[SHELL32] Drive Property Sheet: Run in another thread (#7107)
The drive property sheet was modal, so it used to lock the main thread. This PR will unlock by using another thread. JIRA issue: CORE-4217 JIRA issue: CORE-11547 In dll/win32/shell32/dialogs/drive.cpp: - Add DRIVE_PROP_DATA structure. - Call SHCreateThread function in SH_ShowDriveProperties function. - Clean up the data when they should be released.
This commit is contained in:
parent
f9d8665328
commit
0bd933c28c
1 changed files with 46 additions and 2 deletions
|
@ -166,9 +166,22 @@ typedef struct _DRIVE_PROP_PAGE
|
||||||
UINT DriveType;
|
UINT DriveType;
|
||||||
} DRIVE_PROP_PAGE;
|
} DRIVE_PROP_PAGE;
|
||||||
|
|
||||||
BOOL
|
struct DRIVE_PROP_DATA
|
||||||
SH_ShowDriveProperties(WCHAR *pwszDrive, IDataObject *pDataObj)
|
|
||||||
{
|
{
|
||||||
|
PWSTR pwszDrive;
|
||||||
|
IStream *pStream;
|
||||||
|
};
|
||||||
|
|
||||||
|
static DWORD WINAPI
|
||||||
|
ShowDrivePropThreadProc(LPVOID pParam)
|
||||||
|
{
|
||||||
|
CHeapPtr<DRIVE_PROP_DATA, CComAllocator> pPropData((DRIVE_PROP_DATA *)pParam);
|
||||||
|
CHeapPtr<WCHAR, CComAllocator> pwszDrive(pPropData->pwszDrive);
|
||||||
|
|
||||||
|
// Unmarshall IDataObject from IStream
|
||||||
|
CComPtr<IDataObject> pDataObj;
|
||||||
|
CoGetInterfaceAndReleaseStream(pPropData->pStream, IID_PPV_ARG(IDataObject, &pDataObj));
|
||||||
|
|
||||||
HPSXA hpsx = NULL;
|
HPSXA hpsx = NULL;
|
||||||
HPROPSHEETPAGE hpsp[MAX_PROPERTY_SHEET_PAGE];
|
HPROPSHEETPAGE hpsp[MAX_PROPERTY_SHEET_PAGE];
|
||||||
CComObject<CDrvDefExt> *pDrvDefExt = NULL;
|
CComObject<CDrvDefExt> *pDrvDefExt = NULL;
|
||||||
|
@ -234,6 +247,37 @@ SH_ShowDriveProperties(WCHAR *pwszDrive, IDataObject *pDataObj)
|
||||||
return ret != -1;
|
return ret != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
SH_ShowDriveProperties(WCHAR *pwszDrive, IDataObject *pDataObj)
|
||||||
|
{
|
||||||
|
HRESULT hr = SHStrDupW(pwszDrive, &pwszDrive);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
// Prepare data for thread
|
||||||
|
DRIVE_PROP_DATA *pData = (DRIVE_PROP_DATA *)SHAlloc(sizeof(*pData));
|
||||||
|
if (!pData)
|
||||||
|
{
|
||||||
|
SHFree(pwszDrive);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
pData->pwszDrive = pwszDrive;
|
||||||
|
|
||||||
|
// Marshall IDataObject to IStream
|
||||||
|
hr = CoMarshalInterThreadInterfaceInStream(IID_IDataObject, pDataObj, &pData->pStream);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
// Run a property sheet in another thread
|
||||||
|
if (SHCreateThread(ShowDrivePropThreadProc, pData, CTF_COINIT, NULL))
|
||||||
|
return TRUE; // Success
|
||||||
|
|
||||||
|
pData->pStream->Release();
|
||||||
|
}
|
||||||
|
SHFree(pData);
|
||||||
|
SHFree(pwszDrive);
|
||||||
|
return FALSE; // Failed
|
||||||
|
}
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
InsertDefaultClusterSizeForFs(HWND hwndDlg, PFORMAT_DRIVE_CONTEXT pContext)
|
InsertDefaultClusterSizeForFs(HWND hwndDlg, PFORMAT_DRIVE_CONTEXT pContext)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue