- Get rid of W->A calls for shlexec.

- Implementation of FindExecutableW.
This commit is contained in:
Marcelo Duarte 2004-01-15 06:13:57 +00:00 committed by Alexandre Julliard
parent f33de52f5e
commit 003465415f
3 changed files with 358 additions and 288 deletions

View File

@ -611,10 +611,13 @@ DWORD WINAPI RegEnumKey16( HKEY hkey, DWORD index, LPSTR name, DWORD name_len )
/************************************************************************* /*************************************************************************
* SHELL_Execute16 [Internal] * SHELL_Execute16 [Internal]
*/ */
static UINT SHELL_Execute16(char *lpCmd, void* env, LPSHELLEXECUTEINFOA sei, BOOL shWait) static UINT SHELL_Execute16(WCHAR *lpCmd, void* env, LPSHELLEXECUTEINFOW seiW, BOOL shWait)
{ {
UINT ret = WinExec16(lpCmd, sei->nShow); UINT ret;
sei->hInstApp = HINSTANCE_32(ret); char sCmd[MAX_PATH];
WideCharToMultiByte(CP_ACP, 0, lpCmd, -1, sCmd, MAX_PATH, NULL, NULL);
ret = WinExec16(sCmd, seiW->nShow);
seiW->hInstApp = HINSTANCE_32(ret);
return ret; return ret;
} }
@ -625,23 +628,38 @@ HINSTANCE16 WINAPI ShellExecute16( HWND16 hWnd, LPCSTR lpOperation,
LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpFile, LPCSTR lpParameters,
LPCSTR lpDirectory, INT16 iShowCmd ) LPCSTR lpDirectory, INT16 iShowCmd )
{ {
SHELLEXECUTEINFOA sei; SHELLEXECUTEINFOW seiW;
WCHAR *wVerb = NULL, *wFile = NULL, *wParameters = NULL, *wDirectory = NULL;
HANDLE hProcess = 0; HANDLE hProcess = 0;
sei.cbSize = sizeof(sei); if (lpOperation)
sei.fMask = 0; seiW.lpVerb = __SHCloneStrAtoW(&wVerb, lpOperation);
sei.hwnd = HWND_32(hWnd);
sei.lpVerb = lpOperation;
sei.lpFile = lpFile;
sei.lpParameters = lpParameters;
sei.lpDirectory = lpDirectory;
sei.nShow = iShowCmd;
sei.lpIDList = 0;
sei.lpClass = 0;
sei.hkeyClass = 0;
sei.dwHotKey = 0;
sei.hProcess = hProcess;
ShellExecuteExA32 (&sei, SHELL_Execute16); if (lpFile)
return HINSTANCE_16(sei.hInstApp); seiW.lpFile = __SHCloneStrAtoW(&wFile, lpFile);
if (lpParameters)
seiW.lpParameters = __SHCloneStrAtoW(&wParameters, lpParameters);
if (lpDirectory)
seiW.lpDirectory = __SHCloneStrAtoW(&wDirectory, lpDirectory);
seiW.cbSize = sizeof(seiW);
seiW.fMask = 0;
seiW.hwnd = HWND_32(hWnd);
seiW.nShow = iShowCmd;
seiW.lpIDList = 0;
seiW.lpClass = 0;
seiW.hkeyClass = 0;
seiW.dwHotKey = 0;
seiW.hProcess = hProcess;
ShellExecuteExW32 (&seiW, SHELL_Execute16);
if (wVerb) SHFree(wVerb);
if (wFile) SHFree(wFile);
if (wParameters) SHFree(wParameters);
if (wDirectory) SHFree(wDirectory);
return HINSTANCE_16(seiW.hInstApp);
} }

View File

@ -235,8 +235,6 @@ inline static WCHAR * __SHCloneStrAtoW(WCHAR ** target, const char * source)
#define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16)) #define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16))
#define HINSTANCE_16(h32) (LOWORD(h32)) #define HINSTANCE_16(h32) (LOWORD(h32))
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); typedef UINT (*SHELL_ExecuteW32)(WCHAR *lpCmd, void *env, LPSHELLEXECUTEINFOW sei, BOOL shWait);
BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc); BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc);

File diff suppressed because it is too large Load Diff