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
))
129 /* else fall through */
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]!='"')
156 * IE uses this alot for activating things such as windows media
157 * player. This is not verified to be fully correct but it appears
163 strcpyW(res
, lpFile
);
164 res
+= strlenW(lpFile
);
171 HGLOBAL hmem
= SHAllocShared(pidl
, ILGetSize(pidl
), 0);
172 pv
= SHLockShared(hmem
, 0);
173 res
+= sprintfW(res
, wszILPtr
, pv
);
178 default: FIXME("Unknown escape sequence %%%c\n", *fmt
);
193 HRESULT
SHELL_GetPathFromIDListForExecuteA(LPCITEMIDLIST pidl
, LPSTR pszPath
, UINT uOutSize
)
196 IShellFolder
* desktop
;
198 HRESULT hr
= SHGetDesktopFolder(&desktop
);
201 hr
= IShellFolder_GetDisplayNameOf(desktop
, pidl
, SHGDN_FORPARSING
, &strret
);
204 StrRetToStrNA(pszPath
, uOutSize
, &strret
, pidl
);
206 IShellFolder_Release(desktop
);
212 HRESULT
SHELL_GetPathFromIDListForExecuteW(LPCITEMIDLIST pidl
, LPWSTR pszPath
, UINT uOutSize
)
215 IShellFolder
* desktop
;
217 HRESULT hr
= SHGetDesktopFolder(&desktop
);
220 hr
= IShellFolder_GetDisplayNameOf(desktop
, pidl
, SHGDN_FORPARSING
, &strret
);
223 StrRetToStrNW(pszPath
, uOutSize
, &strret
, pidl
);
225 IShellFolder_Release(desktop
);
231 /*************************************************************************
232 * SHELL_ResolveShortCutW [Internal]
233 * read shortcut file at 'wcmd'
235 static HRESULT
SHELL_ResolveShortCutW(LPWSTR wcmd
, LPWSTR wargs
, LPWSTR wdir
, HWND hwnd
, LPCWSTR lpVerb
, int* pshowcmd
, LPITEMIDLIST
* ppidl
)
239 HRESULT hr
= SHGetDesktopFolder(&psf
);
247 hr
= IShellFolder_ParseDisplayName(psf
, 0, 0, wcmd
, &l
, &pidl
, 0);
252 hr
= IShellFolder_GetUIObjectOf(psf
, NULL
, 1, (LPCITEMIDLIST
*)&pidl
, &IID_IShellLinkW
, NULL
, (LPVOID
*)&psl
);
255 hr
= IShellLinkW_Resolve(psl
, hwnd
, 0);
258 hr
= IShellLinkW_GetPath(psl
, wcmd
, MAX_PATH
, NULL
, SLGP_UNCPRIORITY
);
262 /* We could not translate the PIDL in the shell link into a valid file system path - so return the PIDL instead. */
263 hr
= IShellLinkW_GetIDList(psl
, ppidl
);
265 if (SUCCEEDED(hr
) && *ppidl
) {
266 /* We got a PIDL instead of a file system path - try to translate it. */
267 if (SUCCEEDED(SHELL_GetPathFromIDListW(*ppidl
, wcmd
, MAX_PATH
))) {
275 /* get command line arguments, working directory and display mode if available */
276 IShellLinkW_GetWorkingDirectory(psl
, wdir
, MAX_PATH
);
277 IShellLinkW_GetArguments(psl
, wargs
, MAX_PATH
);
278 IShellLinkW_GetShowCmd(psl
, pshowcmd
);
283 IShellLinkW_Release(psl
);
289 IShellFolder_Release(psf
);
295 /*************************************************************************
296 * SHELL_ExecuteW [Internal]
299 static UINT
SHELL_ExecuteW(const WCHAR
*lpCmd
, void *env
, BOOL shWait
,
300 LPSHELLEXECUTEINFOW psei
, LPSHELLEXECUTEINFOW psei_out
)
302 STARTUPINFOW startup
;
303 PROCESS_INFORMATION info
;
306 WCHAR curdir
[MAX_PATH
];
308 TRACE("Execute %s from directory %s\n", debugstr_w(lpCmd
), debugstr_w(psei
->lpDirectory
));
310 /* ShellExecute specifies the command from psei->lpDirectory
311 * if present. Not from the current dir as CreateProcess does */
312 if( psei
->lpDirectory
&& psei
->lpDirectory
[0] )
313 if( ( gcdret
= GetCurrentDirectoryW( MAX_PATH
, curdir
)))
314 if( !SetCurrentDirectoryW( psei
->lpDirectory
))
315 ERR("cannot set directory %s\n", debugstr_w(psei
->lpDirectory
));
317 ZeroMemory(&startup
, sizeof(startup
));
318 startup
.cb
= sizeof(STARTUPINFOW
);
319 startup
.dwFlags
= STARTF_USESHOWWINDOW
;
320 startup
.wShowWindow
= psei
->nShow
;
322 if (CreateProcessW(NULL
, (LPWSTR
)lpCmd
, NULL
, NULL
, FALSE
, 0,
323 env
, *psei
->lpDirectory
? psei
->lpDirectory
: NULL
, &startup
, &info
))
325 /* Give 30 seconds to the app to come up, if desired. Probably only needed
326 when starting app immediately before making a DDE connection. */
328 if (WaitForInputIdle( info
.hProcess
, 30000 ) == WAIT_FAILED
)
329 WARN("WaitForInputIdle failed: Error %ld\n", GetLastError() );
332 if (psei
->fMask
& SEE_MASK_NOCLOSEPROCESS
)
333 psei_out
->hProcess
= info
.hProcess
;
335 CloseHandle(info
.hProcess
);
337 CloseHandle(info
.hThread
);
339 else if ((retval
= GetLastError()) >= 32)
341 FIXME("Strange error set by CreateProcess: %d\n", retval
);
342 retval
= ERROR_BAD_FORMAT
;
345 TRACE("returning %u\n", retval
);
347 psei_out
->hInstApp
= (HINSTANCE
)retval
;
350 if( !SetCurrentDirectoryW( curdir
))
351 ERR("cannot return to directory %s\n", debugstr_w(curdir
));
357 /***********************************************************************
358 * SHELL_BuildEnvW [Internal]
360 * Build the environment for the new process, adding the specified
361 * path to the PATH variable. Returned pointer must be freed by caller.
363 static void *SHELL_BuildEnvW( const WCHAR
*path
)
365 static const WCHAR wPath
[] = {'P','A','T','H','=',0};
366 WCHAR
*strings
, *new_env
;
368 int total
= strlenW(path
) + 1;
369 BOOL got_path
= FALSE
;
371 if (!(strings
= GetEnvironmentStringsW())) return NULL
;
375 int len
= strlenW(p
) + 1;
376 if (!strncmpiW( p
, wPath
, 5 )) got_path
= TRUE
;
380 if (!got_path
) total
+= 5; /* we need to create PATH */
381 total
++; /* terminating null */
383 if (!(new_env
= HeapAlloc( GetProcessHeap(), 0, total
* sizeof(WCHAR
) )))
385 FreeEnvironmentStringsW( strings
);
392 int len
= strlenW(p
) + 1;
393 memcpy( p2
, p
, len
* sizeof(WCHAR
) );
394 if (!strncmpiW( p
, wPath
, 5 ))
397 strcpyW( p2
+ len
, path
);
398 p2
+= strlenW(path
) + 1;
405 strcpyW( p2
, wPath
);
407 p2
+= strlenW(p2
) + 1;
410 FreeEnvironmentStringsW( strings
);
415 /***********************************************************************
416 * SHELL_TryAppPathW [Internal]
418 * Helper function for SHELL_FindExecutable
419 * @param lpResult - pointer to a buffer of size MAX_PATH
420 * On entry: szName is a filename (probably without path separators).
421 * On exit: if szName found in "App Path", place full path in lpResult, and return true
423 static BOOL
SHELL_TryAppPathW(LPCWSTR szName
, LPWSTR lpResult
, void** env
)
425 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',
426 '\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','A','p','p',' ','P','a','t','h','s','\\',0};
427 static const WCHAR wPath
[] = {'P','a','t','h',0};
435 if (env
) *env
= NULL
;
436 strcpyW(buffer
, wszKeyAppPaths
);
437 strcatW(buffer
, szName
);
438 res
= RegOpenKeyExW(HKEY_LOCAL_MACHINE
, buffer
, 0, KEY_READ
, &hkApp
);
441 len
= MAX_PATH
*sizeof(WCHAR
);
442 res
= RegQueryValueW(hkApp
, NULL
, lpResult
, &len
);
448 DWORD count
= sizeof(buffer
);
449 if (!RegQueryValueExW(hkApp
, wPath
, NULL
, NULL
, (LPBYTE
)buffer
, &count
) && buffer
[0])
450 *env
= SHELL_BuildEnvW( buffer
);
454 if (hkApp
) RegCloseKey(hkApp
);
458 static UINT
SHELL_FindExecutableByOperation(LPCWSTR lpPath
, LPCWSTR lpFile
, LPCWSTR lpOperation
, LPWSTR key
, LPWSTR filetype
, LPWSTR command
, LONG commandlen
)
460 static const WCHAR wCommand
[] = {'\\','c','o','m','m','a','n','d',0};
462 /* Looking for ...buffer\shell\<verb>\command */
463 strcatW(filetype
, wszShell
);
464 strcatW(filetype
, lpOperation
);
465 strcatW(filetype
, wCommand
);
467 if (RegQueryValueW(HKEY_CLASSES_ROOT
, filetype
, command
,
468 &commandlen
) == ERROR_SUCCESS
)
470 commandlen
/= sizeof(WCHAR
);
471 if (key
) strcpyW(key
, filetype
);
475 LONG paramlen
= sizeof(param
);
476 static const WCHAR wSpace
[] = {' ',0};
478 /* FIXME: it seems all Windows version don't behave the same here.
479 * the doc states that this ddeexec information can be found after
481 * on Win98, it doesn't appear, but I think it does on Win2k
483 /* Get the parameters needed by the application
484 from the associated ddeexec key */
485 tmp
= strstrW(filetype
, wCommand
);
487 strcatW(filetype
, wDdeexec
);
488 if (RegQueryValueW(HKEY_CLASSES_ROOT
, filetype
, param
,
489 ¶mlen
) == ERROR_SUCCESS
)
491 paramlen
/= sizeof(WCHAR
);
492 strcatW(command
, wSpace
);
493 strcatW(command
, param
);
494 commandlen
+= paramlen
;
498 command
[commandlen
] = '\0';
500 return 33; /* FIXME see SHELL_FindExecutable() */
503 return 31; /* default - 'No association was found' */
506 /*************************************************************************
507 * SHELL_FindExecutable [Internal]
509 * Utility for code sharing between FindExecutable and ShellExecute
511 * lpFile the name of a file
512 * lpOperation the operation on it (open)
514 * lpResult a buffer, big enough :-(, to store the command to do the
515 * operation on the file
516 * key a buffer, big enough, to get the key name to do actually the
517 * command (it'll be used afterwards for more information
520 UINT
SHELL_FindExecutable(LPCWSTR lpPath
, LPCWSTR lpFile
, LPCWSTR lpOperation
,
521 LPWSTR lpResult
, int resultLen
, LPWSTR key
, void **env
, LPITEMIDLIST pidl
, LPCWSTR args
)
523 static const WCHAR wWindows
[] = {'w','i','n','d','o','w','s',0};
524 static const WCHAR wPrograms
[] = {'p','r','o','g','r','a','m','s',0};
525 static const WCHAR wExtensions
[] = {'e','x','e',' ','p','i','f',' ','b','a','t',' ','c','m','d',' ','c','o','m',0};
527 WCHAR
*extension
= NULL
; /* pointer to file extension */
528 WCHAR wtmpext
[5]; /* local copy to mung as we please */
529 WCHAR filetype
[256]; /* registry name for this filetype */
530 LONG filetypelen
= sizeof(filetype
); /* length of above */
531 WCHAR command
[256]; /* command from registry */
532 WCHAR wBuffer
[256]; /* Used to GetProfileString */
533 UINT retval
= 31; /* default - 'No association was found' */
534 WCHAR
*tok
; /* token pointer */
535 WCHAR xlpFile
[256]; /* result of SearchPath */
536 DWORD attribs
; /* file attributes */
538 TRACE("%s\n", (lpFile
!= NULL
) ? debugstr_w(lpFile
) : "-");
541 lpResult
[0] = '\0'; /* Start off with an empty return string */
542 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 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
);
825 DdeUninitialize(ddeInst
);
830 /*************************************************************************
831 * execute_from_key [Internal]
833 static UINT
execute_from_key(LPWSTR key
, LPCWSTR lpFile
, void *env
, LPCWSTR szCommandline
,
834 SHELL_ExecuteW32 execfunc
,
835 LPSHELLEXECUTEINFOW psei
, LPSHELLEXECUTEINFOW psei_out
)
838 LONG cmdlen
= sizeof(cmd
);
843 /* Get the application for the registry */
844 if (RegQueryValueW(HKEY_CLASSES_ROOT
, key
, cmd
, &cmdlen
) == ERROR_SUCCESS
)
846 static const WCHAR wCommand
[] = {'c','o','m','m','a','n','d',0};
847 static const WCHAR wDdeexec
[] = {'d','d','e','e','x','e','c',0};
851 LONG paramlen
= sizeof(param
);
855 /* Get the parameters needed by the application
856 from the associated ddeexec key */
857 tmp
= strstrW(key
, wCommand
);
859 strcpyW(tmp
, wDdeexec
);
861 if (RegQueryValueW(HKEY_CLASSES_ROOT
, key
, param
, ¶mlen
) == ERROR_SUCCESS
)
863 TRACE("Got ddeexec %s => %s\n", debugstr_w(key
), debugstr_w(param
));
864 retval
= dde_connect(key
, cmd
, param
, lpFile
, env
, szCommandline
, psei
->lpIDList
, execfunc
, psei
, psei_out
);
868 /* Is there a replace() function anywhere? */
869 cmdlen
/= sizeof(WCHAR
);
871 SHELL_ArgifyW(param
, sizeof(param
)/sizeof(WCHAR
), cmd
, lpFile
, psei
->lpIDList
, szCommandline
);
872 retval
= execfunc(param
, env
, FALSE
, psei
, psei_out
);
875 else TRACE("ooch\n");
880 /*************************************************************************
881 * FindExecutableA [SHELL32.@]
883 HINSTANCE WINAPI
FindExecutableA(LPCSTR lpFile
, LPCSTR lpDirectory
, LPSTR lpResult
)
886 WCHAR
*wFile
= NULL
, *wDirectory
= NULL
;
887 WCHAR wResult
[MAX_PATH
];
889 if (lpFile
) __SHCloneStrAtoW(&wFile
, lpFile
);
890 if (lpDirectory
) __SHCloneStrAtoW(&wDirectory
, lpDirectory
);
892 retval
= FindExecutableW(wFile
, wDirectory
, wResult
);
893 WideCharToMultiByte(CP_ACP
, 0, wResult
, -1, lpResult
, MAX_PATH
, NULL
, NULL
);
894 if (wFile
) SHFree( wFile
);
895 if (wDirectory
) SHFree( wDirectory
);
897 TRACE("returning %s\n", lpResult
);
898 return (HINSTANCE
)retval
;
901 /*************************************************************************
902 * FindExecutableW [SHELL32.@]
904 HINSTANCE WINAPI
FindExecutableW(LPCWSTR lpFile
, LPCWSTR lpDirectory
, LPWSTR lpResult
)
906 UINT retval
= 31; /* default - 'No association was found' */
909 TRACE("File %s, Dir %s\n",
910 (lpFile
!= NULL
? debugstr_w(lpFile
) : "-"), (lpDirectory
!= NULL
? debugstr_w(lpDirectory
) : "-"));
912 lpResult
[0] = '\0'; /* Start off with an empty return string */
914 /* trap NULL parameters on entry */
915 if ((lpFile
== NULL
) || (lpResult
== NULL
))
917 /* FIXME - should throw a warning, perhaps! */
918 return (HINSTANCE
)2; /* File not found. Close enough, I guess. */
923 GetCurrentDirectoryW(sizeof(old_dir
)/sizeof(WCHAR
), old_dir
);
924 SetCurrentDirectoryW(lpDirectory
);
927 retval
= SHELL_FindExecutable(lpDirectory
, lpFile
, wszOpen
, lpResult
, MAX_PATH
, NULL
, NULL
, NULL
, NULL
);
929 TRACE("returning %s\n", debugstr_w(lpResult
));
931 SetCurrentDirectoryW(old_dir
);
932 return (HINSTANCE
)retval
;
935 /*************************************************************************
936 * ShellExecuteExW32 [Internal]
938 BOOL WINAPI
ShellExecuteExW32 (LPSHELLEXECUTEINFOW psei
, SHELL_ExecuteW32 execfunc
)
940 static const WCHAR wQuote
[] = {'"',0};
941 static const WCHAR wSpace
[] = {' ',0};
942 static const WCHAR wWww
[] = {'w','w','w',0};
943 static const WCHAR wFile
[] = {'f','i','l','e',0};
944 static const WCHAR wHttp
[] = {'h','t','t','p',':','/','/',0};
945 static const WCHAR wExtLnk
[] = {'.','l','n','k',0};
946 static const WCHAR wExplorer
[] = {'e','x','p','l','o','r','e','r','.','e','x','e',0};
948 WCHAR wszApplicationName
[MAX_PATH
+2], wszParameters
[1024], wszDir
[MAX_PATH
];
949 SHELLEXECUTEINFOW sei_tmp
; /* modifyable copy of SHELLEXECUTEINFO struct */
950 WCHAR wfileName
[MAX_PATH
];
952 WCHAR wszProtocol
[256];
958 /* make a local copy of the LPSHELLEXECUTEINFO structure and work with this from now on */
959 memcpy(&sei_tmp
, psei
, sizeof(sei_tmp
));
961 TRACE("mask=0x%08lx hwnd=%p verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s\n",
962 sei_tmp
.fMask
, sei_tmp
.hwnd
, debugstr_w(sei_tmp
.lpVerb
),
963 debugstr_w(sei_tmp
.lpFile
), debugstr_w(sei_tmp
.lpParameters
),
964 debugstr_w(sei_tmp
.lpDirectory
), sei_tmp
.nShow
,
965 (sei_tmp
.fMask
& SEE_MASK_CLASSNAME
) ? debugstr_w(sei_tmp
.lpClass
) : "not used");
967 psei
->hProcess
= NULL
;
969 /* make copies of all path/command strings */
971 strcpyW(wszApplicationName
, sei_tmp
.lpFile
);
973 *wszApplicationName
= '\0';
975 if (sei_tmp
.lpParameters
)
976 strcpyW(wszParameters
, sei_tmp
.lpParameters
);
978 *wszParameters
= '\0';
980 if (sei_tmp
.lpDirectory
)
981 strcpyW(wszDir
, sei_tmp
.lpDirectory
);
985 /* adjust string pointers to point to the new buffers */
986 sei_tmp
.lpFile
= wszApplicationName
;
987 sei_tmp
.lpParameters
= wszParameters
;
988 sei_tmp
.lpDirectory
= wszDir
;
990 if (sei_tmp
.fMask
& (SEE_MASK_ICON
| SEE_MASK_HOTKEY
|
991 SEE_MASK_CONNECTNETDRV
| SEE_MASK_FLAG_DDEWAIT
|
992 SEE_MASK_DOENVSUBST
| SEE_MASK_FLAG_NO_UI
| SEE_MASK_UNICODE
|
993 SEE_MASK_NO_CONSOLE
| SEE_MASK_ASYNCOK
| SEE_MASK_HMONITOR
))
995 FIXME("flags ignored: 0x%08lx\n", sei_tmp
.fMask
);
998 /* process the IDList */
999 if (sei_tmp
.fMask
& SEE_MASK_IDLIST
)
1001 IShellExecuteHookW
* pSEH
;
1003 HRESULT hr
= SHBindToParent(sei_tmp
.lpIDList
, &IID_IShellExecuteHookW
, (LPVOID
*)&pSEH
, NULL
);
1007 hr
= IShellExecuteHookW_Execute(pSEH
, psei
);
1009 IShellExecuteHookW_Release(pSEH
);
1015 /* try to translate PIDL directly into the corresponding file system path */
1016 if (SUCCEEDED(SHELL_GetPathFromIDListW(sei_tmp
.lpIDList
, wszApplicationName
/*sei_tmp.lpFile*/, sizeof(wszApplicationName
)/sizeof(WCHAR
))))
1018 sei_tmp
.lpIDList
= NULL
;
1019 sei_tmp
.fMask
&= ~SEE_MASK_INVOKEIDLIST
;
1022 TRACE("-- idlist=%p (%s)\n", sei_tmp
.lpIDList
, debugstr_w(wszApplicationName
));
1025 if (sei_tmp
.fMask
& (SEE_MASK_CLASSNAME
| SEE_MASK_CLASSKEY
))
1027 /* launch a document by fileclass like 'WordPad.Document.1' */
1028 /* the Commandline contains 'c:\Path\wordpad.exe "%1"' */
1029 /* FIXME: wszParameters should not be of a fixed size. Fixed to 1024, MAX_PATH is way too short! */
1030 HCR_GetExecuteCommandW((sei_tmp
.fMask
& SEE_MASK_CLASSKEY
)? sei_tmp
.hkeyClass
: NULL
,
1031 (sei_tmp
.fMask
& SEE_MASK_CLASSNAME
)? sei_tmp
.lpClass
: NULL
,
1032 (sei_tmp
.lpVerb
)? sei_tmp
.lpVerb
: wszOpen
,
1033 wszParameters
/*sei_tmp.lpParameters*/, sizeof(wszParameters
)/sizeof(WCHAR
));
1035 /* FIXME: get the extension of lpFile, check if it fits to the lpClass */
1036 TRACE("SEE_MASK_CLASSNAME->'%s', doc->'%s'\n", debugstr_w(sei_tmp
.lpParameters
), debugstr_w(sei_tmp
.lpFile
));
1040 if (!SHELL_ArgifyW(buffer
, sizeof(buffer
)/sizeof(WCHAR
), sei_tmp
.lpParameters
, sei_tmp
.lpFile
, sei_tmp
.lpIDList
, NULL
) && sei_tmp
.lpFile
[0])
1042 strcatW(buffer
, wExtLnk
);
1043 strcatW(buffer
, sei_tmp
.lpFile
);
1046 retval
= execfunc(buffer
, NULL
, FALSE
, &sei_tmp
, psei
);
1054 /* resolve shell shortcuts */
1055 ext
= PathFindExtensionW(sei_tmp
.lpFile
);
1057 if (ext
&& !strcmpiW(ext
, wExtLnk
)) /* or check for: shell_attribs & SFGAO_LINK */
1061 /* expand paths before reading shell link */
1062 if (ExpandEnvironmentStringsW(sei_tmp
.lpFile
, buffer
, MAX_PATH
))
1063 lstrcpyW(wszApplicationName
/*sei_tmp.lpFile*/, buffer
);
1065 if (*sei_tmp
.lpParameters
)
1066 if (ExpandEnvironmentStringsW(sei_tmp
.lpParameters
, buffer
, MAX_PATH
))
1067 lstrcpyW(wszParameters
/*sei_tmp.lpParameters*/, buffer
);
1069 hr
= SHELL_ResolveShortCutW((LPWSTR
)sei_tmp
.lpFile
, (LPWSTR
)sei_tmp
.lpParameters
, (LPWSTR
)sei_tmp
.lpDirectory
,
1070 sei_tmp
.hwnd
, sei_tmp
.lpVerb
?sei_tmp
.lpVerb
:wszEmpty
, &sei_tmp
.nShow
, (LPITEMIDLIST
*)&sei_tmp
.lpIDList
);
1073 psei
->fMask
|= SEE_MASK_IDLIST
; //@@ nicht sei_tmp.fMask ?!
1077 /* repeat IDList processing if needed */
1078 if (sei_tmp
.fMask
& SEE_MASK_IDLIST
)
1080 IShellExecuteHookW
* pSEH
;
1082 HRESULT hr
= SHBindToParent(sei_tmp
.lpIDList
, &IID_IShellExecuteHookW
, (LPVOID
*)&pSEH
, NULL
);
1086 hr
= IShellExecuteHookW_Execute(pSEH
, psei
);
1088 IShellExecuteHookW_Release(pSEH
);
1094 TRACE("-- idlist=%p (%s)\n", debugstr_w(sei_tmp
.lpIDList
), debugstr_w(sei_tmp
.lpFile
));
1100 /* Has the IDList not yet been translated? */
1101 if (sei_tmp
.fMask
& SEE_MASK_IDLIST
)
1103 /* last chance to translate IDList: now also allow CLSID paths */
1104 if (SUCCEEDED(SHELL_GetPathFromIDListForExecuteW(sei_tmp
.lpIDList
, buffer
, sizeof(buffer
)))) {
1105 if (buffer
[0]==':' && buffer
[1]==':') {
1106 /* open shell folder for the specified class GUID */
1107 strcpyW(wszParameters
, buffer
);
1108 strcpyW(wszApplicationName
, wExplorer
);
1110 sei_tmp
.fMask
&= ~SEE_MASK_INVOKEIDLIST
;
1111 } else if (HCR_GetExecuteCommandW(0, wszFolder
, sei_tmp
.lpVerb
?sei_tmp
.lpVerb
:wszOpen
, buffer
, sizeof(buffer
))) {
1112 SHELL_ArgifyW(wszApplicationName
, sizeof(wszApplicationName
)/sizeof(WCHAR
), buffer
, NULL
, sei_tmp
.lpIDList
, NULL
);
1114 sei_tmp
.fMask
&= ~SEE_MASK_INVOKEIDLIST
;
1120 /* expand environment strings */
1122 if (ExpandEnvironmentStringsW(sei_tmp
.lpFile
, buffer
, MAX_PATH
))
1123 lstrcpyW(wszApplicationName
/*sei_tmp.lpFile*/, buffer
);
1125 if (*sei_tmp
.lpParameters
)
1126 if (ExpandEnvironmentStringsW(sei_tmp
.lpParameters
, buffer
, MAX_PATH
))
1127 lstrcpyW(wszParameters
/*sei_tmp.lpParameters*/, buffer
);
1129 if (*sei_tmp
.lpDirectory
)
1130 if (ExpandEnvironmentStringsW(sei_tmp
.lpDirectory
, buffer
, MAX_PATH
))
1131 lstrcpyW(wszDir
/*sei_tmp.lpDirectory*/, buffer
);
1133 /* Else, try to execute the filename */
1134 TRACE("execute:'%s','%s','%s'\n", debugstr_w(wszApplicationName
), debugstr_w(wszCommandline
), debugstr_w(wszDir
));
1137 /* separate out command line arguments from executable file name */
1138 if (!*sei_tmp
.lpParameters
) {
1139 /* If the executable path is quoted, handle the rest of the command line as parameters. */
1140 if (sei_tmp
.lpFile
[0] == '"') {
1141 LPWSTR src
= wszApplicationName
/*sei_tmp.lpFile*/ + 1;
1142 LPWSTR dst
= wfileName
;
1145 /* copy the unquoted executabe path to 'wfileName' */
1146 while(*src
&& *src
!='"')
1154 while(isspace(*src
))
1159 /* copy the parameter string to 'wszParameters' */
1160 strcpyW(wszParameters
, src
);
1162 /* terminate previous command string after the quote character */
1167 /* If the executable name is not quoted, we have to use this search loop here,
1168 that in CreateProcess() is not sufficient because it does not handle shell links. */
1169 WCHAR buffer
[MAX_PATH
], xlpFile
[MAX_PATH
];
1172 LPWSTR beg
= wszApplicationName
/*sei_tmp.lpFile*/;
1173 for(s
=beg
; (space
=strchrW(s
, ' ')); s
=space
+1) {
1174 int idx
= space
-sei_tmp
.lpFile
;
1175 strncpyW(buffer
, sei_tmp
.lpFile
, idx
);
1178 /*FIXME This finds directory paths if the targeted file name contains spaces. */
1179 if (SearchPathW(*sei_tmp
.lpDirectory
? sei_tmp
.lpDirectory
: NULL
, buffer
, wszExe
, sizeof(xlpFile
), xlpFile
, NULL
))
1181 /* separate out command from parameter string */
1182 LPCWSTR p
= space
+ 1;
1187 strcpyW(wszParameters
, p
);
1194 strcpyW(wfileName
, sei_tmp
.lpFile
);
1197 strcpyW(wfileName
, sei_tmp
.lpFile
);
1201 if (sei_tmp
.lpParameters
[0]) {
1202 strcatW(wszApplicationName
/*sei_tmp.lpFile*/, wSpace
);
1203 strcatW(wszApplicationName
/*sei_tmp.lpFile*/, sei_tmp
.lpParameters
);
1206 retval
= execfunc(sei_tmp
.lpFile
, NULL
, FALSE
, &sei_tmp
, psei
);
1209 /* Now, that we have successfully launched a process, we can free the PIDL.
1210 It may have been used before for %I command line options. */
1211 if (sei_tmp
.lpIDList
!=psei
->lpIDList
&& sei_tmp
.lpIDList
)
1212 SHFree(sei_tmp
.lpIDList
);
1214 TRACE("execfunc: retval=%d psei->hInstApp=%p\n", retval
, psei
->hInstApp
);
1218 /* Else, try to find the executable */
1220 retval
= SHELL_FindExecutable(*sei_tmp
.lpDirectory
? sei_tmp
.lpDirectory
: NULL
, lpFile
, sei_tmp
.lpVerb
, buffer
, 1024, wszProtocol
, &env
, sei_tmp
.lpIDList
, sei_tmp
.lpParameters
);
1222 if (retval
> 32) /* Found */
1224 WCHAR wszQuotedCmd
[MAX_PATH
+2];
1225 /* Must quote to handle case where 'buffer' contains spaces,
1226 * else security hole if malicious user creates executable file "C:\\Program"
1228 * FIXME: If we don't have set explicitly command line arguments, we must first
1229 * split executable path from optional command line arguments. Otherwise we would quote
1230 * the complete string with executable path _and_ arguments, which is not what we want.
1232 strcpyW(wszQuotedCmd
, wQuote
);
1233 strcatW(wszQuotedCmd
, buffer
);
1234 strcatW(wszQuotedCmd
, wQuote
);
1236 if (*sei_tmp
.lpParameters
) {
1237 strcatW(wszQuotedCmd
, wSpace
);
1238 strcatW(wszQuotedCmd
, sei_tmp
.lpParameters
);
1241 TRACE("%s/%s => %s/%s\n", debugstr_w(wszApplicationName
), debugstr_w(buffer
), debugstr_w(wszQuotedCmd
), debugstr_w(wszProtocol
));
1244 retval
= execute_from_key(wszProtocol
, lpFile
, env
, sei_tmp
.lpParameters
, execfunc
, &sei_tmp
, psei
);
1246 retval
= execfunc(wszQuotedCmd
, env
, FALSE
, &sei_tmp
, psei
);
1248 if (env
) HeapFree( GetProcessHeap(), 0, env
);
1250 else if (PathIsURLW((LPWSTR
)lpFile
)) /* File not found, check for URL */
1252 static const WCHAR wszShell
[] = {'\\','s','h','e','l','l','\\',0};
1253 static const WCHAR wCommand
[] = {'\\','c','o','m','m','a','n','d',0};
1257 lpstrRes
= strchrW(lpFile
, ':');
1259 iSize
= lpstrRes
- lpFile
;
1261 iSize
= strlenW(lpFile
);
1263 TRACE("Got URL: %s\n", debugstr_w(lpFile
));
1264 /* Looking for ...protocol\shell\<verb>\command */
1265 strncpyW(wszProtocol
, lpFile
, iSize
);
1266 wszProtocol
[iSize
] = '\0';
1267 strcatW(wszProtocol
, wszShell
);
1268 strcatW(wszProtocol
, sei_tmp
.lpVerb
? sei_tmp
.lpVerb
: wszOpen
);
1269 strcatW(wszProtocol
, wCommand
);
1271 /* Remove File Protocol from lpFile */
1272 /* In the case file://path/file */
1273 if (!strncmpiW(lpFile
, wFile
, iSize
))
1276 while (*lpFile
== ':') lpFile
++;
1279 retval
= execute_from_key(wszProtocol
, lpFile
, NULL
, sei_tmp
.lpParameters
, execfunc
, &sei_tmp
, psei
);
1281 /* Check if file specified is in the form www.??????.*** */
1282 else if (!strncmpiW(lpFile
, wWww
, 3))
1284 /* if so, append lpFile http:// and call ShellExecute */
1285 WCHAR lpstrTmpFile
[256];
1286 strcpyW(lpstrTmpFile
, wHttp
);
1287 strcatW(lpstrTmpFile
, lpFile
);
1288 retval
= (UINT
)ShellExecuteW(sei_tmp
.hwnd
, sei_tmp
.lpVerb
, lpstrTmpFile
, NULL
, NULL
, 0);
1291 /* Now we can free the PIDL. It may have been used before for %I command line options. */
1292 if (sei_tmp
.lpIDList
!=psei
->lpIDList
&& sei_tmp
.lpIDList
)
1293 SHFree(sei_tmp
.lpIDList
);
1295 TRACE("retval %u\n", retval
);
1299 psei
->hInstApp
= (HINSTANCE
)retval
;
1303 psei
->hInstApp
= (HINSTANCE
)33;
1307 /*************************************************************************
1308 * ShellExecuteA [SHELL32.290]
1310 HINSTANCE WINAPI
ShellExecuteA(HWND hWnd
, LPCSTR lpOperation
, LPCSTR lpFile
,
1311 LPCSTR lpParameters
, LPCSTR lpDirectory
, INT iShowCmd
)
1313 SHELLEXECUTEINFOA sei
;
1314 HANDLE hProcess
= 0;
1317 sei
.cbSize
= sizeof(sei
);
1320 sei
.lpVerb
= lpOperation
;
1321 sei
.lpFile
= lpFile
;
1322 sei
.lpParameters
= lpParameters
;
1323 sei
.lpDirectory
= lpDirectory
;
1324 sei
.nShow
= iShowCmd
;
1329 sei
.hProcess
= hProcess
;
1331 ShellExecuteExA (&sei
);
1332 return sei
.hInstApp
;
1335 /*************************************************************************
1336 * ShellExecuteEx [SHELL32.291]
1339 BOOL WINAPI
ShellExecuteExAW (LPVOID sei
)
1341 if (SHELL_OsIsUnicode())
1342 return ShellExecuteExW32 (sei
, SHELL_ExecuteW
);
1343 return ShellExecuteExA (sei
);
1346 /*************************************************************************
1347 * ShellExecuteExA [SHELL32.292]
1350 BOOL WINAPI
ShellExecuteExA (LPSHELLEXECUTEINFOA sei
)
1352 SHELLEXECUTEINFOW seiW
;
1354 WCHAR
*wVerb
= NULL
, *wFile
= NULL
, *wParameters
= NULL
, *wDirectory
= NULL
, *wClass
= NULL
;
1358 memcpy(&seiW
, sei
, sizeof(SHELLEXECUTEINFOW
));
1361 seiW
.lpVerb
= __SHCloneStrAtoW(&wVerb
, sei
->lpVerb
);
1364 seiW
.lpFile
= __SHCloneStrAtoW(&wFile
, sei
->lpFile
);
1366 if (sei
->lpParameters
)
1367 seiW
.lpParameters
= __SHCloneStrAtoW(&wParameters
, sei
->lpParameters
);
1369 if (sei
->lpDirectory
)
1370 seiW
.lpDirectory
= __SHCloneStrAtoW(&wDirectory
, sei
->lpDirectory
);
1372 if ((sei
->fMask
& SEE_MASK_CLASSNAME
) && sei
->lpClass
)
1373 seiW
.lpClass
= __SHCloneStrAtoW(&wClass
, sei
->lpClass
);
1375 seiW
.lpClass
= NULL
;
1377 ret
= ShellExecuteExW32 (&seiW
, SHELL_ExecuteW
);
1379 sei
->hInstApp
= seiW
.hInstApp
;
1381 if (wVerb
) SHFree(wVerb
);
1382 if (wFile
) SHFree(wFile
);
1383 if (wParameters
) SHFree(wParameters
);
1384 if (wDirectory
) SHFree(wDirectory
);
1385 if (wClass
) SHFree(wClass
);
1390 /*************************************************************************
1391 * ShellExecuteExW [SHELL32.293]
1394 BOOL WINAPI
ShellExecuteExW (LPSHELLEXECUTEINFOW sei
)
1396 return ShellExecuteExW32 (sei
, SHELL_ExecuteW
);
1399 /*************************************************************************
1400 * ShellExecuteW [SHELL32.294]
1402 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
1403 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
1405 HINSTANCE WINAPI
ShellExecuteW(HWND hwnd
, LPCWSTR lpOperation
, LPCWSTR lpFile
,
1406 LPCWSTR lpParameters
, LPCWSTR lpDirectory
, INT nShowCmd
)
1408 SHELLEXECUTEINFOW sei
;
1411 sei
.cbSize
= sizeof(sei
);
1414 sei
.lpVerb
= lpOperation
;
1415 sei
.lpFile
= lpFile
;
1416 sei
.lpParameters
= lpParameters
;
1417 sei
.lpDirectory
= lpDirectory
;
1418 sei
.nShow
= nShowCmd
;
1425 ShellExecuteExW32 (&sei
, SHELL_ExecuteW
);
1426 return sei
.hInstApp
;