From 52b732dd0d492df3a0fe7ebd9d5eb0eaef16c114 Mon Sep 17 00:00:00 2001 From: Ulrich Czekalla Date: Mon, 19 May 2003 23:07:49 +0000 Subject: [PATCH] Handle SEE_MASK_CLASSKEY case for ShellExecute. --- dlls/shell32/classes.c | 25 +++++++++++++++++++++++++ dlls/shell32/shell32_main.h | 1 + dlls/shell32/shlexec.c | 14 ++++++++++---- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/dlls/shell32/classes.c b/dlls/shell32/classes.c index 0d6590a075a..703a56b2186 100644 --- a/dlls/shell32/classes.c +++ b/dlls/shell32/classes.c @@ -144,6 +144,31 @@ BOOL HCR_GetExecuteCommandA(LPCSTR szClass, LPCSTR szVerb, LPSTR szDest, DWORD l return FALSE; } +BOOL HCR_GetExecuteCommandEx( HKEY hkeyClass, LPCSTR szClass, LPCSTR szVerb, LPSTR szDest, DWORD len ) +{ + BOOL ret = FALSE; + + TRACE("%p %s %s\n", hkeyClass, szClass, szVerb ); + + if (szClass) + RegOpenKeyExA(hkeyClass,szClass,0,0x02000000,&hkeyClass); + + if (hkeyClass) + { + char sTemp[MAX_PATH]; + + snprintf(sTemp, MAX_PATH, "shell\\%s\\command", szVerb); + + ret = (ERROR_SUCCESS == SHGetValueA(hkeyClass, sTemp, NULL, NULL, szDest, &len)); + + if (szClass) + RegCloseKey(hkeyClass); + } + + TRACE("-- %s\n", szDest ); + return ret; +} + /*************************************************************************************** * HCR_GetDefaultIcon [internal] * diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h index efcfb0a3187..b3544500f2d 100644 --- a/dlls/shell32/shell32_main.h +++ b/dlls/shell32/shell32_main.h @@ -68,6 +68,7 @@ BOOL HCR_GetExecuteCommandA(LPCSTR szClass, LPCSTR szVerb, LPSTR szDest, DWORD l BOOL HCR_GetDefaultIconA(LPCSTR szClass, LPSTR szDest, DWORD len, LPDWORD dwNr); BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len); +BOOL HCR_GetExecuteCommandEx ( HKEY hkeyClass, LPCSTR szClass, LPCSTR szVerb, LPSTR szDest, DWORD len ); BOOL HCR_GetFolderAttributes(REFIID riid, LPDWORD szDest); INT_PTR CALLBACK AboutDlgProc(HWND,UINT,WPARAM,LPARAM); diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c index 5f533041116..87bb7adba66 100644 --- a/dlls/shell32/shlexec.c +++ b/dlls/shell32/shlexec.c @@ -582,8 +582,7 @@ BOOL WINAPI ShellExecuteExA32 (LPSHELLEXECUTEINFOA sei, SHELL_ExecuteA1632 execf if (sei->lpParameters) strcpy(szCommandline, sei->lpParameters); - if (sei->fMask & ((SEE_MASK_CLASSKEY & ~SEE_MASK_CLASSNAME) | - SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY | + if (sei->fMask & (SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY | SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT | SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE | SEE_MASK_NO_CONSOLE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR )) @@ -618,12 +617,19 @@ BOOL WINAPI ShellExecuteExA32 (LPSHELLEXECUTEINFOA sei, SHELL_ExecuteA1632 execf } } - if (sei->fMask & SEE_MASK_CLASSNAME) + if (sei->fMask & (SEE_MASK_CLASSNAME | SEE_MASK_CLASSKEY)) { /* launch a document by fileclass like 'WordPad.Document.1' */ /* the Commandline contains 'c:\Path\wordpad.exe "%1"' */ /* FIXME: szCommandline should not be of a fixed size. Plus MAX_PATH is way too short! */ - HCR_GetExecuteCommandA(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, sizeof(szCommandline)); + if (sei->fMask & SEE_MASK_CLASSKEY) + HCR_GetExecuteCommandEx(sei->hkeyClass, + (sei->fMask & SEE_MASK_CLASSNAME) ? sei->lpClass: NULL, + (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, sizeof(szCommandline)); + else if (sei->fMask & SEE_MASK_CLASSNAME) + HCR_GetExecuteCommandA(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : + "open", szCommandline, sizeof(szCommandline)); + /* FIXME: get the extension of lpFile, check if it fits to the lpClass */ TRACE("SEE_MASK_CLASSNAME->'%s', doc->'%s'\n", szCommandline, szApplicationName);