mirror of
https://github.com/reactos/reactos.git
synced 2025-01-04 21:38:43 +00:00
[SHELL32]
- Formatting. No code changes. svn path=/trunk/; revision=54845
This commit is contained in:
parent
898071bb08
commit
61e7814932
4 changed files with 725 additions and 776 deletions
|
@ -259,16 +259,15 @@ static LRESULT WINAPI Control_WndProc(HWND hWnd, UINT wMsg,
|
|||
case WM_CREATE:
|
||||
Control_WndProc_Create(hWnd, (CREATESTRUCTW*)lParam2);
|
||||
return 0;
|
||||
|
||||
case WM_DESTROY:
|
||||
{
|
||||
CPlApplet* applet = panel->first;
|
||||
CPlApplet *applet = panel->first;
|
||||
while (applet)
|
||||
applet = Control_UnloadApplet(applet);
|
||||
|
||||
PostQuitMessage(0);
|
||||
}; break;
|
||||
|
||||
break;
|
||||
}
|
||||
case WM_PAINT:
|
||||
return Control_WndProc_Paint(panel, lParam1);
|
||||
case WM_LBUTTONUP:
|
||||
|
@ -324,27 +323,26 @@ static void Control_DoInterface(CPanel* panel, HWND hWnd, HINSTANCE hInst)
|
|||
}
|
||||
}
|
||||
|
||||
static void Control_DoWindow(CPanel* panel, HWND hWnd, HINSTANCE hInst)
|
||||
static void Control_DoWindow(CPanel *panel, HWND hWnd, HINSTANCE hInst)
|
||||
{
|
||||
HANDLE h;
|
||||
WIN32_FIND_DATAW fd;
|
||||
WCHAR buffer[MAX_PATH];
|
||||
static const WCHAR wszAllCpl[] = {'*','.','c','p','l',0};
|
||||
WCHAR *p;
|
||||
HANDLE hFind;
|
||||
WIN32_FIND_DATAW wfd;
|
||||
WCHAR wszPath[MAX_PATH];
|
||||
WCHAR *Ptr = wszPath;
|
||||
|
||||
GetSystemDirectoryW( buffer, MAX_PATH );
|
||||
p = buffer + wcslen(buffer);
|
||||
*p++ = '\\';
|
||||
wcscpy(p, wszAllCpl);
|
||||
Ptr += GetSystemDirectoryW(wszPath, MAX_PATH);
|
||||
*Ptr++ = '\\';
|
||||
wcscpy(Ptr, L"*.cpl");
|
||||
|
||||
if ((h = FindFirstFileW(buffer, &fd)) != INVALID_HANDLE_VALUE)
|
||||
hFind = FindFirstFileW(wszPath, &wfd);
|
||||
if (hFind != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
do
|
||||
{
|
||||
wcscpy(p, fd.cFileName);
|
||||
Control_LoadApplet(hWnd, buffer, panel);
|
||||
} while (FindNextFileW(h, &fd));
|
||||
FindClose(h);
|
||||
wcscpy(Ptr, wfd.cFileName);
|
||||
Control_LoadApplet(hWnd, wszPath, panel);
|
||||
} while (FindNextFileW(hFind, &wfd));
|
||||
FindClose(hFind);
|
||||
}
|
||||
|
||||
Control_DoInterface(panel, hWnd, hInst);
|
||||
|
|
|
@ -36,7 +36,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
|||
class CControlPanelEnum :
|
||||
public IEnumIDListImpl
|
||||
{
|
||||
private:
|
||||
public:
|
||||
CControlPanelEnum();
|
||||
~CControlPanelEnum();
|
||||
|
|
|
@ -77,14 +77,12 @@ GetKeyDescription(LPWSTR szKeyName, LPWSTR szResult)
|
|||
DWORD dwDesc, dwError;
|
||||
WCHAR szDesc[100];
|
||||
|
||||
static const WCHAR szFriendlyTypeName[] = { '\\','F','r','i','e','n','d','l','y','T','y','p','e','N','a','m','e',0 };
|
||||
|
||||
TRACE("GetKeyDescription: keyname %s\n", debugstr_w(szKeyName));
|
||||
|
||||
if (RegOpenKeyExW(HKEY_CLASSES_ROOT,szKeyName,0, KEY_READ | KEY_QUERY_VALUE,&hKey) != ERROR_SUCCESS)
|
||||
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, szKeyName, 0, KEY_READ | KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
if (RegLoadMUIStringW(hKey,szFriendlyTypeName,szResult,MAX_PATH,&dwDesc,0,NULL) == ERROR_SUCCESS)
|
||||
if (RegLoadMUIStringW(hKey, L"\\FriendlyTypeName", szResult, MAX_PATH, &dwDesc, 0, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
TRACE("result %s\n", debugstr_w(szResult));
|
||||
RegCloseKey(hKey);
|
||||
|
@ -92,7 +90,7 @@ GetKeyDescription(LPWSTR szKeyName, LPWSTR szResult)
|
|||
}
|
||||
/* fetch default value */
|
||||
dwDesc = sizeof(szDesc);
|
||||
dwError = RegGetValueW(hKey,NULL,NULL, RRF_RT_REG_SZ,NULL,szDesc,&dwDesc);
|
||||
dwError = RegGetValueW(hKey, NULL, NULL, RRF_RT_REG_SZ, NULL, szDesc, &dwDesc);
|
||||
if(dwError == ERROR_SUCCESS)
|
||||
{
|
||||
if (wcsncmp(szKeyName, szDesc, dwDesc / sizeof(WCHAR)))
|
||||
|
@ -124,66 +122,58 @@ GetKeyDescription(LPWSTR szKeyName, LPWSTR szResult)
|
|||
CNewMenu::SHELLNEW_ITEM *CNewMenu::LoadItem(LPWSTR szKeyName)
|
||||
{
|
||||
HKEY hKey;
|
||||
DWORD dwIndex;
|
||||
DWORD dwIndex = 0;
|
||||
WCHAR szName[MAX_PATH];
|
||||
WCHAR szCommand[MAX_PATH];
|
||||
WCHAR szDesc[MAX_PATH] = {0};
|
||||
WCHAR szIcon[MAX_PATH] = {0};
|
||||
WCHAR szDesc[MAX_PATH] = L"";
|
||||
WCHAR szIcon[MAX_PATH] = L"";
|
||||
DWORD dwName, dwCommand;
|
||||
LONG result;
|
||||
SHELLNEW_ITEM *pNewItem;
|
||||
|
||||
static const WCHAR szShellNew[] = { '\\','S','h','e','l','l','N','e','w',0 };
|
||||
static const WCHAR szCmd[] = { 'C','o','m','m','a','n','d',0 };
|
||||
static const WCHAR szData[] = { 'D','a','t','a',0 };
|
||||
static const WCHAR szFileName[] = { 'F','i','l','e','N','a','m','e', 0 };
|
||||
static const WCHAR szNullFile[] = { 'N','u','l','l','F','i','l','e', 0 };
|
||||
|
||||
SHELLNEW_ITEM *pNewItem = NULL;
|
||||
|
||||
wcscpy(szName, szKeyName);
|
||||
GetKeyDescription(szKeyName, szDesc);
|
||||
wcscat(szName, szShellNew);
|
||||
result = RegOpenKeyExW(HKEY_CLASSES_ROOT,szName,0,KEY_READ,&hKey);
|
||||
wcscat(szName, L"\\ShellNew");
|
||||
result = RegOpenKeyExW(HKEY_CLASSES_ROOT, szName, 0, KEY_READ, &hKey);
|
||||
|
||||
//TRACE("LoadItem dwName %d keyname %s szName %s szDesc %s szIcon %s\n", dwName, debugstr_w(szKeyName), debugstr_w(szName), debugstr_w(szDesc), debugstr_w(szIcon));
|
||||
TRACE("LoadItem dwName %d keyname %s szName %s szDesc %s szIcon %s\n", dwName, debugstr_w(szKeyName), debugstr_w(szName), debugstr_w(szDesc), debugstr_w(szIcon));
|
||||
|
||||
if (result != ERROR_SUCCESS)
|
||||
{
|
||||
TRACE("Failed to open key\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dwIndex = 0;
|
||||
pNewItem = NULL;
|
||||
|
||||
do
|
||||
{
|
||||
dwName = MAX_PATH;
|
||||
dwCommand = MAX_PATH;
|
||||
result = RegEnumValueW(hKey,dwIndex,szName,&dwName,NULL,NULL,(LPBYTE)szCommand, &dwCommand);
|
||||
result = RegEnumValueW(hKey, dwIndex, szName, &dwName, NULL, NULL, (LPBYTE)szCommand, &dwCommand);
|
||||
if (result == ERROR_SUCCESS)
|
||||
{
|
||||
SHELLNEW_TYPE type = SHELLNEW_TYPE_INVALID;
|
||||
LPWSTR szTarget = szCommand;
|
||||
//TRACE("szName %s szCommand %s\n", debugstr_w(szName), debugstr_w(szCommand));
|
||||
if (!wcsicmp(szName, szCmd))
|
||||
{
|
||||
|
||||
TRACE("szName %s szCommand %s\n", debugstr_w(szName), debugstr_w(szCommand));
|
||||
|
||||
if (!wcsicmp(szName, L"Command"))
|
||||
type = SHELLNEW_TYPE_COMMAND;
|
||||
}else if (!wcsicmp(szName, szData))
|
||||
{
|
||||
else if (!wcsicmp(szName, L"Data"))
|
||||
type = SHELLNEW_TYPE_DATA;
|
||||
}
|
||||
else if (!wcsicmp(szName, szFileName))
|
||||
{
|
||||
else if (!wcsicmp(szName, L"FileName"))
|
||||
type = SHELLNEW_TYPE_FILENAME;
|
||||
}
|
||||
else if (!wcsicmp(szName, szNullFile))
|
||||
else if (!wcsicmp(szName, L"NullFile"))
|
||||
{
|
||||
type = SHELLNEW_TYPE_NULLFILE;
|
||||
szTarget = NULL;
|
||||
}
|
||||
|
||||
if (type != SHELLNEW_TYPE_INVALID)
|
||||
{
|
||||
pNewItem = (SHELLNEW_ITEM *)HeapAlloc(GetProcessHeap(), 0, sizeof(SHELLNEW_ITEM));
|
||||
if (!pNewItem)
|
||||
break;
|
||||
|
||||
pNewItem->Type = type;
|
||||
if (szTarget)
|
||||
pNewItem->szTarget = _wcsdup(szTarget);
|
||||
|
@ -198,12 +188,11 @@ CNewMenu::SHELLNEW_ITEM *CNewMenu::LoadItem(LPWSTR szKeyName)
|
|||
}
|
||||
}
|
||||
dwIndex++;
|
||||
}while(result != ERROR_NO_MORE_ITEMS);
|
||||
} while(result != ERROR_NO_MORE_ITEMS);
|
||||
RegCloseKey(hKey);
|
||||
return pNewItem;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
CNewMenu::LoadShellNewItems()
|
||||
{
|
||||
|
@ -212,25 +201,23 @@ CNewMenu::LoadShellNewItems()
|
|||
LONG result;
|
||||
SHELLNEW_ITEM *pNewItem;
|
||||
SHELLNEW_ITEM *pCurItem = NULL;
|
||||
static WCHAR szLnk[] = { '.','l','n','k',0 };
|
||||
|
||||
/* insert do new folder action */
|
||||
if (!LoadStringW(shell32_hInstance, FCIDM_SHVIEW_NEW, szNew, sizeof(szNew) / sizeof(WCHAR)))
|
||||
szNew[0] = 0;
|
||||
szNew[MAX_PATH-1] = 0;
|
||||
|
||||
UnloadShellItems();
|
||||
|
||||
dwIndex = 0;
|
||||
do
|
||||
{
|
||||
result = RegEnumKeyW(HKEY_CLASSES_ROOT,dwIndex,szName,MAX_PATH);
|
||||
result = RegEnumKeyW(HKEY_CLASSES_ROOT, dwIndex, szName, MAX_PATH);
|
||||
if (result == ERROR_SUCCESS)
|
||||
{
|
||||
pNewItem = LoadItem(szName);
|
||||
if (pNewItem)
|
||||
{
|
||||
if (!wcsicmp(pNewItem->szExt, szLnk))
|
||||
if (!wcsicmp(pNewItem->szExt, L".lnk"))
|
||||
{
|
||||
if (s_SnHead)
|
||||
{
|
||||
|
@ -257,7 +244,7 @@ CNewMenu::LoadShellNewItems()
|
|||
}
|
||||
}
|
||||
dwIndex++;
|
||||
}while(result != ERROR_NO_MORE_ITEMS);
|
||||
} while(result != ERROR_NO_MORE_ITEMS);
|
||||
|
||||
if (s_SnHead == NULL)
|
||||
return FALSE;
|
||||
|
@ -333,7 +320,7 @@ CNewMenu::InsertShellNewItems(HMENU hMenu, UINT idFirst, UINT idMenu)
|
|||
pCurItem = pCurItem->Next;
|
||||
i++;
|
||||
}
|
||||
return (i+2);
|
||||
return (i + 2);
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -355,9 +342,6 @@ CNewMenu::DoShellNewCmd(LPCMINVOKECOMMANDINFO lpcmi, IShellView *psv)
|
|||
CComPtr<IShellFolder> parentFolder;
|
||||
HRESULT hResult;
|
||||
|
||||
static const WCHAR szP1[] = { '%', '1', 0 };
|
||||
static const WCHAR szFormat[] = {'%','s',' ','(','%','d',')','%','s',0 };
|
||||
|
||||
i = 1;
|
||||
target = LOWORD(lpcmi->lpVerb);
|
||||
|
||||
|
@ -413,7 +397,7 @@ CNewMenu::DoShellNewCmd(LPCMINVOKECOMMANDINFO lpcmi, IShellView *psv)
|
|||
break;
|
||||
}
|
||||
|
||||
ptr = wcsstr(szBuffer, szP1);
|
||||
ptr = wcsstr(szBuffer, L"%1");
|
||||
if (ptr)
|
||||
{
|
||||
ptr[1] = 's';
|
||||
|
@ -430,7 +414,7 @@ CNewMenu::DoShellNewCmd(LPCMINVOKECOMMANDINFO lpcmi, IShellView *psv)
|
|||
szCmd = _wcsdup(ptr);
|
||||
if (!szCmd)
|
||||
break;
|
||||
if (CreateProcessW(NULL, szCmd, NULL, NULL,FALSE,0,NULL,NULL,&sInfo, &pi))
|
||||
if (CreateProcessW(NULL, szCmd, NULL, NULL, FALSE, 0, NULL, NULL, &sInfo, &pi))
|
||||
{
|
||||
CloseHandle( pi.hProcess );
|
||||
CloseHandle( pi.hThread );
|
||||
|
@ -458,16 +442,16 @@ CNewMenu::DoShellNewCmd(LPCMINVOKECOMMANDINFO lpcmi, IShellView *psv)
|
|||
dwError = GetLastError();
|
||||
|
||||
TRACE("FileName %s szBuffer %s i %u error %x\n", debugstr_w(szBuffer), debugstr_w(szPath), i, dwError);
|
||||
swprintf(szBuffer, szFormat, szPath, i, pCurItem->szExt);
|
||||
swprintf(szBuffer, L"%s (%d)%s", szPath, i, pCurItem->szExt);
|
||||
i++;
|
||||
}while(hFile == INVALID_HANDLE_VALUE && dwError == ERROR_FILE_EXISTS);
|
||||
} while(hFile == INVALID_HANDLE_VALUE && dwError == ERROR_FILE_EXISTS);
|
||||
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
return E_FAIL;
|
||||
|
||||
if (pCurItem->Type == SHELLNEW_TYPE_DATA)
|
||||
{
|
||||
i = WideCharToMultiByte(CP_ACP, 0, pCurItem->szTarget, -1, (LPSTR)szTemp, MAX_PATH*2, NULL, NULL);
|
||||
i = WideCharToMultiByte(CP_ACP, 0, pCurItem->szTarget, -1, (LPSTR)szTemp, MAX_PATH * 2, NULL, NULL);
|
||||
if (i)
|
||||
{
|
||||
WriteFile(hFile, (LPCVOID)szTemp, i, &dwWritten, NULL);
|
||||
|
@ -570,7 +554,7 @@ CNewMenu::DoDrawItem(HWND hWnd, DRAWITEMSTRUCT * drawItem)
|
|||
void CNewMenu::DoNewFolder(
|
||||
IShellView *psv)
|
||||
{
|
||||
ISFHelper * psfhlp;
|
||||
ISFHelper *psfhlp;
|
||||
WCHAR wszName[MAX_PATH];
|
||||
CComPtr<IFolderView> folderView;
|
||||
CComPtr<IShellFolder> parentFolder;
|
||||
|
@ -600,8 +584,8 @@ void CNewMenu::DoNewFolder(
|
|||
psv->Refresh();
|
||||
/* if we are in a shellview do labeledit */
|
||||
psv->SelectItem(
|
||||
pidl,(SVSI_DESELECTOTHERS | SVSI_EDIT | SVSI_ENSUREVISIBLE
|
||||
|SVSI_FOCUSED|SVSI_SELECT));
|
||||
pidl, (SVSI_DESELECTOTHERS | SVSI_EDIT | SVSI_ENSUREVISIBLE
|
||||
| SVSI_FOCUSED | SVSI_SELECT));
|
||||
psv->Refresh();
|
||||
}
|
||||
SHFree(pidl);
|
||||
|
@ -642,11 +626,8 @@ CNewMenu::QueryContextMenu(HMENU hmenu,
|
|||
TRACE("%p %p %u %u %u %u\n", this,
|
||||
hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags );
|
||||
|
||||
if (!LoadStringW(shell32_hInstance, FCIDM_SHVIEW_NEW, szBuffer, 200))
|
||||
{
|
||||
if (!LoadStringW(shell32_hInstance, FCIDM_SHVIEW_NEW, szBuffer, _countof(szBuffer)))
|
||||
szBuffer[0] = 0;
|
||||
}
|
||||
szBuffer[199] = 0;
|
||||
|
||||
hSubMenu = CreateMenu();
|
||||
memset( &mii, 0, sizeof(mii) );
|
||||
|
@ -655,21 +636,20 @@ CNewMenu::QueryContextMenu(HMENU hmenu,
|
|||
mii.fType = MFT_STRING;
|
||||
mii.wID = idCmdFirst + id++;
|
||||
mii.dwTypeData = szBuffer;
|
||||
mii.cch = wcslen( mii.dwTypeData );
|
||||
mii.cch = wcslen(mii.dwTypeData);
|
||||
mii.fState = MFS_ENABLED;
|
||||
|
||||
if (hSubMenu)
|
||||
{
|
||||
id += InsertShellNewItems( hSubMenu, idCmdFirst, 0);
|
||||
id += InsertShellNewItems(hSubMenu, idCmdFirst, 0);
|
||||
mii.fMask |= MIIM_SUBMENU;
|
||||
mii.hSubMenu = hSubMenu;
|
||||
}
|
||||
|
||||
|
||||
if (!InsertMenuItemW( hmenu, indexMenu, TRUE, &mii ))
|
||||
if (!InsertMenuItemW(hmenu, indexMenu, TRUE, &mii))
|
||||
return E_FAIL;
|
||||
|
||||
return MAKE_HRESULT( SEVERITY_SUCCESS, 0, id );
|
||||
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, id);
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -680,7 +660,7 @@ CNewMenu::InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
|
|||
LPSHELLVIEW lpSV = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
if((lpSB = (LPSHELLBROWSER)SendMessageA(lpici->hwnd, CWM_GETISHELLBROWSER,0,0)))
|
||||
if((lpSB = (LPSHELLBROWSER)SendMessageA(lpici->hwnd, CWM_GETISHELLBROWSER, 0, 0)))
|
||||
{
|
||||
lpSB->QueryActiveShellView(&lpSV);
|
||||
}
|
||||
|
@ -721,11 +701,10 @@ CNewMenu::HandleMenuMsg(UINT uMsg,
|
|||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
DRAWITEMSTRUCT * lpids = (DRAWITEMSTRUCT*) 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);
|
||||
|
||||
switch(uMsg)
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue