From 20f87008f72c53101f8825dec4a59110e2f1594b Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Thu, 7 May 2009 18:05:29 +0000 Subject: [PATCH] - Pass IDataObject to the folder shell extension init function - Fixes displaying property sheet handler extension for directories such as TortoiseSVN svn path=/trunk/; revision=40828 --- reactos/dll/win32/shell32/folder_options.c | 28 +++++++++++++++------- reactos/dll/win32/shell32/fprop.c | 2 +- reactos/dll/win32/shell32/shell32_main.h | 2 +- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/reactos/dll/win32/shell32/folder_options.c b/reactos/dll/win32/shell32/folder_options.c index 3d996faf4ec..86dadaa18f0 100644 --- a/reactos/dll/win32/shell32/folder_options.c +++ b/reactos/dll/win32/shell32/folder_options.c @@ -83,6 +83,7 @@ static FOLDER_VIEW_ENTRY s_Options[] = }; */ +HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface, IDataObject *pDataObj); INT_PTR CALLBACK @@ -562,15 +563,16 @@ FolderAddPropSheetPageProc(HPROPSHEETPAGE hpage, LPARAM lParam) } BOOL -SH_ShowFolderProperties(LPWSTR pwszFolder) +SH_ShowFolderProperties(LPWSTR pwszFolder, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST * apidl) { HPROPSHEETPAGE hppages[MAX_PROPERTY_SHEET_PAGE]; HPROPSHEETPAGE hpage; PROPSHEETHEADERW psh; BOOL ret; WCHAR szName[MAX_PATH] = {0}; - HPSXA hpsx; + HPSXA hpsx = NULL; LPWSTR pFolderName; + IDataObject * pDataObj = NULL; if (!PathIsDirectoryW(pwszFolder)) return FALSE; @@ -594,15 +596,25 @@ SH_ShowFolderProperties(LPWSTR pwszFolder) psh.u3.phpage = hppages; psh.pszCaption = szName; - hpsx = SHCreatePropSheetExtArray(HKEY_CLASSES_ROOT, - L"Directory", - MAX_PROPERTY_SHEET_PAGE-1); - SHAddFromPropSheetExtArray(hpsx, - (LPFNADDPROPSHEETPAGE)FolderAddPropSheetPageProc, - (LPARAM)&psh); + if (SHCreateDataObject(pidlFolder, 1, apidl, NULL, &IID_IDataObject, (void**)&pDataObj) == S_OK) + { + hpsx = SHCreatePropSheetExtArrayEx(HKEY_CLASSES_ROOT, L"Directory", MAX_PROPERTY_SHEET_PAGE-1, pDataObj); + if (hpsx) + { + SHAddFromPropSheetExtArray(hpsx, + (LPFNADDPROPSHEETPAGE)FolderAddPropSheetPageProc, + (LPARAM)&psh); + } + } ret = PropertySheetW(&psh); + if (pDataObj) + IDataObject_Release(pDataObj); + + if (hpsx) + SHDestroyPropSheetExtArray(hpsx); + if (ret < 0) return FALSE; else diff --git a/reactos/dll/win32/shell32/fprop.c b/reactos/dll/win32/shell32/fprop.c index ae5f57549fa..e3f158c8db5 100644 --- a/reactos/dll/win32/shell32/fprop.c +++ b/reactos/dll/win32/shell32/fprop.c @@ -807,7 +807,7 @@ SH_ShowPropertiesDialog(WCHAR *lpf, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST *api if (PathIsDirectoryW(wFileName)) { - return SH_ShowFolderProperties(wFileName); + return SH_ShowFolderProperties(wFileName, pidlFolder, apidl); } if (wcslen(wFileName) == 3) diff --git a/reactos/dll/win32/shell32/shell32_main.h b/reactos/dll/win32/shell32/shell32_main.h index 53778370eeb..6f666202733 100644 --- a/reactos/dll/win32/shell32/shell32_main.h +++ b/reactos/dll/win32/shell32/shell32_main.h @@ -235,5 +235,5 @@ HPROPSHEETPAGE SH_CreatePropertySheetPage(LPSTR resname, DLGPROC dlgproc, LPARAM BOOL SH_ShowDriveProperties(WCHAR * drive, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST * apidl); BOOL SH_ShowRecycleBinProperties(WCHAR sDrive); BOOL SH_ShowPropertiesDialog(LPWSTR lpf, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST * apidl); -BOOL SH_ShowFolderProperties(LPWSTR pwszFolder); +BOOL SH_ShowFolderProperties(LPWSTR pwszFolder, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST * apidl); #endif