Fixed HCR_GetExecuteCommandW() behavior with a class name (based on a

patch by Martin Fuchs).
Removed a couple of no longer used functions.
This commit is contained in:
Alexandre Julliard 2004-01-16 23:06:25 +00:00
parent e6ab6bdcd7
commit e025c59051
3 changed files with 7 additions and 73 deletions

View File

@ -114,67 +114,7 @@ BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, DWORD len, BOOL b
}
BOOL HCR_GetExecuteCommandW(LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len)
{
static const WCHAR swShell[] = {'\\','s','h','e','l','l','\\',0};
static const WCHAR swCommand[] = {'\\','c','o','m','m','a','n','d',0};
WCHAR sTemp[MAX_PATH];
TRACE("%s %s %p\n",debugstr_w(szClass), debugstr_w(szVerb), szDest);
lstrcpyW(sTemp, szClass);
lstrcatW(sTemp, swShell);
lstrcatW(sTemp, szVerb);
lstrcatW(sTemp, swCommand);
if (ERROR_SUCCESS == SHGetValueW(HKEY_CLASSES_ROOT, sTemp, NULL, NULL, szDest, &len)) {
TRACE("-- %s\n", debugstr_w(szDest) );
return TRUE;
}
return FALSE;
}
BOOL HCR_GetExecuteCommandA(LPCSTR szClass, LPCSTR szVerb, LPSTR szDest, DWORD len)
{
char sTemp[MAX_PATH];
TRACE("%s %s\n",szClass, szVerb );
snprintf(sTemp, MAX_PATH, "%s\\shell\\%s\\command",szClass, szVerb);
if (ERROR_SUCCESS == SHGetValueA(HKEY_CLASSES_ROOT, sTemp, NULL, NULL, szDest, &len)) {
TRACE("-- %s\n", debugstr_a(szDest) );
return TRUE;
}
return FALSE;
}
BOOL HCR_GetExecuteCommandExA( 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;
}
BOOL HCR_GetExecuteCommandExW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len )
BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len )
{
static const WCHAR swShell[] = {'\\','s','h','e','l','l','\\',0};
static const WCHAR swCommand[] = {'\\','c','o','m','m','a','n','d',0};
@ -183,7 +123,7 @@ BOOL HCR_GetExecuteCommandExW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb,
TRACE("%p %s %s %p\n", hkeyClass, debugstr_w(szClass), debugstr_w(szVerb), szDest);
if (szClass)
RegOpenKeyExW(hkeyClass,szClass,0,0x02000000,&hkeyClass);
RegOpenKeyExW(HKEY_CLASSES_ROOT, szClass, 0, 0x02000000, &hkeyClass);
if (hkeyClass)
{

View File

@ -62,16 +62,13 @@ INT SIC_GetIconIndex (LPCSTR sSourceFile, INT dwSourceIndex );
/* Classes Root */
BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, DWORD len, BOOL bPrependDot);
BOOL HCR_GetExecuteCommandW(LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len);
BOOL HCR_GetExecuteCommandExW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len );
BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len );
BOOL HCR_GetDefaultIconW(LPCWSTR szClass, LPWSTR szDest, DWORD len, LPDWORD dwNr);
BOOL HCR_GetDefaultIconFromGUIDW(REFIID riid, LPWSTR szDest, DWORD len, LPDWORD dwNr);
BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len);
/* ANSI versions of above functions, supposed to go away as soon as they are not used anymore */
BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, DWORD len, BOOL bPrependDot);
BOOL HCR_GetExecuteCommandA(LPCSTR szClass, LPCSTR szVerb, LPSTR szDest, DWORD len);
BOOL HCR_GetExecuteCommandExA( HKEY hkeyClass, LPCSTR szClass, LPCSTR szVerb, LPSTR szDest, DWORD len );
BOOL HCR_GetDefaultIconA(LPCSTR szClass, LPSTR szDest, DWORD len, LPDWORD dwNr);
BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len);

View File

@ -736,13 +736,10 @@ BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfun
/* 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. Fixed to 1024, MAX_PATH is way too short! */
if (sei->fMask & SEE_MASK_CLASSKEY)
HCR_GetExecuteCommandExW(sei->hkeyClass,
(sei->fMask & SEE_MASK_CLASSNAME) ? sei->lpClass: NULL,
(sei->lpVerb) ? sei->lpVerb : wszOpen, wszCommandline, sizeof(wszCommandline)/sizeof(WCHAR));
else if (sei->fMask & SEE_MASK_CLASSNAME)
HCR_GetExecuteCommandW(sei->lpClass, (sei->lpVerb) ? sei->lpVerb :
wszOpen, wszCommandline, sizeof(wszCommandline)/sizeof(WCHAR));
HCR_GetExecuteCommandW((sei->fMask & SEE_MASK_CLASSKEY) ? sei->hkeyClass : NULL,
(sei->fMask & SEE_MASK_CLASSNAME) ? sei->lpClass: NULL,
(sei->lpVerb) ? sei->lpVerb : wszOpen,
wszCommandline, sizeof(wszCommandline)/sizeof(WCHAR));
/* FIXME: get the extension of lpFile, check if it fits to the lpClass */
TRACE("SEE_MASK_CLASSNAME->'%s', doc->'%s'\n", debugstr_w(wszCommandline), debugstr_w(wszApplicationName));