2 * Shell Library Functions
4 * Copyright 1998 Marcus Meissner
5 * Copyright 2002 Eric Pouech
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "wine/port.h"
44 #include "wine/winbase16.h"
45 #include "shell32_main.h"
46 #include "undocshell.h"
48 #include "wine/debug.h"
50 WINE_DEFAULT_DEBUG_CHANNEL(exec);
52 /***********************************************************************
53 * this function is supposed to expand the escape sequences found in the registry
54 * some diving reported that the following were used:
55 * + %1, %2... seem to report to parameter of index N in ShellExecute pmts
60 * %I address of a global item ID (explorer switch /idlist)
61 * %L seems to be %1 as long filename followed by the 8+3 variation
63 * %* all following parameters (see batfile)
65 static BOOL argify(char* res, int len, const char* fmt, const char* lpFile)
82 if (!done || (*fmt == '1'))
84 if (SearchPathA(NULL, lpFile, ".exe", sizeof(xlpFile), xlpFile, NULL))
87 res += strlen(xlpFile);
92 res += strlen(lpFile);
97 * IE uses this alot for activating things such as windows media
98 * player. This is not verified to be fully correct but it appears
103 res += strlen(lpFile);
106 default: FIXME("Unknown escape sequence %%%c\n", *fmt);
118 /*************************************************************************
119 * SHELL_ExecuteA [Internal]
122 static UINT SHELL_ExecuteA(char *lpCmd, LPSHELLEXECUTEINFOA sei, BOOL shWait)
124 STARTUPINFOA startup;
125 PROCESS_INFORMATION info;
128 TRACE("Execute %s from directory %s\n", lpCmd, sei->lpDirectory);
129 ZeroMemory(&startup,sizeof(STARTUPINFOA));
130 startup.cb = sizeof(STARTUPINFOA);
131 startup.dwFlags = STARTF_USESHOWWINDOW;
132 startup.wShowWindow = sei->nShow;
133 if (CreateProcessA(NULL, lpCmd, NULL, NULL, FALSE, 0,
134 NULL, sei->lpDirectory, &startup, &info))
136 /* Give 30 seconds to the app to come up, if desired. Probably only needed
137 when starting app immediately before making a DDE connection. */
139 if (WaitForInputIdle( info.hProcess, 30000 ) == -1)
140 WARN("WaitForInputIdle failed: Error %ld\n", GetLastError() );
142 if(sei->fMask & SEE_MASK_NOCLOSEPROCESS)
143 sei->hProcess = info.hProcess;
145 CloseHandle( info.hProcess );
146 CloseHandle( info.hThread );
148 else if ((retval = GetLastError()) >= 32)
150 FIXME("Strange error set by CreateProcess: %d\n", retval);
151 retval = ERROR_BAD_FORMAT;
154 sei->hInstApp = (HINSTANCE)retval;
158 /***********************************************************************
161 * Helper function for SHELL_FindExecutable
162 * @param lpResult - pointer to a buffer of size MAX_PATH
163 * On entry: szName is a filename (probably without path separators).
164 * On exit: if szName found in "App Path", place full path in lpResult, and return true
166 static BOOL SHELL_TryAppPath( LPCSTR szName, LPSTR lpResult)
174 sprintf(szAppKey, "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\%s", szName);
175 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, szAppKey, 0, KEY_READ, &hkApp);
177 /*TRACE("RegOpenKeyExA(HKEY_LOCAL_MACHINE, %s,) returns %ld\n", szAppKey, res);*/
182 res = RegQueryValueA(hkApp, NULL, lpResult, &len);
184 /*TRACE("RegQueryValueA(hkApp, NULL,) returns %ld\n", res);*/
187 /*TRACE("%s -> %s\n", szName, lpResult);*/
191 if (hkApp) RegCloseKey(hkApp);
195 /*************************************************************************
196 * SHELL_FindExecutable [Internal]
198 * Utility for code sharing between FindExecutable and ShellExecute
200 * lpFile the name of a file
201 * lpOperation the operation on it (open)
203 * lpResult a buffer, big enough :-(, to store the command to do the
204 * operation on the file
205 * key a buffer, big enough, to get the key name to do actually the
206 * command (it'll be used afterwards for more information
209 static UINT SHELL_FindExecutable(LPCSTR lpPath, LPCSTR lpFile, LPCSTR lpOperation,
210 LPSTR lpResult, LPSTR key)
212 char *extension = NULL; /* pointer to file extension */
213 char tmpext[5]; /* local copy to mung as we please */
214 char filetype[256]; /* registry name for this filetype */
215 LONG filetypelen = 256; /* length of above */
216 char command[256]; /* command from registry */
217 LONG commandlen = 256; /* This is the most DOS can handle :) */
218 char buffer[256]; /* Used to GetProfileString */
219 UINT retval = 31; /* default - 'No association was found' */
220 char *tok; /* token pointer */
221 char xlpFile[256] = ""; /* result of SearchPath */
223 TRACE("%s\n", (lpFile != NULL) ? lpFile : "-");
225 lpResult[0] = '\0'; /* Start off with an empty return string */
226 if (key) *key = '\0';
228 /* trap NULL parameters on entry */
229 if ((lpFile == NULL) || (lpResult == NULL) || (lpOperation == NULL))
231 WARN("(lpFile=%s,lpResult=%s,lpOperation=%s): NULL parameter\n",
232 lpFile, lpOperation, lpResult);
233 return 2; /* File not found. Close enough, I guess. */
236 if (SHELL_TryAppPath( lpFile, lpResult ))
238 TRACE("found %s via App Paths\n", lpResult);
242 if (SearchPathA(lpPath, lpFile, ".exe", sizeof(xlpFile), xlpFile, NULL))
244 TRACE("SearchPathA returned non-zero\n");
246 /* Hey, isn't this value ignored? Why make this call? Shouldn't we return here? --dank*/
249 /* First thing we need is the file's extension */
250 extension = strrchr(xlpFile, '.'); /* Assume last "." is the one; */
251 /* File->Run in progman uses */
253 TRACE("xlpFile=%s,extension=%s\n", xlpFile, extension);
255 if ((extension == NULL) || (extension == &xlpFile[strlen(xlpFile)]))
257 WARN("Returning 31 - No association\n");
258 return 31; /* no association */
261 /* Make local copy & lowercase it for reg & 'programs=' lookup */
262 lstrcpynA(tmpext, extension, 5);
264 TRACE("%s file\n", tmpext);
266 /* Three places to check: */
267 /* 1. win.ini, [windows], programs (NB no leading '.') */
268 /* 2. Registry, HKEY_CLASS_ROOT\<filetype>\shell\open\command */
269 /* 3. win.ini, [extensions], extension (NB no leading '.' */
270 /* All I know of the order is that registry is checked before */
271 /* extensions; however, it'd make sense to check the programs */
272 /* section first, so that's what happens here. */
274 /* See if it's a program - if GetProfileString fails, we skip this
275 * section. Actually, if GetProfileString fails, we've probably
276 * got a lot more to worry about than running a program... */
277 if (GetProfileStringA("windows", "programs", "exe pif bat cmd com",
278 buffer, sizeof(buffer)) > 0)
282 for (i = 0;i<strlen(buffer); i++) buffer[i] = tolower(buffer[i]);
284 tok = strtok(buffer, " \t"); /* ? */
287 if (strcmp(tok, &tmpext[1]) == 0) /* have to skip the leading "." */
289 strcpy(lpResult, xlpFile);
290 /* Need to perhaps check that the file has a path
292 TRACE("found %s\n", lpResult);
295 /* Greater than 32 to indicate success FIXME According to the
296 * docs, I should be returning a handle for the
297 * executable. Does this mean I'm supposed to open the
298 * executable file or something? More RTFM, I guess... */
300 tok = strtok(NULL, " \t");
305 if (RegQueryValueA(HKEY_CLASSES_ROOT, tmpext, filetype,
306 &filetypelen) == ERROR_SUCCESS)
308 filetype[filetypelen] = '\0';
309 TRACE("File type: %s\n", filetype);
311 /* Looking for ...buffer\shell\lpOperation\command */
312 strcat(filetype, "\\shell\\");
313 strcat(filetype, lpOperation);
314 strcat(filetype, "\\command");
316 if (RegQueryValueA(HKEY_CLASSES_ROOT, filetype, command,
317 &commandlen) == ERROR_SUCCESS)
319 if (key) strcpy(key, filetype);
325 /* FIXME: it seems all Windows version don't behave the same here.
326 * the doc states that this ddeexec information can be found after
328 * on Win98, it doesn't appear, but I think it does on Win2k
330 /* Get the parameters needed by the application
331 from the associated ddeexec key */
332 tmp = strstr(filetype, "command");
334 strcat(filetype, "ddeexec");
336 if (RegQueryValueA(HKEY_CLASSES_ROOT, filetype, param, ¶mlen) == ERROR_SUCCESS)
338 strcat(command, " ");
339 strcat(command, param);
340 commandlen += paramlen;
343 command[commandlen] = '\0';
344 argify(lpResult, sizeof(lpResult), command, xlpFile);
345 retval = 33; /* FIXME see above */
348 else /* Check win.ini */
350 /* Toss the leading dot */
352 if (GetProfileStringA("extensions", extension, "", command,
353 sizeof(command)) > 0)
355 if (strlen(command) != 0)
357 strcpy(lpResult, command);
358 tok = strstr(lpResult, "^"); /* should be ^.extension? */
362 strcat(lpResult, xlpFile); /* what if no dir in xlpFile? */
363 tok = strstr(command, "^"); /* see above */
364 if ((tok != NULL) && (strlen(tok)>5))
366 strcat(lpResult, &tok[5]);
369 retval = 33; /* FIXME - see above */
374 TRACE("returning %s\n", lpResult);
378 /******************************************************************
381 * callback for the DDE connection. not really usefull
383 static HDDEDATA CALLBACK dde_cb(UINT uType, UINT uFmt, HCONV hConv,
385 HDDEDATA hData, DWORD dwData1, DWORD dwData2)
390 /******************************************************************
393 * ShellExecute helper. Used to do an operation with a DDE connection
395 * Handles both the direct connection (try #1), and if it fails,
396 * launching an application and trying (#2) to connect to it
399 static unsigned dde_connect(char* key, char* start, char* ddeexec,
401 LPSHELLEXECUTEINFOA sei, SHELL_ExecuteA1632 execfunc)
403 char* endkey = key + strlen(key);
404 char app[256], topic[256], ifexec[256], res[256];
405 LONG applen, topiclen, ifexeclen;
409 HSZ hszApp, hszTopic;
413 strcpy(endkey, "\\application");
414 applen = sizeof(app);
415 if (RegQueryValueA(HKEY_CLASSES_ROOT, key, app, &applen) != ERROR_SUCCESS)
417 FIXME("default app name NIY %s\n", key);
421 strcpy(endkey, "\\topic");
422 topiclen = sizeof(topic);
423 if (RegQueryValueA(HKEY_CLASSES_ROOT, key, topic, &topiclen) != ERROR_SUCCESS)
425 strcpy(topic, "System");
428 if (DdeInitializeA(&ddeInst, dde_cb, APPCMD_CLIENTONLY, 0L) != DMLERR_NO_ERROR)
433 hszApp = DdeCreateStringHandleA(ddeInst, app, CP_WINANSI);
434 hszTopic = DdeCreateStringHandleA(ddeInst, topic, CP_WINANSI);
436 hConv = DdeConnect(ddeInst, hszApp, hszTopic, NULL);
440 TRACE("Launching '%s'\n", start);
441 ret = execfunc(start, sei, TRUE);
444 TRACE("Couldn't launch\n");
447 hConv = DdeConnect(ddeInst, hszApp, hszTopic, NULL);
450 TRACE("Couldn't connect. ret=%d\n", ret);
451 ret = 30; /* whatever */
454 strcpy(endkey, "\\ifexec");
455 ifexeclen = sizeof(ifexec);
456 if (RegQueryValueA(HKEY_CLASSES_ROOT, key, ifexec, &ifexeclen) == ERROR_SUCCESS)
462 argify(res, sizeof(res), exec, lpFile);
463 TRACE("%s %s => %s\n", exec, lpFile, res);
465 ret = (DdeClientTransaction(res, strlen(res) + 1, hConv, 0L, 0,
466 XTYP_EXECUTE, 10000, &tid) != DMLERR_NO_ERROR) ? 31 : 33;
467 DdeDisconnect(hConv);
469 DdeUninitialize(ddeInst);
473 /*************************************************************************
474 * execute_from_key [Internal]
476 static UINT execute_from_key(LPSTR key, LPCSTR lpFile, LPSHELLEXECUTEINFOA sei, SHELL_ExecuteA1632 execfunc)
479 LONG cmdlen = sizeof(cmd);
482 /* Get the application for the registry */
483 if (RegQueryValueA(HKEY_CLASSES_ROOT, key, cmd, &cmdlen) == ERROR_SUCCESS)
486 char param[256] = "";
489 /* Get the parameters needed by the application
490 from the associated ddeexec key */
491 tmp = strstr(key, "command");
493 strcpy(tmp, "ddeexec");
495 if (RegQueryValueA(HKEY_CLASSES_ROOT, key, param, ¶mlen) == ERROR_SUCCESS)
497 TRACE("Got ddeexec %s => %s\n", key, param);
498 retval = dde_connect(key, cmd, param, lpFile, sei, execfunc);
502 /* Is there a replace() function anywhere? */
504 argify(param, sizeof(param), cmd, lpFile);
505 retval = execfunc(param, sei, FALSE);
508 else TRACE("ooch\n");
513 /*************************************************************************
514 * FindExecutableA [SHELL32.@]
516 HINSTANCE WINAPI FindExecutableA(LPCSTR lpFile, LPCSTR lpDirectory, LPSTR lpResult)
518 UINT retval = 31; /* default - 'No association was found' */
521 TRACE("File %s, Dir %s\n",
522 (lpFile != NULL ? lpFile : "-"), (lpDirectory != NULL ? lpDirectory : "-"));
524 lpResult[0] = '\0'; /* Start off with an empty return string */
526 /* trap NULL parameters on entry */
527 if ((lpFile == NULL) || (lpResult == NULL))
529 /* FIXME - should throw a warning, perhaps! */
530 return (HINSTANCE)2; /* File not found. Close enough, I guess. */
535 GetCurrentDirectoryA(sizeof(old_dir), old_dir);
536 SetCurrentDirectoryA(lpDirectory);
539 retval = SHELL_FindExecutable(lpDirectory, lpFile, "open", lpResult, NULL);
541 TRACE("returning %s\n", lpResult);
543 SetCurrentDirectoryA(old_dir);
544 return (HINSTANCE)retval;
547 /*************************************************************************
548 * FindExecutableW [SHELL32.@]
550 HINSTANCE WINAPI FindExecutableW(LPCWSTR lpFile, LPCWSTR lpDirectory, LPWSTR lpResult)
552 FIXME("(%p,%p,%p): stub\n", lpFile, lpDirectory, lpResult);
553 return (HINSTANCE)31; /* default - 'No association was found' */
556 /*************************************************************************
557 * ShellExecuteExA32 [Internal]
559 BOOL WINAPI ShellExecuteExA32 (LPSHELLEXECUTEINFOA sei, SHELL_ExecuteA1632 execfunc)
561 CHAR szApplicationName[MAX_PATH],szCommandline[MAX_PATH],szPidl[20],fileName[MAX_PATH];
564 char lpstrProtocol[256];
565 LPCSTR lpFile,lpOperation;
570 TRACE("mask=0x%08lx hwnd=%p verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s\n",
571 sei->fMask, sei->hwnd, debugstr_a(sei->lpVerb),
572 debugstr_a(sei->lpFile), debugstr_a(sei->lpParameters),
573 debugstr_a(sei->lpDirectory), sei->nShow,
574 (sei->fMask & SEE_MASK_CLASSNAME) ? debugstr_a(sei->lpClass) : "not used");
576 sei->hProcess = NULL;
577 ZeroMemory(szApplicationName,MAX_PATH);
579 strcpy(szApplicationName, sei->lpFile);
581 ZeroMemory(szCommandline,MAX_PATH);
582 if (sei->lpParameters)
583 strcpy(szCommandline, sei->lpParameters);
585 if (sei->fMask & (SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY |
586 SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT |
587 SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE |
588 SEE_MASK_NO_CONSOLE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR ))
590 FIXME("flags ignored: 0x%08lx\n", sei->fMask);
593 /* process the IDList */
594 if ( (sei->fMask & SEE_MASK_INVOKEIDLIST) == SEE_MASK_INVOKEIDLIST) /*0x0c*/
596 SHGetPathFromIDListA (sei->lpIDList,szApplicationName);
597 TRACE("-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName);
601 if (sei->fMask & SEE_MASK_IDLIST )
603 pos = strstr(szCommandline, "%I");
607 HGLOBAL hmem = SHAllocShared ( sei->lpIDList, ILGetSize(sei->lpIDList), 0);
608 pv = SHLockShared(hmem,0);
609 sprintf(szPidl,":%p",pv );
612 gap = strlen(szPidl);
614 memmove(pos+gap,pos+2,len);
615 memcpy(pos,szPidl,gap);
620 if (sei->fMask & (SEE_MASK_CLASSNAME | SEE_MASK_CLASSKEY))
622 /* launch a document by fileclass like 'WordPad.Document.1' */
623 /* the Commandline contains 'c:\Path\wordpad.exe "%1"' */
624 /* FIXME: szCommandline should not be of a fixed size. Plus MAX_PATH is way too short! */
625 if (sei->fMask & SEE_MASK_CLASSKEY)
626 HCR_GetExecuteCommandEx(sei->hkeyClass,
627 (sei->fMask & SEE_MASK_CLASSNAME) ? sei->lpClass: NULL,
628 (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, sizeof(szCommandline));
629 else if (sei->fMask & SEE_MASK_CLASSNAME)
630 HCR_GetExecuteCommandA(sei->lpClass, (sei->lpVerb) ? sei->lpVerb :
631 "open", szCommandline, sizeof(szCommandline));
633 /* FIXME: get the extension of lpFile, check if it fits to the lpClass */
634 TRACE("SEE_MASK_CLASSNAME->'%s', doc->'%s'\n", szCommandline, szApplicationName);
637 done = argify(cmd, sizeof(cmd), szCommandline, szApplicationName);
638 if (!done && szApplicationName[0])
641 strcat(cmd, szApplicationName);
643 retval = execfunc(cmd, sei, FALSE);
650 /* We set the default to open, and that should generally work.
651 But that is not really the way the MS docs say to do it. */
652 if (sei->lpVerb == NULL)
653 lpOperation = "open";
655 lpOperation = sei->lpVerb;
657 /* Else, try to execute the filename */
658 TRACE("execute:'%s','%s'\n",szApplicationName, szCommandline);
660 strcpy(fileName, szApplicationName);
662 if (szCommandline[0]) {
663 strcat(szApplicationName, " ");
664 strcat(szApplicationName, szCommandline);
667 retval = execfunc(szApplicationName, sei, FALSE);
671 /* Else, try to find the executable */
673 retval = SHELL_FindExecutable(sei->lpDirectory, lpFile, lpOperation, cmd, lpstrProtocol);
674 if (retval > 32) /* Found */
676 CHAR szQuotedCmd[MAX_PATH+2];
677 /* Must quote to handle case where cmd contains spaces,
678 * else security hole if malicious user creates executable file "C:\\Program"
680 if (szCommandline[0])
681 sprintf(szQuotedCmd, "\"%s\" %s", cmd, szCommandline);
683 sprintf(szQuotedCmd, "\"%s\"", cmd);
684 TRACE("%s/%s => %s/%s\n", szApplicationName, lpOperation, szQuotedCmd, lpstrProtocol);
686 retval = execute_from_key(lpstrProtocol, szApplicationName, sei, execfunc);
688 retval = execfunc(szQuotedCmd, sei, FALSE);
690 else if (PathIsURLA((LPSTR)lpFile)) /* File not found, check for URL */
695 lpstrRes = strchr(lpFile, ':');
697 iSize = lpstrRes - lpFile;
699 iSize = strlen(lpFile);
701 TRACE("Got URL: %s\n", lpFile);
702 /* Looking for ...protocol\shell\lpOperation\command */
703 strncpy(lpstrProtocol, lpFile, iSize);
704 lpstrProtocol[iSize] = '\0';
705 strcat(lpstrProtocol, "\\shell\\");
706 strcat(lpstrProtocol, lpOperation);
707 strcat(lpstrProtocol, "\\command");
709 /* Remove File Protocol from lpFile */
710 /* In the case file://path/file */
711 if (!strncasecmp(lpFile, "file", iSize))
714 while (*lpFile == ':') lpFile++;
716 retval = execute_from_key(lpstrProtocol, lpFile, sei, execfunc);
718 /* Check if file specified is in the form www.??????.*** */
719 else if (!strncasecmp(lpFile, "www", 3))
721 /* if so, append lpFile http:// and call ShellExecute */
722 char lpstrTmpFile[256] = "http://" ;
723 strcat(lpstrTmpFile, lpFile);
724 retval = (UINT)ShellExecuteA(sei->hwnd, lpOperation, lpstrTmpFile, NULL, NULL, 0);
729 sei->hInstApp = (HINSTANCE)retval;
733 sei->hInstApp = (HINSTANCE)33;
737 /*************************************************************************
738 * ShellExecuteA [SHELL32.290]
740 HINSTANCE WINAPI ShellExecuteA(HWND hWnd, LPCSTR lpOperation,LPCSTR lpFile,
741 LPCSTR lpParameters,LPCSTR lpDirectory, INT iShowCmd)
743 SHELLEXECUTEINFOA sei;
747 sei.cbSize = sizeof(sei);
750 sei.lpVerb = lpOperation;
752 sei.lpParameters = lpParameters;
753 sei.lpDirectory = lpDirectory;
754 sei.nShow = iShowCmd;
759 sei.hProcess = hProcess;
761 ShellExecuteExA32 (&sei, SHELL_ExecuteA);
765 /*************************************************************************
766 * ShellExecuteEx [SHELL32.291]
769 BOOL WINAPI ShellExecuteExAW (LPVOID sei)
771 if (SHELL_OsIsUnicode())
772 return ShellExecuteExW (sei);
773 return ShellExecuteExA32 (sei, SHELL_ExecuteA);
776 /*************************************************************************
777 * ShellExecuteExA [SHELL32.292]
780 BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei)
782 return ShellExecuteExA32 (sei, SHELL_ExecuteA);
785 /*************************************************************************
786 * ShellExecuteExW [SHELL32.293]
789 BOOL WINAPI ShellExecuteExW (LPSHELLEXECUTEINFOW sei)
791 SHELLEXECUTEINFOA seiA;
796 memcpy(&seiA, sei, sizeof(SHELLEXECUTEINFOA));
799 seiA.lpVerb = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpVerb);
802 seiA.lpFile = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpFile);
804 if (sei->lpParameters)
805 seiA.lpParameters = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpParameters);
807 if (sei->lpDirectory)
808 seiA.lpDirectory = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpDirectory);
810 if ((sei->fMask & SEE_MASK_CLASSNAME) && sei->lpClass)
811 seiA.lpClass = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpClass);
815 ret = ShellExecuteExA(&seiA);
817 if (seiA.lpVerb) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpVerb );
818 if (seiA.lpFile) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpFile );
819 if (seiA.lpParameters) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpParameters );
820 if (seiA.lpDirectory) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpDirectory );
821 if (seiA.lpClass) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpClass );
826 /*************************************************************************
827 * ShellExecuteW [SHELL32.294]
829 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
830 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
832 HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpOperation, LPCWSTR lpFile,
833 LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
835 SHELLEXECUTEINFOW sei;
839 sei.cbSize = sizeof(sei);
842 sei.lpVerb = lpOperation;
844 sei.lpParameters = lpParameters;
845 sei.lpDirectory = lpDirectory;
846 sei.nShow = nShowCmd;
851 sei.hProcess = hProcess;
853 ShellExecuteExW (&sei);