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
42 #include "wine/winbase16.h"
43 #include "shell32_main.h"
44 #include "undocshell.h"
46 #include "wine/debug.h"
48 WINE_DEFAULT_DEBUG_CHANNEL(exec
);
50 /* this function is supposed to expand the escape sequences found in the registry
51 * some diving reported that the following were used:
52 * + %1, %2... seem to report to parameter of index N in ShellExecute pmts
57 * %I adress of a global item ID (explorer switch /idlist)
58 * %L seems to be %1 as long filename followed by the 8+3 variation
60 * %* all following parameters (see batfile)
62 static BOOL
argify(char* res
, int len
, const char* fmt
, const char* lpFile
)
79 if (!done
|| (*fmt
== '1'))
81 if (SearchPathA(NULL
, lpFile
, ".exe", sizeof(xlpFile
), xlpFile
, NULL
))
84 res
+= strlen(xlpFile
);
89 res
+= strlen(lpFile
);
93 default: FIXME("Unknown escape sequence %%%c\n", *fmt
);
105 /*************************************************************************
106 * SHELL_ExecuteA [Internal]
109 static HINSTANCE
SHELL_ExecuteA(char *lpCmd
, LPSHELLEXECUTEINFOA sei
, BOOL is32
)
111 STARTUPINFOA startup
;
112 PROCESS_INFORMATION info
;
113 HINSTANCE retval
= 31;
115 TRACE("Execute %s from directory %s\n", lpCmd
, sei
->lpDirectory
);
116 ZeroMemory(&startup
,sizeof(STARTUPINFOA
));
117 startup
.cb
= sizeof(STARTUPINFOA
);
118 startup
.dwFlags
= STARTF_USESHOWWINDOW
;
119 startup
.wShowWindow
= sei
->nShow
;
122 if (CreateProcessA(NULL
, lpCmd
, NULL
, NULL
, FALSE
, 0,
123 NULL
, sei
->lpDirectory
, &startup
, &info
))
125 retval
= (HINSTANCE
)33;
126 if(sei
->fMask
& SEE_MASK_NOCLOSEPROCESS
)
127 sei
->hProcess
= info
.hProcess
;
129 CloseHandle( info
.hProcess
);
130 CloseHandle( info
.hThread
);
132 else if ((retval
= GetLastError()) >= (HINSTANCE
)32)
134 FIXME("Strange error set by CreateProcess: %d\n", retval
);
135 retval
= (HINSTANCE
)ERROR_BAD_FORMAT
;
139 retval
= WinExec16(lpCmd
, sei
->nShow
);
141 sei
->hInstApp
= retval
;
145 /*************************************************************************
146 * SHELL_FindExecutable [Internal]
148 * Utility for code sharing between FindExecutable and ShellExecute
150 * lpFile the name of a file
151 * lpOperation the operation on it (open)
153 * lpResult a buffer, big enough :-(, to store the command to do the
154 * operation on the file
155 * key a buffer, big enough, to get the key name to do actually the
156 * command (it'll be used afterwards for more information
159 static HINSTANCE
SHELL_FindExecutable(LPCSTR lpPath
, LPCSTR lpFile
, LPCSTR lpOperation
,
160 LPSTR lpResult
, LPSTR key
)
162 char *extension
= NULL
; /* pointer to file extension */
163 char tmpext
[5]; /* local copy to mung as we please */
164 char filetype
[256]; /* registry name for this filetype */
165 LONG filetypelen
= 256; /* length of above */
166 char command
[256]; /* command from registry */
167 LONG commandlen
= 256; /* This is the most DOS can handle :) */
168 char buffer
[256]; /* Used to GetProfileString */
169 HINSTANCE retval
= 31; /* default - 'No association was found' */
170 char *tok
; /* token pointer */
171 int i
; /* random counter */
172 char xlpFile
[256] = ""; /* result of SearchPath */
174 TRACE("%s\n", (lpFile
!= NULL
) ? lpFile
: "-");
176 lpResult
[0] = '\0'; /* Start off with an empty return string */
178 /* trap NULL parameters on entry */
179 if ((lpFile
== NULL
) || (lpResult
== NULL
) || (lpOperation
== NULL
))
181 WARN("(lpFile=%s,lpResult=%s,lpOperation=%s): NULL parameter\n",
182 lpFile
, lpOperation
, lpResult
);
183 return 2; /* File not found. Close enough, I guess. */
186 if (SearchPathA(lpPath
, lpFile
, ".exe", sizeof(xlpFile
), xlpFile
, NULL
))
188 TRACE("SearchPathA returned non-zero\n");
192 /* First thing we need is the file's extension */
193 extension
= strrchr(xlpFile
, '.'); /* Assume last "." is the one; */
194 /* File->Run in progman uses */
196 TRACE("xlpFile=%s,extension=%s\n", xlpFile
, extension
);
198 if ((extension
== NULL
) || (extension
== &xlpFile
[strlen(xlpFile
)]))
200 WARN("Returning 31 - No association\n");
201 return 31; /* no association */
204 /* Make local copy & lowercase it for reg & 'programs=' lookup */
205 lstrcpynA(tmpext
, extension
, 5);
207 TRACE("%s file\n", tmpext
);
209 /* Three places to check: */
210 /* 1. win.ini, [windows], programs (NB no leading '.') */
211 /* 2. Registry, HKEY_CLASS_ROOT\<filetype>\shell\open\command */
212 /* 3. win.ini, [extensions], extension (NB no leading '.' */
213 /* All I know of the order is that registry is checked before */
214 /* extensions; however, it'd make sense to check the programs */
215 /* section first, so that's what happens here. */
217 if (key
) *key
= '\0';
219 /* See if it's a program - if GetProfileString fails, we skip this
220 * section. Actually, if GetProfileString fails, we've probably
221 * got a lot more to worry about than running a program... */
222 if (GetProfileStringA("windows", "programs", "exe pif bat com",
223 buffer
, sizeof(buffer
)) > 0)
225 for (i
= 0;i
<strlen(buffer
); i
++) buffer
[i
] = tolower(buffer
[i
]);
227 tok
= strtok(buffer
, " \t"); /* ? */
230 if (strcmp(tok
, &tmpext
[1]) == 0) /* have to skip the leading "." */
232 strcpy(lpResult
, xlpFile
);
233 /* Need to perhaps check that the file has a path
235 TRACE("found %s\n", lpResult
);
238 /* Greater than 32 to indicate success FIXME According to the
239 * docs, I should be returning a handle for the
240 * executable. Does this mean I'm supposed to open the
241 * executable file or something? More RTFM, I guess... */
243 tok
= strtok(NULL
, " \t");
248 if (RegQueryValueA(HKEY_CLASSES_ROOT
, tmpext
, filetype
,
249 &filetypelen
) == ERROR_SUCCESS
)
251 filetype
[filetypelen
] = '\0';
252 TRACE("File type: %s\n", filetype
);
254 /* Looking for ...buffer\shell\lpOperation\command */
255 strcat(filetype
, "\\shell\\");
256 strcat(filetype
, lpOperation
);
257 strcat(filetype
, "\\command");
259 if (RegQueryValueA(HKEY_CLASSES_ROOT
, filetype
, command
,
260 &commandlen
) == ERROR_SUCCESS
)
262 if (key
) strcpy(key
, filetype
);
268 /* FIXME: it seems all Windows version don't behave the same here.
269 * the doc states that this ddeexec information can be found after
271 * on Win98, it doesn't appear, but I think it does on Win2k
273 /* Get the parameters needed by the application
274 from the associated ddeexec key */
275 tmp
= strstr(filetype
, "command");
277 strcat(filetype
, "ddeexec");
279 if (RegQueryValueA(HKEY_CLASSES_ROOT
, filetype
, param
, ¶mlen
) == ERROR_SUCCESS
)
281 strcat(command
, " ");
282 strcat(command
, param
);
283 commandlen
+= paramlen
;
286 command
[commandlen
] = '\0';
287 argify(lpResult
, sizeof(lpResult
), command
, xlpFile
);
288 retval
= 33; /* FIXME see above */
291 else /* Check win.ini */
293 /* Toss the leading dot */
295 if (GetProfileStringA("extensions", extension
, "", command
,
296 sizeof(command
)) > 0)
298 if (strlen(command
) != 0)
300 strcpy(lpResult
, command
);
301 tok
= strstr(lpResult
, "^"); /* should be ^.extension? */
305 strcat(lpResult
, xlpFile
); /* what if no dir in xlpFile? */
306 tok
= strstr(command
, "^"); /* see above */
307 if ((tok
!= NULL
) && (strlen(tok
)>5))
309 strcat(lpResult
, &tok
[5]);
312 retval
= 33; /* FIXME - see above */
317 TRACE("returning %s\n", lpResult
);
321 /******************************************************************
324 * callback for the DDE connection. not really usefull
326 static HDDEDATA CALLBACK
dde_cb(UINT uType
, UINT uFmt
, HCONV hConv
,
328 HDDEDATA hData
, DWORD dwData1
, DWORD dwData2
)
333 /******************************************************************
336 * ShellExecute helper. Used to do an operation with a DDE connection
338 * Handles both the direct connection (try #1), and if it fails,
339 * launching an application and trying (#2) to connect to it
342 static unsigned dde_connect(char* key
, char* start
, char* ddeexec
,
344 LPSHELLEXECUTEINFOA sei
, BOOL is32
)
346 char* endkey
= key
+ strlen(key
);
347 char app
[256], topic
[256], ifexec
[256], res
[256];
348 LONG applen
, topiclen
, ifexeclen
;
352 HSZ hszApp
, hszTopic
;
356 strcpy(endkey
, "\\application");
357 applen
= sizeof(app
);
358 if (RegQueryValueA(HKEY_CLASSES_ROOT
, key
, app
, &applen
) != ERROR_SUCCESS
)
360 FIXME("default app name NIY %s\n", key
);
364 strcpy(endkey
, "\\topic");
365 topiclen
= sizeof(topic
);
366 if (RegQueryValueA(HKEY_CLASSES_ROOT
, key
, topic
, &topiclen
) != ERROR_SUCCESS
)
368 strcpy(topic
, "System");
371 if (DdeInitializeA(&ddeInst
, dde_cb
, APPCMD_CLIENTONLY
, 0L) != DMLERR_NO_ERROR
)
376 hszApp
= DdeCreateStringHandleA(ddeInst
, app
, CP_WINANSI
);
377 hszTopic
= DdeCreateStringHandleA(ddeInst
, topic
, CP_WINANSI
);
379 hConv
= DdeConnect(ddeInst
, hszApp
, hszTopic
, NULL
);
383 TRACE("Launching '%s'\n", start
);
384 ret
= SHELL_ExecuteA(start
, sei
, is32
);
387 TRACE("Couldn't launch\n");
390 hConv
= DdeConnect(ddeInst
, hszApp
, hszTopic
, NULL
);
393 ret
= 30; /* whatever */
396 strcpy(endkey
, "\\ifexec");
397 ifexeclen
= sizeof(ifexec
);
398 if (RegQueryValueA(HKEY_CLASSES_ROOT
, key
, ifexec
, &ifexeclen
) == ERROR_SUCCESS
)
404 argify(res
, sizeof(res
), exec
, lpFile
);
405 TRACE("%s %s => %s\n", exec
, lpFile
, res
);
407 ret
= (DdeClientTransaction(res
, strlen(res
) + 1, hConv
, 0L, 0,
408 XTYP_EXECUTE
, 10000, &tid
) != DMLERR_NO_ERROR
) ? 31 : 32;
409 DdeDisconnect(hConv
);
411 DdeUninitialize(ddeInst
);
415 /*************************************************************************
416 * execute_from_key [Internal]
418 static HINSTANCE
execute_from_key(LPSTR key
, LPCSTR lpFile
, LPSHELLEXECUTEINFOA sei
, BOOL is32
)
421 LONG cmdlen
= sizeof(cmd
);
422 HINSTANCE retval
= 31;
424 /* Get the application for the registry */
425 if (RegQueryValueA(HKEY_CLASSES_ROOT
, key
, cmd
, &cmdlen
) == ERROR_SUCCESS
)
428 char param
[256] = "";
431 /* Get the parameters needed by the application
432 from the associated ddeexec key */
433 tmp
= strstr(key
, "command");
435 strcpy(tmp
, "ddeexec");
437 if (RegQueryValueA(HKEY_CLASSES_ROOT
, key
, param
, ¶mlen
) == ERROR_SUCCESS
)
439 TRACE("Got ddeexec %s => %s\n", key
, param
);
440 retval
= dde_connect(key
, cmd
, param
, lpFile
, sei
, is32
);
444 /* Is there a replace() function anywhere? */
446 argify(param
, sizeof(param
), cmd
, lpFile
);
447 retval
= SHELL_ExecuteA(param
, sei
, is32
);
450 else TRACE("ooch\n");
455 /*************************************************************************
456 * FindExecutableA [SHELL32.@]
458 HINSTANCE WINAPI
FindExecutableA(LPCSTR lpFile
, LPCSTR lpDirectory
, LPSTR lpResult
)
460 HINSTANCE retval
= 31; /* default - 'No association was found' */
463 TRACE("File %s, Dir %s\n",
464 (lpFile
!= NULL
? lpFile
: "-"), (lpDirectory
!= NULL
? lpDirectory
: "-"));
466 lpResult
[0] = '\0'; /* Start off with an empty return string */
468 /* trap NULL parameters on entry */
469 if ((lpFile
== NULL
) || (lpResult
== NULL
))
471 /* FIXME - should throw a warning, perhaps! */
472 return 2; /* File not found. Close enough, I guess. */
477 GetCurrentDirectoryA(sizeof(old_dir
), old_dir
);
478 SetCurrentDirectoryA(lpDirectory
);
481 retval
= SHELL_FindExecutable(lpDirectory
, lpFile
, "open", lpResult
, NULL
);
483 TRACE("returning %s\n", lpResult
);
485 SetCurrentDirectoryA(old_dir
);
489 /*************************************************************************
490 * FindExecutableW [SHELL32.@]
492 HINSTANCE WINAPI
FindExecutableW(LPCWSTR lpFile
, LPCWSTR lpDirectory
, LPWSTR lpResult
)
494 FIXME("(%p,%p,%p): stub\n", lpFile
, lpDirectory
, lpResult
);
495 return 31; /* default - 'No association was found' */
498 /*************************************************************************
499 * ShellExecuteExA32 [Internal]
501 BOOL WINAPI
ShellExecuteExA32 (LPSHELLEXECUTEINFOA sei
, BOOL is32
)
503 CHAR szApplicationName
[MAX_PATH
],szCommandline
[MAX_PATH
],szPidl
[20],fileName
[MAX_PATH
];
506 char lpstrProtocol
[256];
507 LPCSTR lpFile
,lpOperation
;
508 HINSTANCE retval
= 31;
512 TRACE("mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s\n",
513 sei
->fMask
, sei
->hwnd
, debugstr_a(sei
->lpVerb
),
514 debugstr_a(sei
->lpFile
), debugstr_a(sei
->lpParameters
),
515 debugstr_a(sei
->lpDirectory
), sei
->nShow
,
516 (sei
->fMask
& SEE_MASK_CLASSNAME
) ? debugstr_a(sei
->lpClass
) : "not used");
518 sei
->hProcess
= (HANDLE
)NULL
;
519 ZeroMemory(szApplicationName
,MAX_PATH
);
521 strcpy(szApplicationName
, sei
->lpFile
);
523 ZeroMemory(szCommandline
,MAX_PATH
);
524 if (sei
->lpParameters
)
525 strcpy(szCommandline
, sei
->lpParameters
);
527 if (sei
->fMask
& ((SEE_MASK_CLASSKEY
& ~SEE_MASK_CLASSNAME
) |
528 SEE_MASK_INVOKEIDLIST
| SEE_MASK_ICON
| SEE_MASK_HOTKEY
|
529 SEE_MASK_CONNECTNETDRV
| SEE_MASK_FLAG_DDEWAIT
|
530 SEE_MASK_DOENVSUBST
| SEE_MASK_FLAG_NO_UI
| SEE_MASK_UNICODE
|
531 SEE_MASK_NO_CONSOLE
| SEE_MASK_ASYNCOK
| SEE_MASK_HMONITOR
))
533 FIXME("flags ignored: 0x%08lx\n", sei
->fMask
);
536 /* process the IDList */
537 if ( (sei
->fMask
& SEE_MASK_INVOKEIDLIST
) == SEE_MASK_INVOKEIDLIST
) /*0x0c*/
539 SHGetPathFromIDListA (sei
->lpIDList
,szApplicationName
);
540 TRACE("-- idlist=%p (%s)\n", sei
->lpIDList
, szApplicationName
);
544 if (sei
->fMask
& SEE_MASK_IDLIST
)
546 pos
= strstr(szCommandline
, "%I");
550 HGLOBAL hmem
= SHAllocShared ( sei
->lpIDList
, ILGetSize(sei
->lpIDList
), 0);
551 pv
= SHLockShared(hmem
,0);
552 sprintf(szPidl
,":%p",pv
);
555 gap
= strlen(szPidl
);
557 memmove(pos
+gap
,pos
+2,len
);
558 memcpy(pos
,szPidl
,gap
);
563 if (sei
->fMask
& SEE_MASK_CLASSNAME
)
565 /* launch a document by fileclass like 'WordPad.Document.1' */
566 /* the Commandline contains 'c:\Path\wordpad.exe "%1"' */
567 /* FIXME: szCommandline should not be of a fixed size. Plus MAX_PATH is way too short! */
568 HCR_GetExecuteCommand(sei
->lpClass
, (sei
->lpVerb
) ? sei
->lpVerb
: "open", szCommandline
, sizeof(szCommandline
));
569 /* FIXME: get the extension of lpFile, check if it fits to the lpClass */
570 TRACE("SEE_MASK_CLASSNAME->'%s', doc->'%s'\n", szCommandline
, szApplicationName
);
573 done
= argify(cmd
, sizeof(cmd
), szCommandline
, szApplicationName
);
574 if (!done
&& szApplicationName
[0])
577 strcat(cmd
, szApplicationName
);
579 retval
= SHELL_ExecuteA(cmd
, sei
, is32
);
586 /* We set the default to open, and that should generally work.
587 But that is not really the way the MS docs say to do it. */
588 if (sei
->lpVerb
== NULL
)
589 lpOperation
= "open";
591 lpOperation
= sei
->lpVerb
;
593 /* Else, try to execute the filename */
594 TRACE("execute:'%s','%s'\n",szApplicationName
, szCommandline
);
596 strcpy(fileName
, szApplicationName
);
598 if (szCommandline
[0]) {
599 strcat(szApplicationName
, " ");
600 strcat(szApplicationName
, szCommandline
);
603 retval
= SHELL_ExecuteA(szApplicationName
, sei
, is32
);
607 /* Else, try to find the executable */
609 retval
= SHELL_FindExecutable(sei
->lpDirectory
, lpFile
, lpOperation
, cmd
, lpstrProtocol
);
610 if (retval
> 32) /* Found */
612 if (szCommandline
[0]) {
614 strcat(cmd
, szCommandline
);
616 TRACE("%s/%s => %s/%s\n", szApplicationName
, lpOperation
, cmd
, lpstrProtocol
);
618 retval
= execute_from_key(lpstrProtocol
, szApplicationName
, sei
, is32
);
620 retval
= SHELL_ExecuteA(cmd
, sei
, is32
);
622 else if (PathIsURLA((LPSTR
)lpFile
)) /* File not found, check for URL */
627 lpstrRes
= strchr(lpFile
, ':');
628 /* PathIsURLA probably should fail on strings without a ':', but it doesn't */
630 iSize
= lpstrRes
- lpFile
;
632 iSize
= strlen(lpFile
);
634 TRACE("Got URL: %s\n", lpFile
);
635 /* Looking for ...protocol\shell\lpOperation\command */
636 strncpy(lpstrProtocol
, lpFile
, iSize
);
637 lpstrProtocol
[iSize
] = '\0';
638 strcat(lpstrProtocol
, "\\shell\\");
639 strcat(lpstrProtocol
, lpOperation
);
640 strcat(lpstrProtocol
, "\\command");
642 /* Remove File Protocol from lpFile */
643 /* In the case file://path/file */
644 if (!strncasecmp(lpFile
, "file", iSize
))
647 while (*lpFile
== ':') lpFile
++;
649 retval
= execute_from_key(lpstrProtocol
, lpFile
, sei
, is32
);
651 /* Check if file specified is in the form www.??????.*** */
652 else if (!strncasecmp(lpFile
, "www", 3))
654 /* if so, append lpFile http:// and call ShellExecute */
655 char lpstrTmpFile
[256] = "http://" ;
656 strcat(lpstrTmpFile
, lpFile
);
657 retval
= ShellExecuteA(sei
->hwnd
, lpOperation
, lpstrTmpFile
, NULL
, NULL
, 0);
662 sei
->hInstApp
= retval
;
671 /*************************************************************************
672 * ShellExecute [SHELL.20]
674 HINSTANCE16 WINAPI
ShellExecute16( HWND16 hWnd
, LPCSTR lpOperation
,
675 LPCSTR lpFile
, LPCSTR lpParameters
,
676 LPCSTR lpDirectory
, INT16 iShowCmd
)
678 SHELLEXECUTEINFOA sei
;
681 sei
.cbSize
= sizeof(sei
);
683 sei
.hwnd
= HWND_32(hWnd
);
684 sei
.lpVerb
= lpOperation
;
686 sei
.lpParameters
= lpParameters
;
687 sei
.lpDirectory
= lpDirectory
;
688 sei
.nShow
= iShowCmd
;
693 sei
.hProcess
= hProcess
;
695 ShellExecuteExA32 (&sei
, FALSE
);
696 return (HINSTANCE16
)sei
.hInstApp
;
699 /*************************************************************************
700 * ShellExecuteA [SHELL32.290]
702 HINSTANCE WINAPI
ShellExecuteA(HWND hWnd
, LPCSTR lpOperation
,LPCSTR lpFile
,
703 LPCSTR lpParameters
,LPCSTR lpDirectory
, INT iShowCmd
)
705 SHELLEXECUTEINFOA sei
;
709 sei
.cbSize
= sizeof(sei
);
712 sei
.lpVerb
= lpOperation
;
714 sei
.lpParameters
= lpParameters
;
715 sei
.lpDirectory
= lpDirectory
;
716 sei
.nShow
= iShowCmd
;
721 sei
.hProcess
= hProcess
;
723 ShellExecuteExA32 (&sei
, TRUE
);
727 /*************************************************************************
728 * ShellExecuteEx [SHELL32.291]
731 BOOL WINAPI
ShellExecuteExAW (LPVOID sei
)
733 if (SHELL_OsIsUnicode())
734 return ShellExecuteExW (sei
);
735 return ShellExecuteExA32 (sei
, TRUE
);
738 /*************************************************************************
739 * ShellExecuteExA [SHELL32.292]
742 BOOL WINAPI
ShellExecuteExA (LPSHELLEXECUTEINFOA sei
)
744 return ShellExecuteExA32 (sei
, TRUE
);
747 /*************************************************************************
748 * ShellExecuteExW [SHELL32.293]
751 BOOL WINAPI
ShellExecuteExW (LPSHELLEXECUTEINFOW sei
)
753 SHELLEXECUTEINFOA seiA
;
758 memcpy(&seiA
, sei
, sizeof(SHELLEXECUTEINFOA
));
761 seiA
.lpVerb
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpVerb
);
764 seiA
.lpFile
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpFile
);
766 if (sei
->lpParameters
)
767 seiA
.lpParameters
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpParameters
);
769 if (sei
->lpDirectory
)
770 seiA
.lpDirectory
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpDirectory
);
772 if ((sei
->fMask
& SEE_MASK_CLASSNAME
) && sei
->lpClass
)
773 seiA
.lpClass
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpClass
);
777 ret
= ShellExecuteExA(&seiA
);
779 if (seiA
.lpVerb
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpVerb
);
780 if (seiA
.lpFile
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpFile
);
781 if (seiA
.lpParameters
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpParameters
);
782 if (seiA
.lpDirectory
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpDirectory
);
783 if (seiA
.lpClass
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpClass
);
788 /*************************************************************************
789 * ShellExecuteW [SHELL32.294]
791 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
792 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
794 HINSTANCE WINAPI
ShellExecuteW(HWND hwnd
, LPCWSTR lpOperation
, LPCWSTR lpFile
,
795 LPCWSTR lpParameters
, LPCWSTR lpDirectory
, INT nShowCmd
)
797 SHELLEXECUTEINFOW sei
;
801 sei
.cbSize
= sizeof(sei
);
804 sei
.lpVerb
= lpOperation
;
806 sei
.lpParameters
= lpParameters
;
807 sei
.lpDirectory
= lpDirectory
;
808 sei
.nShow
= nShowCmd
;
813 sei
.hProcess
= hProcess
;
815 ShellExecuteExW (&sei
);