Janitorial: Get rid of W->A calls for shlexec (1/2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Changelog:
Marcelo Duarte <wine-devel@xxxxxxxxxx>
* dlls/shell32/classes.c
-Implementation of HCR_GetExecuteCommandExW for internal use
* dlls/shell32/shell32_main.h
-new inline function  __SHCloneStrAtoW and its use in ShellExecuteExA in next 
patch, etc.

-- 
Marcelo Duarte
Index: dlls/shell32/classes.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/classes.c,v
retrieving revision 1.31
diff -u -u -p -r1.31 classes.c
--- dlls/shell32/classes.c	5 Sep 2003 23:08:31 -0000	1.31
+++ dlls/shell32/classes.c	9 Dec 2003 06:34:40 -0000
@@ -149,7 +149,7 @@ BOOL HCR_GetExecuteCommandA(LPCSTR szCla
 	return FALSE;
 }
 
-BOOL HCR_GetExecuteCommandEx( HKEY hkeyClass, LPCSTR szClass, LPCSTR szVerb, LPSTR szDest, DWORD len )
+BOOL HCR_GetExecuteCommandExA( HKEY hkeyClass, LPCSTR szClass, LPCSTR szVerb, LPSTR szDest, DWORD len )
 {
 	BOOL	ret = FALSE;
 
@@ -171,6 +171,34 @@ BOOL HCR_GetExecuteCommandEx( HKEY hkeyC
 	}
 
 	TRACE("-- %s\n", szDest );
+	return ret;
+}
+
+BOOL HCR_GetExecuteCommandExW( 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};
+	BOOL	ret = FALSE;
+
+	TRACE("%p %s %s %p\n", hkeyClass, debugstr_w(szClass), debugstr_w(szVerb), szDest);
+
+	if (szClass)
+            RegOpenKeyExW(hkeyClass,szClass,0,0x02000000,&hkeyClass);
+
+        if (hkeyClass)
+	{
+	    WCHAR sTemp[MAX_PATH];
+	    lstrcpyW(sTemp, swShell);
+	    lstrcatW(sTemp, szVerb);
+	    lstrcatW(sTemp, swCommand);
+
+	    ret = (ERROR_SUCCESS == SHGetValueW(hkeyClass, sTemp, NULL, NULL, szDest, &len));
+
+	    if (szClass)
+	       RegCloseKey(hkeyClass);
+	}
+
+	TRACE("-- %s\n", debugstr_w(szDest) );
 	return ret;
 }
 
Index: dlls/shell32/shell32_main.h
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shell32_main.h,v
retrieving revision 1.74
diff -u -u -p -r1.74 shell32_main.h
--- dlls/shell32/shell32_main.h	26 Nov 2003 03:59:17 -0000	1.74
+++ dlls/shell32/shell32_main.h	9 Dec 2003 06:34:42 -0000
@@ -35,6 +35,7 @@
 #include "shlobj.h"
 #include "shellapi.h"
 #include "wine/windef16.h"
+#include "wine/unicode.h"
 
 /*******************************************
 *  global SHELL32.DLL variables
@@ -62,6 +63,7 @@ INT SIC_GetIconIndex (LPCSTR sSourceFile
 /* 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_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);
@@ -69,10 +71,10 @@ BOOL HCR_GetClassNameW(REFIID riid, LPWS
 /* 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);
 
-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);
@@ -202,8 +204,8 @@ inline static BOOL SHELL_OsIsUnicode(voi
 	};
 inline static void __SHCloneStrA(char ** target,const char * source)
 {
-	*target = SHAlloc(strlen(source)+1); \
-	strcpy(*target, source); \
+	*target = SHAlloc(strlen(source)+1);
+	strcpy(*target, source);
 }
 
 inline static void __SHCloneStrWtoA(char ** target, const WCHAR * source)
@@ -213,6 +215,20 @@ inline static void __SHCloneStrWtoA(char
 	WideCharToMultiByte(CP_ACP, 0, source, -1, *target, len, NULL, NULL);
 }
 
+inline static void __SHCloneStrW(WCHAR ** target, const WCHAR * source)
+{
+	*target = SHAlloc(strlenW(source)+1);
+	strcpyW(*target, source);
+}
+
+inline static WCHAR * __SHCloneStrAtoW(WCHAR ** target, const char * source)
+{
+	int len = MultiByteToWideChar(CP_ACP, 0, source, -1, NULL, 0);
+	*target = SHAlloc(len);
+	MultiByteToWideChar(CP_ACP, 0, source, -1, *target, len);
+	return *target;
+}
+
 /* handle conversions */
 #define HICON_16(h32)		(LOWORD(h32))
 #define HICON_32(h16)		((HICON)(ULONG_PTR)(h16))
@@ -221,5 +237,7 @@ inline static void __SHCloneStrWtoA(char
 
 typedef UINT (*SHELL_ExecuteA1632)(char *lpCmd, void *env, LPSHELLEXECUTEINFOA sei, BOOL shWait);
 BOOL WINAPI ShellExecuteExA32 (LPSHELLEXECUTEINFOA sei, SHELL_ExecuteA1632 execfunc);
+typedef UINT (*SHELL_ExecuteW32)(WCHAR *lpCmd, void *env, LPSHELLEXECUTEINFOW sei, BOOL shWait);
+BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc);
 
 #endif
Index: dlls/shell32/shlexec.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlexec.c,v
retrieving revision 1.23
diff -u -u -p -r1.23 shlexec.c
--- dlls/shell32/shlexec.c	26 Sep 2003 04:35:01 -0000	1.23
+++ dlls/shell32/shlexec.c	9 Dec 2003 06:34:46 -0000
@@ -688,7 +688,7 @@ BOOL WINAPI ShellExecuteExA32 (LPSHELLEX
         /* the Commandline contains 'c:\Path\wordpad.exe "%1"' */
         /* FIXME: szCommandline should not be of a fixed size. Plus MAX_PATH is way too short! */
         if (sei->fMask & SEE_MASK_CLASSKEY)
-            HCR_GetExecuteCommandEx(sei->hkeyClass,
+            HCR_GetExecuteCommandExA(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)

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux