mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 09:50:07 +00:00
- Do not pass SHGDN_INFOLDER flag
- Implement IPersistFolder2 for control panel shell folder - Replace _InsertMenuItem with unicode - Pass the pidl of shellfolder and selected drive to SH_ShowDriveProperties to construct a valid IDataObject which is passed to drive PropertySheet handlers - Release HPSX array only if it was constructed - Optimize AddShellPropSheetExCallback for file property dialog - Pass the pidl of the parent shell folder and selected item to SH_ShowPropertiesDialog and construct a IDataObject from it - Check for success for created IDataObject and HPSX array - Add a lot of buffer checks for the OpenNew shell extension - Pass the full filename of the item from Admin Tools shellfolder when IShellFolder_GetDisplayNameOf is called with SHGDN_FORPARSING - Implement initializing the AdminTools folder - Implement IShellFolder_SetNameOf for the desktop shell folder to support renaming desktop items and sub folders - Implement ISFHelper interface for desktop shell folder to support deleting with backspace key and fixes the new item shell service for items and directories - Implement hiding (deleting) shell extensions from desktop - Display a messagebox if shell extensions should be really deleted - Fix the IShellFolder_GetAttributesOf for the Mycomputer shell folder - Implement changing drive name with rename verb using IShellFolder_SetNameOf (MyComputer) - Implement Initializing the MyComputer shell folder properly - Fix Shellfolder attributes for MyDocuments shell folder - Fix Shellfolder attributes for Netplaces shell folder - Implement Initializing the Netplaces shell folder properly - Remove the 'properties' and 'open' verb from recycle bin shell folder, these verbs are statically generated - Directories cannot have the link attribute - Implement IShellExtInit interface for the new item shell service - Implement the default context menu based on the existing item context menu and background context menu and delete old implementation - Implement copy&paste of files and directories - Implement creating links to files - Check if a dynamic shell extension has already been loaded - Free static / dynamic shell extensions on release svn path=/trunk/; revision=35476
This commit is contained in:
parent
6d22ab5923
commit
e577021a2b
|
@ -78,7 +78,7 @@ typedef struct
|
|||
static const IAutoCompleteVtbl acvt;
|
||||
static const IAutoComplete2Vtbl ac2vt;
|
||||
|
||||
static inline IAutoCompleteImpl *impl_from_IAutoComplete2( IAutoComplete2 *iface )
|
||||
static IAutoCompleteImpl * impl_from_IAutoComplete2( IAutoComplete2 *iface )
|
||||
{
|
||||
return (IAutoCompleteImpl *)((char*)iface - FIELD_OFFSET(IAutoCompleteImpl, lpvtblAutoComplete2));
|
||||
}
|
||||
|
|
|
@ -703,7 +703,7 @@ static HRESULT WINAPI ISF_ControlPanel_fnGetDisplayNameOf(IShellFolder2 * iface,
|
|||
len = lstrlenW(wszPath);
|
||||
|
||||
if (!SUCCEEDED
|
||||
(SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags | SHGDN_INFOLDER, wszPath + len, MAX_PATH + 1 - len)))
|
||||
(SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags, wszPath + len, MAX_PATH + 1 - len)))
|
||||
return E_OUTOFMEMORY;
|
||||
if (!WideCharToMultiByte(CP_ACP, 0, wszPath, -1, szPath, MAX_PATH, NULL, NULL))
|
||||
wszPath[0] = '\0';
|
||||
|
@ -907,8 +907,11 @@ static HRESULT WINAPI ICPanel_PersistFolder2_GetClassID(IPersistFolder2 * iface,
|
|||
static HRESULT WINAPI ICPanel_PersistFolder2_Initialize(IPersistFolder2 * iface, LPCITEMIDLIST pidl)
|
||||
{
|
||||
ICPanelImpl *This = impl_from_IPersistFolder2(iface);
|
||||
TRACE("(%p)->(%p)\n", This, pidl);
|
||||
return E_NOTIMPL;
|
||||
if (This->pidlRoot)
|
||||
SHFree((LPVOID)This->pidlRoot);
|
||||
|
||||
This->pidlRoot = ILClone(pidl);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -1222,7 +1225,7 @@ static HRESULT WINAPI ICPanel_IContextMenu2_QueryContextMenu(
|
|||
UINT idCmdLast,
|
||||
UINT uFlags)
|
||||
{
|
||||
char szBuffer[30] = {0};
|
||||
WCHAR szBuffer[30] = {0};
|
||||
ULONG Count = 1;
|
||||
|
||||
ICPanelImpl *This = impl_from_IContextMenu(iface);
|
||||
|
@ -1230,22 +1233,22 @@ static HRESULT WINAPI ICPanel_IContextMenu2_QueryContextMenu(
|
|||
TRACE("(%p)->(hmenu=%p indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n",
|
||||
This, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
|
||||
|
||||
if (LoadStringA(shell32_hInstance, IDS_OPEN, szBuffer, sizeof(szBuffer)/sizeof(char)))
|
||||
if (LoadStringW(shell32_hInstance, IDS_OPEN, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
|
||||
{
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(char))-1] = L'\0';
|
||||
_InsertMenuItem(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_DEFAULT);
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
|
||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_DEFAULT);
|
||||
Count++;
|
||||
}
|
||||
|
||||
if (LoadStringA(shell32_hInstance, IDS_CREATELINK, szBuffer, sizeof(szBuffer)/sizeof(char)))
|
||||
if (LoadStringW(shell32_hInstance, IDS_CREATELINK, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
|
||||
{
|
||||
if (Count)
|
||||
{
|
||||
_InsertMenuItem(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
}
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(char))-1] = L'\0';
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
|
||||
|
||||
_InsertMenuItem(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_ENABLED);
|
||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_ENABLED);
|
||||
Count++;
|
||||
}
|
||||
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, Count);
|
||||
|
|
|
@ -244,6 +244,7 @@ INT_PTR CALLBACK PickIconProc(HWND hwndDlg,
|
|||
DI_NORMAL);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#define NTOS_MODE_USER
|
||||
#define UNICODE
|
||||
#define _UNICODE
|
||||
#define COBJMACROS
|
||||
#include <windows.h>
|
||||
#include <ndk/ntndk.h>
|
||||
|
||||
|
@ -121,7 +122,7 @@ typedef struct
|
|||
|
||||
BOOL InitializeFmifsLibrary(PFORMAT_DRIVE_CONTEXT pContext);
|
||||
BOOL GetDefaultClusterSize(LPWSTR szFs, PDWORD pClusterSize, PULARGE_INTEGER TotalNumberOfBytes);
|
||||
|
||||
HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface, IDataObject *pDataObj);
|
||||
HWND WINAPI
|
||||
DeviceCreateHardwarePageEx(HWND hWndParent,
|
||||
LPGUID lpGuids,
|
||||
|
@ -667,7 +668,7 @@ struct
|
|||
{ "DRIVE_HARDWARE_DLG", DriveHardwareDlg },
|
||||
};
|
||||
|
||||
BOOL
|
||||
HRESULT
|
||||
CALLBACK
|
||||
AddPropSheetPageProc(HPROPSHEETPAGE hpage, LPARAM lParam)
|
||||
{
|
||||
|
@ -681,15 +682,16 @@ AddPropSheetPageProc(HPROPSHEETPAGE hpage, LPARAM lParam)
|
|||
}
|
||||
|
||||
BOOL
|
||||
SH_ShowDriveProperties(WCHAR * drive)
|
||||
SH_ShowDriveProperties(WCHAR * drive, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST * apidl)
|
||||
{
|
||||
HPSXA hpsx;
|
||||
HPSXA hpsx = NULL;
|
||||
HPROPSHEETPAGE hpsp[MAX_PROPERTY_SHEET_PAGE];
|
||||
PROPSHEETHEADERW psh;
|
||||
BOOL ret;
|
||||
UINT i;
|
||||
WCHAR szName[MAX_PATH];
|
||||
DWORD dwMaxComponent, dwFileSysFlags;
|
||||
IDataObject * pDataObj = NULL;
|
||||
|
||||
ZeroMemory(&psh, sizeof(PROPSHEETHEADERW));
|
||||
psh.dwSize = sizeof(PROPSHEETHEADERW);
|
||||
|
@ -721,7 +723,6 @@ SH_ShowDriveProperties(WCHAR * drive)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < DRIVE_PROPERTY_PAGES; i++)
|
||||
{
|
||||
HPROPSHEETPAGE hprop = SH_CreatePropertySheetPage(PropPages[i].resname, PropPages[i].dlgproc, (LPARAM)drive, NULL);
|
||||
|
@ -731,16 +732,22 @@ SH_ShowDriveProperties(WCHAR * drive)
|
|||
psh.nPages++;
|
||||
}
|
||||
}
|
||||
|
||||
hpsx = SHCreatePropSheetExtArray(HKEY_CLASSES_ROOT,
|
||||
L"Drive",
|
||||
MAX_PROPERTY_SHEET_PAGE-DRIVE_PROPERTY_PAGES);
|
||||
|
||||
SHAddFromPropSheetExtArray(hpsx,
|
||||
(LPFNADDPROPSHEETPAGE)AddPropSheetPageProc,
|
||||
(LPARAM)&psh);
|
||||
if (SHCreateDataObject(pidlFolder, 1, apidl, NULL, &IID_IDataObject, (void**)&pDataObj) == S_OK)
|
||||
{
|
||||
hpsx = SHCreatePropSheetExtArrayEx(HKEY_CLASSES_ROOT, L"Drive", MAX_PROPERTY_SHEET_PAGE-DRIVE_PROPERTY_PAGES, pDataObj);
|
||||
if (hpsx)
|
||||
{
|
||||
SHAddFromPropSheetExtArray(hpsx, (LPFNADDPROPSHEETPAGE)AddPropSheetPageProc, (LPARAM)&psh);
|
||||
}
|
||||
}
|
||||
|
||||
ret = PropertySheetW(&psh);
|
||||
if (pDataObj)
|
||||
IDataObject_Release(pDataObj);
|
||||
|
||||
if (hpsx)
|
||||
SHDestroyPropSheetExtArray(hpsx);
|
||||
|
||||
if (ret < 0)
|
||||
return FALSE;
|
||||
else
|
||||
|
|
|
@ -60,6 +60,48 @@ typedef struct
|
|||
WCHAR szFolderPath[MAX_PATH];
|
||||
}FOLDER_PROPERTIES_CONTEXT, *PFOLDER_PROPERTIES_CONTEXT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LPCWSTR szKeyName;
|
||||
UINT ResourceID;
|
||||
}FOLDER_VIEW_ENTRY, PFOLDER_VIEW_ENTRY;
|
||||
/*
|
||||
static FOLDER_VIEW_ENTRY s_Options[] =
|
||||
{
|
||||
{ L"AlwaysShowMenus", IDS_ALWAYSSHOWMENUS },
|
||||
{ L"AutoCheckSelect", -1 },
|
||||
{ L"ClassicViewState", -1 },
|
||||
{ L"DontPrettyPath", -1 },
|
||||
{ L"Filter", -1 },
|
||||
{ L"FolderContentsInfoTip", IDS_FOLDERCONTENTSTIP },
|
||||
{ L"FriendlyTree", -1 },
|
||||
{ L"Hidden", -1, },
|
||||
{ L"HideFileExt", IDS_HIDEFILEEXT },
|
||||
{ L"HideIcons", -1},
|
||||
{ L"IconsOnly", -1},
|
||||
{ L"ListviewAlphaSelect", -1},
|
||||
{ L"ListviewShadow", -1},
|
||||
{ L"ListviewWatermark", -1},
|
||||
{ L"MapNetDrvBtn", -1},
|
||||
{ L"PersistBrowsers", -1},
|
||||
{ L"SeperateProcess", IDS_SEPERATEPROCESS},
|
||||
{ L"ServerAdminUI", -1},
|
||||
{ L"SharingWizardOn", IDS_USESHAREWIZARD},
|
||||
{ L"ShowCompColor", IDS_COMPCOLOR},
|
||||
{ L"ShowInfoTip", IDS_SHOWINFOTIP},
|
||||
{ L"ShowPreviewHandlers", -1},
|
||||
{ L"ShowSuperHidden", IDS_HIDEOSFILES},
|
||||
{ L"ShowTypeOverlay", -1},
|
||||
{ L"Start_ShowMyGames", -1},
|
||||
{ L"StartMenuInit", -1},
|
||||
{ L"SuperHidden", -1},
|
||||
{ L"TypeAhead", -1},
|
||||
{ L"Webview", -1},
|
||||
{ NULL, -1}
|
||||
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
INT_PTR
|
||||
CALLBACK
|
||||
|
@ -76,6 +118,35 @@ FolderOptionsGeneralDlg(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static
|
||||
VOID
|
||||
InitializeFolderOptionsListCtrl(HWND hwndDlg)
|
||||
{
|
||||
RECT clientRect;
|
||||
LVCOLUMNW col;
|
||||
WCHAR szName[50];
|
||||
HWND hDlgCtrl;
|
||||
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, 14003);
|
||||
|
||||
if (!LoadStringW(shell32_hInstance, IDS_COLUMN_EXTENSION, szName, sizeof(szName) / sizeof(WCHAR)))
|
||||
szName[0] = 0;
|
||||
szName[(sizeof(szName)/sizeof(WCHAR))-1] = 0;
|
||||
|
||||
GetClientRect(hDlgCtrl, &clientRect);
|
||||
ZeroMemory(&col, sizeof(LV_COLUMN));
|
||||
col.mask = LVCF_SUBITEM | LVCF_WIDTH | LVCF_FMT;
|
||||
col.iSubItem = 0;
|
||||
col.pszText = szName;
|
||||
col.fmt = LVCFMT_LEFT;
|
||||
col.cx = (clientRect.right - clientRect.left) - GetSystemMetrics(SM_CXVSCROLL);
|
||||
(void)ListView_InsertColumnW(hDlgCtrl, 0, &col);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
INT_PTR
|
||||
CALLBACK
|
||||
FolderOptionsViewDlg(
|
||||
|
@ -85,10 +156,15 @@ FolderOptionsViewDlg(
|
|||
LPARAM lParam
|
||||
)
|
||||
{
|
||||
|
||||
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
InitializeFolderOptionsListCtrl(hwndDlg);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
|
@ -173,12 +249,9 @@ InitializeFileTypesListCtrl(HWND hwndDlg)
|
|||
DWORD dwName;
|
||||
INT iItem = 0;
|
||||
|
||||
|
||||
hDlgCtrl = GetDlgItem(hwndDlg, 14000);
|
||||
InitializeFileTypesListCtrlColumns(hDlgCtrl);
|
||||
|
||||
|
||||
|
||||
dwName = sizeof(szName) / sizeof(WCHAR);
|
||||
|
||||
while(RegEnumKeyExW(HKEY_CLASSES_ROOT, dwIndex++, szName, &dwName, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
|
||||
|
@ -206,7 +279,6 @@ FolderOptionsFileTypesDlg(
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -650,24 +650,19 @@ SH_FileGeneralDlgProc(
|
|||
|
||||
BOOL CALLBACK AddShellPropSheetExCallback(HPROPSHEETPAGE hPage, LPARAM lParam)
|
||||
{
|
||||
UINT iIndex;
|
||||
HPROPSHEETPAGE * hppages = (HPROPSHEETPAGE *)lParam;
|
||||
PROPSHEETHEADERW *pinfo = (PROPSHEETHEADERW *)lParam;
|
||||
|
||||
TRACE("AddShellPropSheetExCallback called\n");
|
||||
for(iIndex = 0; iIndex < MAX_PROPERTY_SHEET_PAGE; iIndex++)
|
||||
if (pinfo->nPages < MAX_PROPERTY_SHEET_PAGE)
|
||||
{
|
||||
if (hppages[iIndex] == NULL)
|
||||
{
|
||||
hppages[iIndex] = hPage;
|
||||
return TRUE;
|
||||
}
|
||||
pinfo->u3.phpage[pinfo->nPages++] = hPage;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
EnumPropSheetExt(LPWSTR wFileName, HPROPSHEETPAGE * hppages, int NumPages, HPSXA * hpsxa, IDataObject *pDataObj)
|
||||
EnumPropSheetExt(LPWSTR wFileName, PROPSHEETHEADERW *pinfo, int NumPages, HPSXA * hpsxa, IDataObject *pDataObj)
|
||||
{
|
||||
WCHAR szName[100];
|
||||
WCHAR * pOffset;
|
||||
|
@ -702,7 +697,7 @@ EnumPropSheetExt(LPWSTR wFileName, HPROPSHEETPAGE * hppages, int NumPages, HPSXA
|
|||
}
|
||||
TRACE("EnumPropSheetExt szName %s\n", debugstr_w(szName));
|
||||
hpsxa[0] = SHCreatePropSheetExtArrayEx(HKEY_CLASSES_ROOT, szName, NumPages, pDataObj);
|
||||
Pages = SHAddFromPropSheetExtArray(hpsxa[0], AddShellPropSheetExCallback, (LPARAM)hppages);
|
||||
Pages = SHAddFromPropSheetExtArray(hpsxa[0], AddShellPropSheetExCallback, (LPARAM)pinfo);
|
||||
|
||||
|
||||
if (pOffset)
|
||||
|
@ -714,7 +709,7 @@ EnumPropSheetExt(LPWSTR wFileName, HPROPSHEETPAGE * hppages, int NumPages, HPSXA
|
|||
TRACE("EnumPropSheetExt szName %s, pOffset %s\n", debugstr_w(szName), debugstr_w(pOffset));
|
||||
szName[(sizeof(szName)/sizeof(WCHAR))-1] = L'\0';
|
||||
hpsxa[1] = SHCreatePropSheetExtArrayEx(HKEY_CLASSES_ROOT, szName, NumPages - Pages, pDataObj);
|
||||
Pages +=SHAddFromPropSheetExtArray(hpsxa[1], AddShellPropSheetExCallback, (LPARAM)hppages);
|
||||
Pages +=SHAddFromPropSheetExtArray(hpsxa[1], AddShellPropSheetExCallback, (LPARAM)pinfo);
|
||||
}
|
||||
}
|
||||
return Pages;
|
||||
|
@ -735,19 +730,15 @@ EnumPropSheetExt(LPWSTR wFileName, HPROPSHEETPAGE * hppages, int NumPages, HPSXA
|
|||
*/
|
||||
|
||||
BOOL
|
||||
SH_ShowPropertiesDialog(PCWSTR lpf)
|
||||
SH_ShowPropertiesDialog(WCHAR * lpf, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST * apidl)
|
||||
{
|
||||
PROPSHEETHEADERW pinfo;
|
||||
HPROPSHEETPAGE hppages[MAX_PROPERTY_SHEET_PAGE];
|
||||
HPROPSHEETPAGE hpage;
|
||||
WCHAR wFileName[MAX_PATH];
|
||||
UINT num_pages = 0;
|
||||
DWORD dwHandle = 0;
|
||||
WCHAR * pFileName;
|
||||
HPSXA hpsxa[2];
|
||||
INT_PTR res;
|
||||
LPITEMIDLIST pidlChild, pidlFolder;
|
||||
WCHAR szTemp[MAX_PATH];
|
||||
IDataObject* pDataObj = NULL;
|
||||
HRESULT hResult;
|
||||
|
||||
|
@ -783,45 +774,9 @@ SH_ShowPropertiesDialog(PCWSTR lpf)
|
|||
|
||||
if (wcslen(wFileName) == 3)
|
||||
{
|
||||
return SH_ShowDriveProperties(wFileName);
|
||||
return SH_ShowDriveProperties(wFileName, pidlFolder, apidl);
|
||||
}
|
||||
|
||||
wcscpy(szTemp, wFileName);
|
||||
pFileName = wcsrchr(szTemp, '\\');
|
||||
if (pFileName)
|
||||
{
|
||||
pFileName[0] = L'\0';
|
||||
pFileName++;
|
||||
pidlChild = ILCreateFromPathW(pFileName);
|
||||
pidlFolder = ILCreateFromPathW(szTemp);
|
||||
if (pidlChild && pidlFolder)
|
||||
{
|
||||
hResult = SHCreateDataObject(pidlFolder, 1, (LPCITEMIDLIST*)&pidlChild, NULL, &IID_IDataObject, (LPVOID*)&pDataObj);
|
||||
ILFree(pidlChild);
|
||||
ILFree(pidlFolder);
|
||||
if (hResult != S_OK)
|
||||
pDataObj = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
hpage = SH_CreatePropertySheetPage("SHELL_FILE_GENERAL_DLG", SH_FileGeneralDlgProc, (LPARAM)wFileName, NULL);
|
||||
|
||||
if (hpage == NULL)
|
||||
return FALSE;
|
||||
|
||||
hppages[num_pages] = hpage;
|
||||
num_pages++;
|
||||
num_pages += EnumPropSheetExt(wFileName, hppages, MAX_PROPERTY_SHEET_PAGE-1, hpsxa, pDataObj);
|
||||
|
||||
if ( GetFileVersionInfoSizeW(lpf, &dwHandle) && num_pages)
|
||||
{
|
||||
if ( (hpage = SH_CreatePropertySheetPage("SHELL_FILE_VERSION_DLG",SH_FileVersionDlgProc, (LPARAM)wFileName, NULL))!= NULL)
|
||||
{
|
||||
hppages[num_pages] = hpage;
|
||||
num_pages++;
|
||||
}
|
||||
}
|
||||
|
||||
pFileName = wcsrchr(wFileName, '\\');
|
||||
if (!pFileName)
|
||||
|
@ -833,17 +788,35 @@ SH_ShowPropertiesDialog(PCWSTR lpf)
|
|||
memset(&pinfo, 0x0, sizeof(PROPSHEETHEADERW));
|
||||
pinfo.dwSize = sizeof(PROPSHEETHEADERW);
|
||||
pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE;
|
||||
pinfo.nPages = num_pages;
|
||||
pinfo.u3.phpage = hppages;
|
||||
pinfo.pszCaption = pFileName;
|
||||
|
||||
TRACE("SH_ShowPropertiesDialog pages %u\n", num_pages);
|
||||
hppages[pinfo.nPages] = SH_CreatePropertySheetPage("SHELL_FILE_GENERAL_DLG", SH_FileGeneralDlgProc, (LPARAM)wFileName, NULL);
|
||||
if (hppages[pinfo.nPages])
|
||||
pinfo.nPages++;
|
||||
|
||||
|
||||
hResult = SHCreateDataObject(pidlFolder, 1, apidl, NULL, &IID_IDataObject, (LPVOID*)&pDataObj);
|
||||
if (hResult == S_OK)
|
||||
{
|
||||
EnumPropSheetExt(wFileName, &pinfo, MAX_PROPERTY_SHEET_PAGE-1, hpsxa, pDataObj);
|
||||
}
|
||||
|
||||
if ( GetFileVersionInfoSizeW(lpf, &dwHandle))
|
||||
{
|
||||
hppages[pinfo.nPages] = SH_CreatePropertySheetPage("SHELL_FILE_VERSION_DLG",SH_FileVersionDlgProc, (LPARAM)wFileName, NULL);
|
||||
if (hppages[pinfo.nPages])
|
||||
pinfo.nPages++;
|
||||
}
|
||||
|
||||
res = PropertySheetW(&pinfo);
|
||||
|
||||
SHDestroyPropSheetExtArray(hpsxa[0]);
|
||||
SHDestroyPropSheetExtArray(hpsxa[1]);
|
||||
if (pDataObj)
|
||||
if (hResult == S_OK)
|
||||
{
|
||||
SHDestroyPropSheetExtArray(hpsxa[0]);
|
||||
SHDestroyPropSheetExtArray(hpsxa[1]);
|
||||
IDataObject_Release(pDataObj);
|
||||
}
|
||||
|
||||
return (res != -1);
|
||||
}
|
||||
|
|
|
@ -1382,6 +1382,22 @@ LPITEMIDLIST _ILCreateIExplore(void)
|
|||
|
||||
LPITEMIDLIST _ILCreateControlPanel(void)
|
||||
{
|
||||
TRACE("()\n");
|
||||
LPITEMIDLIST parent = _ILCreateGuid(PT_GUID, &CLSID_MyComputer), ret = NULL;
|
||||
|
||||
if (parent)
|
||||
{
|
||||
LPITEMIDLIST printers = _ILCreateGuid(PT_YAGUID, &CLSID_ControlPanel);
|
||||
|
||||
if (printers)
|
||||
{
|
||||
ret = ILCombine(parent, printers);
|
||||
SHFree(printers);
|
||||
}
|
||||
SHFree(parent);
|
||||
}
|
||||
return ret;
|
||||
|
||||
return _ILCreateGuid(PT_SHELLEXT, &CLSID_ControlPanel);
|
||||
}
|
||||
|
||||
|
|
|
@ -143,8 +143,8 @@ HRESULT WINAPI SHEOW_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv)
|
|||
SHEOWImpl * ow;
|
||||
HRESULT res;
|
||||
|
||||
ow = LocalAlloc(LMEM_ZEROINIT, sizeof(SHEOWImpl));
|
||||
if (!ow)
|
||||
ow = LocalAlloc(LMEM_ZEROINIT, sizeof(SHEOWImpl));
|
||||
if (!ow)
|
||||
{
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
@ -241,6 +241,8 @@ AddItem(HMENU hMenu, UINT idCmdFirst)
|
|||
if (!LoadStringW(shell32_hInstance, IDS_OPEN_WITH_CHOOSE, szBuffer, sizeof(szBuffer) / sizeof(WCHAR)))
|
||||
wcscpy(szBuffer, szChoose);
|
||||
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
|
||||
|
||||
mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
|
||||
mii.fType = MFT_STRING;
|
||||
mii.fState = MFS_ENABLED;
|
||||
|
@ -279,6 +281,7 @@ LoadOWItems(POPEN_WITH_CONTEXT pContext, WCHAR * szName)
|
|||
szPath[0] = 0;
|
||||
if (RegGetValueW(HKEY_CLASSES_ROOT, szExt, NULL, RRF_RT_REG_SZ, NULL, szPath, &dwPath) == ERROR_SUCCESS)
|
||||
{
|
||||
szPath[(sizeof(szPath)/sizeof(WCHAR))-1] = L'\0';
|
||||
LoadItemFromHKCR(pContext, szPath);
|
||||
}
|
||||
}
|
||||
|
@ -294,17 +297,18 @@ static HRESULT WINAPI SHEOWCm_fnQueryContextMenu(
|
|||
UINT uFlags)
|
||||
{
|
||||
MENUITEMINFOW mii;
|
||||
WCHAR szBuffer[100];
|
||||
WCHAR szBuffer[100] = {0};
|
||||
INT pos;
|
||||
HMENU hSubMenu = NULL;
|
||||
OPEN_WITH_CONTEXT Context;
|
||||
SHEOWImpl *This = impl_from_IContextMenu(iface);
|
||||
|
||||
if (LoadStringW(shell32_hInstance, IDS_OPEN_WITH, szBuffer, 100) < 0)
|
||||
if (LoadStringW(shell32_hInstance, IDS_OPEN_WITH, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)) < 0)
|
||||
{
|
||||
TRACE("failed to load string\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
|
||||
|
||||
hSubMenu = CreatePopupMenu();
|
||||
|
||||
|
@ -383,12 +387,16 @@ FreeListItems(HWND hwndDlg)
|
|||
|
||||
BOOL HideApplicationFromList(WCHAR * pFileName)
|
||||
{
|
||||
WCHAR szBuffer[100];
|
||||
WCHAR szBuffer[100] = {'A','p','p','l','i','c','a','t','i','o','n','s','\\',0};
|
||||
DWORD dwSize = 0;
|
||||
LONG result;
|
||||
|
||||
wcscpy(szBuffer, L"Applications\\");
|
||||
wcscat(szBuffer, pFileName);
|
||||
if (wcslen(pFileName) > (sizeof(szBuffer)/sizeof(WCHAR)) - 14)
|
||||
{
|
||||
ERR("insufficient buffer\n");
|
||||
return FALSE;
|
||||
}
|
||||
wcscpy(&szBuffer[13], pFileName);
|
||||
|
||||
result = RegGetValueW(HKEY_CLASSES_ROOT, szBuffer, L"NoOpenWith", RRF_RT_REG_SZ, NULL, NULL, &dwSize);
|
||||
|
||||
|
@ -405,11 +413,17 @@ WriteStaticShellExtensionKey(HKEY hRootKey, WCHAR * pVerb, WCHAR *pFullPath)
|
|||
{
|
||||
HKEY hShell;
|
||||
LONG result;
|
||||
WCHAR szBuffer[MAX_PATH+10];
|
||||
WCHAR szBuffer[MAX_PATH+10] = {'s','h','e','l','l','\\', 0 };
|
||||
|
||||
if (wcslen(pVerb) > (sizeof(szBuffer)/sizeof(WCHAR)) - 15 ||
|
||||
wcslen(pFullPath) > (sizeof(szBuffer)/sizeof(WCHAR)) - 4)
|
||||
{
|
||||
ERR("insufficient buffer\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* construct verb reg path */
|
||||
wcscpy(szBuffer, L"shell\\");
|
||||
wcscat(szBuffer, pVerb);
|
||||
wcscpy(&szBuffer[6], pVerb);
|
||||
wcscat(szBuffer, L"\\command");
|
||||
|
||||
/* create verb reg key */
|
||||
|
@ -427,7 +441,7 @@ WriteStaticShellExtensionKey(HKEY hRootKey, WCHAR * pVerb, WCHAR *pFullPath)
|
|||
VOID
|
||||
StoreNewSettings(WCHAR * szFileName, WCHAR *szAppName)
|
||||
{
|
||||
WCHAR szBuffer[100];
|
||||
WCHAR szBuffer[100] = { L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\"};
|
||||
WCHAR * pFileExt;
|
||||
HKEY hKey;
|
||||
LONG result;
|
||||
|
@ -435,9 +449,12 @@ StoreNewSettings(WCHAR * szFileName, WCHAR *szAppName)
|
|||
|
||||
/* get file extension */
|
||||
pFileExt = wcsrchr(szFileName, L'.');
|
||||
wcscpy(szBuffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\");
|
||||
wcscat(szBuffer, pFileExt);
|
||||
|
||||
if (wcslen(pFileExt) > (sizeof(szBuffer)/sizeof(WCHAR)) - 60)
|
||||
{
|
||||
ERR("insufficient buffer\n");
|
||||
return;
|
||||
}
|
||||
wcscpy(&szBuffer[60], pFileExt);
|
||||
/* open base key for this file extension */
|
||||
if (RegCreateKeyExW(HKEY_CURRENT_USER, szBuffer, 0, NULL, 0, KEY_WRITE | KEY_READ, NULL, &hKey, NULL) != ERROR_SUCCESS)
|
||||
return;
|
||||
|
@ -464,7 +481,7 @@ VOID
|
|||
SetProgrammAsDefaultHandler(WCHAR * szFileName, WCHAR * szAppName)
|
||||
{
|
||||
HKEY hKey;
|
||||
HKEY hAppKey;
|
||||
HKEY hAppKey;
|
||||
DWORD dwDisposition;
|
||||
WCHAR szBuffer[100];
|
||||
DWORD dwSize;
|
||||
|
@ -541,18 +558,17 @@ SetProgrammAsDefaultHandler(WCHAR * szFileName, WCHAR * szAppName)
|
|||
void
|
||||
BrowseForApplication(HWND hwndDlg)
|
||||
{
|
||||
WCHAR szBuffer[30];
|
||||
WCHAR szFilter[30];
|
||||
WCHAR szBuffer[30] = {0};
|
||||
WCHAR szFilter[30] = {0};
|
||||
WCHAR szPath[MAX_PATH];
|
||||
OPENFILENAMEW ofn;
|
||||
OPEN_WITH_CONTEXT Context;
|
||||
INT count;
|
||||
|
||||
/* load resource open with */
|
||||
szBuffer[0] = 0;
|
||||
if (LoadStringW(shell32_hInstance, IDS_OPEN_WITH, szBuffer, sizeof(szBuffer) / sizeof(WCHAR)))
|
||||
{
|
||||
szBuffer[99] = 0;
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
|
||||
ofn.lpstrTitle = szBuffer;
|
||||
ofn.nMaxFileTitle = strlenW(szBuffer);
|
||||
}
|
||||
|
@ -565,10 +581,9 @@ BrowseForApplication(HWND hwndDlg)
|
|||
ofn.lpstrFile = szPath;
|
||||
|
||||
/* load the filter resource string */
|
||||
szFilter[0] = 0;
|
||||
if (LoadStringW(shell32_hInstance, IDS_OPEN_WITH_FILTER, szFilter, sizeof(szFilter) / sizeof(WCHAR)))
|
||||
{
|
||||
szFilter[99] = 0;
|
||||
szFilter[(sizeof(szFilter)/sizeof(WCHAR))-1] = 0;
|
||||
ofn.lpstrFilter = szFilter;
|
||||
}
|
||||
ZeroMemory(szPath, sizeof(szPath));
|
||||
|
@ -658,12 +673,16 @@ static BOOL CALLBACK OpenWithProgrammDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
{
|
||||
szBuffer[0] = L'\0';
|
||||
SendDlgItemMessageA(hwndDlg, 14001, WM_GETTEXT, sizeof(szBuffer), (LPARAM)szBuffer);
|
||||
strcat((char*)szBuffer, poainfo->pcszFile);
|
||||
index = strlen((char*)szBuffer);
|
||||
if (index + strlen(poainfo->pcszFile) + 1 < sizeof(szBuffer))
|
||||
strcat((char*)szBuffer, poainfo->pcszFile);
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
|
||||
SendDlgItemMessageA(hwndDlg, 14001, WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||
}
|
||||
if (MultiByteToWideChar(CP_ACP, 0,poainfo->pcszFile, -1, szBuffer, MAX_PATH))
|
||||
{
|
||||
OPEN_WITH_CONTEXT Context;
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
|
||||
ZeroMemory(&Context, sizeof(OPEN_WITH_CONTEXT));
|
||||
Context.hDlgCtrl = GetDlgItem(hwndDlg, 14002);
|
||||
LoadOWItems(&Context, szBuffer);
|
||||
|
@ -1231,7 +1250,7 @@ SHEOW_LoadOpenWithItems(SHEOWImpl *This, IDataObject *pdtobj)
|
|||
return E_OUTOFMEMORY;
|
||||
}
|
||||
if (_ILIsDesktop(pidl_child) || _ILIsMyDocuments(pidl_child) || _ILIsControlPanel(pidl_child) || _ILIsNetHood(pidl_child) ||
|
||||
_ILIsBitBucket(pidl_child) || _ILIsDrive(pidl_child) || _ILIsCPanelStruct(pidl_child) || _ILIsFolder(pidl_child))
|
||||
_ILIsBitBucket(pidl_child) || _ILIsDrive(pidl_child) || _ILIsCPanelStruct(pidl_child) || _ILIsFolder(pidl_child) || _ILIsControlPanel(pidl_folder))
|
||||
{
|
||||
TRACE("pidl is a folder\n");
|
||||
SHFree((void*)pidl);
|
||||
|
|
|
@ -65,8 +65,7 @@
|
|||
<file>shlmenu.c</file>
|
||||
<file>shlview.c</file>
|
||||
<file>shpolicy.c</file>
|
||||
<file>shv_bg_cmenu.c</file>
|
||||
<file>shv_item_cmenu.c</file>
|
||||
<file>shv_def_cmenu.c</file>
|
||||
<file>startmenu.c</file>
|
||||
<file>ros-systray.c</file>
|
||||
<file>shell32.rc</file>
|
||||
|
|
|
@ -176,8 +176,8 @@ HGLOBAL16 WINAPI InternalExtractIcon16(HINSTANCE16,LPCSTR,UINT16,WORD);
|
|||
BOOL16 WINAPI ShellAbout16(HWND16,LPCSTR,LPCSTR,HICON16);
|
||||
BOOL16 WINAPI AboutDlgProc16(HWND16,UINT16,WPARAM16,LPARAM);
|
||||
|
||||
void WINAPI _InsertMenuItem (HMENU hmenu, UINT indexMenu, BOOL fByPosition,
|
||||
UINT wID, UINT fType, LPCSTR dwTypeData, UINT fState);
|
||||
void WINAPI _InsertMenuItemW (HMENU hmenu, UINT indexMenu, BOOL fByPosition,
|
||||
UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState);
|
||||
|
||||
static inline BOOL SHELL_OsIsUnicode(void)
|
||||
{
|
||||
|
@ -246,8 +246,8 @@ BOOL SHELL_IsShortcut(LPCITEMIDLIST);
|
|||
INT_PTR CALLBACK SH_FileGeneralDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
INT_PTR CALLBACK SH_FileVersionDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
HPROPSHEETPAGE SH_CreatePropertySheetPage(LPSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR szTitle);
|
||||
BOOL SH_ShowDriveProperties(WCHAR * drive);
|
||||
BOOL SH_ShowDriveProperties(WCHAR * drive, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST * apidl);
|
||||
BOOL SH_ShowRecycleBinProperties(WCHAR sDrive);
|
||||
BOOL SH_ShowPropertiesDialog(PCWSTR lpf);
|
||||
BOOL SH_ShowPropertiesDialog(LPWSTR lpf, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST * apidl);
|
||||
BOOL SH_ShowFolderProperties(LPWSTR pwszFolder);
|
||||
#endif
|
||||
|
|
|
@ -163,7 +163,8 @@ static ULONG WINAPI ISF_AdminTools_fnRelease (IShellFolder2 * iface)
|
|||
TRACE ("-- destroying IShellFolder(%p)\n", This);
|
||||
if (This->pidlRoot)
|
||||
SHFree (This->pidlRoot);
|
||||
LocalFree ((HLOCAL) This);
|
||||
HeapFree(GetProcessHeap(), 0, This->szTarget);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return 0;
|
||||
}
|
||||
return refCount;
|
||||
|
@ -187,6 +188,8 @@ static HRESULT WINAPI ISF_AdminTools_fnParseDisplayName (IShellFolder2 * iface,
|
|||
if (pchEaten)
|
||||
*pchEaten = 0;
|
||||
|
||||
MessageBoxW(NULL, lpszDisplayName, L"ParseDisplayName", MB_OK);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -433,7 +436,8 @@ static HRESULT WINAPI ISF_AdminTools_fnGetDisplayNameOf (IShellFolder2 * iface,
|
|||
{
|
||||
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
||||
HRESULT hr = S_OK;
|
||||
LPWSTR pszPath;
|
||||
LPWSTR pszPath, pOffset;
|
||||
|
||||
|
||||
TRACE ("(%p)->(pidl=%p,0x%08x,%p)\n", This, pidl, dwFlags, strRet);
|
||||
pdump (pidl);
|
||||
|
@ -457,7 +461,19 @@ static HRESULT WINAPI ISF_AdminTools_fnGetDisplayNameOf (IShellFolder2 * iface,
|
|||
}
|
||||
else if (_ILIsPidlSimple(pidl))
|
||||
{
|
||||
_ILSimpleGetTextW(pidl, pszPath, MAX_PATH);
|
||||
if ((GET_SHGDN_FOR(dwFlags) & SHGDN_FORPARSING) &&
|
||||
(GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER) &&
|
||||
This->szTarget)
|
||||
{
|
||||
wcscpy(pszPath, This->szTarget);
|
||||
pOffset = PathAddBackslashW(pszPath);
|
||||
if (pOffset)
|
||||
_ILSimpleGetTextW(pidl, pOffset, MAX_PATH + 1 - (pOffset - pszPath));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ILSimpleGetTextW(pidl, pszPath, MAX_PATH + 1);
|
||||
}
|
||||
}
|
||||
else if (_ILIsSpecialFolder(pidl))
|
||||
{
|
||||
|
@ -467,10 +483,6 @@ static HRESULT WINAPI ISF_AdminTools_fnGetDisplayNameOf (IShellFolder2 * iface,
|
|||
{
|
||||
_ILSimpleGetTextW(pidl, pszPath, MAX_PATH);
|
||||
}
|
||||
else
|
||||
{
|
||||
FIXME("special pidl\n");
|
||||
}
|
||||
|
||||
if ((dwFlags & SHGDN_FORPARSING) && !bSimplePidl)
|
||||
{
|
||||
|
@ -709,8 +721,11 @@ static HRESULT WINAPI IPF_AdminTools_Initialize (
|
|||
IPersistFolder2 * iface, LPCITEMIDLIST pidl)
|
||||
{
|
||||
_ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
|
||||
FIXME ("(%p)->(%p): stub\n", This, pidl);
|
||||
return E_NOTIMPL;
|
||||
if (This->pidlRoot)
|
||||
SHFree((LPVOID)This->pidlRoot);
|
||||
|
||||
This->pidlRoot = ILClone(pidl);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -765,6 +780,7 @@ HRESULT WINAPI ISF_AdminTools_Constructor (
|
|||
{
|
||||
HeapFree(GetProcessHeap(), 0, sf->szTarget);
|
||||
HeapFree(GetProcessHeap(), 0, sf);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
sf->ref = 1;
|
||||
|
|
|
@ -62,6 +62,7 @@ WINE_DEFAULT_DEBUG_CHANNEL (shell);
|
|||
typedef struct {
|
||||
const IShellFolder2Vtbl *lpVtbl;
|
||||
const IPersistFolder2Vtbl *lpPF2;
|
||||
const ISFHelperVtbl *lpvtblSFHelper;
|
||||
LONG ref;
|
||||
|
||||
/* both paths are parsible from the desktop */
|
||||
|
@ -72,6 +73,9 @@ typedef struct {
|
|||
BOOL fAcceptFmt; /* flag for pending Drop */
|
||||
} IGenericSFImpl;
|
||||
|
||||
WCHAR *build_paths_list(LPCWSTR wszBasePath, int cidl, LPCITEMIDLIST *pidls);
|
||||
int SHELL_ConfirmMsgBox(HWND hWnd, LPWSTR lpszText, LPWSTR lpszCaption, HICON hIcon, BOOL bYesToAll);
|
||||
|
||||
#define _IUnknown_(This) (IShellFolder*)&(This->lpVtbl)
|
||||
#define _IShellFolder_(This) (IShellFolder*)&(This->lpVtbl)
|
||||
|
||||
|
@ -110,6 +114,10 @@ static HRESULT WINAPI ISF_Desktop_fnQueryInterface(
|
|||
{
|
||||
*ppvObj = &This->lpPF2;
|
||||
}
|
||||
else if (IsEqualIID(riid, &IID_ISFHelper))
|
||||
{
|
||||
*ppvObj = &This->lpvtblSFHelper;
|
||||
}
|
||||
if (*ppvObj)
|
||||
{
|
||||
IUnknown_AddRef ((IUnknown *) (*ppvObj));
|
||||
|
@ -120,6 +128,11 @@ static HRESULT WINAPI ISF_Desktop_fnQueryInterface(
|
|||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static inline IGenericSFImpl *impl_from_ISFHelper( ISFHelper *iface )
|
||||
{
|
||||
return (IGenericSFImpl *)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpvtblSFHelper));
|
||||
}
|
||||
|
||||
static ULONG WINAPI ISF_Desktop_fnAddRef (IShellFolder2 * iface)
|
||||
{
|
||||
return 2; /* non-heap based object */
|
||||
|
@ -246,7 +259,7 @@ static const WCHAR ClassicStartMenuW[] = {'S','O','F','T','W','A','R','E','\\',
|
|||
'C','l','a','s','s','i','c','S','t','a','r','t','M','e','n','u','\0' };
|
||||
|
||||
INT
|
||||
HideNamespaceExtension(WCHAR *iid)
|
||||
IsNamespaceExtensionHidden(WCHAR *iid)
|
||||
{
|
||||
DWORD Result, dwResult;
|
||||
dwResult = sizeof(DWORD);
|
||||
|
@ -265,6 +278,19 @@ HideNamespaceExtension(WCHAR *iid)
|
|||
return Result;
|
||||
}
|
||||
|
||||
static
|
||||
VOID
|
||||
SetNamespaceExtensionVisibleStatus(WCHAR * iid, DWORD dwStatus)
|
||||
{
|
||||
HKEY hKey;
|
||||
|
||||
if (RegOpenKeyExW(HKEY_CURRENT_USER, ClassicStartMenuW, 0, KEY_WRITE, &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
RegSetValueExW(hKey, iid, 0, REG_DWORD, (LPBYTE)&dwStatus, sizeof(DWORD));
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -280,6 +306,7 @@ static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags)
|
|||
{
|
||||
BOOL ret = TRUE;
|
||||
WCHAR szPath[MAX_PATH];
|
||||
|
||||
static WCHAR MyDocumentsClassString[] = L"{450D8FBA-AD25-11D0-98A8-0800361B1103}";
|
||||
|
||||
|
||||
|
@ -293,7 +320,7 @@ static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags)
|
|||
DWORD dwResult;
|
||||
|
||||
/* create the pidl for This item */
|
||||
if (HideNamespaceExtension(MyDocumentsClassString) < 1)
|
||||
if (IsNamespaceExtensionHidden(MyDocumentsClassString) < 1)
|
||||
{
|
||||
ret = AddToEnumList(list, _ILCreateMyDocuments());
|
||||
}
|
||||
|
@ -321,7 +348,7 @@ static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags)
|
|||
r = RegEnumKeyExW(hkey, i, iid, &size, 0, NULL, NULL, NULL);
|
||||
if (ERROR_SUCCESS == r)
|
||||
{
|
||||
if (HideNamespaceExtension(iid) < 1)
|
||||
if (IsNamespaceExtensionHidden(iid) < 1)
|
||||
{
|
||||
pidl = _ILCreateGuidFromStrW(iid);
|
||||
if (!HasItemWithCLSID(list, pidl))
|
||||
|
@ -388,7 +415,7 @@ static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags)
|
|||
}
|
||||
|
||||
/* enumerate the elements in %windir%\desktop */
|
||||
SHGetSpecialFolderPathW(0, szPath, CSIDL_DESKTOPDIRECTORY, FALSE);
|
||||
ret = ret && SHGetSpecialFolderPathW(0, szPath, CSIDL_DESKTOPDIRECTORY, FALSE);
|
||||
ret = ret && CreateFolderEnumList(list, szPath, dwFlags);
|
||||
|
||||
return ret;
|
||||
|
@ -741,7 +768,6 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
|
|||
}
|
||||
|
||||
_ILSimpleGetTextW(pidl, pszPath + cLen, MAX_PATH - cLen);
|
||||
|
||||
if (!_ILIsFolder(pidl))
|
||||
SHELL_FS_ProcessDisplayFilename(pszPath, dwFlags);
|
||||
}
|
||||
|
@ -796,13 +822,63 @@ static HRESULT WINAPI ISF_Desktop_fnSetNameOf (IShellFolder2 * iface,
|
|||
LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
|
||||
{
|
||||
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
||||
IShellFolder2 * psf;
|
||||
HRESULT hr;
|
||||
WCHAR szSrc[MAX_PATH + 1], szDest[MAX_PATH + 1];
|
||||
LPWSTR ptr;
|
||||
BOOL bIsFolder = _ILIsFolder (ILFindLastID (pidl));
|
||||
|
||||
FIXME ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", This, hwndOwner, pidl,
|
||||
TRACE ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", This, hwndOwner, pidl,
|
||||
debugstr_w (lpName), dwFlags, pPidlOut);
|
||||
|
||||
if (_ILGetGUIDPointer(pidl))
|
||||
{
|
||||
if (SUCCEEDED(IShellFolder2_BindToObject(iface, pidl, NULL, &IID_IShellFolder2, (LPVOID*)&psf)))
|
||||
{
|
||||
hr = IShellFolder2_SetNameOf(psf, hwndOwner, pidl, lpName, dwFlags, pPidlOut);
|
||||
IShellFolder2_Release(psf);
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
|
||||
/* build source path */
|
||||
lstrcpynW(szSrc, This->sPathTarget, MAX_PATH);
|
||||
ptr = PathAddBackslashW (szSrc);
|
||||
if (ptr)
|
||||
_ILSimpleGetTextW (pidl, ptr, MAX_PATH + 1 - (ptr - szSrc));
|
||||
|
||||
/* build destination path */
|
||||
if (dwFlags == SHGDN_NORMAL || dwFlags & SHGDN_INFOLDER) {
|
||||
lstrcpynW(szDest, This->sPathTarget, MAX_PATH);
|
||||
ptr = PathAddBackslashW (szDest);
|
||||
if (ptr)
|
||||
lstrcpynW(ptr, lpName, MAX_PATH + 1 - (ptr - szDest));
|
||||
} else
|
||||
lstrcpynW(szDest, lpName, MAX_PATH);
|
||||
|
||||
if(!(dwFlags & SHGDN_FORPARSING) && SHELL_FS_HideExtension(szSrc)) {
|
||||
WCHAR *ext = PathFindExtensionW(szSrc);
|
||||
if(*ext != '\0') {
|
||||
INT len = strlenW(szDest);
|
||||
lstrcpynW(szDest + len, ext, MAX_PATH - len);
|
||||
}
|
||||
}
|
||||
|
||||
TRACE ("src=%s dest=%s\n", debugstr_w(szSrc), debugstr_w(szDest));
|
||||
if (MoveFileW (szSrc, szDest))
|
||||
{
|
||||
hr = S_OK;
|
||||
|
||||
if (pPidlOut)
|
||||
hr = _ILCreateFromPathW(szDest, pPidlOut);
|
||||
|
||||
SHChangeNotify (bIsFolder ? SHCNE_RENAMEFOLDER : SHCNE_RENAMEITEM,
|
||||
SHCNF_PATHW, szSrc, szDest);
|
||||
|
||||
return hr;
|
||||
}
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ISF_Desktop_fnGetDefaultSearchGUID(IShellFolder2 *iface,
|
||||
GUID * pguid)
|
||||
{
|
||||
|
@ -1024,6 +1100,228 @@ static const IPersistFolder2Vtbl vt_FSFldr_PersistFolder2 =
|
|||
ISF_Desktop_PersistFolder2_fnGetCurFolder,
|
||||
};
|
||||
|
||||
static HRESULT WINAPI
|
||||
ISF_Desktop_ISFHelper_fnQueryInterface (ISFHelper * iface, REFIID riid, LPVOID * ppvObj)
|
||||
{
|
||||
IGenericSFImpl *This = impl_from_ISFHelper(iface);
|
||||
|
||||
TRACE ("(%p)->(count=%u)\n", This, This->ref);
|
||||
|
||||
return ISF_Desktop_fnQueryInterface ((IShellFolder2*)This, riid, ppvObj);
|
||||
}
|
||||
|
||||
static ULONG WINAPI
|
||||
ISF_Desktop_ISFHelper_fnAddRef (ISFHelper * iface)
|
||||
{
|
||||
IGenericSFImpl *This = impl_from_ISFHelper(iface);
|
||||
|
||||
TRACE ("(%p)->(count=%u)\n", This, This->ref);
|
||||
|
||||
return ISF_Desktop_fnAddRef((IShellFolder2*)This);
|
||||
}
|
||||
|
||||
static ULONG WINAPI
|
||||
ISF_Desktop_ISFHelper_fnRelease (ISFHelper * iface)
|
||||
{
|
||||
IGenericSFImpl *This = impl_from_ISFHelper(iface);
|
||||
|
||||
TRACE ("(%p)\n", This);
|
||||
|
||||
return ISF_Desktop_fnRelease ((IShellFolder2*)This);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ISF_Desktop_ISFHelper_fnGetUniqueName (ISFHelper * iface, LPWSTR pwszName, UINT uLen)
|
||||
{
|
||||
IGenericSFImpl *This = impl_from_ISFHelper(iface);
|
||||
IEnumIDList *penum;
|
||||
HRESULT hr;
|
||||
WCHAR wszText[MAX_PATH];
|
||||
WCHAR wszNewFolder[25];
|
||||
const WCHAR wszFormat[] = {'%','s',' ','%','d',0 };
|
||||
|
||||
LoadStringW(shell32_hInstance, IDS_NEWFOLDER, wszNewFolder, sizeof(wszNewFolder)/sizeof(WCHAR));
|
||||
|
||||
TRACE ("(%p)(%p %u)\n", This, pwszName, uLen);
|
||||
|
||||
if (uLen < sizeof(wszNewFolder)/sizeof(WCHAR) + 3)
|
||||
return E_POINTER;
|
||||
|
||||
lstrcpynW (pwszName, wszNewFolder, uLen);
|
||||
|
||||
hr = IShellFolder_EnumObjects ((IShellFolder2*)This, 0,
|
||||
SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &penum);
|
||||
if (penum) {
|
||||
LPITEMIDLIST pidl;
|
||||
DWORD dwFetched;
|
||||
int i = 1;
|
||||
|
||||
next:
|
||||
IEnumIDList_Reset (penum);
|
||||
while (S_OK == IEnumIDList_Next (penum, 1, &pidl, &dwFetched) &&
|
||||
dwFetched) {
|
||||
_ILSimpleGetTextW (pidl, wszText, MAX_PATH);
|
||||
if (0 == lstrcmpiW (wszText, pwszName)) {
|
||||
snprintfW (pwszName, uLen, wszFormat, wszNewFolder, i++);
|
||||
if (i > 99) {
|
||||
hr = E_FAIL;
|
||||
break;
|
||||
}
|
||||
goto next;
|
||||
}
|
||||
}
|
||||
|
||||
IEnumIDList_Release (penum);
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ISF_Desktop_ISFHelper_fnAddFolder (ISFHelper * iface, HWND hwnd, LPCWSTR pwszName,
|
||||
LPITEMIDLIST * ppidlOut)
|
||||
{
|
||||
IGenericSFImpl *This = impl_from_ISFHelper(iface);
|
||||
WCHAR wszNewDir[MAX_PATH];
|
||||
DWORD bRes;
|
||||
HRESULT hres = E_FAIL;
|
||||
|
||||
TRACE ("(%p)(%s %p)\n", This, debugstr_w(pwszName), ppidlOut);
|
||||
|
||||
wszNewDir[0] = 0;
|
||||
if (This->sPathTarget)
|
||||
lstrcpynW(wszNewDir, This->sPathTarget, MAX_PATH);
|
||||
PathAppendW(wszNewDir, pwszName);
|
||||
bRes = CreateDirectoryW (wszNewDir, NULL);
|
||||
if (bRes)
|
||||
{
|
||||
SHChangeNotify (SHCNE_MKDIR, SHCNF_PATHW, wszNewDir, NULL);
|
||||
hres = S_OK;
|
||||
if (ppidlOut)
|
||||
hres = _ILCreateFromPathW(wszNewDir, ppidlOut);
|
||||
}
|
||||
|
||||
return hres;
|
||||
}
|
||||
static HRESULT WINAPI
|
||||
ISF_Desktop_ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPCITEMIDLIST * apidl)
|
||||
{
|
||||
IGenericSFImpl *This = impl_from_ISFHelper(iface);
|
||||
UINT i;
|
||||
SHFILEOPSTRUCTW op;
|
||||
WCHAR wszPath[MAX_PATH];
|
||||
WCHAR wszCaption[50];
|
||||
WCHAR *wszPathsList;
|
||||
HRESULT ret;
|
||||
WCHAR *wszCurrentPath;
|
||||
UINT bRestoreWithDeskCpl = FALSE;
|
||||
int res;
|
||||
|
||||
TRACE ("(%p)(%u %p)\n", This, cidl, apidl);
|
||||
if (cidl==0) return S_OK;
|
||||
|
||||
for(i = 0; i < cidl; i++)
|
||||
{
|
||||
if (_ILIsMyComputer(apidl[i]))
|
||||
bRestoreWithDeskCpl++;
|
||||
else if (_ILIsNetHood(apidl[i]))
|
||||
bRestoreWithDeskCpl++;
|
||||
else if (_ILIsMyDocuments(apidl[i]))
|
||||
bRestoreWithDeskCpl++;
|
||||
}
|
||||
|
||||
if (bRestoreWithDeskCpl)
|
||||
{
|
||||
/* FIXME use FormatMessage
|
||||
* use a similar message resource as in windows
|
||||
*/
|
||||
LoadStringW(shell32_hInstance, IDS_DELETEMULTIPLE_TEXT, wszPath, sizeof(wszPath)/sizeof(WCHAR));
|
||||
wszPath[(sizeof(wszPath)/sizeof(WCHAR))-1] = 0;
|
||||
|
||||
LoadStringW(shell32_hInstance, IDS_DELETEITEM_CAPTION, wszCaption, sizeof(wszCaption)/sizeof(WCHAR));
|
||||
wszCaption[(sizeof(wszCaption)/sizeof(WCHAR))-1] = 0;
|
||||
|
||||
res = SHELL_ConfirmMsgBox(GetActiveWindow(), wszPath, wszCaption, NULL, cidl > 1);
|
||||
if (res == IDD_YESTOALL || res == IDYES)
|
||||
{
|
||||
for(i = 0; i < cidl; i++)
|
||||
{
|
||||
if (_ILIsMyComputer(apidl[i]))
|
||||
SetNamespaceExtensionVisibleStatus(L"{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 0x1);
|
||||
else if (_ILIsNetHood(apidl[i]))
|
||||
SetNamespaceExtensionVisibleStatus(L"{208D2C60-3AEA-1069-A2D7-08002B30309D}", 0x1);
|
||||
else if (_ILIsMyDocuments(apidl[i]))
|
||||
SetNamespaceExtensionVisibleStatus(L"{450D8FBA-AD25-11D0-98A8-0800361B1103}", 0x1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (This->sPathTarget)
|
||||
lstrcpynW(wszPath, This->sPathTarget, MAX_PATH);
|
||||
else
|
||||
wszPath[0] = '\0';
|
||||
|
||||
PathAddBackslashW(wszPath);
|
||||
wszPathsList = build_paths_list(wszPath, cidl, apidl);
|
||||
|
||||
ZeroMemory(&op, sizeof(op));
|
||||
op.hwnd = GetActiveWindow();
|
||||
op.wFunc = FO_DELETE;
|
||||
op.pFrom = wszPathsList;
|
||||
op.fFlags = FOF_ALLOWUNDO;
|
||||
if (SHFileOperationW(&op))
|
||||
{
|
||||
WARN("SHFileOperation failed\n");
|
||||
ret = E_FAIL;
|
||||
}
|
||||
else
|
||||
ret = S_OK;
|
||||
|
||||
/* we currently need to manually send the notifies */
|
||||
wszCurrentPath = wszPathsList;
|
||||
for (i = 0; i < cidl; i++)
|
||||
{
|
||||
LONG wEventId;
|
||||
|
||||
if (_ILIsFolder(apidl[i]))
|
||||
wEventId = SHCNE_RMDIR;
|
||||
else if (_ILIsValue(apidl[i]))
|
||||
wEventId = SHCNE_DELETE;
|
||||
else
|
||||
continue;
|
||||
|
||||
/* check if file exists */
|
||||
if (GetFileAttributesW(wszCurrentPath) == INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
LPITEMIDLIST pidl = ILCombine(This->pidlRoot, apidl[i]);
|
||||
SHChangeNotify(wEventId, SHCNF_IDLIST, pidl, NULL);
|
||||
SHFree(pidl);
|
||||
}
|
||||
|
||||
wszCurrentPath += lstrlenW(wszCurrentPath)+1;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, wszPathsList);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ISF_Desktop_ISFHelper_fnCopyItems (ISFHelper * iface, IShellFolder * pSFFrom, UINT cidl, LPCITEMIDLIST * apidl)
|
||||
{
|
||||
IGenericSFImpl *This = impl_from_ISFHelper(iface);
|
||||
|
||||
TRACE ("(%p)->(%p,%u,%p)\n", This, pSFFrom, cidl, apidl);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const ISFHelperVtbl vt_FSFldr_ISFHelper =
|
||||
{
|
||||
ISF_Desktop_ISFHelper_fnQueryInterface,
|
||||
ISF_Desktop_ISFHelper_fnAddRef,
|
||||
ISF_Desktop_ISFHelper_fnRelease,
|
||||
ISF_Desktop_ISFHelper_fnGetUniqueName,
|
||||
ISF_Desktop_ISFHelper_fnAddFolder,
|
||||
ISF_Desktop_ISFHelper_fnDeleteItems,
|
||||
ISF_Desktop_ISFHelper_fnCopyItems
|
||||
};
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* ISF_Desktop_Constructor
|
||||
|
@ -1055,6 +1353,7 @@ HRESULT WINAPI ISF_Desktop_Constructor (
|
|||
sf->ref = 1;
|
||||
sf->lpVtbl = &vt_MCFldr_ShellFolder2;
|
||||
sf->lpPF2 = &vt_FSFldr_PersistFolder2;
|
||||
sf->lpvtblSFHelper = &vt_FSFldr_ISFHelper;
|
||||
sf->pidlRoot = _ILCreateDesktop(); /* my qualified pidl */
|
||||
sf->sPathTarget = SHAlloc( (lstrlenW(szMyPath) + 1)*sizeof(WCHAR) );
|
||||
lstrcpyW( sf->sPathTarget, szMyPath );
|
||||
|
|
|
@ -918,7 +918,7 @@ static HRESULT WINAPI ISF_Fonts_IContextMenu2_QueryContextMenu(
|
|||
UINT idCmdLast,
|
||||
UINT uFlags)
|
||||
{
|
||||
char szBuffer[30] = {0};
|
||||
WCHAR szBuffer[30] = {0};
|
||||
ULONG Count = 1;
|
||||
|
||||
_ICOM_THIS_From_IContextMenu2FontItem(IGenericSFImpl, iface);
|
||||
|
@ -926,38 +926,38 @@ static HRESULT WINAPI ISF_Fonts_IContextMenu2_QueryContextMenu(
|
|||
TRACE("(%p)->(hmenu=%p indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n",
|
||||
This, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
|
||||
|
||||
if (LoadStringA(shell32_hInstance, IDS_OPEN, szBuffer, sizeof(szBuffer)/sizeof(char)))
|
||||
if (LoadStringW(shell32_hInstance, IDS_OPEN, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
|
||||
{
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(char))-1] = L'\0';
|
||||
_InsertMenuItem(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_DEFAULT);
|
||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_DEFAULT);
|
||||
Count++;
|
||||
}
|
||||
|
||||
if (LoadStringA(shell32_hInstance, IDS_PRINT_VERB, szBuffer, sizeof(szBuffer)/sizeof(char)))
|
||||
if (LoadStringW(shell32_hInstance, IDS_PRINT_VERB, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
|
||||
{
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(char))-1] = L'\0';
|
||||
_InsertMenuItem(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED);
|
||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED);
|
||||
}
|
||||
|
||||
if (LoadStringA(shell32_hInstance, IDS_COPY, szBuffer, sizeof(szBuffer)/sizeof(char)))
|
||||
if (LoadStringW(shell32_hInstance, IDS_COPY, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
|
||||
{
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(char))-1] = L'\0';
|
||||
_InsertMenuItem(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
_InsertMenuItem(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED);
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
|
||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED);
|
||||
}
|
||||
|
||||
if (LoadStringA(shell32_hInstance, IDS_DELETE, szBuffer, sizeof(szBuffer)/sizeof(char)))
|
||||
if (LoadStringW(shell32_hInstance, IDS_DELETE, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
|
||||
{
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(char))-1] = L'\0';
|
||||
_InsertMenuItem(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
_InsertMenuItem(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_ENABLED);
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
|
||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_ENABLED);
|
||||
}
|
||||
|
||||
if (LoadStringA(shell32_hInstance, IDS_PROPERTIES, szBuffer, sizeof(szBuffer)/sizeof(char)))
|
||||
if (LoadStringW(shell32_hInstance, IDS_PROPERTIES, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
|
||||
{
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(char))-1] = L'\0';
|
||||
_InsertMenuItem(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
_InsertMenuItem(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_ENABLED);
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
|
||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_ENABLED);
|
||||
}
|
||||
|
||||
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, Count);
|
||||
|
|
|
@ -451,6 +451,9 @@ static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf (IShellFolder2 * iface,
|
|||
{
|
||||
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
||||
HRESULT hr = S_OK;
|
||||
static const DWORD dwComputerAttributes =
|
||||
SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR | SFGAO_CANCOPY |
|
||||
SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER | SFGAO_CANRENAME | SFGAO_CANDELETE;
|
||||
|
||||
TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
|
||||
This, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
|
||||
|
@ -463,15 +466,8 @@ static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf (IShellFolder2 * iface,
|
|||
if (*rgfInOut == 0)
|
||||
*rgfInOut = ~0;
|
||||
|
||||
if(cidl == 0){
|
||||
IShellFolder *psfParent = NULL;
|
||||
LPCITEMIDLIST rpidl = NULL;
|
||||
|
||||
hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder, (LPVOID*)&psfParent, (LPCITEMIDLIST*)&rpidl);
|
||||
if(SUCCEEDED(hr)) {
|
||||
SHELL32_GetItemAttributes (psfParent, rpidl, rgfInOut);
|
||||
IShellFolder_Release(psfParent);
|
||||
}
|
||||
if(cidl == 0) {
|
||||
*rgfInOut &= dwComputerAttributes;
|
||||
} else {
|
||||
while (cidl > 0 && *apidl) {
|
||||
pdump (*apidl);
|
||||
|
@ -778,10 +774,23 @@ static HRESULT WINAPI ISF_MyComputer_fnSetNameOf (
|
|||
LPWSTR sName;
|
||||
HKEY hKey;
|
||||
UINT length;
|
||||
WCHAR szName[30];
|
||||
|
||||
TRACE ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", This,
|
||||
hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
|
||||
|
||||
if (_ILIsDrive(pidl))
|
||||
{
|
||||
if (_ILSimpleGetTextW(pidl, szName, sizeof(szName)/sizeof(WCHAR)))
|
||||
{
|
||||
SetVolumeLabelW(szName, lpName);
|
||||
}
|
||||
if (pPidlOut)
|
||||
*pPidlOut = _ILCreateDrive(szName);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
if (pPidlOut != NULL)
|
||||
{
|
||||
*pPidlOut = _ILCreateMyComputer();
|
||||
|
@ -1021,7 +1030,12 @@ static HRESULT WINAPI IMCFldr_PersistFolder2_Initialize (
|
|||
{
|
||||
IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
|
||||
TRACE ("(%p)->(%p)\n", This, pidl);
|
||||
return E_NOTIMPL;
|
||||
|
||||
if (This->pidlRoot)
|
||||
SHFree((LPVOID)This->pidlRoot);
|
||||
|
||||
This->pidlRoot = ILClone(pidl);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
|
|
@ -368,8 +368,8 @@ static HRESULT WINAPI ISF_MyDocuments_fnGetAttributesOf (IShellFolder2 * iface,
|
|||
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
||||
HRESULT hr = S_OK;
|
||||
static const DWORD dwMyDocumentsAttributes =
|
||||
SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
|
||||
SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER;
|
||||
SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR | SFGAO_CANCOPY |
|
||||
SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER | SFGAO_CANRENAME | SFGAO_CANDELETE;
|
||||
|
||||
TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
|
||||
This, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
|
||||
|
|
|
@ -317,6 +317,9 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnGetAttributesOf (IShellFolder2 * iface
|
|||
UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
|
||||
{
|
||||
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
||||
static const DWORD dwNethoodAttributes =
|
||||
SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
|
||||
SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER | SFGAO_CANRENAME | SFGAO_CANDELETE;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n", This,
|
||||
|
@ -330,17 +333,8 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnGetAttributesOf (IShellFolder2 * iface
|
|||
if (*rgfInOut == 0)
|
||||
*rgfInOut = ~0;
|
||||
|
||||
if (cidl == 0)
|
||||
{
|
||||
IShellFolder *psfParent = NULL;
|
||||
LPCITEMIDLIST rpidl = NULL;
|
||||
|
||||
hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder, (LPVOID*)&psfParent, (LPCITEMIDLIST*)&rpidl);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
SHELL32_GetItemAttributes (psfParent, rpidl, rgfInOut);
|
||||
IShellFolder_Release(psfParent);
|
||||
}
|
||||
if(cidl == 0) {
|
||||
*rgfInOut = dwNethoodAttributes;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -392,8 +386,7 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnGetUIObjectOf (IShellFolder2 * iface,
|
|||
|
||||
if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1))
|
||||
{
|
||||
pObj = (LPUNKNOWN) ISvItemCm_Constructor ((IShellFolder *) iface, This->pidlRoot, apidl, cidl);
|
||||
hr = S_OK;
|
||||
hr = CDefFolderMenu_Create2(This->pidlRoot, hwndOwner, cidl, apidl, (IShellFolder*)iface, NULL, 0, NULL, (IContextMenu**)&pObj);
|
||||
}
|
||||
else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1))
|
||||
{
|
||||
|
|
|
@ -923,8 +923,11 @@ static HRESULT WINAPI IPF_Printers_Initialize (
|
|||
IPersistFolder2 * iface, LPCITEMIDLIST pidl)
|
||||
{
|
||||
_ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
|
||||
FIXME ("(%p)->(%p): stub\n", This, pidl);
|
||||
return E_NOTIMPL;
|
||||
if (This->pidlRoot)
|
||||
SHFree((LPVOID)This->pidlRoot);
|
||||
|
||||
This->pidlRoot = ILClone(pidl);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
|
|
@ -88,11 +88,7 @@ typedef struct tagRecycleBin
|
|||
const IContextMenu2Vtbl *lpContextMenu2;
|
||||
const IShellExtInitVtbl *lpSEI;
|
||||
LONG refCount;
|
||||
|
||||
INT iIdOpen;
|
||||
INT iIdEmpty;
|
||||
INT iIdProperties;
|
||||
|
||||
LPITEMIDLIST pidl;
|
||||
LPCITEMIDLIST apidl;
|
||||
} RecycleBin;
|
||||
|
@ -180,12 +176,12 @@ static HRESULT WINAPI RecycleBin_QueryInterface(IShellFolder2 *iface, REFIID rii
|
|||
|| IsEqualGUID(riid, &IID_IPersistFolder2))
|
||||
*ppvObject = &This->lpPersistFolderVtbl;
|
||||
|
||||
if (IsEqualIID(riid, &IID_IContextMenu) || IsEqualGUID(riid, &IID_IContextMenu2))
|
||||
else if (IsEqualIID(riid, &IID_IContextMenu) || IsEqualGUID(riid, &IID_IContextMenu2))
|
||||
{
|
||||
This->lpContextMenu2 = &recycleBincmVtblFolder;
|
||||
*ppvObject = &This->lpContextMenu2;
|
||||
}
|
||||
if(IsEqualIID(riid, &IID_IShellExtInit))
|
||||
else if(IsEqualIID(riid, &IID_IShellExtInit))
|
||||
{
|
||||
*ppvObject = &(This->lpSEI);
|
||||
}
|
||||
|
@ -533,10 +529,12 @@ static HRESULT WINAPI RecycleBin_GetDisplayNameOf(IShellFolder2 *This, LPCITEMID
|
|||
{
|
||||
WCHAR pszPath[100];
|
||||
|
||||
HCR_GetClassNameW(&CLSID_RecycleBin, pszPath, MAX_PATH);
|
||||
pName->uType = STRRET_WSTR;
|
||||
pName->u.pOleStr = StrDupW(pszPath);
|
||||
return S_OK;
|
||||
if (HCR_GetClassNameW(&CLSID_RecycleBin, pszPath, MAX_PATH))
|
||||
{
|
||||
pName->uType = STRRET_WSTR;
|
||||
pName->u.pOleStr = StrDupW(pszPath);
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
pFileDetails = _ILGetRecycleStruct(pidl);
|
||||
|
@ -747,6 +745,7 @@ static HRESULT WINAPI RecycleBin_IPersistFolder2_Initialize(IPersistFolder2 *ifa
|
|||
RecycleBin *This = impl_from_IPersistFolder(iface);
|
||||
TRACE("(%p, %p)\n", This, pidl);
|
||||
|
||||
SHFree((LPVOID)This->pidl);
|
||||
This->pidl = ILClone(pidl);
|
||||
if (This->pidl == NULL)
|
||||
return E_OUTOFMEMORY;
|
||||
|
@ -874,31 +873,19 @@ RecycleBin_IContextMenu2Folder_QueryContextMenu( IContextMenu2* iface, HMENU hme
|
|||
memset( &mii, 0, sizeof(mii) );
|
||||
mii.cbSize = sizeof(mii);
|
||||
mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
|
||||
szBuffer[0] = L'\0';
|
||||
LoadStringW(shell32_hInstance, IDS_OPEN, szBuffer, sizeof(szBuffer)/sizeof(WCHAR));
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
|
||||
mii.dwTypeData = (LPWSTR)szBuffer;
|
||||
mii.cch = strlenW( mii.dwTypeData );
|
||||
mii.wID = idCmdFirst + id++;
|
||||
mii.fState = MFS_ENABLED;
|
||||
mii.fType = MFT_STRING;
|
||||
|
||||
if (!InsertMenuItemW( hmenu, indexMenu, TRUE, &mii ))
|
||||
return E_FAIL;
|
||||
This->iIdOpen = 1;
|
||||
|
||||
mii.fState = MFS_ENABLED;
|
||||
szBuffer[0] = L'\0';
|
||||
LoadStringW(shell32_hInstance, IDS_EMPTY_BITBUCKET, szBuffer, sizeof(szBuffer)/sizeof(WCHAR));
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
|
||||
mii.dwTypeData = szBuffer;
|
||||
mii.cch = strlenW( mii.dwTypeData );
|
||||
mii.wID = idCmdFirst + id++;
|
||||
if (!InsertMenuItemW( hmenu, idCmdLast, TRUE, &mii ))
|
||||
{
|
||||
TRACE("RecycleBin_IContextMenu2Folder_QueryContextMenu failed to insert item properties");
|
||||
mii.fType = MFT_STRING;
|
||||
This->iIdEmpty = 1;
|
||||
|
||||
if (!InsertMenuItemW( hmenu, indexMenu, TRUE, &mii ))
|
||||
return E_FAIL;
|
||||
}
|
||||
This->iIdEmpty = 2;
|
||||
|
||||
return MAKE_HRESULT( SEVERITY_SUCCESS, 0, id );
|
||||
}
|
||||
|
||||
|
@ -908,7 +895,6 @@ RecycleBin_IContextMenu2Folder_InvokeCommand( IContextMenu2* iface, LPCMINVOKECO
|
|||
HRESULT hr;
|
||||
LPSHELLBROWSER lpSB;
|
||||
LPSHELLVIEW lpSV = NULL;
|
||||
|
||||
RecycleBin * This = impl_from_IContextMenu2(iface);
|
||||
|
||||
TRACE("%p %p verb %p\n", This, lpici, lpici->lpVerb);
|
||||
|
@ -932,15 +918,6 @@ RecycleBin_IContextMenu2Folder_InvokeCommand( IContextMenu2* iface, LPCMINVOKECO
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( LOWORD(lpici->lpVerb) == This->iIdProperties)
|
||||
{
|
||||
WCHAR szDrive = 'C';
|
||||
SH_ShowRecycleBinProperties(szDrive);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -1036,7 +1013,7 @@ static HRESULT WINAPI RecycleBin_IContextMenu2Item_QueryContextMenu(
|
|||
UINT idCmdLast,
|
||||
UINT uFlags)
|
||||
{
|
||||
char szBuffer[30] = {0};
|
||||
WCHAR szBuffer[30] = {0};
|
||||
ULONG Count = 1;
|
||||
|
||||
RecycleBin * This = impl_from_IContextMenu2(iface);
|
||||
|
@ -1044,32 +1021,32 @@ static HRESULT WINAPI RecycleBin_IContextMenu2Item_QueryContextMenu(
|
|||
TRACE("(%p)->(hmenu=%p indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n",
|
||||
This, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
|
||||
|
||||
if (LoadStringA(shell32_hInstance, IDS_RESTORE, szBuffer, sizeof(szBuffer)/sizeof(char)))
|
||||
if (LoadStringW(shell32_hInstance, IDS_RESTORE, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
|
||||
{
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(char))-1] = L'\0';
|
||||
_InsertMenuItem(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_ENABLED);
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
|
||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_ENABLED);
|
||||
Count++;
|
||||
}
|
||||
|
||||
if (LoadStringA(shell32_hInstance, IDS_CUT, szBuffer, sizeof(szBuffer)/sizeof(char)))
|
||||
if (LoadStringW(shell32_hInstance, IDS_CUT, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
|
||||
{
|
||||
_InsertMenuItem(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(char))-1] = L'\0';
|
||||
_InsertMenuItem(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED);
|
||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
|
||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED);
|
||||
}
|
||||
|
||||
if (LoadStringA(shell32_hInstance, IDS_DELETE, szBuffer, sizeof(szBuffer)/sizeof(char)))
|
||||
if (LoadStringW(shell32_hInstance, IDS_DELETE, szBuffer, sizeof(szBuffer)/sizeof(char)))
|
||||
{
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(char))-1] = L'\0';
|
||||
_InsertMenuItem(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
_InsertMenuItem(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED);
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
|
||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED);
|
||||
}
|
||||
|
||||
if (LoadStringA(shell32_hInstance, IDS_PROPERTIES, szBuffer, sizeof(szBuffer)/sizeof(char)))
|
||||
if (LoadStringW(shell32_hInstance, IDS_PROPERTIES, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
|
||||
{
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(char))-1] = L'\0';
|
||||
_InsertMenuItem(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
_InsertMenuItem(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_DEFAULT);
|
||||
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
|
||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_DEFAULT);
|
||||
}
|
||||
|
||||
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, Count);
|
||||
|
|
|
@ -1298,7 +1298,7 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
|
|||
static const WCHAR wFile[] = {'f','i','l','e',0};
|
||||
static const WCHAR wHttp[] = {'h','t','t','p',':','/','/',0};
|
||||
static const WCHAR wExplorer[] = {'e','x','p','l','o','r','e','r','.','e','x','e',0};
|
||||
static const WCHAR wProperties[] = { 'p','r','o','p','e','r','t','i','e','s',0 };
|
||||
//static const WCHAR wProperties[] = { 'p','r','o','p','e','r','t','i','e','s',0 };
|
||||
static const DWORD unsupportedFlags =
|
||||
SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY |
|
||||
SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI |
|
||||
|
@ -1403,14 +1403,14 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
|
|||
HeapFree(GetProcessHeap(), 0, wszApplicationName);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (sei_tmp.lpVerb && !wcscmp(sei_tmp.lpVerb, wProperties))
|
||||
{
|
||||
SH_ShowPropertiesDialog(sei_tmp.lpFile);
|
||||
sei->hInstApp = (HINSTANCE) 33;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
if (sei_tmp.fMask & SEE_MASK_CLASSALL)
|
||||
{
|
||||
/* launch a document by fileclass like 'WordPad.Document.1' */
|
||||
|
|
|
@ -190,7 +190,7 @@ static INT_PTR CALLBACK ConfirmMsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, L
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static int SHELL_ConfirmMsgBox(HWND hWnd, LPWSTR lpszText, LPWSTR lpszCaption, HICON hIcon, BOOL bYesToAll)
|
||||
int SHELL_ConfirmMsgBox(HWND hWnd, LPWSTR lpszText, LPWSTR lpszCaption, HICON hIcon, BOOL bYesToAll)
|
||||
{
|
||||
static const WCHAR wszTemplate[] = {'S','H','E','L','L','_','Y','E','S','T','O','A','L','L','_','M','S','G','B','O','X',0};
|
||||
struct confirm_msg_info info;
|
||||
|
|
|
@ -418,7 +418,7 @@ HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWO
|
|||
|
||||
if (_ILIsDrive (pidl)) {
|
||||
*pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|
|
||||
SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANLINK|SFGAO_CANRENAME;
|
||||
SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANRENAME;
|
||||
} else if (has_guid && HCR_GetFolderAttributes(pidl, &dwAttributes)) {
|
||||
*pdwAttributes = dwAttributes;
|
||||
} else if (_ILGetDataPointer (pidl)) {
|
||||
|
@ -446,7 +446,10 @@ HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWO
|
|||
SFGAO_CANRENAME | SFGAO_CANLINK | SFGAO_CANMOVE | SFGAO_CANCOPY;
|
||||
|
||||
if (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
{
|
||||
*pdwAttributes |= (SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR);
|
||||
*pdwAttributes &= ~SFGAO_CANLINK;
|
||||
}
|
||||
else
|
||||
*pdwAttributes &= ~(SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR);
|
||||
|
||||
|
|
|
@ -907,6 +907,7 @@ HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uI
|
|||
|
||||
if (!GetMenuItemInfoW(hmSrc, nItem, TRUE, &miiSrc))
|
||||
{
|
||||
MessageBoxW(NULL, L"GetMenuItemInfoW failed", NULL, MB_OK);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -916,8 +917,10 @@ HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uI
|
|||
{
|
||||
/* This is a separator; don't put two of them in a row */
|
||||
if (bAlreadySeparated)
|
||||
{
|
||||
MessageBoxW(NULL, L"bAlreadySeparated failed", NULL, MB_OK);
|
||||
continue;
|
||||
|
||||
}
|
||||
bAlreadySeparated = TRUE;
|
||||
}
|
||||
else if (miiSrc.hSubMenu)
|
||||
|
@ -926,9 +929,10 @@ HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uI
|
|||
{
|
||||
miiSrc.wID += uIDAdjust; /* add uIDAdjust to the ID */
|
||||
|
||||
if (miiSrc.wID > uIDAdjustMax) /* skip ID's higher uIDAdjustMax */
|
||||
if (miiSrc.wID > uIDAdjustMax) /* skip ID's higher uIDAdjustMax */
|
||||
{MessageBoxW(NULL, L"uIDAdjustMax 111 failed", NULL, MB_OK);
|
||||
continue;
|
||||
|
||||
}
|
||||
if (uIDMax <= miiSrc.wID) /* remember the highest ID */
|
||||
uIDMax = miiSrc.wID + 1;
|
||||
}
|
||||
|
@ -953,9 +957,10 @@ HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uI
|
|||
{
|
||||
miiSrc.wID += uIDAdjust; /* add uIDAdjust to the ID */
|
||||
|
||||
if (miiSrc.wID > uIDAdjustMax) /* skip ID's higher uIDAdjustMax */
|
||||
if (miiSrc.wID > uIDAdjustMax) /* skip ID's higher uIDAdjustMax */{
|
||||
MessageBoxW(NULL, L"uIDAdjustMax max 222 failed", NULL, MB_OK);
|
||||
continue;
|
||||
|
||||
}
|
||||
if (uIDMax <= miiSrc.wID) /* remember the highest ID */
|
||||
uIDMax = miiSrc.wID + 1;
|
||||
|
||||
|
@ -966,6 +971,7 @@ HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uI
|
|||
*/
|
||||
if (!InsertMenuItemW(hmDst, uInsert, TRUE, &miiSrc))
|
||||
{
|
||||
MessageBoxW(NULL, L"InsertMenuItemW failed", NULL, MB_OK);
|
||||
return(uIDMax);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -774,8 +774,8 @@ static void ShellView_MergeFileMenu(IShellViewImpl * This, HMENU hSubMenu)
|
|||
|
||||
if(hSubMenu)
|
||||
{ /*insert This item at the beginning of the menu */
|
||||
_InsertMenuItem(hSubMenu, 0, TRUE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
_InsertMenuItem(hSubMenu, 0, TRUE, IDM_MYFILEITEM, MFT_STRING, "dummy45", MFS_ENABLED);
|
||||
_InsertMenuItemW(hSubMenu, 0, TRUE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
_InsertMenuItemW(hSubMenu, 0, TRUE, IDM_MYFILEITEM, MFT_STRING, L"dummy45", MFS_ENABLED);
|
||||
|
||||
}
|
||||
TRACE("--\n");
|
||||
|
@ -791,18 +791,18 @@ static void ShellView_MergeViewMenu(IShellViewImpl * This, HMENU hSubMenu)
|
|||
|
||||
if(hSubMenu)
|
||||
{ /*add a separator at the correct position in the menu*/
|
||||
MENUITEMINFOA mii;
|
||||
static char view[] = "View";
|
||||
MENUITEMINFOW mii;
|
||||
static WCHAR view[] = L"View";
|
||||
|
||||
_InsertMenuItem(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
_InsertMenuItemW(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
|
||||
ZeroMemory(&mii, sizeof(mii));
|
||||
mii.cbSize = sizeof(mii);
|
||||
mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA;
|
||||
mii.fType = MFT_STRING;
|
||||
mii.dwTypeData = view;
|
||||
mii.hSubMenu = LoadMenuA(shell32_hInstance, "MENU_001");
|
||||
InsertMenuItemA(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii);
|
||||
mii.hSubMenu = LoadMenuW(shell32_hInstance, L"MENU_001");
|
||||
InsertMenuItemW(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -841,6 +841,8 @@ static UINT ShellView_GetSelections(IShellViewImpl * This)
|
|||
{
|
||||
This->apidl[i] = (LPITEMIDLIST)lvItem.lParam;
|
||||
i++;
|
||||
if (i == This->cidl)
|
||||
break;
|
||||
TRACE("-- selected Item found\n");
|
||||
}
|
||||
lvItem.iItem++;
|
||||
|
@ -1030,7 +1032,7 @@ static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL
|
|||
{
|
||||
hMenu = CreatePopupMenu();
|
||||
|
||||
This->pCM = ISvBgCm_Constructor(This->pSFParent, FALSE);
|
||||
CDefFolderMenu_Create2(NULL, NULL, This->cidl, (LPCITEMIDLIST*)This->apidl, This->pSFParent, NULL, 0, NULL, (IContextMenu**)&This->pCM);
|
||||
IContextMenu2_QueryContextMenu(This->pCM, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0);
|
||||
|
||||
uCommand = TrackPopupMenu( hMenu, TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL);
|
||||
|
@ -2063,6 +2065,7 @@ static HRESULT WINAPI IShellView_fnSelectItem(
|
|||
|
||||
static HRESULT WINAPI IShellView_fnGetItemObject(IShellView * iface, UINT uItem, REFIID riid, LPVOID *ppvOut)
|
||||
{
|
||||
HRESULT hr = E_FAIL;
|
||||
IShellViewImpl *This = (IShellViewImpl *)iface;
|
||||
|
||||
TRACE("(%p)->(uItem=0x%08x,\n\tIID=%s, ppv=%p)\n",This, uItem, debugstr_guid(riid), ppvOut);
|
||||
|
@ -2072,19 +2075,19 @@ static HRESULT WINAPI IShellView_fnGetItemObject(IShellView * iface, UINT uItem,
|
|||
switch(uItem)
|
||||
{
|
||||
case SVGIO_BACKGROUND:
|
||||
*ppvOut = ISvBgCm_Constructor(This->pSFParent, FALSE);
|
||||
//*ppvOut = ISvBgCm_Constructor(This->pSFParent, FALSE);
|
||||
CDefFolderMenu_Create2(NULL, NULL, This->cidl, (LPCITEMIDLIST*)This->apidl, This->pSFParent, NULL, 0, NULL, (IContextMenu**)ppvOut);
|
||||
if (!ppvOut) hr = E_OUTOFMEMORY;
|
||||
break;
|
||||
|
||||
case SVGIO_SELECTION:
|
||||
ShellView_GetSelections(This);
|
||||
IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, (LPCITEMIDLIST*)This->apidl, riid, 0, ppvOut);
|
||||
hr = IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, (LPCITEMIDLIST*)This->apidl, riid, 0, ppvOut);
|
||||
break;
|
||||
}
|
||||
TRACE("-- (%p)->(interface=%p)\n",This, *ppvOut);
|
||||
|
||||
if(!*ppvOut) return E_OUTOFMEMORY;
|
||||
|
||||
return S_OK;
|
||||
return hr;
|
||||
}
|
||||
|
||||
static const IShellViewVtbl svvt =
|
||||
|
|
|
@ -1,500 +0,0 @@
|
|||
/*
|
||||
* IContextMenu
|
||||
* ShellView Background Context Menu (shv_bg_cm)
|
||||
*
|
||||
* Copyright 1999 Juergen Schmied <juergen.schmied@metronet.de>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
#include <string.h>
|
||||
|
||||
#define COBJMACROS
|
||||
#define NONAMELESSUNION
|
||||
#define NONAMELESSSTRUCT
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "windef.h"
|
||||
#include "wingdi.h"
|
||||
#include "pidl.h"
|
||||
#include "shlobj.h"
|
||||
#include "shtypes.h"
|
||||
#include "shell32_main.h"
|
||||
#include "shellfolder.h"
|
||||
#include "undocshell.h"
|
||||
#include "shlwapi.h"
|
||||
#include "stdio.h"
|
||||
#include "winuser.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
||||
|
||||
/**************************************************************************
|
||||
* IContextMenu Implementation
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const IContextMenu2Vtbl *lpVtbl;
|
||||
IShellFolder* pSFParent;
|
||||
LONG ref;
|
||||
BOOL bDesktop;
|
||||
IContextMenu2 * icm_new;
|
||||
} BgCmImpl;
|
||||
|
||||
static const IContextMenu2Vtbl cmvt;
|
||||
|
||||
BOOL
|
||||
HasClipboardData()
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
IDataObject * pda;
|
||||
|
||||
if(SUCCEEDED(OleGetClipboard(&pda)))
|
||||
{
|
||||
STGMEDIUM medium;
|
||||
FORMATETC formatetc;
|
||||
|
||||
TRACE("pda=%p\n", pda);
|
||||
|
||||
/* Set the FORMATETC structure*/
|
||||
InitFormatEtc(formatetc, RegisterClipboardFormatA(CFSTR_SHELLIDLIST), TYMED_HGLOBAL);
|
||||
if(SUCCEEDED(IDataObject_GetData(pda,&formatetc,&medium)))
|
||||
{
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
IDataObject_Release(pda);
|
||||
ReleaseStgMedium(&medium);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* ISVBgCm_Constructor()
|
||||
*/
|
||||
IContextMenu2 *ISvBgCm_Constructor(IShellFolder* pSFParent, BOOL bDesktop)
|
||||
{
|
||||
BgCmImpl* cm;
|
||||
|
||||
cm = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(BgCmImpl));
|
||||
cm->lpVtbl = &cmvt;
|
||||
cm->ref = 1;
|
||||
cm->pSFParent = pSFParent;
|
||||
cm->bDesktop = bDesktop;
|
||||
if(pSFParent) IShellFolder_AddRef(pSFParent);
|
||||
|
||||
TRACE("(%p)->()\n",cm);
|
||||
return (IContextMenu2*)cm;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* ISVBgCm_fnQueryInterface
|
||||
*/
|
||||
static HRESULT WINAPI ISVBgCm_fnQueryInterface(IContextMenu2 *iface, REFIID riid, LPVOID *ppvObj)
|
||||
{
|
||||
BgCmImpl *This = (BgCmImpl *)iface;
|
||||
|
||||
TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);
|
||||
|
||||
*ppvObj = NULL;
|
||||
|
||||
if(IsEqualIID(riid, &IID_IUnknown) ||
|
||||
IsEqualIID(riid, &IID_IContextMenu) ||
|
||||
IsEqualIID(riid, &IID_IContextMenu2))
|
||||
{
|
||||
*ppvObj = This;
|
||||
}
|
||||
else if(IsEqualIID(riid, &IID_IShellExtInit)) /*IShellExtInit*/
|
||||
{
|
||||
FIXME("-- LPSHELLEXTINIT pointer requested\n");
|
||||
}
|
||||
|
||||
if(*ppvObj)
|
||||
{
|
||||
IUnknown_AddRef((IUnknown*)*ppvObj);
|
||||
TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
|
||||
return S_OK;
|
||||
}
|
||||
TRACE("-- Interface: E_NOINTERFACE\n");
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* ISVBgCm_fnAddRef
|
||||
*/
|
||||
static ULONG WINAPI ISVBgCm_fnAddRef(IContextMenu2 *iface)
|
||||
{
|
||||
BgCmImpl *This = (BgCmImpl *)iface;
|
||||
ULONG refCount = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p)->(count=%u)\n", This, refCount - 1);
|
||||
|
||||
return refCount;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* ISVBgCm_fnRelease
|
||||
*/
|
||||
static ULONG WINAPI ISVBgCm_fnRelease(IContextMenu2 *iface)
|
||||
{
|
||||
BgCmImpl *This = (BgCmImpl *)iface;
|
||||
ULONG refCount = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p)->(count=%i)\n", This, refCount + 1);
|
||||
|
||||
if (!refCount)
|
||||
{
|
||||
TRACE(" destroying IContextMenu(%p)\n",This);
|
||||
|
||||
if(This->pSFParent)
|
||||
IShellFolder_Release(This->pSFParent);
|
||||
|
||||
HeapFree(GetProcessHeap(),0,This);
|
||||
}
|
||||
return refCount;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* ISVBgCm_fnQueryContextMenu()
|
||||
*/
|
||||
|
||||
VOID INewItem_SetParent(LPSHELLFOLDER pSFParent); /* FIXME: remove that, shouldn't be needed */
|
||||
|
||||
static HRESULT WINAPI ISVBgCm_fnQueryContextMenu(
|
||||
IContextMenu2 *iface,
|
||||
HMENU hMenu,
|
||||
UINT indexMenu,
|
||||
UINT idCmdFirst,
|
||||
UINT idCmdLast,
|
||||
UINT uFlags)
|
||||
{
|
||||
HMENU hMyMenu;
|
||||
UINT idMax;
|
||||
MENUITEMINFOW mii;
|
||||
HRESULT hr;
|
||||
|
||||
IContextMenu2 * icm;
|
||||
BgCmImpl *This = (BgCmImpl *)iface;
|
||||
|
||||
TRACE("(%p)->(hmenu=%p indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n",
|
||||
This, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
|
||||
|
||||
|
||||
hMyMenu = LoadMenuA(shell32_hInstance, "MENU_002");
|
||||
if (uFlags & CMF_DEFAULTONLY)
|
||||
{
|
||||
HMENU ourMenu = GetSubMenu(hMyMenu,0);
|
||||
UINT oldDef = GetMenuDefaultItem(hMenu,TRUE,GMDI_USEDISABLED);
|
||||
UINT newDef = GetMenuDefaultItem(ourMenu,TRUE,GMDI_USEDISABLED);
|
||||
if (newDef != oldDef)
|
||||
SetMenuDefaultItem(hMenu,newDef,TRUE);
|
||||
if (newDef!=0xFFFFFFFF)
|
||||
hr = MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, newDef+1);
|
||||
else
|
||||
hr = MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
idMax = Shell_MergeMenus (hMenu, GetSubMenu(hMyMenu,0), indexMenu,
|
||||
idCmdFirst, idCmdLast, MM_SUBMENUSHAVEIDS);
|
||||
hr = MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, idMax-idCmdFirst+1);
|
||||
}
|
||||
DestroyMenu(hMyMenu);
|
||||
|
||||
if (!HasClipboardData())
|
||||
{
|
||||
mii.cbSize = sizeof(mii);
|
||||
mii.fMask = MIIM_STATE;
|
||||
mii.fState = MFS_DISABLED;
|
||||
mii.fType = 0;
|
||||
SetMenuItemInfoW(hMenu, FCIDM_SHVIEW_INSERT, FALSE, &mii);
|
||||
SetMenuItemInfoW(hMenu, FCIDM_SHVIEW_INSERTLINK, FALSE, &mii);
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME
|
||||
* load other shell extensions
|
||||
*/
|
||||
if (SUCCEEDED(INewItem_Constructor(NULL, &IID_IContextMenu2, (LPVOID*)&icm)))
|
||||
{
|
||||
if (SUCCEEDED(IContextMenu_QueryContextMenu(icm, hMenu, 10, idCmdFirst, idCmdLast, uFlags)))
|
||||
{
|
||||
This->icm_new = icm;
|
||||
_InsertMenuItem(hMenu, 11, TRUE, -1, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
||||
}
|
||||
else
|
||||
{
|
||||
This->icm_new = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Prepare 'New item' shell extension */
|
||||
/* FIXME: shouldn't be needed... */
|
||||
INewItem_SetParent(This->pSFParent);
|
||||
|
||||
if (This->bDesktop)
|
||||
{
|
||||
/* desktop menu has no view option */
|
||||
DeleteMenu(hMenu, 0, MF_BYPOSITION);
|
||||
DeleteMenu(hMenu, 0, MF_BYPOSITION);
|
||||
}
|
||||
TRACE("(%p)->returning 0x%x\n",This,hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* DoPaste
|
||||
*/
|
||||
static BOOL DoPaste(
|
||||
IContextMenu2 *iface)
|
||||
{
|
||||
BgCmImpl *This = (BgCmImpl *)iface;
|
||||
BOOL bSuccess = FALSE;
|
||||
IDataObject * pda;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if(SUCCEEDED(OleGetClipboard(&pda)))
|
||||
{
|
||||
STGMEDIUM medium;
|
||||
FORMATETC formatetc;
|
||||
|
||||
TRACE("pda=%p\n", pda);
|
||||
|
||||
/* Set the FORMATETC structure*/
|
||||
InitFormatEtc(formatetc, RegisterClipboardFormatA(CFSTR_SHELLIDLIST), TYMED_HGLOBAL);
|
||||
|
||||
/* Get the pidls from IDataObject */
|
||||
if(SUCCEEDED(IDataObject_GetData(pda,&formatetc,&medium)))
|
||||
{
|
||||
LPITEMIDLIST * apidl;
|
||||
LPITEMIDLIST pidl;
|
||||
IShellFolder *psfFrom = NULL, *psfDesktop;
|
||||
|
||||
LPIDA lpcida = GlobalLock(medium.u.hGlobal);
|
||||
TRACE("cida=%p\n", lpcida);
|
||||
|
||||
apidl = _ILCopyCidaToaPidl(&pidl, lpcida);
|
||||
|
||||
/* bind to the source shellfolder */
|
||||
SHGetDesktopFolder(&psfDesktop);
|
||||
if(psfDesktop)
|
||||
{
|
||||
IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (LPVOID*)&psfFrom);
|
||||
IShellFolder_Release(psfDesktop);
|
||||
}
|
||||
|
||||
if (psfFrom)
|
||||
{
|
||||
/* get source and destination shellfolder */
|
||||
ISFHelper *psfhlpdst, *psfhlpsrc;
|
||||
IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (LPVOID*)&psfhlpdst);
|
||||
IShellFolder_QueryInterface(psfFrom, &IID_ISFHelper, (LPVOID*)&psfhlpsrc);
|
||||
|
||||
/* do the copy/move */
|
||||
if (psfhlpdst && psfhlpsrc)
|
||||
{
|
||||
ISFHelper_CopyItems(psfhlpdst, psfFrom, lpcida->cidl, (LPCITEMIDLIST*)apidl);
|
||||
/* FIXME handle move
|
||||
ISFHelper_DeleteItems(psfhlpsrc, lpcida->cidl, apidl);
|
||||
*/
|
||||
}
|
||||
if(psfhlpdst) ISFHelper_Release(psfhlpdst);
|
||||
if(psfhlpsrc) ISFHelper_Release(psfhlpsrc);
|
||||
IShellFolder_Release(psfFrom);
|
||||
}
|
||||
|
||||
_ILFreeaPidl(apidl, lpcida->cidl);
|
||||
SHFree(pidl);
|
||||
|
||||
/* release the medium*/
|
||||
ReleaseStgMedium(&medium);
|
||||
}
|
||||
IDataObject_Release(pda);
|
||||
}
|
||||
#if 0
|
||||
HGLOBAL hMem;
|
||||
|
||||
OpenClipboard(NULL);
|
||||
hMem = GetClipboardData(CF_HDROP);
|
||||
|
||||
if(hMem)
|
||||
{
|
||||
char * pDropFiles = (char *)GlobalLock(hMem);
|
||||
if(pDropFiles)
|
||||
{
|
||||
int len, offset = sizeof(DROPFILESTRUCT);
|
||||
|
||||
while( pDropFiles[offset] != 0)
|
||||
{
|
||||
len = strlen(pDropFiles + offset);
|
||||
TRACE("%s\n", pDropFiles + offset);
|
||||
offset += len+1;
|
||||
}
|
||||
}
|
||||
GlobalUnlock(hMem);
|
||||
}
|
||||
CloseClipboard();
|
||||
#endif
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* ISVBgCm_fnInvokeCommand()
|
||||
*/
|
||||
static HRESULT WINAPI ISVBgCm_fnInvokeCommand(
|
||||
IContextMenu2 *iface,
|
||||
LPCMINVOKECOMMANDINFO lpcmi)
|
||||
{
|
||||
BgCmImpl *This = (BgCmImpl *)iface;
|
||||
|
||||
LPSHELLBROWSER lpSB;
|
||||
LPSHELLVIEW lpSV = NULL;
|
||||
HWND hWndSV = 0;
|
||||
|
||||
TRACE("(%p)->(invcom=%p verb=%p wnd=%p)\n",This,lpcmi,lpcmi->lpVerb, lpcmi->hwnd);
|
||||
|
||||
/* get the active IShellView */
|
||||
if((lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER,0,0)))
|
||||
{
|
||||
if(SUCCEEDED(IShellBrowser_QueryActiveShellView(lpSB, &lpSV)))
|
||||
{
|
||||
IShellView_GetWindow(lpSV, &hWndSV);
|
||||
}
|
||||
}
|
||||
|
||||
if(HIWORD(lpcmi->lpVerb))
|
||||
{
|
||||
TRACE("%s\n",lpcmi->lpVerb);
|
||||
|
||||
if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWLISTA))
|
||||
{
|
||||
if(hWndSV) SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_LISTVIEW,0),0 );
|
||||
}
|
||||
else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWDETAILSA))
|
||||
{
|
||||
if(hWndSV) SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_REPORTVIEW,0),0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
FIXME("please report: unknown verb %s\n",lpcmi->lpVerb);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(LOWORD(lpcmi->lpVerb))
|
||||
{
|
||||
case FCIDM_SHVIEW_REFRESH:
|
||||
if (lpSV) IShellView_Refresh(lpSV);
|
||||
break;
|
||||
case FCIDM_SHVIEW_INSERT:
|
||||
DoPaste(iface);
|
||||
break;
|
||||
|
||||
case FCIDM_SHVIEW_PROPERTIES:
|
||||
if (This->bDesktop) {
|
||||
ShellExecuteA(lpcmi->hwnd, "open", "rundll32.exe shell32.dll,Control_RunDLL desk.cpl", NULL, NULL, SW_SHOWNORMAL);
|
||||
} else {
|
||||
FIXME("launch item properties dialog\n");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
if (This->icm_new && SUCCEEDED(IContextMenu2_InvokeCommand(This->icm_new, lpcmi)))
|
||||
return S_OK;
|
||||
|
||||
/* if it's an id just pass it to the parent shv */
|
||||
if (hWndSV) SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(LOWORD(lpcmi->lpVerb), 0),0 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (lpSV)
|
||||
IShellView_Release(lpSV); /* QueryActiveShellView does AddRef */
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* ISVBgCm_fnGetCommandString()
|
||||
*
|
||||
*/
|
||||
static HRESULT WINAPI ISVBgCm_fnGetCommandString(
|
||||
IContextMenu2 *iface,
|
||||
UINT_PTR idCommand,
|
||||
UINT uFlags,
|
||||
UINT* lpReserved,
|
||||
LPSTR lpszName,
|
||||
UINT uMaxNameLen)
|
||||
{
|
||||
BgCmImpl *This = (BgCmImpl *)iface;
|
||||
|
||||
TRACE("(%p)->(idcom=%lx flags=%x %p name=%p len=%x)\n",This, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen);
|
||||
|
||||
/* test the existence of the menu items, the file dialog enables
|
||||
the buttons according to this */
|
||||
if (uFlags == GCS_VALIDATEA)
|
||||
{
|
||||
if(HIWORD(idCommand))
|
||||
{
|
||||
if (!strcmp((LPSTR)idCommand, CMDSTR_VIEWLISTA) ||
|
||||
!strcmp((LPSTR)idCommand, CMDSTR_VIEWDETAILSA))
|
||||
{
|
||||
return NOERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FIXME("unknown command string\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* ISVBgCm_fnHandleMenuMsg()
|
||||
*/
|
||||
static HRESULT WINAPI ISVBgCm_fnHandleMenuMsg(
|
||||
IContextMenu2 *iface,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
BgCmImpl *This = (BgCmImpl *)iface;
|
||||
|
||||
TRACE("ISVBgCm_fnHandleMenuMsg (%p)->(msg=%x wp=%lx lp=%lx)\n",This, uMsg, wParam, lParam);
|
||||
|
||||
if (This->icm_new)
|
||||
{
|
||||
IContextMenu2_HandleMenuMsg(This->icm_new, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* IContextMenu2 VTable
|
||||
*
|
||||
*/
|
||||
static const IContextMenu2Vtbl cmvt =
|
||||
{
|
||||
ISVBgCm_fnQueryInterface,
|
||||
ISVBgCm_fnAddRef,
|
||||
ISVBgCm_fnRelease,
|
||||
ISVBgCm_fnQueryContextMenu,
|
||||
ISVBgCm_fnInvokeCommand,
|
||||
ISVBgCm_fnGetCommandString,
|
||||
ISVBgCm_fnHandleMenuMsg
|
||||
};
|
1726
reactos/dll/win32/shell32/shv_def_cmenu.c
Normal file
1726
reactos/dll/win32/shell32/shv_def_cmenu.c
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -50,11 +50,14 @@ typedef struct __SHELLNEW_ITEM__
|
|||
typedef struct
|
||||
{
|
||||
const IContextMenu2Vtbl *lpVtblContextMenu;
|
||||
LPSHELLFOLDER pSFParent;
|
||||
const IShellExtInitVtbl *lpvtblShellExtInit;
|
||||
LPWSTR szPath;
|
||||
IShellFolder *pSFParent;
|
||||
PSHELLNEW_ITEM s_SnHead;
|
||||
}INewMenuImpl;
|
||||
|
||||
static const IContextMenu2Vtbl cmvt;
|
||||
static const IShellExtInitVtbl sei;
|
||||
static WCHAR szNew[MAX_PATH];
|
||||
|
||||
|
||||
|
@ -552,15 +555,20 @@ static void DoNewFolder(
|
|||
if (psfhlp)
|
||||
{
|
||||
LPITEMIDLIST pidl;
|
||||
ISFHelper_GetUniqueName(psfhlp, wszName, MAX_PATH);
|
||||
ISFHelper_AddFolder(psfhlp, 0, wszName, &pidl);
|
||||
|
||||
if (ISFHelper_GetUniqueName(psfhlp, wszName, MAX_PATH) != S_OK)
|
||||
return;
|
||||
if (ISFHelper_AddFolder(psfhlp, 0, wszName, &pidl) != S_OK)
|
||||
return;
|
||||
|
||||
if(psv)
|
||||
{
|
||||
IShellView_Refresh(psv);
|
||||
/* if we are in a shellview do labeledit */
|
||||
IShellView_SelectItem(psv,
|
||||
pidl,(SVSI_DESELECTOTHERS | SVSI_EDIT | SVSI_ENSUREVISIBLE
|
||||
|SVSI_FOCUSED|SVSI_SELECT));
|
||||
IShellView_Refresh(psv);
|
||||
}
|
||||
SHFree(pidl);
|
||||
|
||||
|
@ -569,12 +577,10 @@ static void DoNewFolder(
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static inline INewMenuImpl *impl_from_IShellExtInit( IShellExtInit *iface )
|
||||
{
|
||||
return (INewMenuImpl *)((char*)iface - FIELD_OFFSET(INewMenuImpl, lpvtblShellExtInit));
|
||||
}
|
||||
#endif
|
||||
|
||||
static __inline INewMenuImpl * impl_from_IContextMenu( IContextMenu2 *iface )
|
||||
{
|
||||
|
@ -583,22 +589,21 @@ static __inline INewMenuImpl * impl_from_IContextMenu( IContextMenu2 *iface )
|
|||
|
||||
static HRESULT WINAPI INewItem_fnQueryInterface(INewMenuImpl * This, REFIID riid, LPVOID *ppvObj)
|
||||
{
|
||||
TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);
|
||||
TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);
|
||||
|
||||
*ppvObj = NULL;
|
||||
*ppvObj = NULL;
|
||||
|
||||
if(IsEqualIID(riid, &IID_IUnknown) ||
|
||||
IsEqualIID(riid, &IID_IContextMenu) ||
|
||||
IsEqualIID(riid, &IID_IContextMenu2))
|
||||
{
|
||||
*ppvObj = &This->lpVtblContextMenu;
|
||||
}
|
||||
#if 0
|
||||
else if(IsEqualIID(riid, &IID_IShellExtInit))
|
||||
{
|
||||
*ppvObj = &This->lpvtblShellExtInit;
|
||||
}
|
||||
#endif
|
||||
{
|
||||
*ppvObj = &This->lpVtblContextMenu;
|
||||
}
|
||||
else if(IsEqualIID(riid, &IID_IShellExtInit))
|
||||
{
|
||||
*ppvObj = &This->lpvtblShellExtInit;
|
||||
}
|
||||
|
||||
|
||||
if(*ppvObj)
|
||||
{
|
||||
|
@ -757,12 +762,12 @@ INewItem_IContextMenu_fnHandleMenuMsg(IContextMenu2 *iface,
|
|||
LPARAM lParam)
|
||||
{
|
||||
INewMenuImpl *This = impl_from_IContextMenu(iface);
|
||||
//DRAWITEMSTRUCT * lpids = (DRAWITEMSTRUCT*) lParam;
|
||||
//MEASUREITEMSTRUCT *lpmis = (MEASUREITEMSTRUCT*) lParam;
|
||||
DRAWITEMSTRUCT * lpids = (DRAWITEMSTRUCT*) lParam;
|
||||
MEASUREITEMSTRUCT *lpmis = (MEASUREITEMSTRUCT*) lParam;
|
||||
|
||||
TRACE("INewItem_IContextMenu_fnHandleMenuMsg (%p)->(msg=%x wp=%lx lp=%lx)\n",This, uMsg, wParam, lParam);
|
||||
|
||||
TRACE("INewItem_IContextMenu_fnHandleMenuMsg (%p)->(msg=%x wp=%lx lp=%lx)\n",This, uMsg, wParam, lParam);
|
||||
|
||||
#if 0
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_MEASUREITEM:
|
||||
|
@ -772,9 +777,7 @@ INewItem_IContextMenu_fnHandleMenuMsg(IContextMenu2 *iface,
|
|||
return DoDrawItem(This, (HWND)wParam, lpids);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
return S_OK;
|
||||
#endif
|
||||
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
@ -790,7 +793,48 @@ static const IContextMenu2Vtbl cmvt =
|
|||
INewItem_IContextMenu_fnHandleMenuMsg
|
||||
};
|
||||
|
||||
static INewMenuImpl *cached_ow;
|
||||
static HRESULT WINAPI
|
||||
INewItem_ExtInit_fnQueryInterface( IShellExtInit* iface, REFIID riid, void** ppvObject )
|
||||
{
|
||||
return INewItem_fnQueryInterface(impl_from_IShellExtInit(iface), riid, ppvObject);
|
||||
}
|
||||
|
||||
static ULONG WINAPI
|
||||
INewItem_ExtInit_AddRef( IShellExtInit* iface )
|
||||
{
|
||||
return INewItem_fnAddRef(impl_from_IShellExtInit(iface));
|
||||
}
|
||||
|
||||
static ULONG WINAPI
|
||||
INewItem_ExtInit_Release( IShellExtInit* iface )
|
||||
{
|
||||
return INewItem_fnRelease(impl_from_IShellExtInit(iface));
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
INewItem_ExtInit_Initialize( IShellExtInit* iface, LPCITEMIDLIST pidlFolder,
|
||||
IDataObject *pdtobj, HKEY hkeyProgID )
|
||||
{
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IShellExtInitVtbl sei =
|
||||
{
|
||||
INewItem_ExtInit_fnQueryInterface,
|
||||
INewItem_ExtInit_AddRef,
|
||||
INewItem_ExtInit_Release,
|
||||
INewItem_ExtInit_Initialize
|
||||
};
|
||||
static INewMenuImpl *cached_ow = NULL;
|
||||
|
||||
VOID
|
||||
INewItem_SetCurrentShellFolder(IShellFolder * psfParent)
|
||||
{
|
||||
if (cached_ow)
|
||||
cached_ow->pSFParent = psfParent;
|
||||
}
|
||||
|
||||
HRESULT WINAPI INewItem_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv)
|
||||
{
|
||||
INewMenuImpl * ow;
|
||||
|
@ -798,14 +842,16 @@ HRESULT WINAPI INewItem_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *p
|
|||
|
||||
if (!cached_ow)
|
||||
{
|
||||
ow = LocalAlloc(LMEM_ZEROINIT, sizeof(INewMenuImpl));
|
||||
if (!ow)
|
||||
ow = LocalAlloc(LMEM_ZEROINIT, sizeof(INewMenuImpl));
|
||||
if (!ow)
|
||||
{
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
ow->lpVtblContextMenu = &cmvt;
|
||||
ow->lpvtblShellExtInit = &sei;
|
||||
ow->s_SnHead = NULL;
|
||||
ow->szPath = NULL;
|
||||
|
||||
if (InterlockedCompareExchangePointer((void *)&cached_ow, ow, NULL) != NULL)
|
||||
{
|
||||
|
@ -814,18 +860,6 @@ HRESULT WINAPI INewItem_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *p
|
|||
}
|
||||
}
|
||||
|
||||
TRACE("(%p)->()\n",cached_ow);
|
||||
|
||||
res = INewItem_fnQueryInterface( cached_ow, riid, ppv );
|
||||
return res;
|
||||
}
|
||||
|
||||
VOID INewItem_SetParent(LPSHELLFOLDER pSFParent)
|
||||
{
|
||||
if (cached_ow->pSFParent)
|
||||
{
|
||||
IShellFolder_Release(cached_ow->pSFParent);
|
||||
}
|
||||
cached_ow->pSFParent = pSFParent;
|
||||
IShellFolder_AddRef(pSFParent);
|
||||
}
|
||||
|
|
|
@ -178,8 +178,8 @@ typedef struct
|
|||
|
||||
int WINAPI Shell_GetCachedImageIndex(
|
||||
LPCSTR lpszFileName,
|
||||
UINT nIconIndex,
|
||||
BOOL bSimulateDoc);
|
||||
int nIconIndex,
|
||||
UINT bSimulateDoc);
|
||||
|
||||
BOOL WINAPI Shell_GetImageLists(
|
||||
HIMAGELIST *lphimlLarge,
|
||||
|
|
Loading…
Reference in a new issue