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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "wine/port.h"
45 #include "shell32_main.h"
49 #include "wine/debug.h"
51 WINE_DEFAULT_DEBUG_CHANNEL(exec
);
53 static const WCHAR wszOpen
[] = {'o','p','e','n',0};
54 static const WCHAR wszExe
[] = {'.','e','x','e',0};
55 static const WCHAR wszILPtr
[] = {':','%','p',0};
56 static const WCHAR wszShell
[] = {'\\','s','h','e','l','l','\\',0};
57 static const WCHAR wszFolder
[] = {'F','o','l','d','e','r',0};
58 static const WCHAR wszEmpty
[] = {0};
60 #define SEE_MASK_CLASSALL (SEE_MASK_CLASSNAME | SEE_MASK_CLASSKEY)
62 typedef UINT_PTR (*SHELL_ExecuteW32
)(const WCHAR
*lpCmd
, WCHAR
*env
, BOOL shWait
,
63 const SHELLEXECUTEINFOW
*sei
, LPSHELLEXECUTEINFOW sei_out
);
66 /***********************************************************************
67 * SHELL_ArgifyW [Internal]
69 * this function is supposed to expand the escape sequences found in the registry
70 * some diving reported that the following were used:
71 * + %1, %2... seem to report to parameter of index N in ShellExecute pmts
76 * %I address of a global item ID (explorer switch /idlist)
77 * %L seems to be %1 as long filename followed by the 8+3 variation
79 * %* all following parameters (see batfile)
82 static BOOL
SHELL_ArgifyW(WCHAR
* out
, int len
, const WCHAR
* fmt
, const WCHAR
* lpFile
, LPITEMIDLIST pidl
, LPCWSTR args
, DWORD
* out_len
)
86 BOOL found_p1
= FALSE
;
91 TRACE("%p, %d, %s, %s, %p, %p\n", out
, len
, debugstr_w(fmt
),
92 debugstr_w(lpFile
), pidl
, args
);
138 while(*args
&& !isspace(*args
))
147 while(isspace(*args
))
152 /* else fall through */
154 if (!done
|| (*fmt
== '1'))
156 /*FIXME Is the call to SearchPathW() really needed? We already have separated out the parameter string in args. */
157 if (SearchPathW(NULL
, lpFile
, wszExe
, sizeof(xlpFile
)/sizeof(WCHAR
), xlpFile
, NULL
))
162 used
+= strlenW(cmd
);
173 * IE uses this a lot for activating things such as windows media
174 * player. This is not verified to be fully correct but it appears
180 used
+= strlenW(lpFile
);
183 strcpyW(res
, lpFile
);
184 res
+= strlenW(lpFile
);
194 /* %p should not exceed 8, maybe 16 when looking forward to 64bit.
195 * allowing a buffer of 100 should more than exceed all needs */
198 HGLOBAL hmem
= SHAllocShared(pidl
, ILGetSize(pidl
), 0);
199 pv
= SHLockShared(hmem
, 0);
200 chars
= sprintfW(buf
, wszILPtr
, pv
);
201 if (chars
>= sizeof(buf
)/sizeof(WCHAR
))
202 ERR("pidl format buffer too small!\n");
216 * Check if this is an env-variable here...
219 /* Make sure that we have at least one more %.*/
220 if (strchrW(fmt
, '%'))
222 WCHAR tmpBuffer
[1024];
223 PWSTR tmpB
= tmpBuffer
;
224 WCHAR tmpEnvBuff
[MAX_PATH
];
231 TRACE("Checking %s to be an env-var\n", debugstr_w(tmpBuffer
));
233 envRet
= GetEnvironmentVariableW(tmpBuffer
, tmpEnvBuff
, MAX_PATH
);
234 if (envRet
== 0 || envRet
> MAX_PATH
)
236 used
+= strlenW(tmpBuffer
);
239 strcpyW( res
, tmpBuffer
);
240 res
+= strlenW(tmpBuffer
);
245 used
+= strlenW(tmpEnvBuff
);
248 strcpyW( res
, tmpEnvBuff
);
249 res
+= strlenW(tmpEnvBuff
);
256 /* Don't skip past terminator (catch a single '%' at the end) */
278 TRACE("used %i of %i space\n",used
,len
);
285 static HRESULT
SHELL_GetPathFromIDListForExecuteW(LPCITEMIDLIST pidl
, LPWSTR pszPath
, UINT uOutSize
)
288 IShellFolder
* desktop
;
290 HRESULT hr
= SHGetDesktopFolder(&desktop
);
293 hr
= IShellFolder_GetDisplayNameOf(desktop
, pidl
, SHGDN_FORPARSING
, &strret
);
296 StrRetToStrNW(pszPath
, uOutSize
, &strret
, pidl
);
298 IShellFolder_Release(desktop
);
304 /*************************************************************************
305 * SHELL_ExecuteW [Internal]
308 static UINT_PTR
SHELL_ExecuteW(const WCHAR
*lpCmd
, WCHAR
*env
, BOOL shWait
,
309 const SHELLEXECUTEINFOW
*psei
, LPSHELLEXECUTEINFOW psei_out
)
311 STARTUPINFOW startup
;
312 PROCESS_INFORMATION info
;
313 UINT_PTR retval
= SE_ERR_NOASSOC
;
315 WCHAR curdir
[MAX_PATH
];
316 DWORD dwCreationFlags
;
317 const WCHAR
*lpDirectory
= NULL
;
319 TRACE("Execute %s from directory %s\n", debugstr_w(lpCmd
), debugstr_w(psei
->lpDirectory
));
321 /* make sure we don't fail the CreateProcess if the calling app passes in
322 * a bad working directory */
323 if (psei
->lpDirectory
&& psei
->lpDirectory
[0])
325 DWORD attr
= GetFileAttributesW(psei
->lpDirectory
);
326 if (attr
!= INVALID_FILE_ATTRIBUTES
&& attr
& FILE_ATTRIBUTE_DIRECTORY
)
327 lpDirectory
= psei
->lpDirectory
;
330 /* ShellExecute specifies the command from psei->lpDirectory
331 * if present. Not from the current dir as CreateProcess does */
333 if( ( gcdret
= GetCurrentDirectoryW( MAX_PATH
, curdir
)))
334 if( !SetCurrentDirectoryW( lpDirectory
))
335 ERR("cannot set directory %s\n", debugstr_w(lpDirectory
));
336 ZeroMemory(&startup
,sizeof(STARTUPINFOW
));
337 startup
.cb
= sizeof(STARTUPINFOW
);
338 startup
.dwFlags
= STARTF_USESHOWWINDOW
;
339 startup
.wShowWindow
= psei
->nShow
;
340 dwCreationFlags
= CREATE_UNICODE_ENVIRONMENT
;
341 if (psei
->fMask
& SEE_MASK_NO_CONSOLE
)
342 dwCreationFlags
|= CREATE_NEW_CONSOLE
;
343 if (CreateProcessW(NULL
, (LPWSTR
)lpCmd
, NULL
, NULL
, FALSE
, dwCreationFlags
, env
,
344 lpDirectory
, &startup
, &info
))
346 /* Give 30 seconds to the app to come up, if desired. Probably only needed
347 when starting app immediately before making a DDE connection. */
349 if (WaitForInputIdle( info
.hProcess
, 30000 ) == WAIT_FAILED
)
350 WARN("WaitForInputIdle failed: Error %d\n", GetLastError() );
352 if (psei
->fMask
& SEE_MASK_NOCLOSEPROCESS
)
353 psei_out
->hProcess
= info
.hProcess
;
355 CloseHandle( info
.hProcess
);
356 CloseHandle( info
.hThread
);
358 else if ((retval
= GetLastError()) >= 32)
360 TRACE("CreateProcess returned error %ld\n", retval
);
361 retval
= ERROR_BAD_FORMAT
;
364 TRACE("returning %lu\n", retval
);
366 psei_out
->hInstApp
= (HINSTANCE
)retval
;
368 if( !SetCurrentDirectoryW( curdir
))
369 ERR("cannot return to directory %s\n", debugstr_w(curdir
));
375 /***********************************************************************
376 * SHELL_BuildEnvW [Internal]
378 * Build the environment for the new process, adding the specified
379 * path to the PATH variable. Returned pointer must be freed by caller.
381 static void *SHELL_BuildEnvW( const WCHAR
*path
)
383 static const WCHAR wPath
[] = {'P','A','T','H','=',0};
384 WCHAR
*strings
, *new_env
;
386 int total
= strlenW(path
) + 1;
387 BOOL got_path
= FALSE
;
389 if (!(strings
= GetEnvironmentStringsW())) return NULL
;
393 int len
= strlenW(p
) + 1;
394 if (!strncmpiW( p
, wPath
, 5 )) got_path
= TRUE
;
398 if (!got_path
) total
+= 5; /* we need to create PATH */
399 total
++; /* terminating null */
401 if (!(new_env
= HeapAlloc( GetProcessHeap(), 0, total
* sizeof(WCHAR
) )))
403 FreeEnvironmentStringsW( strings
);
410 int len
= strlenW(p
) + 1;
411 memcpy( p2
, p
, len
* sizeof(WCHAR
) );
412 if (!strncmpiW( p
, wPath
, 5 ))
415 strcpyW( p2
+ len
, path
);
416 p2
+= strlenW(path
) + 1;
423 strcpyW( p2
, wPath
);
425 p2
+= strlenW(p2
) + 1;
428 FreeEnvironmentStringsW( strings
);
433 /***********************************************************************
434 * SHELL_TryAppPathW [Internal]
436 * Helper function for SHELL_FindExecutable
437 * @param lpResult - pointer to a buffer of size MAX_PATH
438 * On entry: szName is a filename (probably without path separators).
439 * On exit: if szName found in "App Path", place full path in lpResult, and return true
441 static BOOL
SHELL_TryAppPathW( LPCWSTR szName
, LPWSTR lpResult
, WCHAR
**env
)
443 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',
444 '\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','A','p','p',' ','P','a','t','h','s','\\',0};
445 static const WCHAR wPath
[] = {'P','a','t','h',0};
452 if (env
) *env
= NULL
;
453 strcpyW(buffer
, wszKeyAppPaths
);
454 strcatW(buffer
, szName
);
455 res
= RegOpenKeyExW(HKEY_LOCAL_MACHINE
, buffer
, 0, KEY_READ
, &hkApp
);
458 len
= MAX_PATH
*sizeof(WCHAR
);
459 res
= RegQueryValueW(hkApp
, NULL
, lpResult
, &len
);
465 DWORD count
= sizeof(buffer
);
466 if (!RegQueryValueExW(hkApp
, wPath
, NULL
, NULL
, (LPBYTE
)buffer
, &count
) && buffer
[0])
467 *env
= SHELL_BuildEnvW( buffer
);
471 if (hkApp
) RegCloseKey(hkApp
);
475 /*************************************************************************
476 * SHELL_FindExecutableByOperation [Internal]
478 * called from SHELL_FindExecutable or SHELL_execute_class
480 * filetype a buffer, big enough, to get the key name to do actually the
481 * command "WordPad.Document.1\\shell\\open\\command"
482 * passed as "WordPad.Document.1"
484 * lpOperation the operation on it (open)
485 * commandlen the size of command buffer (in bytes)
487 * command a buffer, to store the command to do the
488 * operation on the file
489 * key a buffer, big enough, to get the key name to do actually the
490 * command "WordPad.Document.1\\shell\\open\\command"
493 static UINT
SHELL_FindExecutableByOperation(LPCWSTR lpOperation
, LPWSTR key
, LPWSTR filetype
, LPWSTR command
, LONG commandlen
)
495 static const WCHAR wCommand
[] = {'\\','c','o','m','m','a','n','d',0};
497 WCHAR verb
[MAX_PATH
];
499 if (RegOpenKeyExW(HKEY_CLASSES_ROOT
, filetype
, 0, 0x02000000, &hkeyClass
))
500 return SE_ERR_NOASSOC
;
501 if (!HCR_GetDefaultVerbW(hkeyClass
, lpOperation
, verb
, sizeof(verb
)/sizeof(verb
[0])))
502 return SE_ERR_NOASSOC
;
503 RegCloseKey(hkeyClass
);
505 /* Looking for ...buffer\shell\<verb>\command */
506 strcatW(filetype
, wszShell
);
507 strcatW(filetype
, verb
);
508 strcatW(filetype
, wCommand
);
510 if (RegQueryValueW(HKEY_CLASSES_ROOT
, filetype
, command
,
511 &commandlen
) == ERROR_SUCCESS
)
513 commandlen
/= sizeof(WCHAR
);
514 if (key
) strcpyW(key
, filetype
);
518 LONG paramlen
= sizeof(param
);
519 static const WCHAR wSpace
[] = {' ',0};
521 /* FIXME: it seems all Windows version don't behave the same here.
522 * the doc states that this ddeexec information can be found after
524 * on Win98, it doesn't appear, but I think it does on Win2k
526 /* Get the parameters needed by the application
527 from the associated ddeexec key */
528 tmp
= strstrW(filetype
, wCommand
);
530 strcatW(filetype
, wDdeexec
);
531 if (RegQueryValueW(HKEY_CLASSES_ROOT
, filetype
, param
,
532 ¶mlen
) == ERROR_SUCCESS
)
534 paramlen
/= sizeof(WCHAR
);
535 strcatW(command
, wSpace
);
536 strcatW(command
, param
);
537 commandlen
+= paramlen
;
541 command
[commandlen
] = '\0';
543 return 33; /* FIXME see SHELL_FindExecutable() */
546 return SE_ERR_NOASSOC
;
549 /*************************************************************************
550 * SHELL_FindExecutable [Internal]
552 * Utility for code sharing between FindExecutable and ShellExecute
554 * lpFile the name of a file
555 * lpOperation the operation on it (open)
557 * lpResult a buffer, big enough :-(, to store the command to do the
558 * operation on the file
559 * key a buffer, big enough, to get the key name to do actually the
560 * command (it'll be used afterwards for more information
563 static UINT
SHELL_FindExecutable(LPCWSTR lpPath
, LPCWSTR lpFile
, LPCWSTR lpOperation
,
564 LPWSTR lpResult
, int resultLen
, LPWSTR key
, WCHAR
**env
, LPITEMIDLIST pidl
, LPCWSTR args
)
566 static const WCHAR wWindows
[] = {'w','i','n','d','o','w','s',0};
567 static const WCHAR wPrograms
[] = {'p','r','o','g','r','a','m','s',0};
568 static const WCHAR wExtensions
[] = {'e','x','e',' ','p','i','f',' ','b','a','t',' ','c','m','d',' ','c','o','m',0};
569 WCHAR
*extension
= NULL
; /* pointer to file extension */
570 WCHAR filetype
[256]; /* registry name for this filetype */
571 LONG filetypelen
= sizeof(filetype
); /* length of above */
572 WCHAR command
[1024]; /* command from registry */
573 WCHAR wBuffer
[256]; /* Used to GetProfileString */
574 UINT retval
= SE_ERR_NOASSOC
;
575 WCHAR
*tok
; /* token pointer */
576 WCHAR xlpFile
[256]; /* result of SearchPath */
577 DWORD attribs
; /* file attributes */
579 TRACE("%s\n", debugstr_w(lpFile
));
582 return ERROR_INVALID_PARAMETER
;
585 lpResult
[0] = '\0'; /* Start off with an empty return string */
586 if (key
) *key
= '\0';
588 /* trap NULL parameters on entry */
591 WARN("(lpFile=%s,lpResult=%s): NULL parameter\n",
592 debugstr_w(lpFile
), debugstr_w(lpResult
));
593 return ERROR_FILE_NOT_FOUND
; /* File not found. Close enough, I guess. */
596 if (SHELL_TryAppPathW( lpFile
, lpResult
, env
))
598 TRACE("found %s via App Paths\n", debugstr_w(lpResult
));
602 if (SearchPathW(lpPath
, lpFile
, wszExe
, sizeof(xlpFile
)/sizeof(WCHAR
), xlpFile
, NULL
))
604 TRACE("SearchPathW returned non-zero\n");
606 /* Hey, isn't this value ignored? Why make this call? Shouldn't we return here? --dank*/
609 attribs
= GetFileAttributesW(lpFile
);
610 if (attribs
!=INVALID_FILE_ATTRIBUTES
&& (attribs
&FILE_ATTRIBUTE_DIRECTORY
))
612 strcpyW(filetype
, wszFolder
);
616 /* Did we get something? Anything? */
619 TRACE("Returning SE_ERR_FNF\n");
622 /* First thing we need is the file's extension */
623 extension
= strrchrW(xlpFile
, '.'); /* Assume last "." is the one; */
624 /* File->Run in progman uses */
626 TRACE("xlpFile=%s,extension=%s\n", debugstr_w(xlpFile
), debugstr_w(extension
));
628 if (extension
== NULL
|| extension
[1]==0)
630 WARN("Returning SE_ERR_NOASSOC\n");
631 return SE_ERR_NOASSOC
;
634 /* Three places to check: */
635 /* 1. win.ini, [windows], programs (NB no leading '.') */
636 /* 2. Registry, HKEY_CLASS_ROOT\<filetype>\shell\open\command */
637 /* 3. win.ini, [extensions], extension (NB no leading '.' */
638 /* All I know of the order is that registry is checked before */
639 /* extensions; however, it'd make sense to check the programs */
640 /* section first, so that's what happens here. */
642 /* See if it's a program - if GetProfileString fails, we skip this
643 * section. Actually, if GetProfileString fails, we've probably
644 * got a lot more to worry about than running a program... */
645 if (GetProfileStringW(wWindows
, wPrograms
, wExtensions
, wBuffer
, sizeof(wBuffer
)/sizeof(WCHAR
)) > 0)
652 while (*p
&& *p
!= ' ' && *p
!= '\t') p
++;
656 while (*p
== ' ' || *p
== '\t') p
++;
659 if (strcmpiW(tok
, &extension
[1]) == 0) /* have to skip the leading "." */
661 strcpyW(lpResult
, xlpFile
);
662 /* Need to perhaps check that the file has a path
664 TRACE("found %s\n", debugstr_w(lpResult
));
666 /* Greater than 32 to indicate success */
673 if (RegQueryValueW(HKEY_CLASSES_ROOT
, extension
, filetype
,
674 &filetypelen
) == ERROR_SUCCESS
)
676 filetypelen
/= sizeof(WCHAR
);
677 if (filetypelen
== sizeof(filetype
)/sizeof(WCHAR
))
679 filetype
[filetypelen
] = '\0';
680 TRACE("File type: %s\n", debugstr_w(filetype
));
690 /* pass the operation string to SHELL_FindExecutableByOperation() */
691 retval
= SHELL_FindExecutableByOperation(lpOperation
, key
, filetype
, command
, sizeof(command
));
696 SHELL_ArgifyW(lpResult
, resultLen
, command
, xlpFile
, pidl
, args
, &finishedLen
);
697 if (finishedLen
> resultLen
)
698 ERR("Argify buffer not large enough.. truncated\n");
700 /* Remove double quotation marks and command line arguments */
701 if (*lpResult
== '"')
704 while (*(p
+ 1) != '"')
713 /* Truncate on first space */
715 while (*p
!= ' ' && *p
!= '\0')
721 else /* Check win.ini */
723 static const WCHAR wExtensions
[] = {'e','x','t','e','n','s','i','o','n','s',0};
725 /* Toss the leading dot */
727 if (GetProfileStringW(wExtensions
, extension
, wszEmpty
, command
, sizeof(command
)/sizeof(WCHAR
)) > 0)
729 if (strlenW(command
) != 0)
731 strcpyW(lpResult
, command
);
732 tok
= strchrW(lpResult
, '^'); /* should be ^.extension? */
736 strcatW(lpResult
, xlpFile
); /* what if no dir in xlpFile? */
737 tok
= strchrW(command
, '^'); /* see above */
738 if ((tok
!= NULL
) && (strlenW(tok
)>5))
740 strcatW(lpResult
, &tok
[5]);
743 retval
= 33; /* FIXME - see above */
748 TRACE("returning %s\n", debugstr_w(lpResult
));
752 /******************************************************************
755 * callback for the DDE connection. not really useful
757 static HDDEDATA CALLBACK
dde_cb(UINT uType
, UINT uFmt
, HCONV hConv
,
758 HSZ hsz1
, HSZ hsz2
, HDDEDATA hData
,
759 ULONG_PTR dwData1
, ULONG_PTR dwData2
)
761 TRACE("dde_cb: %04x, %04x, %p, %p, %p, %p, %08lx, %08lx\n",
762 uType
, uFmt
, hConv
, hsz1
, hsz2
, hData
, dwData1
, dwData2
);
766 /******************************************************************
769 * ShellExecute helper. Used to do an operation with a DDE connection
771 * Handles both the direct connection (try #1), and if it fails,
772 * launching an application and trying (#2) to connect to it
775 static unsigned dde_connect(const WCHAR
* key
, const WCHAR
* start
, WCHAR
* ddeexec
,
776 const WCHAR
* lpFile
, WCHAR
*env
,
777 LPCWSTR szCommandline
, LPITEMIDLIST pidl
, SHELL_ExecuteW32 execfunc
,
778 const SHELLEXECUTEINFOW
*psei
, LPSHELLEXECUTEINFOW psei_out
)
780 static const WCHAR wApplication
[] = {'\\','a','p','p','l','i','c','a','t','i','o','n',0};
781 static const WCHAR wTopic
[] = {'\\','t','o','p','i','c',0};
783 WCHAR
* endkey
= regkey
+ strlenW(key
);
784 WCHAR app
[256], topic
[256], ifexec
[256], static_res
[256];
785 WCHAR
* dynamic_res
=NULL
;
787 LONG applen
, topiclen
, ifexeclen
;
792 HSZ hszApp
, hszTopic
;
795 unsigned ret
= SE_ERR_NOASSOC
;
796 BOOL unicode
= !(GetVersion() & 0x80000000);
798 strcpyW(regkey
, key
);
799 strcpyW(endkey
, wApplication
);
800 applen
= sizeof(app
);
801 if (RegQueryValueW(HKEY_CLASSES_ROOT
, regkey
, app
, &applen
) != ERROR_SUCCESS
)
803 WCHAR command
[1024], fullpath
[MAX_PATH
];
804 static const WCHAR wSo
[] = { '.','s','o',0 };
805 int sizeSo
= sizeof(wSo
)/sizeof(WCHAR
);
809 /* Get application command from start string and find filename of application */
812 strcpyW(command
, start
+1);
813 if ((ptr
= strchrW(command
, '"')))
815 ret
= SearchPathW(NULL
, command
, wszExe
, sizeof(fullpath
)/sizeof(WCHAR
), fullpath
, &ptr
);
821 for (p
=start
; (space
=strchrW(p
, ' ')); p
=space
+1)
823 int idx
= space
-start
;
824 memcpy(command
, start
, idx
*sizeof(WCHAR
));
826 if ((ret
= SearchPathW(NULL
, command
, wszExe
, sizeof(fullpath
)/sizeof(WCHAR
), fullpath
, &ptr
)))
830 ret
= SearchPathW(NULL
, start
, wszExe
, sizeof(fullpath
)/sizeof(WCHAR
), fullpath
, &ptr
);
835 ERR("Unable to find application path for command %s\n", debugstr_w(start
));
836 return ERROR_ACCESS_DENIED
;
840 /* Remove extensions (including .so) */
841 ptr
= app
+ strlenW(app
) - (sizeSo
-1);
842 if (strlenW(app
) >= sizeSo
&&
846 ptr
= strrchrW(app
, '.');
851 strcpyW(endkey
, wTopic
);
852 topiclen
= sizeof(topic
);
853 if (RegQueryValueW(HKEY_CLASSES_ROOT
, regkey
, topic
, &topiclen
) != ERROR_SUCCESS
)
855 static const WCHAR wSystem
[] = {'S','y','s','t','e','m',0};
856 strcpyW(topic
, wSystem
);
861 if (DdeInitializeW(&ddeInst
, dde_cb
, APPCMD_CLIENTONLY
, 0L) != DMLERR_NO_ERROR
)
866 if (DdeInitializeA(&ddeInst
, dde_cb
, APPCMD_CLIENTONLY
, 0L) != DMLERR_NO_ERROR
)
870 hszApp
= DdeCreateStringHandleW(ddeInst
, app
, CP_WINUNICODE
);
871 hszTopic
= DdeCreateStringHandleW(ddeInst
, topic
, CP_WINUNICODE
);
873 hConv
= DdeConnect(ddeInst
, hszApp
, hszTopic
, NULL
);
877 static const WCHAR wIfexec
[] = {'\\','i','f','e','x','e','c',0};
878 TRACE("Launching %s\n", debugstr_w(start
));
879 ret
= execfunc(start
, env
, TRUE
, psei
, psei_out
);
882 TRACE("Couldn't launch\n");
885 hConv
= DdeConnect(ddeInst
, hszApp
, hszTopic
, NULL
);
888 TRACE("Couldn't connect. ret=%d\n", ret
);
889 DdeUninitialize(ddeInst
);
890 SetLastError(ERROR_DDE_FAIL
);
891 return 30; /* whatever */
893 strcpyW(endkey
, wIfexec
);
894 ifexeclen
= sizeof(ifexec
);
895 if (RegQueryValueW(HKEY_CLASSES_ROOT
, regkey
, ifexec
, &ifexeclen
) == ERROR_SUCCESS
)
901 SHELL_ArgifyW(static_res
, sizeof(static_res
)/sizeof(WCHAR
), exec
, lpFile
, pidl
, szCommandline
, &resultLen
);
902 if (resultLen
> sizeof(static_res
)/sizeof(WCHAR
))
904 res
= dynamic_res
= HeapAlloc(GetProcessHeap(), 0, resultLen
* sizeof(WCHAR
));
905 SHELL_ArgifyW(dynamic_res
, resultLen
, exec
, lpFile
, pidl
, szCommandline
, NULL
);
909 TRACE("%s %s => %s\n", debugstr_w(exec
), debugstr_w(lpFile
), debugstr_w(res
));
911 /* It's documented in the KB 330337 that IE has a bug and returns
912 * error DMLERR_NOTPROCESSED on XTYP_EXECUTE request.
915 hDdeData
= DdeClientTransaction((LPBYTE
)res
, (strlenW(res
) + 1) * sizeof(WCHAR
), hConv
, 0L, 0,
916 XTYP_EXECUTE
, 30000, &tid
);
919 DWORD lenA
= WideCharToMultiByte(CP_ACP
, 0, res
, -1, NULL
, 0, NULL
, NULL
);
920 char *resA
= HeapAlloc(GetProcessHeap(), 0, lenA
);
921 WideCharToMultiByte(CP_ACP
, 0, res
, -1, resA
, lenA
, NULL
, NULL
);
922 hDdeData
= DdeClientTransaction( (LPBYTE
)resA
, lenA
, hConv
, 0L, 0,
923 XTYP_EXECUTE
, 10000, &tid
);
924 HeapFree(GetProcessHeap(), 0, resA
);
927 DdeFreeDataHandle(hDdeData
);
929 WARN("DdeClientTransaction failed with error %04x\n", DdeGetLastError(ddeInst
));
932 HeapFree(GetProcessHeap(), 0, dynamic_res
);
934 DdeDisconnect(hConv
);
937 DdeUninitialize(ddeInst
);
942 /*************************************************************************
943 * execute_from_key [Internal]
945 static UINT_PTR
execute_from_key(LPCWSTR key
, LPCWSTR lpFile
, WCHAR
*env
, LPCWSTR szCommandline
,
946 LPCWSTR executable_name
,
947 SHELL_ExecuteW32 execfunc
,
948 LPSHELLEXECUTEINFOW psei
, LPSHELLEXECUTEINFOW psei_out
)
950 static const WCHAR wCommand
[] = {'c','o','m','m','a','n','d',0};
951 static const WCHAR wDdeexec
[] = {'d','d','e','e','x','e','c',0};
952 WCHAR cmd
[256], param
[1024], ddeexec
[256];
953 LONG cmdlen
= sizeof(cmd
), ddeexeclen
= sizeof(ddeexec
);
954 UINT_PTR retval
= SE_ERR_NOASSOC
;
958 TRACE("%s %s %s %s %s\n", debugstr_w(key
), debugstr_w(lpFile
), debugstr_w(env
),
959 debugstr_w(szCommandline
), debugstr_w(executable_name
));
964 /* Get the application from the registry */
965 if (RegQueryValueW(HKEY_CLASSES_ROOT
, key
, cmd
, &cmdlen
) == ERROR_SUCCESS
)
967 TRACE("got cmd: %s\n", debugstr_w(cmd
));
969 /* Is there a replace() function anywhere? */
970 cmdlen
/= sizeof(WCHAR
);
971 if (cmdlen
>= sizeof(cmd
)/sizeof(WCHAR
))
972 cmdlen
= sizeof(cmd
)/sizeof(WCHAR
)-1;
974 SHELL_ArgifyW(param
, sizeof(param
)/sizeof(WCHAR
), cmd
, lpFile
, psei
->lpIDList
, szCommandline
, &resultLen
);
975 if (resultLen
> sizeof(param
)/sizeof(WCHAR
))
976 ERR("Argify buffer not large enough, truncating\n");
979 /* Get the parameters needed by the application
980 from the associated ddeexec key */
981 tmp
= strstrW(key
, wCommand
);
983 strcpyW(tmp
, wDdeexec
);
985 if (RegQueryValueW(HKEY_CLASSES_ROOT
, key
, ddeexec
, &ddeexeclen
) == ERROR_SUCCESS
)
987 TRACE("Got ddeexec %s => %s\n", debugstr_w(key
), debugstr_w(ddeexec
));
988 if (!param
[0]) strcpyW(param
, executable_name
);
989 retval
= dde_connect(key
, param
, ddeexec
, lpFile
, env
, szCommandline
, psei
->lpIDList
, execfunc
, psei
, psei_out
);
993 TRACE("executing: %s\n", debugstr_w(param
));
994 retval
= execfunc(param
, env
, FALSE
, psei
, psei_out
);
997 WARN("Nothing appropriate found for %s\n", debugstr_w(key
));
1002 /*************************************************************************
1003 * FindExecutableA [SHELL32.@]
1005 HINSTANCE WINAPI
FindExecutableA(LPCSTR lpFile
, LPCSTR lpDirectory
, LPSTR lpResult
)
1008 WCHAR
*wFile
= NULL
, *wDirectory
= NULL
;
1009 WCHAR wResult
[MAX_PATH
];
1011 if (lpFile
) __SHCloneStrAtoW(&wFile
, lpFile
);
1012 if (lpDirectory
) __SHCloneStrAtoW(&wDirectory
, lpDirectory
);
1014 retval
= FindExecutableW(wFile
, wDirectory
, wResult
);
1015 WideCharToMultiByte(CP_ACP
, 0, wResult
, -1, lpResult
, MAX_PATH
, NULL
, NULL
);
1017 SHFree( wDirectory
);
1019 TRACE("returning %s\n", lpResult
);
1023 /*************************************************************************
1024 * FindExecutableW [SHELL32.@]
1026 * This function returns the executable associated with the specified file
1027 * for the default verb.
1030 * lpFile [I] The file to find the association for. This must refer to
1031 * an existing file otherwise FindExecutable fails and returns
1033 * lpResult [O] Points to a buffer into which the executable path is
1034 * copied. This parameter must not be NULL otherwise
1035 * FindExecutable() segfaults. The buffer must be of size at
1036 * least MAX_PATH characters.
1039 * A value greater than 32 on success, less than or equal to 32 otherwise.
1040 * See the SE_ERR_* constants.
1043 * On Windows XP and 2003, FindExecutable() seems to first convert the
1044 * filename into 8.3 format, thus taking into account only the first three
1045 * characters of the extension, and expects to find an association for those.
1046 * However other Windows versions behave sanely.
1048 HINSTANCE WINAPI
FindExecutableW(LPCWSTR lpFile
, LPCWSTR lpDirectory
, LPWSTR lpResult
)
1050 UINT_PTR retval
= SE_ERR_NOASSOC
;
1051 WCHAR old_dir
[1024];
1053 TRACE("File %s, Dir %s\n", debugstr_w(lpFile
), debugstr_w(lpDirectory
));
1055 lpResult
[0] = '\0'; /* Start off with an empty return string */
1057 return (HINSTANCE
)SE_ERR_FNF
;
1061 GetCurrentDirectoryW(sizeof(old_dir
)/sizeof(WCHAR
), old_dir
);
1062 SetCurrentDirectoryW(lpDirectory
);
1065 retval
= SHELL_FindExecutable(lpDirectory
, lpFile
, wszOpen
, lpResult
, MAX_PATH
, NULL
, NULL
, NULL
, NULL
);
1067 TRACE("returning %s\n", debugstr_w(lpResult
));
1069 SetCurrentDirectoryW(old_dir
);
1070 return (HINSTANCE
)retval
;
1073 /* FIXME: is this already implemented somewhere else? */
1074 static HKEY
ShellExecute_GetClassKey( const SHELLEXECUTEINFOW
*sei
)
1076 LPCWSTR ext
= NULL
, lpClass
= NULL
;
1078 DWORD type
= 0, sz
= 0;
1082 if (sei
->fMask
& SEE_MASK_CLASSALL
)
1083 return sei
->hkeyClass
;
1085 if (sei
->fMask
& SEE_MASK_CLASSNAME
)
1086 lpClass
= sei
->lpClass
;
1089 ext
= PathFindExtensionW( sei
->lpFile
);
1090 TRACE("ext = %s\n", debugstr_w( ext
) );
1094 r
= RegOpenKeyW( HKEY_CLASSES_ROOT
, ext
, &hkey
);
1095 if (r
!= ERROR_SUCCESS
)
1098 r
= RegQueryValueExW( hkey
, NULL
, 0, &type
, NULL
, &sz
);
1099 if ( r
== ERROR_SUCCESS
&& type
== REG_SZ
)
1101 sz
+= sizeof (WCHAR
);
1102 cls
= HeapAlloc( GetProcessHeap(), 0, sz
);
1104 RegQueryValueExW( hkey
, NULL
, 0, &type
, (LPBYTE
) cls
, &sz
);
1107 RegCloseKey( hkey
);
1111 TRACE("class = %s\n", debugstr_w(lpClass
) );
1115 RegOpenKeyW( HKEY_CLASSES_ROOT
, lpClass
, &hkey
);
1117 HeapFree( GetProcessHeap(), 0, cls
);
1122 static IDataObject
*shellex_get_dataobj( LPSHELLEXECUTEINFOW sei
)
1124 LPCITEMIDLIST pidllast
= NULL
;
1125 IDataObject
*dataobj
= NULL
;
1126 IShellFolder
*shf
= NULL
;
1127 LPITEMIDLIST pidl
= NULL
;
1130 if (sei
->fMask
& SEE_MASK_CLASSALL
)
1131 pidl
= sei
->lpIDList
;
1134 WCHAR fullpath
[MAX_PATH
];
1138 ret
= GetFullPathNameW( sei
->lpFile
, MAX_PATH
, fullpath
, NULL
);
1142 pidl
= ILCreateFromPathW( fullpath
);
1145 r
= SHBindToParent( pidl
, &IID_IShellFolder
, (LPVOID
*)&shf
, &pidllast
);
1149 IShellFolder_GetUIObjectOf( shf
, NULL
, 1, &pidllast
,
1150 &IID_IDataObject
, NULL
, (LPVOID
*) &dataobj
);
1153 if ( pidl
!= sei
->lpIDList
)
1156 IShellFolder_Release( shf
);
1160 static HRESULT
shellex_run_context_menu_default( IShellExtInit
*obj
,
1161 LPSHELLEXECUTEINFOW sei
)
1163 IContextMenu
*cm
= NULL
;
1164 CMINVOKECOMMANDINFOEX ici
;
1171 TRACE("%p %p\n", obj
, sei
);
1173 r
= IShellExtInit_QueryInterface( obj
, &IID_IContextMenu
, (LPVOID
*) &cm
);
1177 hmenu
= CreateMenu();
1181 /* the number of the last menu added is returned in r */
1182 r
= IContextMenu_QueryContextMenu( cm
, hmenu
, 0, 0x20, 0x7fff, CMF_DEFAULTONLY
);
1186 n
= GetMenuItemCount( hmenu
);
1187 for ( i
= 0; i
< n
; i
++ )
1189 memset( &info
, 0, sizeof info
);
1190 info
.cbSize
= sizeof info
;
1191 info
.fMask
= MIIM_FTYPE
| MIIM_STRING
| MIIM_STATE
| MIIM_DATA
| MIIM_ID
;
1192 info
.dwTypeData
= string
;
1193 info
.cch
= sizeof string
;
1195 GetMenuItemInfoW( hmenu
, i
, TRUE
, &info
);
1197 TRACE("menu %d %s %08x %08lx %08x %08x\n", i
, debugstr_w(string
),
1198 info
.fState
, info
.dwItemData
, info
.fType
, info
.wID
);
1199 if ( ( !sei
->lpVerb
&& (info
.fState
& MFS_DEFAULT
) ) ||
1200 ( sei
->lpVerb
&& !lstrcmpiW( sei
->lpVerb
, string
) ) )
1211 memset( &ici
, 0, sizeof ici
);
1212 ici
.cbSize
= sizeof ici
;
1213 ici
.fMask
= CMIC_MASK_UNICODE
| (sei
->fMask
& (SEE_MASK_NOASYNC
|SEE_MASK_ASYNCOK
|SEE_MASK_FLAG_NO_UI
));
1214 ici
.nShow
= sei
->nShow
;
1215 ici
.lpVerb
= MAKEINTRESOURCEA( def
);
1216 ici
.hwnd
= sei
->hwnd
;
1217 ici
.lpParametersW
= sei
->lpParameters
;
1219 r
= IContextMenu_InvokeCommand( cm
, (LPCMINVOKECOMMANDINFO
) &ici
);
1221 TRACE("invoke command returned %08x\n", r
);
1225 DestroyMenu( hmenu
);
1227 IContextMenu_Release( cm
);
1231 static HRESULT
shellex_load_object_and_run( HKEY hkey
, LPCGUID guid
, LPSHELLEXECUTEINFOW sei
)
1233 IDataObject
*dataobj
= NULL
;
1234 IObjectWithSite
*ows
= NULL
;
1235 IShellExtInit
*obj
= NULL
;
1238 TRACE("%p %s %p\n", hkey
, debugstr_guid( guid
), sei
);
1240 r
= CoInitialize( NULL
);
1244 r
= CoCreateInstance( guid
, NULL
, CLSCTX_INPROC_SERVER
,
1245 &IID_IShellExtInit
, (LPVOID
*)&obj
);
1248 ERR("failed %08x\n", r
);
1252 dataobj
= shellex_get_dataobj( sei
);
1255 ERR("failed to get data object\n");
1259 r
= IShellExtInit_Initialize( obj
, NULL
, dataobj
, hkey
);
1263 r
= IShellExtInit_QueryInterface( obj
, &IID_IObjectWithSite
, (LPVOID
*) &ows
);
1267 IObjectWithSite_SetSite( ows
, NULL
);
1269 r
= shellex_run_context_menu_default( obj
, sei
);
1273 IObjectWithSite_Release( ows
);
1275 IDataObject_Release( dataobj
);
1277 IShellExtInit_Release( obj
);
1283 /*************************************************************************
1284 * ShellExecute_FromContextMenu [Internal]
1286 static LONG
ShellExecute_FromContextMenu( LPSHELLEXECUTEINFOW sei
)
1288 static const WCHAR szcm
[] = { 's','h','e','l','l','e','x','\\',
1289 'C','o','n','t','e','x','t','M','e','n','u','H','a','n','d','l','e','r','s',0 };
1290 HKEY hkey
, hkeycm
= 0;
1297 TRACE("%s\n", debugstr_w(sei
->lpFile
) );
1299 hkey
= ShellExecute_GetClassKey( sei
);
1301 return ERROR_FUNCTION_FAILED
;
1303 r
= RegOpenKeyW( hkey
, szcm
, &hkeycm
);
1304 if ( r
== ERROR_SUCCESS
)
1309 r
= RegEnumKeyW( hkeycm
, i
++, szguid
, sizeof(szguid
)/sizeof(szguid
[0]) );
1310 if ( r
!= ERROR_SUCCESS
)
1313 hr
= CLSIDFromString( szguid
, &guid
);
1316 /* stop at the first one that succeeds in running */
1317 hr
= shellex_load_object_and_run( hkey
, &guid
, sei
);
1318 if ( SUCCEEDED( hr
) )
1322 RegCloseKey( hkeycm
);
1325 if ( hkey
!= sei
->hkeyClass
)
1326 RegCloseKey( hkey
);
1330 static UINT_PTR
SHELL_quote_and_execute( LPCWSTR wcmd
, LPCWSTR wszParameters
, LPCWSTR lpstrProtocol
, LPCWSTR wszApplicationName
, LPWSTR env
, LPSHELLEXECUTEINFOW psei
, LPSHELLEXECUTEINFOW psei_out
, SHELL_ExecuteW32 execfunc
);
1332 static UINT_PTR
SHELL_execute_class( LPCWSTR wszApplicationName
, LPSHELLEXECUTEINFOW psei
, LPSHELLEXECUTEINFOW psei_out
, SHELL_ExecuteW32 execfunc
)
1334 static const WCHAR wQuote
[] = {'"',0};
1335 static const WCHAR wSpace
[] = {' ',0};
1336 WCHAR execCmd
[1024], filetype
[1024];
1337 /* launch a document by fileclass like 'WordPad.Document.1' */
1338 /* the Commandline contains 'c:\Path\wordpad.exe "%1"' */
1339 /* FIXME: wcmd should not be of a fixed size. Fixed to 1024, MAX_PATH is way too short! */
1340 ULONG cmask
=(psei
->fMask
& SEE_MASK_CLASSALL
);
1345 /* FIXME: remove following block when SHELL_quote_and_execute supports hkeyClass parameter */
1346 if (cmask
!= SEE_MASK_CLASSNAME
)
1349 HCR_GetExecuteCommandW((cmask
== SEE_MASK_CLASSKEY
) ? psei
->hkeyClass
: NULL
,
1350 (cmask
== SEE_MASK_CLASSNAME
) ? psei
->lpClass
: NULL
,
1352 execCmd
, sizeof(execCmd
));
1354 /* FIXME: get the extension of lpFile, check if it fits to the lpClass */
1355 TRACE("SEE_MASK_CLASSNAME->%s, doc->%s\n", debugstr_w(execCmd
), debugstr_w(wszApplicationName
));
1358 done
= SHELL_ArgifyW(wcmd
, sizeof(wcmd
)/sizeof(WCHAR
), execCmd
, wszApplicationName
, psei
->lpIDList
, NULL
, &resultLen
);
1359 if (!done
&& wszApplicationName
[0])
1361 strcatW(wcmd
, wSpace
);
1362 if (*wszApplicationName
!= '"')
1364 strcatW(wcmd
, wQuote
);
1365 strcatW(wcmd
, wszApplicationName
);
1366 strcatW(wcmd
, wQuote
);
1369 strcatW(wcmd
, wszApplicationName
);
1371 if (resultLen
> sizeof(wcmd
)/sizeof(WCHAR
))
1372 ERR("Argify buffer not large enough... truncating\n");
1373 return execfunc(wcmd
, NULL
, FALSE
, psei
, psei_out
);
1376 strcpyW(filetype
, psei
->lpClass
);
1377 rslt
= SHELL_FindExecutableByOperation(psei
->lpVerb
, NULL
, filetype
, execCmd
, sizeof(execCmd
));
1379 TRACE("SHELL_FindExecutableByOperation returned %u (%s, %s)\n", (unsigned int)rslt
, debugstr_w(filetype
), debugstr_w(execCmd
));
1382 rslt
= SHELL_quote_and_execute( execCmd
, wszEmpty
, filetype
,
1383 wszApplicationName
, NULL
, psei
,
1384 psei_out
, execfunc
);
1388 static BOOL
SHELL_translate_idlist( LPSHELLEXECUTEINFOW sei
, LPWSTR wszParameters
, DWORD parametersLen
, LPWSTR wszApplicationName
, DWORD dwApplicationNameLen
)
1390 static const WCHAR wExplorer
[] = {'e','x','p','l','o','r','e','r','.','e','x','e',0};
1391 WCHAR buffer
[MAX_PATH
];
1392 BOOL appKnownSingular
= FALSE
;
1394 /* last chance to translate IDList: now also allow CLSID paths */
1395 if (SUCCEEDED(SHELL_GetPathFromIDListForExecuteW(sei
->lpIDList
, buffer
, sizeof(buffer
)))) {
1396 if (buffer
[0]==':' && buffer
[1]==':') {
1397 /* open shell folder for the specified class GUID */
1398 if (strlenW(buffer
) + 1 > parametersLen
)
1399 ERR("parameters len exceeds buffer size (%i > %i), truncating\n",
1400 lstrlenW(buffer
) + 1, parametersLen
);
1401 lstrcpynW(wszParameters
, buffer
, parametersLen
);
1402 if (strlenW(wExplorer
) > dwApplicationNameLen
)
1403 ERR("application len exceeds buffer size (%i > %i), truncating\n",
1404 lstrlenW(wExplorer
) + 1, dwApplicationNameLen
);
1405 lstrcpynW(wszApplicationName
, wExplorer
, dwApplicationNameLen
);
1406 appKnownSingular
= TRUE
;
1408 sei
->fMask
&= ~SEE_MASK_INVOKEIDLIST
;
1410 WCHAR target
[MAX_PATH
];
1413 /* Check if we're executing a directory and if so use the
1414 handler for the Folder class */
1415 strcpyW(target
, buffer
);
1416 attribs
= GetFileAttributesW(buffer
);
1417 if (attribs
!= INVALID_FILE_ATTRIBUTES
&&
1418 (attribs
& FILE_ATTRIBUTE_DIRECTORY
) &&
1419 HCR_GetExecuteCommandW(0, wszFolder
,
1421 buffer
, sizeof(buffer
))) {
1422 SHELL_ArgifyW(wszApplicationName
, dwApplicationNameLen
,
1423 buffer
, target
, sei
->lpIDList
, NULL
, &resultLen
);
1424 if (resultLen
> dwApplicationNameLen
)
1425 ERR("Argify buffer not large enough... truncating\n");
1426 appKnownSingular
= FALSE
;
1428 sei
->fMask
&= ~SEE_MASK_INVOKEIDLIST
;
1431 return appKnownSingular
;
1434 static UINT_PTR
SHELL_quote_and_execute( LPCWSTR wcmd
, LPCWSTR wszParameters
, LPCWSTR lpstrProtocol
, LPCWSTR wszApplicationName
, LPWSTR env
, LPSHELLEXECUTEINFOW psei
, LPSHELLEXECUTEINFOW psei_out
, SHELL_ExecuteW32 execfunc
)
1436 static const WCHAR wQuote
[] = {'"',0};
1437 static const WCHAR wSpace
[] = {' ',0};
1440 WCHAR
*wszQuotedCmd
;
1442 /* Length of quotes plus length of command plus NULL terminator */
1443 len
= 2 + lstrlenW(wcmd
) + 1;
1444 if (wszParameters
[0])
1446 /* Length of space plus length of parameters */
1447 len
+= 1 + lstrlenW(wszParameters
);
1449 wszQuotedCmd
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
1450 /* Must quote to handle case where cmd contains spaces,
1451 * else security hole if malicious user creates executable file "C:\\Program"
1453 strcpyW(wszQuotedCmd
, wQuote
);
1454 strcatW(wszQuotedCmd
, wcmd
);
1455 strcatW(wszQuotedCmd
, wQuote
);
1456 if (wszParameters
[0]) {
1457 strcatW(wszQuotedCmd
, wSpace
);
1458 strcatW(wszQuotedCmd
, wszParameters
);
1460 TRACE("%s/%s => %s/%s\n", debugstr_w(wszApplicationName
), debugstr_w(psei
->lpVerb
), debugstr_w(wszQuotedCmd
), debugstr_w(lpstrProtocol
));
1462 retval
= execute_from_key(lpstrProtocol
, wszApplicationName
, env
, psei
->lpParameters
, wcmd
, execfunc
, psei
, psei_out
);
1464 retval
= execfunc(wszQuotedCmd
, env
, FALSE
, psei
, psei_out
);
1465 HeapFree(GetProcessHeap(), 0, wszQuotedCmd
);
1469 static UINT_PTR
SHELL_execute_url( LPCWSTR lpFile
, LPCWSTR wFile
, LPCWSTR wcmd
, LPSHELLEXECUTEINFOW psei
, LPSHELLEXECUTEINFOW psei_out
, SHELL_ExecuteW32 execfunc
)
1471 static const WCHAR wShell
[] = {'\\','s','h','e','l','l','\\',0};
1472 static const WCHAR wCommand
[] = {'\\','c','o','m','m','a','n','d',0};
1474 WCHAR
*lpstrProtocol
;
1479 lpstrRes
= strchrW(lpFile
, ':');
1481 iSize
= lpstrRes
- lpFile
;
1483 iSize
= strlenW(lpFile
);
1485 TRACE("Got URL: %s\n", debugstr_w(lpFile
));
1486 /* Looking for ...protocol\shell\lpOperation\command */
1487 len
= iSize
+ lstrlenW(wShell
) + lstrlenW(wCommand
) + 1;
1489 len
+= lstrlenW(psei
->lpVerb
);
1491 len
+= lstrlenW(wszOpen
);
1492 lpstrProtocol
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
1493 memcpy(lpstrProtocol
, lpFile
, iSize
*sizeof(WCHAR
));
1494 lpstrProtocol
[iSize
] = '\0';
1495 strcatW(lpstrProtocol
, wShell
);
1496 strcatW(lpstrProtocol
, psei
->lpVerb
? psei
->lpVerb
: wszOpen
);
1497 strcatW(lpstrProtocol
, wCommand
);
1499 /* Remove File Protocol from lpFile */
1500 /* In the case file://path/file */
1501 if (!strncmpiW(lpFile
, wFile
, iSize
))
1504 while (*lpFile
== ':') lpFile
++;
1506 retval
= execute_from_key(lpstrProtocol
, lpFile
, NULL
, psei
->lpParameters
,
1507 wcmd
, execfunc
, psei
, psei_out
);
1508 HeapFree(GetProcessHeap(), 0, lpstrProtocol
);
1512 static void do_error_dialog( UINT_PTR retval
, HWND hwnd
)
1515 int error_code
=GetLastError();
1517 if (retval
== SE_ERR_NOASSOC
)
1518 LoadStringW(shell32_hInstance
, IDS_SHLEXEC_NOASSOC
, msg
, sizeof(msg
)/sizeof(WCHAR
));
1520 FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM
, NULL
, error_code
, 0, msg
, sizeof(msg
)/sizeof(WCHAR
), NULL
);
1522 MessageBoxW(hwnd
, msg
, NULL
, MB_ICONERROR
);
1525 /*************************************************************************
1526 * SHELL_execute [Internal]
1528 static BOOL
SHELL_execute( LPSHELLEXECUTEINFOW sei
, SHELL_ExecuteW32 execfunc
)
1530 static const WCHAR wSpace
[] = {' ',0};
1531 static const WCHAR wWww
[] = {'w','w','w',0};
1532 static const WCHAR wFile
[] = {'f','i','l','e',0};
1533 static const WCHAR wHttp
[] = {'h','t','t','p',':','/','/',0};
1534 static const DWORD unsupportedFlags
=
1535 SEE_MASK_INVOKEIDLIST
| SEE_MASK_ICON
| SEE_MASK_HOTKEY
|
1536 SEE_MASK_CONNECTNETDRV
| SEE_MASK_FLAG_DDEWAIT
|
1537 SEE_MASK_UNICODE
| SEE_MASK_ASYNCOK
| SEE_MASK_HMONITOR
;
1539 WCHAR parametersBuffer
[1024], dirBuffer
[MAX_PATH
], wcmdBuffer
[1024];
1540 WCHAR
*wszApplicationName
, *wszParameters
, *wszDir
, *wcmd
;
1541 DWORD dwApplicationNameLen
= MAX_PATH
+2;
1542 DWORD parametersLen
= sizeof(parametersBuffer
) / sizeof(WCHAR
);
1543 DWORD dirLen
= sizeof(dirBuffer
) / sizeof(WCHAR
);
1544 DWORD wcmdLen
= sizeof(wcmdBuffer
) / sizeof(WCHAR
);
1546 SHELLEXECUTEINFOW sei_tmp
; /* modifiable copy of SHELLEXECUTEINFO struct */
1547 WCHAR wfileName
[MAX_PATH
];
1549 WCHAR lpstrProtocol
[256];
1551 UINT_PTR retval
= SE_ERR_NOASSOC
;
1552 BOOL appKnownSingular
= FALSE
;
1554 /* make a local copy of the LPSHELLEXECUTEINFO structure and work with this from now on */
1557 TRACE("mask=0x%08x hwnd=%p verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s\n",
1558 sei_tmp
.fMask
, sei_tmp
.hwnd
, debugstr_w(sei_tmp
.lpVerb
),
1559 debugstr_w(sei_tmp
.lpFile
), debugstr_w(sei_tmp
.lpParameters
),
1560 debugstr_w(sei_tmp
.lpDirectory
), sei_tmp
.nShow
,
1561 ((sei_tmp
.fMask
& SEE_MASK_CLASSALL
) == SEE_MASK_CLASSNAME
) ?
1562 debugstr_w(sei_tmp
.lpClass
) : "not used");
1564 sei
->hProcess
= NULL
;
1566 /* make copies of all path/command strings */
1567 if (!sei_tmp
.lpFile
)
1569 wszApplicationName
= HeapAlloc(GetProcessHeap(), 0, dwApplicationNameLen
*sizeof(WCHAR
));
1570 *wszApplicationName
= '\0';
1572 else if (*sei_tmp
.lpFile
== '\"')
1574 DWORD l
= strlenW(sei_tmp
.lpFile
+1);
1575 if(l
>= dwApplicationNameLen
) dwApplicationNameLen
= l
+1;
1576 wszApplicationName
= HeapAlloc(GetProcessHeap(), 0, dwApplicationNameLen
*sizeof(WCHAR
));
1577 memcpy(wszApplicationName
, sei_tmp
.lpFile
+1, (l
+1)*sizeof(WCHAR
));
1578 if (wszApplicationName
[l
-1] == '\"')
1579 wszApplicationName
[l
-1] = '\0';
1580 appKnownSingular
= TRUE
;
1581 TRACE("wszApplicationName=%s\n",debugstr_w(wszApplicationName
));
1583 DWORD l
= strlenW(sei_tmp
.lpFile
)+1;
1584 if(l
> dwApplicationNameLen
) dwApplicationNameLen
= l
+1;
1585 wszApplicationName
= HeapAlloc(GetProcessHeap(), 0, dwApplicationNameLen
*sizeof(WCHAR
));
1586 memcpy(wszApplicationName
, sei_tmp
.lpFile
, l
*sizeof(WCHAR
));
1589 wszParameters
= parametersBuffer
;
1590 if (sei_tmp
.lpParameters
)
1592 len
= lstrlenW(sei_tmp
.lpParameters
) + 1;
1593 if (len
> parametersLen
)
1595 wszParameters
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
1596 parametersLen
= len
;
1598 strcpyW(wszParameters
, sei_tmp
.lpParameters
);
1601 *wszParameters
= '\0';
1604 if (sei_tmp
.lpDirectory
)
1606 len
= lstrlenW(sei_tmp
.lpDirectory
) + 1;
1609 wszDir
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
1612 strcpyW(wszDir
, sei_tmp
.lpDirectory
);
1617 /* adjust string pointers to point to the new buffers */
1618 sei_tmp
.lpFile
= wszApplicationName
;
1619 sei_tmp
.lpParameters
= wszParameters
;
1620 sei_tmp
.lpDirectory
= wszDir
;
1622 if (sei_tmp
.fMask
& unsupportedFlags
)
1624 FIXME("flags ignored: 0x%08x\n", sei_tmp
.fMask
& unsupportedFlags
);
1627 /* process the IDList */
1628 if (sei_tmp
.fMask
& SEE_MASK_IDLIST
)
1630 IShellExecuteHookW
* pSEH
;
1632 HRESULT hr
= SHBindToParent(sei_tmp
.lpIDList
, &IID_IShellExecuteHookW
, (LPVOID
*)&pSEH
, NULL
);
1636 hr
= IShellExecuteHookW_Execute(pSEH
, &sei_tmp
);
1638 IShellExecuteHookW_Release(pSEH
);
1641 HeapFree(GetProcessHeap(), 0, wszApplicationName
);
1642 if (wszParameters
!= parametersBuffer
)
1643 HeapFree(GetProcessHeap(), 0, wszParameters
);
1644 if (wszDir
!= dirBuffer
)
1645 HeapFree(GetProcessHeap(), 0, wszDir
);
1650 SHGetPathFromIDListW(sei_tmp
.lpIDList
, wszApplicationName
);
1651 appKnownSingular
= TRUE
;
1652 TRACE("-- idlist=%p (%s)\n", sei_tmp
.lpIDList
, debugstr_w(wszApplicationName
));
1655 if ( ERROR_SUCCESS
== ShellExecute_FromContextMenu( &sei_tmp
) )
1657 sei
->hInstApp
= (HINSTANCE
) 33;
1658 HeapFree(GetProcessHeap(), 0, wszApplicationName
);
1659 if (wszParameters
!= parametersBuffer
)
1660 HeapFree(GetProcessHeap(), 0, wszParameters
);
1661 if (wszDir
!= dirBuffer
)
1662 HeapFree(GetProcessHeap(), 0, wszDir
);
1666 if (sei_tmp
.fMask
& SEE_MASK_CLASSALL
)
1668 retval
= SHELL_execute_class( wszApplicationName
, &sei_tmp
, sei
,
1670 if (retval
<= 32 && !(sei_tmp
.fMask
& SEE_MASK_FLAG_NO_UI
))
1671 do_error_dialog(retval
, sei_tmp
.hwnd
);
1672 HeapFree(GetProcessHeap(), 0, wszApplicationName
);
1673 if (wszParameters
!= parametersBuffer
)
1674 HeapFree(GetProcessHeap(), 0, wszParameters
);
1675 if (wszDir
!= dirBuffer
)
1676 HeapFree(GetProcessHeap(), 0, wszDir
);
1680 /* Has the IDList not yet been translated? */
1681 if (sei_tmp
.fMask
& SEE_MASK_IDLIST
)
1683 appKnownSingular
= SHELL_translate_idlist( &sei_tmp
, wszParameters
,
1686 dwApplicationNameLen
);
1689 /* expand environment strings */
1690 len
= ExpandEnvironmentStringsW(sei_tmp
.lpFile
, NULL
, 0);
1694 buf
= HeapAlloc(GetProcessHeap(),0,(len
+1)*sizeof(WCHAR
));
1696 ExpandEnvironmentStringsW(sei_tmp
.lpFile
, buf
, len
+1);
1697 HeapFree(GetProcessHeap(), 0, wszApplicationName
);
1698 dwApplicationNameLen
= len
+1;
1699 wszApplicationName
= buf
;
1700 /* appKnownSingular unmodified */
1702 sei_tmp
.lpFile
= wszApplicationName
;
1705 if (*sei_tmp
.lpParameters
)
1707 len
= ExpandEnvironmentStringsW(sei_tmp
.lpParameters
, NULL
, 0);
1712 buf
= HeapAlloc(GetProcessHeap(),0,len
*sizeof(WCHAR
));
1713 ExpandEnvironmentStringsW(sei_tmp
.lpParameters
, buf
, len
);
1714 if (wszParameters
!= parametersBuffer
)
1715 HeapFree(GetProcessHeap(), 0, wszParameters
);
1716 wszParameters
= buf
;
1717 parametersLen
= len
;
1718 sei_tmp
.lpParameters
= wszParameters
;
1722 if (*sei_tmp
.lpDirectory
)
1724 len
= ExpandEnvironmentStringsW(sei_tmp
.lpDirectory
, NULL
, 0);
1729 buf
= HeapAlloc(GetProcessHeap(),0,len
*sizeof(WCHAR
));
1730 ExpandEnvironmentStringsW(sei_tmp
.lpDirectory
, buf
, len
);
1731 if (wszDir
!= dirBuffer
)
1732 HeapFree(GetProcessHeap(), 0, wszDir
);
1734 sei_tmp
.lpDirectory
= wszDir
;
1738 /* Else, try to execute the filename */
1739 TRACE("execute:%s,%s,%s\n", debugstr_w(wszApplicationName
), debugstr_w(wszParameters
), debugstr_w(wszDir
));
1741 /* separate out command line arguments from executable file name */
1742 if (!*sei_tmp
.lpParameters
&& !appKnownSingular
) {
1743 /* If the executable path is quoted, handle the rest of the command line as parameters. */
1744 if (sei_tmp
.lpFile
[0] == '"') {
1745 LPWSTR src
= wszApplicationName
/*sei_tmp.lpFile*/ + 1;
1746 LPWSTR dst
= wfileName
;
1749 /* copy the unquoted executable path to 'wfileName' */
1750 while(*src
&& *src
!='"')
1758 while(isspace(*src
))
1763 /* copy the parameter string to 'wszParameters' */
1764 strcpyW(wszParameters
, src
);
1766 /* terminate previous command string after the quote character */
1771 /* If the executable name is not quoted, we have to use this search loop here,
1772 that in CreateProcess() is not sufficient because it does not handle shell links. */
1773 WCHAR buffer
[MAX_PATH
], xlpFile
[MAX_PATH
];
1776 LPWSTR beg
= wszApplicationName
/*sei_tmp.lpFile*/;
1777 for(s
=beg
; (space
=strchrW(s
, ' ')); s
=space
+1) {
1778 int idx
= space
-sei_tmp
.lpFile
;
1779 memcpy(buffer
, sei_tmp
.lpFile
, idx
* sizeof(WCHAR
));
1782 /*FIXME This finds directory paths if the targeted file name contains spaces. */
1783 if (SearchPathW(*sei_tmp
.lpDirectory
? sei_tmp
.lpDirectory
: NULL
, buffer
, wszExe
, sizeof(xlpFile
)/sizeof(xlpFile
[0]), xlpFile
, NULL
))
1785 /* separate out command from parameter string */
1786 LPCWSTR p
= space
+ 1;
1791 strcpyW(wszParameters
, p
);
1798 lstrcpynW(wfileName
, sei_tmp
.lpFile
,sizeof(wfileName
)/sizeof(WCHAR
));
1801 lstrcpynW(wfileName
, sei_tmp
.lpFile
,sizeof(wfileName
)/sizeof(WCHAR
));
1806 len
= lstrlenW(wszApplicationName
) + 1;
1807 if (sei_tmp
.lpParameters
[0])
1808 len
+= 1 + lstrlenW(wszParameters
);
1811 wcmd
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
1814 strcpyW(wcmd
, wszApplicationName
);
1815 if (sei_tmp
.lpParameters
[0]) {
1816 strcatW(wcmd
, wSpace
);
1817 strcatW(wcmd
, wszParameters
);
1820 retval
= execfunc(wcmd
, NULL
, FALSE
, &sei_tmp
, sei
);
1822 HeapFree(GetProcessHeap(), 0, wszApplicationName
);
1823 if (wszParameters
!= parametersBuffer
)
1824 HeapFree(GetProcessHeap(), 0, wszParameters
);
1825 if (wszDir
!= dirBuffer
)
1826 HeapFree(GetProcessHeap(), 0, wszDir
);
1827 if (wcmd
!= wcmdBuffer
)
1828 HeapFree(GetProcessHeap(), 0, wcmd
);
1832 /* Else, try to find the executable */
1834 retval
= SHELL_FindExecutable(sei_tmp
.lpDirectory
, lpFile
, sei_tmp
.lpVerb
, wcmd
, wcmdLen
, lpstrProtocol
, &env
, sei_tmp
.lpIDList
, sei_tmp
.lpParameters
);
1835 if (retval
> 32) /* Found */
1837 retval
= SHELL_quote_and_execute( wcmd
, wszParameters
, lpstrProtocol
,
1838 wszApplicationName
, env
, &sei_tmp
,
1840 HeapFree( GetProcessHeap(), 0, env
);
1842 else if (PathIsDirectoryW(lpFile
))
1844 static const WCHAR wExplorer
[] = {'e','x','p','l','o','r','e','r',0};
1845 static const WCHAR wQuote
[] = {'"',0};
1846 WCHAR wExec
[MAX_PATH
];
1847 WCHAR
* lpQuotedFile
= HeapAlloc( GetProcessHeap(), 0, sizeof(WCHAR
) * (strlenW(lpFile
) + 3) );
1851 retval
= SHELL_FindExecutable( sei_tmp
.lpDirectory
, wExplorer
,
1852 wszOpen
, wExec
, MAX_PATH
,
1853 NULL
, &env
, NULL
, NULL
);
1856 strcpyW(lpQuotedFile
, wQuote
);
1857 strcatW(lpQuotedFile
, lpFile
);
1858 strcatW(lpQuotedFile
, wQuote
);
1859 retval
= SHELL_quote_and_execute( wExec
, lpQuotedFile
,
1861 wszApplicationName
, env
,
1862 &sei_tmp
, sei
, execfunc
);
1863 HeapFree( GetProcessHeap(), 0, env
);
1865 HeapFree( GetProcessHeap(), 0, lpQuotedFile
);
1868 retval
= 0; /* Out of memory */
1870 else if (PathIsURLW(lpFile
)) /* File not found, check for URL */
1872 retval
= SHELL_execute_url( lpFile
, wFile
, wcmd
, &sei_tmp
, sei
, execfunc
);
1874 /* Check if file specified is in the form www.??????.*** */
1875 else if (!strncmpiW(lpFile
, wWww
, 3))
1877 /* if so, append lpFile http:// and call ShellExecute */
1878 WCHAR lpstrTmpFile
[256];
1879 strcpyW(lpstrTmpFile
, wHttp
);
1880 strcatW(lpstrTmpFile
, lpFile
);
1881 retval
= (UINT_PTR
)ShellExecuteW(sei_tmp
.hwnd
, sei_tmp
.lpVerb
, lpstrTmpFile
, NULL
, NULL
, 0);
1884 TRACE("retval %lu\n", retval
);
1886 HeapFree(GetProcessHeap(), 0, wszApplicationName
);
1887 if (wszParameters
!= parametersBuffer
)
1888 HeapFree(GetProcessHeap(), 0, wszParameters
);
1889 if (wszDir
!= dirBuffer
)
1890 HeapFree(GetProcessHeap(), 0, wszDir
);
1891 if (wcmd
!= wcmdBuffer
)
1892 HeapFree(GetProcessHeap(), 0, wcmd
);
1894 sei
->hInstApp
= (HINSTANCE
)(retval
> 32 ? 33 : retval
);
1896 if (retval
<= 32 && !(sei_tmp
.fMask
& SEE_MASK_FLAG_NO_UI
))
1897 do_error_dialog(retval
, sei_tmp
.hwnd
);
1901 /*************************************************************************
1902 * ShellExecuteA [SHELL32.290]
1904 HINSTANCE WINAPI
ShellExecuteA(HWND hWnd
, LPCSTR lpOperation
,LPCSTR lpFile
,
1905 LPCSTR lpParameters
,LPCSTR lpDirectory
, INT iShowCmd
)
1907 SHELLEXECUTEINFOA sei
;
1909 TRACE("%p,%s,%s,%s,%s,%d\n",
1910 hWnd
, debugstr_a(lpOperation
), debugstr_a(lpFile
),
1911 debugstr_a(lpParameters
), debugstr_a(lpDirectory
), iShowCmd
);
1913 sei
.cbSize
= sizeof(sei
);
1914 sei
.fMask
= SEE_MASK_FLAG_NO_UI
;
1916 sei
.lpVerb
= lpOperation
;
1917 sei
.lpFile
= lpFile
;
1918 sei
.lpParameters
= lpParameters
;
1919 sei
.lpDirectory
= lpDirectory
;
1920 sei
.nShow
= iShowCmd
;
1927 ShellExecuteExA (&sei
);
1928 return sei
.hInstApp
;
1931 /*************************************************************************
1932 * ShellExecuteExA [SHELL32.292]
1935 BOOL WINAPI DECLSPEC_HOTPATCH
ShellExecuteExA (LPSHELLEXECUTEINFOA sei
)
1937 SHELLEXECUTEINFOW seiW
;
1939 WCHAR
*wVerb
= NULL
, *wFile
= NULL
, *wParameters
= NULL
, *wDirectory
= NULL
, *wClass
= NULL
;
1943 memcpy(&seiW
, sei
, sizeof(SHELLEXECUTEINFOW
));
1946 seiW
.lpVerb
= __SHCloneStrAtoW(&wVerb
, sei
->lpVerb
);
1949 seiW
.lpFile
= __SHCloneStrAtoW(&wFile
, sei
->lpFile
);
1951 if (sei
->lpParameters
)
1952 seiW
.lpParameters
= __SHCloneStrAtoW(&wParameters
, sei
->lpParameters
);
1954 if (sei
->lpDirectory
)
1955 seiW
.lpDirectory
= __SHCloneStrAtoW(&wDirectory
, sei
->lpDirectory
);
1957 if ((sei
->fMask
& SEE_MASK_CLASSALL
) == SEE_MASK_CLASSNAME
&& sei
->lpClass
)
1958 seiW
.lpClass
= __SHCloneStrAtoW(&wClass
, sei
->lpClass
);
1960 seiW
.lpClass
= NULL
;
1962 ret
= SHELL_execute( &seiW
, SHELL_ExecuteW
);
1964 sei
->hInstApp
= seiW
.hInstApp
;
1966 if (sei
->fMask
& SEE_MASK_NOCLOSEPROCESS
)
1967 sei
->hProcess
= seiW
.hProcess
;
1971 SHFree(wParameters
);
1978 /*************************************************************************
1979 * ShellExecuteExW [SHELL32.293]
1982 BOOL WINAPI DECLSPEC_HOTPATCH
ShellExecuteExW (LPSHELLEXECUTEINFOW sei
)
1984 return SHELL_execute( sei
, SHELL_ExecuteW
);
1987 /*************************************************************************
1988 * ShellExecuteW [SHELL32.294]
1990 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
1991 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
1993 HINSTANCE WINAPI
ShellExecuteW(HWND hwnd
, LPCWSTR lpOperation
, LPCWSTR lpFile
,
1994 LPCWSTR lpParameters
, LPCWSTR lpDirectory
, INT nShowCmd
)
1996 SHELLEXECUTEINFOW sei
;
1999 sei
.cbSize
= sizeof(sei
);
2000 sei
.fMask
= SEE_MASK_FLAG_NO_UI
;
2002 sei
.lpVerb
= lpOperation
;
2003 sei
.lpFile
= lpFile
;
2004 sei
.lpParameters
= lpParameters
;
2005 sei
.lpDirectory
= lpDirectory
;
2006 sei
.nShow
= nShowCmd
;
2013 SHELL_execute( &sei
, SHELL_ExecuteW
);
2014 return sei
.hInstApp
;
2017 /*************************************************************************
2018 * WOWShellExecute [SHELL32.@]
2020 * FIXME: the callback function most likely doesn't work the same way on Windows.
2022 HINSTANCE WINAPI
WOWShellExecute(HWND hWnd
, LPCSTR lpOperation
,LPCSTR lpFile
,
2023 LPCSTR lpParameters
,LPCSTR lpDirectory
, INT iShowCmd
, void *callback
)
2025 SHELLEXECUTEINFOW seiW
;
2026 WCHAR
*wVerb
= NULL
, *wFile
= NULL
, *wParameters
= NULL
, *wDirectory
= NULL
;
2027 HANDLE hProcess
= 0;
2029 seiW
.lpVerb
= lpOperation
? __SHCloneStrAtoW(&wVerb
, lpOperation
) : NULL
;
2030 seiW
.lpFile
= lpFile
? __SHCloneStrAtoW(&wFile
, lpFile
) : NULL
;
2031 seiW
.lpParameters
= lpParameters
? __SHCloneStrAtoW(&wParameters
, lpParameters
) : NULL
;
2032 seiW
.lpDirectory
= lpDirectory
? __SHCloneStrAtoW(&wDirectory
, lpDirectory
) : NULL
;
2034 seiW
.cbSize
= sizeof(seiW
);
2037 seiW
.nShow
= iShowCmd
;
2042 seiW
.hProcess
= hProcess
;
2044 SHELL_execute( &seiW
, callback
);
2048 SHFree(wParameters
);
2050 return seiW
.hInstApp
;
2053 /*************************************************************************
2054 * OpenAs_RunDLLA [SHELL32.@]
2056 void WINAPI
OpenAs_RunDLLA(HWND hwnd
, HINSTANCE hinst
, LPCSTR cmdline
, int cmdshow
)
2058 FIXME("%p, %p, %s, %d\n", hwnd
, hinst
, debugstr_a(cmdline
), cmdshow
);
2061 /*************************************************************************
2062 * OpenAs_RunDLLW [SHELL32.@]
2064 void WINAPI
OpenAs_RunDLLW(HWND hwnd
, HINSTANCE hinst
, LPCWSTR cmdline
, int cmdshow
)
2066 FIXME("%p, %p, %s, %d\n", hwnd
, hinst
, debugstr_w(cmdline
), cmdshow
);