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"
47 #include "wine/winbase16.h"
48 #include "shell32_main.h"
49 #include "undocshell.h"
52 #include "wine/debug.h"
54 WINE_DEFAULT_DEBUG_CHANNEL(exec
);
56 static const WCHAR wszOpen
[] = {'o','p','e','n',0};
57 static const WCHAR wszExe
[] = {'.','e','x','e',0};
58 static const WCHAR wszILPtr
[] = {':','%','p',0};
59 static const WCHAR wszShell
[] = {'\\','s','h','e','l','l','\\',0};
60 static const WCHAR wszFolder
[] = {'F','o','l','d','e','r',0};
61 static const WCHAR wszEmpty
[] = {0};
64 /***********************************************************************
65 * SHELL_ArgifyW [Internal]
67 * this function is supposed to expand the escape sequences found in the registry
68 * some diving reported that the following were used:
69 * + %1, %2... seem to report to parameter of index N in ShellExecute pmts
74 * %I address of a global item ID (explorer switch /idlist)
75 * %L seems to be %1 as long filename followed by the 8+3 variation
77 * %* all following parameters (see batfile)
81 static BOOL
SHELL_ArgifyW(WCHAR
* out
, int len
, const WCHAR
* fmt
, const WCHAR
* lpFile
, LPITEMIDLIST pidl
, LPCWSTR args
)
121 while(*args
&& !isspace(*args
))
124 while(isspace(*args
))
131 if (!done
|| (*fmt
== '1'))
133 /*FIXME Is the call to SearchPathW() really needed? We already have separated out the parameter string in args. */
134 if (SearchPathW(NULL
, lpFile
, wszExe
, sizeof(xlpFile
)/sizeof(WCHAR
), xlpFile
, NULL
))
139 /* Add double quotation marks unless we already have them (e.g.: "%1" %* for exefile) */
140 if (res
!= out
&& *(res
- 1) == '"')
155 * IE uses this alot for activating things such as windows media
156 * player. This is not verified to be fully correct but it appears
162 strcpyW(res
, lpFile
);
163 res
+= strlenW(lpFile
);
170 HGLOBAL hmem
= SHAllocShared(pidl
, ILGetSize(pidl
), 0);
171 pv
= SHLockShared(hmem
, 0);
172 res
+= sprintfW(res
, wszILPtr
, pv
);
177 default: FIXME("Unknown escape sequence %%%c\n", *fmt
);
192 HRESULT
SHELL_GetPathFromIDListForExecuteA(LPCITEMIDLIST pidl
, LPSTR pszPath
, UINT uOutSize
)
195 IShellFolder
* desktop
;
197 HRESULT hr
= SHGetDesktopFolder(&desktop
);
200 hr
= IShellFolder_GetDisplayNameOf(desktop
, pidl
, SHGDN_FORPARSING
, &strret
);
203 StrRetToStrNA(pszPath
, uOutSize
, &strret
, pidl
);
205 IShellFolder_Release(desktop
);
211 HRESULT
SHELL_GetPathFromIDListForExecuteW(LPCITEMIDLIST pidl
, LPWSTR pszPath
, UINT uOutSize
)
214 IShellFolder
* desktop
;
216 HRESULT hr
= SHGetDesktopFolder(&desktop
);
219 hr
= IShellFolder_GetDisplayNameOf(desktop
, pidl
, SHGDN_FORPARSING
, &strret
);
222 StrRetToStrNW(pszPath
, uOutSize
, &strret
, pidl
);
224 IShellFolder_Release(desktop
);
230 /*************************************************************************
231 * SHELL_ResolveShortCutW [Internal]
232 * read shortcut file at 'wcmd' and fill psei with its content
234 static HRESULT
SHELL_ResolveShortCutW(LPWSTR wcmd
, LPWSTR wargs
, LPWSTR wdir
, HWND hwnd
, LPCWSTR lpVerb
, int* pshowcmd
, LPITEMIDLIST
* ppidl
)
238 HRESULT hr
= SHGetDesktopFolder(&psf
);
246 hr
= IShellFolder_ParseDisplayName(psf
, 0, 0, wcmd
, &l
, &pidl
, 0);
251 hr
= IShellFolder_GetUIObjectOf(psf
, NULL
, 1, (LPCITEMIDLIST
*)&pidl
, &IID_IShellLinkW
, NULL
, (LPVOID
*)&psl
);
254 hr
= IShellLinkW_Resolve(psl
, hwnd
, 0);
257 hr
= IShellLinkW_GetPath(psl
, wcmd
, MAX_PATH
, NULL
, SLGP_UNCPRIORITY
);
261 /* We could not translate the PIDL in the shell link into a valid file system path - so return the PIDL instead. */
262 hr
= IShellLinkW_GetIDList(psl
, ppidl
);
264 if (SUCCEEDED(hr
) && *ppidl
) {
265 /* We got a PIDL instead of a file system path - try to translate it. */
266 if (SUCCEEDED(SHELL_GetPathFromIDListW(*ppidl
, wcmd
, MAX_PATH
))) {
274 /* get command line arguments, working directory and display mode if available */
275 IShellLinkW_GetWorkingDirectory(psl
, wdir
, MAX_PATH
);
276 IShellLinkW_GetArguments(psl
, wargs
, MAX_PATH
);
277 IShellLinkW_GetShowCmd(psl
, pshowcmd
);
282 IShellLinkW_Release(psl
);
288 IShellFolder_Release(psf
);
294 /*************************************************************************
295 * SHELL_ExecuteW [Internal]
298 static UINT
SHELL_ExecuteW(const WCHAR
*lpCmd
, void *env
, BOOL shWait
,
299 LPSHELLEXECUTEINFOW psei
, LPSHELLEXECUTEINFOW psei_out
)
301 STARTUPINFOW startup
;
302 PROCESS_INFORMATION info
;
305 WCHAR curdir
[MAX_PATH
];
307 TRACE("Execute %s from directory %s\n", debugstr_w(lpCmd
), debugstr_w(psei
->lpDirectory
));
309 /* ShellExecute specifies the command from psei->lpDirectory
310 * if present. Not from the current dir as CreateProcess does */
311 if( psei
->lpDirectory
&& psei
->lpDirectory
[0] )
312 if( ( gcdret
= GetCurrentDirectoryW( MAX_PATH
, curdir
)))
313 if( !SetCurrentDirectoryW( psei
->lpDirectory
))
314 ERR("cannot set directory %s\n", debugstr_w(psei
->lpDirectory
));
316 ZeroMemory(&startup
, sizeof(startup
));
317 startup
.cb
= sizeof(STARTUPINFOW
);
318 startup
.dwFlags
= STARTF_USESHOWWINDOW
;
319 startup
.wShowWindow
= psei
->nShow
;
321 if (CreateProcessW(NULL
, (LPWSTR
)lpCmd
, NULL
, NULL
, FALSE
, 0,
322 env
, *psei
->lpDirectory
? psei
->lpDirectory
: NULL
, &startup
, &info
))
324 /* Give 30 seconds to the app to come up, if desired. Probably only needed
325 when starting app immediately before making a DDE connection. */
327 if (WaitForInputIdle( info
.hProcess
, 30000 ) == -1)
328 WARN("WaitForInputIdle failed: Error %ld\n", GetLastError() );
331 if (psei
->fMask
& SEE_MASK_NOCLOSEPROCESS
)
332 psei_out
->hProcess
= info
.hProcess
;
334 CloseHandle(info
.hProcess
);
336 CloseHandle(info
.hThread
);
338 else if ((retval
= GetLastError()) >= 32)
340 FIXME("Strange error set by CreateProcess: %d\n", retval
);
341 retval
= ERROR_BAD_FORMAT
;
344 TRACE("returning %u\n", retval
);
346 psei_out
->hInstApp
= (HINSTANCE
)retval
;
349 if( !SetCurrentDirectoryW( curdir
))
350 ERR("cannot return to directory %s\n", debugstr_w(curdir
));
356 /***********************************************************************
357 * SHELL_BuildEnvW [Internal]
359 * Build the environment for the new process, adding the specified
360 * path to the PATH variable. Returned pointer must be freed by caller.
362 static void *SHELL_BuildEnvW( const WCHAR
*path
)
364 static const WCHAR wPath
[] = {'P','A','T','H','=',0};
365 WCHAR
*strings
, *new_env
;
367 int total
= strlenW(path
) + 1;
368 BOOL got_path
= FALSE
;
370 if (!(strings
= GetEnvironmentStringsW())) return NULL
;
374 int len
= strlenW(p
) + 1;
375 if (!strncmpiW( p
, wPath
, 5 )) got_path
= TRUE
;
379 if (!got_path
) total
+= 5; /* we need to create PATH */
380 total
++; /* terminating null */
382 if (!(new_env
= HeapAlloc( GetProcessHeap(), 0, total
* sizeof(WCHAR
) )))
384 FreeEnvironmentStringsW( strings
);
391 int len
= strlenW(p
) + 1;
392 memcpy( p2
, p
, len
* sizeof(WCHAR
) );
393 if (!strncmpiW( p
, wPath
, 5 ))
396 strcpyW( p2
+ len
, path
);
397 p2
+= strlenW(path
) + 1;
404 strcpyW( p2
, wPath
);
406 p2
+= strlenW(p2
) + 1;
409 FreeEnvironmentStringsW( strings
);
414 /***********************************************************************
415 * SHELL_TryAppPathW [Internal]
417 * Helper function for SHELL_FindExecutable
418 * @param lpResult - pointer to a buffer of size MAX_PATH
419 * On entry: szName is a filename (probably without path separators).
420 * On exit: if szName found in "App Path", place full path in lpResult, and return true
422 static BOOL
SHELL_TryAppPathW(LPCWSTR szName
, LPWSTR lpResult
, void** env
)
424 static const WCHAR wszKeyAppPaths
[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s',
425 '\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','A','p','p',' ','P','a','t','h','s','\\',0};
426 static const WCHAR wPath
[] = {'P','a','t','h',0};
434 if (env
) *env
= NULL
;
435 strcpyW(buffer
, wszKeyAppPaths
);
436 strcatW(buffer
, szName
);
437 res
= RegOpenKeyExW(HKEY_LOCAL_MACHINE
, buffer
, 0, KEY_READ
, &hkApp
);
440 len
= MAX_PATH
*sizeof(WCHAR
);
441 res
= RegQueryValueW(hkApp
, NULL
, lpResult
, &len
);
447 DWORD count
= sizeof(buffer
);
448 if (!RegQueryValueExW(hkApp
, wPath
, NULL
, NULL
, (LPBYTE
)buffer
, &count
) && buffer
[0])
449 *env
= SHELL_BuildEnvW( buffer
);
453 if (hkApp
) RegCloseKey(hkApp
);
457 static UINT
SHELL_FindExecutableByOperation(LPCWSTR lpPath
, LPCWSTR lpFile
, LPCWSTR lpOperation
, LPWSTR key
, LPWSTR filetype
, LPWSTR command
, LONG commandlen
)
459 static const WCHAR wCommand
[] = {'\\','c','o','m','m','a','n','d',0};
461 /* Looking for ...buffer\shell\<verb>\command */
462 strcatW(filetype
, wszShell
);
463 strcatW(filetype
, lpOperation
);
464 strcatW(filetype
, wCommand
);
466 if (RegQueryValueW(HKEY_CLASSES_ROOT
, filetype
, command
,
467 &commandlen
) == ERROR_SUCCESS
)
469 commandlen
/= sizeof(WCHAR
);
470 if (key
) strcpyW(key
, filetype
);
474 LONG paramlen
= sizeof(param
);
475 static const WCHAR wSpace
[] = {' ',0};
477 /* FIXME: it seems all Windows version don't behave the same here.
478 * the doc states that this ddeexec information can be found after
480 * on Win98, it doesn't appear, but I think it does on Win2k
482 /* Get the parameters needed by the application
483 from the associated ddeexec key */
484 tmp
= strstrW(filetype
, wCommand
);
486 strcatW(filetype
, wDdeexec
);
487 if (RegQueryValueW(HKEY_CLASSES_ROOT
, filetype
, param
,
488 ¶mlen
) == ERROR_SUCCESS
)
490 paramlen
/= sizeof(WCHAR
);
491 strcatW(command
, wSpace
);
492 strcatW(command
, param
);
493 commandlen
+= paramlen
;
497 command
[commandlen
] = '\0';
499 return 33; /* FIXME see SHELL_FindExecutable() */
502 return 31; /* default - 'No association was found' */
505 /*************************************************************************
506 * SHELL_FindExecutable [Internal]
508 * Utility for code sharing between FindExecutable and ShellExecute
510 * lpFile the name of a file
511 * lpOperation the operation on it (open)
513 * lpResult a buffer, big enough :-(, to store the command to do the
514 * operation on the file
515 * key a buffer, big enough, to get the key name to do actually the
516 * command (it'll be used afterwards for more information
519 UINT
SHELL_FindExecutable(LPCWSTR lpPath
, LPCWSTR lpFile
, LPCWSTR lpOperation
,
520 LPWSTR lpResult
, int resultLen
, LPWSTR key
, void **env
, LPITEMIDLIST pidl
, LPCWSTR args
)
522 static const WCHAR wWindows
[] = {'w','i','n','d','o','w','s',0};
523 static const WCHAR wPrograms
[] = {'p','r','o','g','r','a','m','s',0};
524 static const WCHAR wExtensions
[] = {'e','x','e',' ','p','i','f',' ','b','a','t',' ','c','m','d',' ','c','o','m',0};
526 WCHAR
*extension
= NULL
; /* pointer to file extension */
527 WCHAR wtmpext
[5]; /* local copy to mung as we please */
528 WCHAR filetype
[256]; /* registry name for this filetype */
529 LONG filetypelen
= sizeof(filetype
); /* length of above */
530 WCHAR command
[256]; /* command from registry */
531 WCHAR wBuffer
[256]; /* Used to GetProfileString */
532 UINT retval
= 31; /* default - 'No association was found' */
533 WCHAR
*tok
; /* token pointer */
534 WCHAR xlpFile
[256]; /* result of SearchPath */
535 DWORD attribs
; /* file attributes */
537 TRACE("%s\n", (lpFile
!= NULL
) ? debugstr_w(lpFile
) : "-");
539 lpResult
[0] = '\0'; /* Start off with an empty return string */
540 if (key
) *key
= '\0';
544 /* trap NULL parameters on entry */
545 if ((lpFile
== NULL
) || (lpResult
== NULL
))
547 WARN("(lpFile=%s,lpResult=%s): NULL parameter\n", debugstr_w(lpFile
), debugstr_w(lpResult
));
548 return 2; /* File not found. Close enough, I guess. */
551 if (SHELL_TryAppPathW( lpFile
, lpResult
, env
))
553 TRACE("found %s via App Paths\n", debugstr_w(lpResult
));
557 if (SearchPathW(lpPath
, lpFile
, wszExe
, sizeof(xlpFile
)/sizeof(WCHAR
), xlpFile
, NULL
))
559 TRACE("SearchPathW returned non-zero\n");
561 /* Hey, isn't this value ignored? Why make this call? Shouldn't we return here? --dank*/
564 attribs
= GetFileAttributesW(lpFile
);
565 if (attribs
!=INVALID_FILE_ATTRIBUTES
&& (attribs
&FILE_ATTRIBUTE_DIRECTORY
))
567 strcpyW(filetype
, wszFolder
);
568 filetypelen
= 6; /* strlen("Folder") */
572 /* First thing we need is the file's extension */
573 extension
= strrchrW(xlpFile
, '.'); /* Assume last "." is the one; */
574 /* File->Run in progman uses */
576 TRACE("xlpFile=%s,extension=%s\n", debugstr_w(xlpFile
), debugstr_w(extension
));
578 if ((extension
== NULL
) || (extension
== &xlpFile
[strlenW(xlpFile
)]))
580 WARN("Returning 31 - No association\n");
581 return 31; /* no association */
583 /* Make local copy & lowercase it for reg & 'programs=' lookup */
584 lstrcpynW(wtmpext
, extension
, 5);
586 TRACE("%s file\n", debugstr_w(wtmpext
));
588 /* Three places to check: */
589 /* 1. win.ini, [windows], programs (NB no leading '.') */
590 /* 2. Registry, HKEY_CLASS_ROOT\<filetype>\shell\open\command */
591 /* 3. win.ini, [extensions], extension (NB no leading '.' */
592 /* All I know of the order is that registry is checked before */
593 /* extensions; however, it'd make sense to check the programs */
594 /* section first, so that's what happens here. */
596 /* See if it's a program - if GetProfileString fails, we skip this
597 * section. Actually, if GetProfileString fails, we've probably
598 * got a lot more to worry about than running a program... */
599 if (GetProfileStringW(wWindows
, wPrograms
, wExtensions
, wBuffer
, sizeof(wBuffer
)/sizeof(WCHAR
)) > 0)
606 while (*p
&& *p
!= ' ' && *p
!= '\t') p
++;
610 while (*p
== ' ' || *p
== '\t') p
++;
613 if (strcmpW(tok
, &wtmpext
[1]) == 0) /* have to skip the leading "." */
615 strcpyW(lpResult
, xlpFile
);
616 /* Need to perhaps check that the file has a path
618 TRACE("found %s\n", debugstr_w(lpResult
));
621 /* Greater than 32 to indicate success FIXME According to the
622 * docs, I should be returning a handle for the
623 * executable. Does this mean I'm supposed to open the
624 * executable file or something? More RTFM, I guess... */
631 if (RegQueryValueW(HKEY_CLASSES_ROOT
, wtmpext
, filetype
,
632 &filetypelen
) == ERROR_SUCCESS
)
634 filetypelen
/= sizeof(WCHAR
);
635 filetype
[filetypelen
] = '\0';
636 TRACE("File type: %s\n", debugstr_w(filetype
));
644 /* pass the operation string to SHELL_FindExecutableByOperation() */
645 filetype
[filetypelen
] = '\0';
646 retval
= SHELL_FindExecutableByOperation(lpPath
, lpFile
, lpOperation
, key
, filetype
, command
, sizeof(command
));
650 WCHAR operation
[MAX_PATH
];
653 /* Looking for ...buffer\shell\<operation>\command */
654 strcatW(filetype
, wszShell
);
656 /* enumerate the operation subkeys in the registry and search for one with an associated command */
657 if (RegOpenKeyW(HKEY_CLASSES_ROOT
, filetype
, &hkey
) == ERROR_SUCCESS
)
662 if (RegEnumKeyW(hkey
, idx
, operation
, MAX_PATH
) != ERROR_SUCCESS
)
665 filetype
[filetypelen
] = '\0';
666 retval
= SHELL_FindExecutableByOperation(lpPath
, lpFile
, operation
, key
, filetype
, command
, sizeof(command
));
677 SHELL_ArgifyW(lpResult
, resultLen
, command
, xlpFile
, pidl
, args
);
679 /* Remove double quotation marks and command line arguments */
680 if (*lpResult
== '"')
683 while (*(p
+ 1) != '"')
692 else if (extension
) /* Check win.ini */
694 static const WCHAR wExtensions
[] = {'e','x','t','e','n','s','i','o','n','s',0};
696 /* Toss the leading dot */
698 if (GetProfileStringW(wExtensions
, extension
, wszEmpty
, command
, sizeof(command
)/sizeof(WCHAR
)) > 0)
700 if (strlenW(command
) != 0)
702 strcpyW(lpResult
, command
);
703 tok
= strchrW(lpResult
, '^'); /* should be ^.extension? */
708 strcatW(lpResult
, xlpFile
); /* what if no dir in xlpFile? */
709 tok
= strchrW(command
, '^'); /* see above */
710 if ((tok
!= NULL
) && (strlenW(tok
)>5))
712 strcatW(lpResult
, &tok
[5]);
716 retval
= 33; /* FIXME - see above */
721 TRACE("returning %s\n", debugstr_w(lpResult
));
725 /******************************************************************
728 * callback for the DDE connection. not really usefull
730 static HDDEDATA CALLBACK
dde_cb(UINT uType
, UINT uFmt
, HCONV hConv
,
732 HDDEDATA hData
, DWORD dwData1
, DWORD dwData2
)
737 /******************************************************************
740 * ShellExecute helper. Used to do an operation with a DDE connection
742 * Handles both the direct connection (try #1), and if it fails,
743 * launching an application and trying (#2) to connect to it
746 static unsigned dde_connect(WCHAR
* key
, WCHAR
* start
, WCHAR
* ddeexec
,
747 const WCHAR
* lpFile
, void *env
,
748 LPCWSTR szCommandline
, LPITEMIDLIST pidl
, SHELL_ExecuteW32 execfunc
,
749 LPSHELLEXECUTEINFOW psei
, LPSHELLEXECUTEINFOW psei_out
)
751 static const WCHAR wApplication
[] = {'\\','a','p','p','l','i','c','a','t','i','o','n',0};
752 static const WCHAR wTopic
[] = {'\\','t','o','p','i','c',0};
754 WCHAR
* endkey
= key
+ strlenW(key
);
755 WCHAR app
[256], topic
[256], ifexec
[256];
757 LONG applen
, topiclen
, ifexeclen
;
761 HSZ hszApp
, hszTopic
;
765 strcpyW(endkey
, wApplication
);
766 applen
= sizeof(app
);
767 if (RegQueryValueW(HKEY_CLASSES_ROOT
, key
, app
, &applen
) != ERROR_SUCCESS
)
769 FIXME("default app name NIY %s\n", debugstr_w(key
));
773 strcpyW(endkey
, wTopic
);
774 topiclen
= sizeof(topic
);
775 if (RegQueryValueW(HKEY_CLASSES_ROOT
, key
, topic
, &topiclen
) != ERROR_SUCCESS
)
777 static const WCHAR wSystem
[] = {'S','y','s','t','e','m',0};
778 strcpyW(topic
, wSystem
);
781 if (DdeInitializeW(&ddeInst
, dde_cb
, APPCMD_CLIENTONLY
, 0L) != DMLERR_NO_ERROR
)
786 hszApp
= DdeCreateStringHandleW(ddeInst
, app
, CP_WINANSI
);
787 hszTopic
= DdeCreateStringHandleW(ddeInst
, topic
, CP_WINANSI
);
789 hConv
= DdeConnect(ddeInst
, hszApp
, hszTopic
, NULL
);
793 static const WCHAR wIfexec
[] = {'\\','i','f','e','x','e','c',0};
794 TRACE("Launching '%s'\n", debugstr_w(start
));
795 ret
= execfunc(start
, env
, TRUE
, psei
, psei_out
);
798 TRACE("Couldn't launch\n");
801 hConv
= DdeConnect(ddeInst
, hszApp
, hszTopic
, NULL
);
804 TRACE("Couldn't connect. ret=%d\n", ret
);
805 DdeUninitialize(ddeInst
);
806 SetLastError(ERROR_DDE_FAIL
);
807 return ret
= 30; /* whatever */
809 strcpyW(endkey
, wIfexec
);
810 ifexeclen
= sizeof(ifexec
);
811 if (RegQueryValueW(HKEY_CLASSES_ROOT
, key
, ifexec
, &ifexeclen
) == ERROR_SUCCESS
)
817 SHELL_ArgifyW(res
, sizeof(res
)/sizeof(WCHAR
), exec
, lpFile
, pidl
, szCommandline
);
818 TRACE("%s %s => %s\n", debugstr_w(exec
), debugstr_w(lpFile
), debugstr_w(res
));
820 ret
= (DdeClientTransaction((LPBYTE
)res
, (strlenW(res
) + 1) * sizeof(WCHAR
), hConv
, 0L, 0,
821 XTYP_EXECUTE
, 10000, &tid
) != DMLERR_NO_ERROR
) ? 31 : 33;
822 DdeDisconnect(hConv
);
824 DdeUninitialize(ddeInst
);
828 /*************************************************************************
829 * execute_from_key [Internal]
831 static UINT
execute_from_key(LPWSTR key
, LPCWSTR lpFile
, void *env
, LPCWSTR szCommandline
,
832 SHELL_ExecuteW32 execfunc
,
833 LPSHELLEXECUTEINFOW psei
, LPSHELLEXECUTEINFOW psei_out
)
836 LONG cmdlen
= sizeof(cmd
);
841 /* Get the application for the registry */
842 if (RegQueryValueW(HKEY_CLASSES_ROOT
, key
, cmd
, &cmdlen
) == ERROR_SUCCESS
)
844 static const WCHAR wCommand
[] = {'c','o','m','m','a','n','d',0};
845 static const WCHAR wDdeexec
[] = {'d','d','e','e','x','e','c',0};
849 LONG paramlen
= sizeof(param
);
853 /* Get the parameters needed by the application
854 from the associated ddeexec key */
855 tmp
= strstrW(key
, wCommand
);
857 strcpyW(tmp
, wDdeexec
);
859 if (RegQueryValueW(HKEY_CLASSES_ROOT
, key
, param
, ¶mlen
) == ERROR_SUCCESS
)
861 TRACE("Got ddeexec %s => %s\n", debugstr_w(key
), debugstr_w(param
));
862 retval
= dde_connect(key
, cmd
, param
, lpFile
, env
, szCommandline
, psei
->lpIDList
, execfunc
, psei
, psei_out
);
866 /* Is there a replace() function anywhere? */
867 cmdlen
/= sizeof(WCHAR
);
869 SHELL_ArgifyW(param
, sizeof(param
)/sizeof(WCHAR
), cmd
, lpFile
, psei
->lpIDList
, szCommandline
);
870 retval
= execfunc(param
, env
, FALSE
, psei
, psei_out
);
873 else TRACE("ooch\n");
878 /*************************************************************************
879 * FindExecutableA [SHELL32.@]
881 HINSTANCE WINAPI
FindExecutableA(LPCSTR lpFile
, LPCSTR lpDirectory
, LPSTR lpResult
)
884 WCHAR
*wFile
= NULL
, *wDirectory
= NULL
;
885 WCHAR wResult
[MAX_PATH
];
887 if (lpFile
) __SHCloneStrAtoW(&wFile
, lpFile
);
888 if (lpDirectory
) __SHCloneStrAtoW(&wDirectory
, lpDirectory
);
890 retval
= FindExecutableW(wFile
, wDirectory
, wResult
);
891 WideCharToMultiByte(CP_ACP
, 0, wResult
, -1, lpResult
, MAX_PATH
, NULL
, NULL
);
892 if (wFile
) SHFree( wFile
);
893 if (wDirectory
) SHFree( wDirectory
);
895 TRACE("returning %s\n", lpResult
);
896 return (HINSTANCE
)retval
;
899 /*************************************************************************
900 * FindExecutableW [SHELL32.@]
902 HINSTANCE WINAPI
FindExecutableW(LPCWSTR lpFile
, LPCWSTR lpDirectory
, LPWSTR lpResult
)
904 UINT retval
= 31; /* default - 'No association was found' */
907 TRACE("File %s, Dir %s\n",
908 (lpFile
!= NULL
? debugstr_w(lpFile
) : "-"), (lpDirectory
!= NULL
? debugstr_w(lpDirectory
) : "-"));
910 lpResult
[0] = '\0'; /* Start off with an empty return string */
912 /* trap NULL parameters on entry */
913 if ((lpFile
== NULL
) || (lpResult
== NULL
))
915 /* FIXME - should throw a warning, perhaps! */
916 return (HINSTANCE
)2; /* File not found. Close enough, I guess. */
921 GetCurrentDirectoryW(sizeof(old_dir
)/sizeof(WCHAR
), old_dir
);
922 SetCurrentDirectoryW(lpDirectory
);
925 retval
= SHELL_FindExecutable(lpDirectory
, lpFile
, wszOpen
, lpResult
, MAX_PATH
, NULL
, NULL
, NULL
, NULL
);
927 TRACE("returning %s\n", debugstr_w(lpResult
));
929 SetCurrentDirectoryW(old_dir
);
930 return (HINSTANCE
)retval
;
933 /*************************************************************************
934 * ShellExecuteExW32 [Internal]
936 BOOL WINAPI
ShellExecuteExW32 (LPSHELLEXECUTEINFOW psei
, SHELL_ExecuteW32 execfunc
)
938 static const WCHAR wQuote
[] = {'"',0};
939 static const WCHAR wSpace
[] = {' ',0};
940 static const WCHAR wWww
[] = {'w','w','w',0};
941 static const WCHAR wFile
[] = {'f','i','l','e',0};
942 static const WCHAR wHttp
[] = {'h','t','t','p',':','/','/',0};
943 static const WCHAR wExtLnk
[] = {'.','l','n','k',0};
944 static const WCHAR wExplorer
[] = {'e','x','p','l','o','r','e','r','.','e','x','e',0};
946 WCHAR wszApplicationName
[MAX_PATH
+2], wszParameters
[1024], wfileName
[MAX_PATH
], wszDir
[MAX_PATH
];
947 SHELLEXECUTEINFOW sei_tmp
; /* modifyable copy of SHELLEXECUTEINFO struct */
949 WCHAR wszProtocol
[256];
955 /* make a local copy of the LPSHELLEXECUTEINFO structure and work with this from now on */
956 memcpy(&sei_tmp
, psei
, sizeof(sei_tmp
));
958 TRACE("mask=0x%08lx hwnd=%p verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s\n",
959 sei_tmp
.fMask
, sei_tmp
.hwnd
, debugstr_w(sei_tmp
.lpVerb
),
960 debugstr_w(sei_tmp
.lpFile
), debugstr_w(sei_tmp
.lpParameters
),
961 debugstr_w(sei_tmp
.lpDirectory
), sei_tmp
.nShow
,
962 (sei_tmp
.fMask
& SEE_MASK_CLASSNAME
) ? debugstr_w(sei_tmp
.lpClass
) : "not used");
964 psei
->hProcess
= NULL
;
966 /* make copies of all path/command strings */
968 strcpyW(wszApplicationName
, sei_tmp
.lpFile
);
970 *wszApplicationName
= '\0';
972 if (sei_tmp
.lpParameters
)
973 strcpyW(wszParameters
, sei_tmp
.lpParameters
);
975 *wszParameters
= '\0';
977 if (sei_tmp
.lpDirectory
)
978 strcpyW(wszDir
, sei_tmp
.lpDirectory
);
982 /* adjust string pointers to point to the new buffers */
983 sei_tmp
.lpFile
= wszApplicationName
;
984 sei_tmp
.lpParameters
= wszParameters
;
985 sei_tmp
.lpDirectory
= wszDir
;
987 if (sei_tmp
.fMask
& (SEE_MASK_ICON
| SEE_MASK_HOTKEY
|
988 SEE_MASK_CONNECTNETDRV
| SEE_MASK_FLAG_DDEWAIT
|
989 SEE_MASK_DOENVSUBST
| SEE_MASK_FLAG_NO_UI
| SEE_MASK_UNICODE
|
990 SEE_MASK_NO_CONSOLE
| SEE_MASK_ASYNCOK
| SEE_MASK_HMONITOR
))
992 FIXME("flags ignored: 0x%08lx\n", sei_tmp
.fMask
);
995 /* process the IDList */
996 if (sei_tmp
.fMask
& SEE_MASK_INVOKEIDLIST
) /* 0x0c: includes SEE_MASK_IDLIST */
998 IShellExecuteHookW
* pSEH
;
1000 HRESULT hr
= SHBindToParent(sei_tmp
.lpIDList
, &IID_IShellExecuteHookW
, (LPVOID
*)&pSEH
, NULL
);
1004 hr
= IShellExecuteHookW_Execute(pSEH
, psei
);
1006 IShellExecuteHookW_Release(pSEH
);
1012 /* try to translate PIDL directly into the corresponding file system path */
1013 if (SUCCEEDED(SHELL_GetPathFromIDListW(sei_tmp
.lpIDList
, wszApplicationName
/*sei_tmp.lpFile*/, sizeof(wszApplicationName
)/sizeof(WCHAR
))))
1015 sei_tmp
.lpIDList
= NULL
;
1016 sei_tmp
.fMask
&= ~SEE_MASK_INVOKEIDLIST
;
1019 TRACE("-- idlist=%p (%s)\n", sei_tmp
.lpIDList
, debugstr_w(wszApplicationName
));
1022 if (sei_tmp
.fMask
& (SEE_MASK_CLASSNAME
| SEE_MASK_CLASSKEY
))
1024 /* launch a document by fileclass like 'WordPad.Document.1' */
1025 /* the Commandline contains 'c:\Path\wordpad.exe "%1"' */
1026 /* FIXME: wszParameters should not be of a fixed size. Fixed to 1024, MAX_PATH is way too short! */
1027 HCR_GetExecuteCommandW((sei_tmp
.fMask
& SEE_MASK_CLASSKEY
)? sei_tmp
.hkeyClass
: NULL
,
1028 (sei_tmp
.fMask
& SEE_MASK_CLASSNAME
)? sei_tmp
.lpClass
: NULL
,
1029 (sei_tmp
.lpVerb
)? sei_tmp
.lpVerb
: wszOpen
,
1030 wszParameters
/*sei_tmp.lpParameters*/, sizeof(wszParameters
)/sizeof(WCHAR
));
1032 /* FIXME: get the extension of lpFile, check if it fits to the lpClass */
1033 TRACE("SEE_MASK_CLASSNAME->'%s', doc->'%s'\n", debugstr_w(sei_tmp
.lpParameters
), debugstr_w(sei_tmp
.lpFile
));
1037 if (!SHELL_ArgifyW(buffer
, sizeof(buffer
)/sizeof(WCHAR
), sei_tmp
.lpParameters
, sei_tmp
.lpFile
, sei_tmp
.lpIDList
, NULL
) && sei_tmp
.lpFile
[0])
1039 strcatW(buffer
, wExtLnk
);
1040 strcatW(buffer
, sei_tmp
.lpFile
);
1043 retval
= execfunc(buffer
, NULL
, FALSE
, &sei_tmp
, psei
);
1051 /* resolve shell shortcuts */
1052 ext
= PathFindExtensionW(sei_tmp
.lpFile
);
1054 if (ext
&& !strcmpiW(ext
, wExtLnk
)) /* or check for: shell_attribs & SFGAO_LINK */
1058 /* expand paths before reading shell link */
1059 if (ExpandEnvironmentStringsW(sei_tmp
.lpFile
, buffer
, MAX_PATH
))
1060 lstrcpyW(wszApplicationName
/*sei_tmp.lpFile*/, buffer
);
1062 if (*sei_tmp
.lpParameters
)
1063 if (ExpandEnvironmentStringsW(sei_tmp
.lpParameters
, buffer
, MAX_PATH
))
1064 lstrcpyW(wszParameters
/*sei_tmp.lpParameters*/, buffer
);
1066 hr
= SHELL_ResolveShortCutW((LPWSTR
)sei_tmp
.lpFile
, (LPWSTR
)sei_tmp
.lpParameters
, (LPWSTR
)sei_tmp
.lpDirectory
,
1067 sei_tmp
.hwnd
, sei_tmp
.lpVerb
?sei_tmp
.lpVerb
:wszEmpty
, &sei_tmp
.nShow
, (LPITEMIDLIST
*)&sei_tmp
.lpIDList
);
1070 psei
->fMask
|= SEE_MASK_IDLIST
; //@@ nicht sei_tmp.fMask ?!
1074 /* repeat IDList processing if needed */
1075 if (sei_tmp
.fMask
& SEE_MASK_IDLIST
)
1077 IShellExecuteHookW
* pSEH
;
1079 HRESULT hr
= SHBindToParent(sei_tmp
.lpIDList
, &IID_IShellExecuteHookW
, (LPVOID
*)&pSEH
, NULL
);
1083 hr
= IShellExecuteHookW_Execute(pSEH
, psei
);
1085 IShellExecuteHookW_Release(pSEH
);
1091 TRACE("-- idlist=%p (%s)\n", debugstr_w(sei_tmp
.lpIDList
), debugstr_w(sei_tmp
.lpFile
));
1097 /* Has the IDList not yet been translated? */
1098 if (sei_tmp
.fMask
& SEE_MASK_IDLIST
)
1100 /* last chance to translate IDList: now also allow CLSID paths */
1101 if (SUCCEEDED(SHELL_GetPathFromIDListForExecuteW(sei_tmp
.lpIDList
, buffer
, sizeof(buffer
)))) {
1102 if (buffer
[0]==':' && buffer
[1]==':') {
1103 /* open shell folder for the specified class GUID */
1104 strcpyW(wszParameters
, buffer
);
1105 strcpyW(wszApplicationName
, wExplorer
);
1107 sei_tmp
.fMask
&= ~SEE_MASK_INVOKEIDLIST
;
1108 } else if (HCR_GetExecuteCommandW(0, wszFolder
, sei_tmp
.lpVerb
?sei_tmp
.lpVerb
:wszOpen
, buffer
, sizeof(buffer
))) {
1109 SHELL_ArgifyW(wszApplicationName
, sizeof(wszApplicationName
)/sizeof(WCHAR
), buffer
, NULL
, sei_tmp
.lpIDList
, NULL
);
1111 sei_tmp
.fMask
&= ~SEE_MASK_INVOKEIDLIST
;
1117 /* expand environment strings */
1119 if (ExpandEnvironmentStringsW(sei_tmp
.lpFile
, buffer
, MAX_PATH
))
1120 lstrcpyW(wszApplicationName
/*sei_tmp.lpFile*/, buffer
);
1122 if (*sei_tmp
.lpParameters
)
1123 if (ExpandEnvironmentStringsW(sei_tmp
.lpParameters
, buffer
, MAX_PATH
))
1124 lstrcpyW(wszParameters
/*sei_tmp.lpParameters*/, buffer
);
1126 if (*sei_tmp
.lpDirectory
)
1127 if (ExpandEnvironmentStringsW(sei_tmp
.lpDirectory
, buffer
, MAX_PATH
))
1128 lstrcpyW(wszDir
/*sei_tmp.lpDirectory*/, buffer
);
1130 /* Else, try to execute the filename */
1131 TRACE("execute:'%s','%s','%s'\n", debugstr_w(wszApplicationName
), debugstr_w(wszCommandline
), debugstr_w(wszDir
));
1134 /* separate out command line arguments from executable file name */
1135 if (!*sei_tmp
.lpParameters
) {
1136 /* If the executable path is quoted, handle the rest of the command line as parameters. */
1137 if (sei_tmp
.lpFile
[0] == '"') {
1138 LPWSTR src
= wszApplicationName
/*sei_tmp.lpFile*/ + 1;
1139 LPWSTR dst
= wfileName
;
1142 /* copy the unquoted executabe path to 'wfileName' */
1143 while(*src
&& *src
!='"')
1151 while(isspace(*src
))
1156 /* copy the parameter string to 'wszParameters' */
1157 strcpyW(wszParameters
, src
);
1159 /* terminate previous command string after the quote character */
1164 /* If the executable name is not quoted, we have to use this search loop here,
1165 that in CreateProcess() is not sufficient because it does not handle shell links. */
1166 WCHAR buffer
[MAX_PATH
], xlpFile
[MAX_PATH
];
1169 LPWSTR beg
= wszApplicationName
/*sei_tmp.lpFile*/;
1170 for(s
=beg
; (space
=strchrW(s
, ' ')); s
=space
+1) {
1171 int idx
= space
-sei_tmp
.lpFile
;
1172 strncpyW(buffer
, sei_tmp
.lpFile
, idx
);
1175 /*FIXME This finds directory paths if the targeted file name contains spaces. */
1176 if (SearchPathW(*sei_tmp
.lpDirectory
? sei_tmp
.lpDirectory
: NULL
, buffer
, wszExe
, sizeof(xlpFile
), xlpFile
, NULL
))
1178 /* separate out command from parameter string */
1179 LPCWSTR p
= space
+ 1;
1184 strcpyW(wszParameters
, p
);
1191 strcpyW(wfileName
, sei_tmp
.lpFile
);
1194 strcpyW(wfileName
, sei_tmp
.lpFile
);
1198 if (sei_tmp
.lpParameters
[0]) {
1199 strcatW(wszApplicationName
/*sei_tmp.lpFile*/, wSpace
);
1200 strcatW(wszApplicationName
/*sei_tmp.lpFile*/, sei_tmp
.lpParameters
);
1203 retval
= execfunc(sei_tmp
.lpFile
, NULL
, FALSE
, &sei_tmp
, psei
);
1206 /* Now, that we have successfully launched a process, we can free the PIDL.
1207 It may have been used before for %I command line options. */
1208 if (sei_tmp
.lpIDList
!=psei
->lpIDList
&& sei_tmp
.lpIDList
)
1209 SHFree(sei_tmp
.lpIDList
);
1211 TRACE("execfunc: retval=%d psei->hInstApp=%p\n", retval
, psei
->hInstApp
);
1215 /* Else, try to find the executable */
1217 retval
= SHELL_FindExecutable(*sei_tmp
.lpDirectory
? sei_tmp
.lpDirectory
: NULL
, lpFile
, sei_tmp
.lpVerb
, buffer
, 1024, wszProtocol
, &env
, sei_tmp
.lpIDList
, sei_tmp
.lpParameters
);
1219 if (retval
> 32) /* Found */
1221 WCHAR wszQuotedCmd
[MAX_PATH
+2];
1222 /* Must quote to handle case where 'buffer' contains spaces,
1223 * else security hole if malicious user creates executable file "C:\\Program"
1225 * FIXME: If we don't have set explicitly command line arguments, we must first
1226 * split executable path from optional command line arguments. Otherwise we would quote
1227 * the complete string with executable path _and_ arguments, which is not what we want.
1229 strcpyW(wszQuotedCmd
, wQuote
);
1230 strcatW(wszQuotedCmd
, buffer
);
1231 strcatW(wszQuotedCmd
, wQuote
);
1233 if (*sei_tmp
.lpParameters
) {
1234 strcatW(wszQuotedCmd
, wSpace
);
1235 strcatW(wszQuotedCmd
, sei_tmp
.lpParameters
);
1238 TRACE("%s/%s => %s/%s\n", debugstr_w(wszApplicationName
), debugstr_w(buffer
), debugstr_w(wszQuotedCmd
), debugstr_w(wszProtocol
));
1241 retval
= execute_from_key(wszProtocol
, lpFile
, env
, sei_tmp
.lpParameters
, execfunc
, &sei_tmp
, psei
);
1243 retval
= execfunc(wszQuotedCmd
, env
, FALSE
, &sei_tmp
, psei
);
1245 if (env
) HeapFree( GetProcessHeap(), 0, env
);
1247 else if (PathIsURLW((LPWSTR
)lpFile
)) /* File not found, check for URL */
1249 static const WCHAR wszShell
[] = {'\\','s','h','e','l','l','\\',0};
1250 static const WCHAR wCommand
[] = {'\\','c','o','m','m','a','n','d',0};
1254 lpstrRes
= strchrW(lpFile
, ':');
1256 iSize
= lpstrRes
- lpFile
;
1258 iSize
= strlenW(lpFile
);
1260 TRACE("Got URL: %s\n", debugstr_w(lpFile
));
1261 /* Looking for ...protocol\shell\<verb>\command */
1262 strncpyW(wszProtocol
, lpFile
, iSize
);
1263 wszProtocol
[iSize
] = '\0';
1264 strcatW(wszProtocol
, wszShell
);
1265 strcatW(wszProtocol
, sei_tmp
.lpVerb
? sei_tmp
.lpVerb
: wszOpen
);
1266 strcatW(wszProtocol
, wCommand
);
1268 /* Remove File Protocol from lpFile */
1269 /* In the case file://path/file */
1270 if (!strncmpiW(lpFile
, wFile
, iSize
))
1273 while (*lpFile
== ':') lpFile
++;
1276 retval
= execute_from_key(wszProtocol
, lpFile
, NULL
, sei_tmp
.lpParameters
, execfunc
, &sei_tmp
, psei
);
1278 /* Check if file specified is in the form www.??????.*** */
1279 else if (!strncmpiW(lpFile
, wWww
, 3))
1281 /* if so, append lpFile http:// and call ShellExecute */
1282 WCHAR lpstrTmpFile
[256];
1283 strcpyW(lpstrTmpFile
, wHttp
);
1284 strcatW(lpstrTmpFile
, lpFile
);
1285 retval
= (UINT
)ShellExecuteW(sei_tmp
.hwnd
, sei_tmp
.lpVerb
, lpstrTmpFile
, NULL
, NULL
, 0);
1288 /* Now we can free the PIDL. It may have been used before for %I command line options. */
1289 if (sei_tmp
.lpIDList
!=psei
->lpIDList
&& sei_tmp
.lpIDList
)
1290 SHFree(sei_tmp
.lpIDList
);
1292 TRACE("retval %u\n", retval
);
1296 psei
->hInstApp
= (HINSTANCE
)retval
;
1300 psei
->hInstApp
= (HINSTANCE
)33;
1304 /*************************************************************************
1305 * ShellExecuteA [SHELL32.290]
1307 HINSTANCE WINAPI
ShellExecuteA(HWND hWnd
, LPCSTR lpOperation
, LPCSTR lpFile
,
1308 LPCSTR lpParameters
, LPCSTR lpDirectory
, INT iShowCmd
)
1310 SHELLEXECUTEINFOA sei
;
1311 HANDLE hProcess
= 0;
1314 sei
.cbSize
= sizeof(sei
);
1317 sei
.lpVerb
= lpOperation
;
1318 sei
.lpFile
= lpFile
;
1319 sei
.lpParameters
= lpParameters
;
1320 sei
.lpDirectory
= lpDirectory
;
1321 sei
.nShow
= iShowCmd
;
1326 sei
.hProcess
= hProcess
;
1328 ShellExecuteExA (&sei
);
1329 return sei
.hInstApp
;
1332 /*************************************************************************
1333 * ShellExecuteEx [SHELL32.291]
1336 BOOL WINAPI
ShellExecuteExAW (LPVOID sei
)
1338 if (SHELL_OsIsUnicode())
1339 return ShellExecuteExW32 (sei
, SHELL_ExecuteW
);
1340 return ShellExecuteExA (sei
);
1343 /*************************************************************************
1344 * ShellExecuteExA [SHELL32.292]
1347 BOOL WINAPI
ShellExecuteExA (LPSHELLEXECUTEINFOA sei
)
1349 SHELLEXECUTEINFOW seiW
;
1351 WCHAR
*wVerb
= NULL
, *wFile
= NULL
, *wParameters
= NULL
, *wDirectory
= NULL
, *wClass
= NULL
;
1355 memcpy(&seiW
, sei
, sizeof(SHELLEXECUTEINFOW
));
1358 seiW
.lpVerb
= __SHCloneStrAtoW(&wVerb
, sei
->lpVerb
);
1361 seiW
.lpFile
= __SHCloneStrAtoW(&wFile
, sei
->lpFile
);
1363 if (sei
->lpParameters
)
1364 seiW
.lpParameters
= __SHCloneStrAtoW(&wParameters
, sei
->lpParameters
);
1366 if (sei
->lpDirectory
)
1367 seiW
.lpDirectory
= __SHCloneStrAtoW(&wDirectory
, sei
->lpDirectory
);
1369 if ((sei
->fMask
& SEE_MASK_CLASSNAME
) && sei
->lpClass
)
1370 seiW
.lpClass
= __SHCloneStrAtoW(&wClass
, sei
->lpClass
);
1372 seiW
.lpClass
= NULL
;
1374 ret
= ShellExecuteExW32 (&seiW
, SHELL_ExecuteW
);
1376 sei
->hInstApp
= seiW
.hInstApp
;
1378 if (wVerb
) SHFree(wVerb
);
1379 if (wFile
) SHFree(wFile
);
1380 if (wParameters
) SHFree(wParameters
);
1381 if (wDirectory
) SHFree(wDirectory
);
1382 if (wClass
) SHFree(wClass
);
1387 /*************************************************************************
1388 * ShellExecuteExW [SHELL32.293]
1391 BOOL WINAPI
ShellExecuteExW (LPSHELLEXECUTEINFOW sei
)
1393 return ShellExecuteExW32 (sei
, SHELL_ExecuteW
);
1396 /*************************************************************************
1397 * ShellExecuteW [SHELL32.294]
1399 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
1400 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
1402 HINSTANCE WINAPI
ShellExecuteW(HWND hwnd
, LPCWSTR lpOperation
, LPCWSTR lpFile
,
1403 LPCWSTR lpParameters
, LPCWSTR lpDirectory
, INT nShowCmd
)
1405 SHELLEXECUTEINFOW sei
;
1408 sei
.cbSize
= sizeof(sei
);
1411 sei
.lpVerb
= lpOperation
;
1412 sei
.lpFile
= lpFile
;
1413 sei
.lpParameters
= lpParameters
;
1414 sei
.lpDirectory
= lpDirectory
;
1415 sei
.nShow
= nShowCmd
;
1422 ShellExecuteExW32 (&sei
, SHELL_ExecuteW
);
1423 return sei
.hInstApp
;