mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 23:33:01 +00:00
[SHELL32][BOOTDATA] Implement Command Prompt here (#2029)
Add "Command Prompt here" menu item to the Right-click menu of normal folders and drives. Currently, this menu item doesn't work correctly because of the bug of pushd. CORE-12150
This commit is contained in:
parent
e753d5e108
commit
90c63d12a1
38 changed files with 129 additions and 27 deletions
|
@ -562,49 +562,62 @@ CDefaultContextMenu::AddStaticContextMenusToMenu(
|
|||
/* By default use verb for menu item name */
|
||||
mii.dwTypeData = pEntry->szVerb;
|
||||
|
||||
WCHAR wszKey[256];
|
||||
HRESULT hr;
|
||||
hr = StringCbPrintfW(wszKey, sizeof(wszKey), L"shell\\%s", pEntry->szVerb);
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
{
|
||||
pEntry = pEntry->pNext;
|
||||
continue;
|
||||
}
|
||||
|
||||
BOOL Extended = FALSE;
|
||||
HKEY hkVerb;
|
||||
if (idResource > 0)
|
||||
{
|
||||
if (LoadStringW(shell32_hInstance, idResource, wszVerb, _countof(wszVerb)))
|
||||
mii.dwTypeData = wszVerb; /* use translated verb */
|
||||
else
|
||||
ERR("Failed to load string\n");
|
||||
|
||||
LONG res = RegOpenKeyW(pEntry->hkClass, wszKey, &hkVerb);
|
||||
if (res == ERROR_SUCCESS)
|
||||
{
|
||||
res = RegQueryValueExW(hkVerb, L"Extended", NULL, NULL, NULL, NULL);
|
||||
Extended = (res == ERROR_SUCCESS);
|
||||
|
||||
RegCloseKey(hkVerb);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WCHAR wszKey[256];
|
||||
HRESULT hr = StringCbPrintfW(wszKey, sizeof(wszKey), L"shell\\%s", pEntry->szVerb);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
LONG res = RegOpenKeyW(pEntry->hkClass, wszKey, &hkVerb);
|
||||
if (res == ERROR_SUCCESS)
|
||||
{
|
||||
HKEY hkVerb;
|
||||
DWORD cbVerb = sizeof(wszVerb);
|
||||
LONG res = RegOpenKeyW(pEntry->hkClass, wszKey, &hkVerb);
|
||||
res = RegLoadMUIStringW(hkVerb, NULL, wszVerb, cbVerb, NULL, 0, NULL);
|
||||
if (res == ERROR_SUCCESS)
|
||||
{
|
||||
res = RegLoadMUIStringW(hkVerb,
|
||||
NULL,
|
||||
wszVerb,
|
||||
cbVerb,
|
||||
NULL,
|
||||
0,
|
||||
NULL);
|
||||
if (res == ERROR_SUCCESS)
|
||||
{
|
||||
/* use description for the menu entry */
|
||||
mii.dwTypeData = wszVerb;
|
||||
}
|
||||
|
||||
RegCloseKey(hkVerb);
|
||||
/* use description for the menu entry */
|
||||
mii.dwTypeData = wszVerb;
|
||||
}
|
||||
|
||||
res = RegQueryValueExW(hkVerb, L"Extended", NULL, NULL, NULL, NULL);
|
||||
Extended = (res == ERROR_SUCCESS);
|
||||
|
||||
RegCloseKey(hkVerb);
|
||||
}
|
||||
}
|
||||
|
||||
mii.cch = wcslen(mii.dwTypeData);
|
||||
mii.fState = fState;
|
||||
mii.wID = iIdCmdFirst + cIds;
|
||||
InsertMenuItemW(hMenu, *pIndexMenu, TRUE, &mii);
|
||||
(*pIndexMenu)++;
|
||||
cIds++;
|
||||
if (!Extended || GetAsyncKeyState(VK_SHIFT) < 0)
|
||||
{
|
||||
mii.cch = wcslen(mii.dwTypeData);
|
||||
mii.fState = fState;
|
||||
mii.wID = iIdCmdFirst + cIds;
|
||||
InsertMenuItemW(hMenu, *pIndexMenu, TRUE, &mii);
|
||||
(*pIndexMenu)++;
|
||||
cIds++;
|
||||
}
|
||||
|
||||
pEntry = pEntry->pNext;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue