2 * The parameters of many functions changes between different OS versions
3 * (NT uses Unicode strings, 95 uses ASCII strings)
5 * Copyright 1997 Marcus Meissner
12 #include "debugtools.h"
14 #include "winversion.h"
20 #include "shell32_main.h"
21 #include "wine/undocshell.h"
24 DEFAULT_DEBUG_CHANNEL(shell
);
26 /*************************************************************************
27 * ParseFieldA [SHELL32.58]
29 * copys a field from a ',' delimited string
31 * first field is nField = 1
33 DWORD WINAPI
ParseFieldA(LPCSTR src
, DWORD nField
, LPSTR dst
, DWORD len
)
35 WARN("('%s',0x%08lx,%p,%ld) semi-stub.\n",src
,nField
,dst
,len
);
37 if (!src
|| !src
[0] || !dst
|| !len
)
40 /* skip n fields delimited by ',' */
43 if (*src
=='\0') return FALSE
;
44 if (*(src
++)==',') nField
--;
47 /* copy part till the next ',' to dst */
48 while ( *src
!='\0' && *src
!=',' && (len
--)>0 ) *(dst
++)=*(src
++);
50 /* finalize the string */
56 /*************************************************************************
57 * PickIconDlg [SHELL32.62]
60 DWORD WINAPI
PickIconDlg(DWORD x
,DWORD y
,DWORD z
,DWORD a
)
61 { FIXME("(%08lx,%08lx,%08lx,%08lx):stub.\n",x
,y
,z
,a
);
65 /*************************************************************************
66 * GetFileNameFromBrowse [SHELL32.63]
69 DWORD WINAPI
GetFileNameFromBrowse(HWND howner
, LPSTR targetbuf
, DWORD len
, DWORD x
, LPCSTR suffix
, LPCSTR y
, LPCSTR cmd
)
70 { FIXME("(%04x,%p,%ld,%08lx,%s,%s,%s):stub.\n",
71 howner
,targetbuf
,len
,x
,suffix
,y
,cmd
);
72 /* puts up a Open Dialog and requests input into targetbuf */
73 /* OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST|OFN_unknown */
74 lstrcpyA(targetbuf
,"x:\\dummy.exe");
78 /*************************************************************************
79 * SHGetSettings [SHELL32.68]
82 * the registry path are for win98 (tested)
83 * and possibly are the same in nt40
85 void WINAPI
SHGetSettings(LPSHELLFLAGSTATE lpsfs
, DWORD dwMask
, DWORD dwx
)
89 DWORD dwDataSize
= sizeof (DWORD
);
91 TRACE("(%p 0x%08lx 0x%08lx)\n",lpsfs
,dwMask
, dwx
);
93 if (RegCreateKeyExA(HKEY_CURRENT_USER
, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
94 0, 0, 0, KEY_ALL_ACCESS
, 0, &hKey
, 0))
97 if ( (SSF_SHOWEXTENSIONS
& dwMask
) && !RegQueryValueExA(hKey
, "HideFileExt", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
98 lpsfs
->fShowExtensions
= ((dwData
== 0) ? 0 : 1);
100 if ( (SSF_SHOWINFOTIP
& dwMask
) && !RegQueryValueExA(hKey
, "ShowInfoTip", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
101 lpsfs
->fShowInfoTip
= ((dwData
== 0) ? 0 : 1);
103 if ( (SSF_DONTPRETTYPATH
& dwMask
) && !RegQueryValueExA(hKey
, "DontPrettyPath", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
104 lpsfs
->fDontPrettyPath
= ((dwData
== 0) ? 0 : 1);
106 if ( (SSF_HIDEICONS
& dwMask
) && !RegQueryValueExA(hKey
, "HideIcons", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
107 lpsfs
->fHideIcons
= ((dwData
== 0) ? 0 : 1);
109 if ( (SSF_MAPNETDRVBUTTON
& dwMask
) && !RegQueryValueExA(hKey
, "MapNetDrvBtn", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
110 lpsfs
->fMapNetDrvBtn
= ((dwData
== 0) ? 0 : 1);
112 if ( (SSF_SHOWATTRIBCOL
& dwMask
) && !RegQueryValueExA(hKey
, "ShowAttribCol", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
113 lpsfs
->fShowAttribCol
= ((dwData
== 0) ? 0 : 1);
115 if (((SSF_SHOWALLOBJECTS
| SSF_SHOWSYSFILES
) & dwMask
) && !RegQueryValueExA(hKey
, "Hidden", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
117 { if (SSF_SHOWALLOBJECTS
& dwMask
) lpsfs
->fShowAllObjects
= 0;
118 if (SSF_SHOWSYSFILES
& dwMask
) lpsfs
->fShowSysFiles
= 0;
120 else if (dwData
== 1)
121 { if (SSF_SHOWALLOBJECTS
& dwMask
) lpsfs
->fShowAllObjects
= 1;
122 if (SSF_SHOWSYSFILES
& dwMask
) lpsfs
->fShowSysFiles
= 0;
124 else if (dwData
== 2)
125 { if (SSF_SHOWALLOBJECTS
& dwMask
) lpsfs
->fShowAllObjects
= 0;
126 if (SSF_SHOWSYSFILES
& dwMask
) lpsfs
->fShowSysFiles
= 1;
131 TRACE("-- 0x%04x\n", *(WORD
*)lpsfs
);
134 /*************************************************************************
135 * SHShellFolderView_Message [SHELL32.73]
138 * hwndCabinet defines the explorer cabinet window that contains the
139 * shellview you need to communicate with
140 * uMsg identifying the SFVM enum to perform
144 * Message SFVM_REARRANGE = 1
145 * This message gets sent when a column gets clicked to instruct the
146 * shell view to re-sort the item list. lParam identifies the column
149 int WINAPI
SHShellFolderView_Message(HWND hwndCabinet
,UINT uMsg
,LPARAM lParam
)
150 { FIXME("%04x %08ux %08lx stub\n",hwndCabinet
,uMsg
,lParam
);
154 /*************************************************************************
155 * OleStrToStrN [SHELL32.78]
157 BOOL WINAPI
OleStrToStrNA (LPSTR lpStr
, INT nStr
, LPCWSTR lpOle
, INT nOle
)
159 TRACE("(%p, %x, %s, %x)\n", lpStr
, nStr
, debugstr_wn(lpOle
,nOle
), nOle
);
160 return WideCharToMultiByte (0, 0, lpOle
, nOle
, lpStr
, nStr
, NULL
, NULL
);
163 BOOL WINAPI
OleStrToStrNW (LPWSTR lpwStr
, INT nwStr
, LPCWSTR lpOle
, INT nOle
)
165 TRACE("(%p, %x, %s, %x)\n", lpwStr
, nwStr
, debugstr_wn(lpOle
,nOle
), nOle
);
167 if (lstrcpynW ( lpwStr
, lpOle
, nwStr
))
168 { return lstrlenW (lpwStr
);
173 BOOL WINAPI
OleStrToStrNAW (LPVOID lpOut
, INT nOut
, LPCVOID lpIn
, INT nIn
)
175 if (VERSION_OsIsUnicode())
176 return OleStrToStrNW (lpOut
, nOut
, lpIn
, nIn
);
177 return OleStrToStrNA (lpOut
, nOut
, lpIn
, nIn
);
180 /*************************************************************************
181 * StrToOleStrN [SHELL32.79]
182 * lpMulti, nMulti, nWide [IN]
185 BOOL WINAPI
StrToOleStrNA (LPWSTR lpWide
, INT nWide
, LPCSTR lpStrA
, INT nStr
)
187 TRACE("(%p, %x, %s, %x)\n", lpWide
, nWide
, debugstr_an(lpStrA
,nStr
), nStr
);
188 return MultiByteToWideChar (0, 0, lpStrA
, nStr
, lpWide
, nWide
);
190 BOOL WINAPI
StrToOleStrNW (LPWSTR lpWide
, INT nWide
, LPCWSTR lpStrW
, INT nStr
)
192 TRACE("(%p, %x, %s, %x)\n", lpWide
, nWide
, debugstr_wn(lpStrW
, nStr
), nStr
);
194 if (lstrcpynW (lpWide
, lpStrW
, nWide
))
195 { return lstrlenW (lpWide
);
200 BOOL WINAPI
StrToOleStrNAW (LPWSTR lpWide
, INT nWide
, LPCVOID lpStr
, INT nStr
)
202 if (VERSION_OsIsUnicode())
203 return StrToOleStrNW (lpWide
, nWide
, lpStr
, nStr
);
204 return StrToOleStrNA (lpWide
, nWide
, lpStr
, nStr
);
207 /*************************************************************************
208 * RegisterShellHook [SHELL32.181]
211 * hwnd [I] window handle
215 * exported by ordinal
217 void WINAPI
RegisterShellHook(HWND hwnd
, DWORD y
) {
218 FIXME("(0x%08x,0x%08lx):stub.\n",hwnd
,y
);
220 /*************************************************************************
221 * ShellMessageBoxW [SHELL32.182]
223 * Format and output errormessage.
225 * idText resource ID of title or LPSTR
226 * idTitle resource ID of title or LPSTR
229 * exported by ordinal
232 ShellMessageBoxW(HMODULE hmod
,HWND hwnd
,DWORD idText
,DWORD idTitle
,DWORD uType
,LPCVOID arglist
)
233 { WCHAR szText
[100],szTitle
[100],szTemp
[256];
234 LPWSTR pszText
= &szText
[0], pszTitle
= &szTitle
[0];
235 LPVOID args
= &arglist
;
237 TRACE("(%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n",(DWORD
)hmod
,(DWORD
)hwnd
,idText
,idTitle
,uType
,arglist
);
239 if (!HIWORD (idTitle
))
240 LoadStringW(hmod
,idTitle
,pszTitle
,100);
242 pszTitle
= (LPWSTR
)idTitle
;
244 if (! HIWORD (idText
))
245 LoadStringW(hmod
,idText
,pszText
,100);
247 pszText
= (LPWSTR
)idText
;
249 FormatMessageW(FORMAT_MESSAGE_FROM_STRING
| FORMAT_MESSAGE_ARGUMENT_ARRAY
,szText
,0,0,szTemp
,256,args
);
250 return MessageBoxW(hwnd
,szTemp
,szTitle
,uType
);
253 /*************************************************************************
254 * ShellMessageBoxA [SHELL32.183]
257 ShellMessageBoxA(HMODULE hmod
,HWND hwnd
,DWORD idText
,DWORD idTitle
,DWORD uType
,LPCVOID arglist
)
258 { char szText
[100],szTitle
[100],szTemp
[256];
259 LPSTR pszText
= &szText
[0], pszTitle
= &szTitle
[0];
260 LPVOID args
= &arglist
;
262 TRACE("(%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n", (DWORD
)hmod
,(DWORD
)hwnd
,idText
,idTitle
,uType
,arglist
);
264 if (!HIWORD (idTitle
))
265 LoadStringA(hmod
,idTitle
,pszTitle
,100);
267 pszTitle
= (LPSTR
)idTitle
;
269 if (! HIWORD (idText
))
270 LoadStringA(hmod
,idText
,pszText
,100);
272 pszText
= (LPSTR
)idText
;
274 FormatMessageA(FORMAT_MESSAGE_FROM_STRING
| FORMAT_MESSAGE_ARGUMENT_ARRAY
,pszText
,0,0,szTemp
,256,args
);
275 return MessageBoxA(hwnd
,szTemp
,pszTitle
,uType
);
278 /*************************************************************************
279 * SHRestricted [SHELL32.100]
281 * walks through policy table, queries <app> key, <type> value, returns
282 * queried (DWORD) value, and caches it between called to SHInitRestricted
283 * to prevent unnecessary registry access.
286 * exported by ordinal
289 * MS System Policy Editor
290 * 98Lite 2.0 (which uses many of these policy keys) http://www.98lite.net/
291 * "The Windows 95 Registry", by John Woram, 1996 MIS: Press
293 DWORD WINAPI
SHRestricted (DWORD pol
) {
296 DWORD retval
, polidx
, i
, datsize
= 4;
298 TRACE("(%08lx)\n",pol
);
302 /* scan to see if we know this policy ID */
303 for (i
= 0; i
< SHELL_MAX_POLICIES
; i
++)
305 if (pol
== sh32_policy_table
[i
].polflags
)
314 /* we don't know this policy, return 0 */
315 TRACE("unknown policy: (%08lx)\n", pol
);
319 /* we have a known policy */
320 lstrcpyA(regstr
, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\");
321 lstrcatA(regstr
, sh32_policy_table
[polidx
].appstr
);
323 /* first check if this policy has been cached, return it if so */
324 if (sh32_policy_table
[polidx
].cache
!= SHELL_NO_POLICY
)
326 return sh32_policy_table
[polidx
].cache
;
329 /* return 0 and don't set the cache if any registry errors occur */
331 if (RegOpenKeyA(HKEY_CURRENT_USER
, regstr
, &xhkey
) == ERROR_SUCCESS
)
333 if (RegQueryValueExA(xhkey
, sh32_policy_table
[polidx
].keystr
, NULL
, NULL
, (LPBYTE
)&retval
, &datsize
) == ERROR_SUCCESS
)
335 sh32_policy_table
[polidx
].cache
= retval
;
344 /*************************************************************************
345 * SHInitRestricted [SHELL32.244]
347 * Win98+ by-ordinal only routine called by Explorer and MSIE 4 and 5.
348 * Inits the policy cache used by SHRestricted to avoid excess
352 * Two inputs: one is a string or NULL. If non-NULL the pointer
353 * should point to a string containing the following exact text:
354 * "Software\Microsoft\Windows\CurrentVersion\Policies".
355 * The other input is unused.
358 * If the input is non-NULL and does not point to a string containing
359 * that exact text the routine will do nothing.
361 * If the text does match or the pointer is NULL, then the routine
362 * will init SHRestricted()'s policy cache to all 0xffffffff and
363 * returns 0xffffffff as well.
365 * I haven't yet run into anything calling this with inputs other than
366 * (NULL, NULL), so I may have the inputs reversed.
369 BOOL WINAPI
SHInitRestricted(LPSTR inpRegKey
, LPSTR parm2
)
373 TRACE("(%p, %p)\n", inpRegKey
, parm2
);
375 /* first check - if input is non-NULL and points to the secret
376 key string, then pass. Otherwise return 0.
379 if (inpRegKey
!= (LPSTR
)NULL
)
381 if (lstrcmpiA(inpRegKey
, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies"))
383 /* doesn't match, fail */
388 /* check passed, init all policy cache entries with SHELL_NO_POLICY */
389 for (i
= 0; i
< SHELL_MAX_POLICIES
; i
++)
391 sh32_policy_table
[i
].cache
= SHELL_NO_POLICY
;
394 return SHELL_NO_POLICY
;
397 /*************************************************************************
398 * SHFree [SHELL32.195]
401 * free_ptr() - frees memory using IMalloc
402 * exported by ordinal
405 DWORD WINAPI
SHFree(LPVOID x
)
408 WORD len
= *(LPWORD
)((LPBYTE
)x
-2);
410 if ( *(LPWORD
)((LPBYTE
)x
+len
) != 0x7384)
413 if ( (*(LPWORD
)((LPBYTE
)x
-4)) != 0x8271)
416 memset((LPBYTE
)x
-4, 0xde, len
+6);
418 TRACE("%p len=%u\n",x
, len
);
424 return HeapFree(GetProcessHeap(), 0, x
);
427 /*************************************************************************
428 * SHAlloc [SHELL32.196]
431 * void *task_alloc(DWORD len), uses SHMalloc allocator
432 * exported by ordinal
434 LPVOID WINAPI
SHAlloc(DWORD len
)
439 ret
= (LPVOID
) HeapAlloc(GetProcessHeap(),0,len
+6);
441 ret
= (LPVOID
) HeapAlloc(GetProcessHeap(),0,len
);
445 *(LPWORD
)(ret
) = 0x8271;
446 *(LPWORD
)(ret
+2) = (WORD
)len
;
447 *(LPWORD
)(ret
+4+len
) = 0x7384;
449 memset(ret
, 0xdf, len
);
451 TRACE("%lu bytes at %p\n",len
, ret
);
455 /*************************************************************************
456 * SHRegisterDragDrop [SHELL32.86]
459 * exported by ordinal
461 DWORD WINAPI
SHRegisterDragDrop(HWND hWnd
,IDropTarget
* pDropTarget
)
463 FIXME("(0x%08x,%p):stub.\n", hWnd
, pDropTarget
);
464 return RegisterDragDrop(hWnd
, pDropTarget
);
467 /*************************************************************************
468 * SHRevokeDragDrop [SHELL32.87]
471 * exported by ordinal
473 DWORD WINAPI
SHRevokeDragDrop(DWORD x
) {
474 FIXME("(0x%08lx):stub.\n",x
);
478 /*************************************************************************
479 * SHDoDragDrop [SHELL32.88]
482 * exported by ordinal
484 DWORD WINAPI
SHDoDragDrop(DWORD u
, DWORD v
, DWORD w
, DWORD x
, DWORD y
, DWORD z
) {
485 FIXME("(0x%08lx 0x%08lx 0x%08lx 0x%08lx 0x%08lx 0x%08lx):stub.\n",u
,v
,w
,x
,y
,z
);
489 /*************************************************************************
490 * RunFileDlg [SHELL32.61]
493 * Original name: RunFileDlg (exported by ordinal)
496 RunFileDlg (HWND hwndOwner
, DWORD dwParam1
, DWORD dwParam2
,
497 LPSTR lpszTitle
, LPSTR lpszPrompt
, UINT uFlags
)
499 FIXME("(0x%08x 0x%lx 0x%lx \"%s\" \"%s\" 0x%x):stub.\n",
500 hwndOwner
, dwParam1
, dwParam2
, lpszTitle
, lpszPrompt
, uFlags
);
504 /*************************************************************************
505 * ExitWindowsDialog [SHELL32.60]
508 * exported by ordinal
510 void WINAPI
ExitWindowsDialog (HWND hWndOwner
)
512 TRACE("(0x%08x)\n", hWndOwner
);
513 if (MessageBoxA( hWndOwner
, "Do you want to exit WINE?", "Shutdown", MB_YESNO
|MB_ICONQUESTION
) == IDOK
)
514 { SendMessageA ( hWndOwner
, WM_QUIT
, 0, 0);
518 /*************************************************************************
519 * ArrangeWindows [SHELL32.184]
523 ArrangeWindows (DWORD dwParam1
, DWORD dwParam2
, DWORD dwParam3
,
524 DWORD dwParam4
, DWORD dwParam5
)
526 FIXME("(0x%lx 0x%lx 0x%lx 0x%lx 0x%lx):stub.\n",
527 dwParam1
, dwParam2
, dwParam3
, dwParam4
, dwParam5
);
531 /*************************************************************************
532 * SignalFileOpen [SHELL32.103]
535 * exported by ordinal
538 SignalFileOpen (DWORD dwParam1
)
540 FIXME("(0x%08lx):stub.\n", dwParam1
);
545 /*************************************************************************
546 * SHAddToRecentDocs [SHELL32.234]
549 * uFlags [IN] SHARD_PATH or SHARD_PIDL
550 * pv [IN] string or pidl, NULL clears the list
555 DWORD WINAPI
SHAddToRecentDocs (UINT uFlags
,LPCVOID pv
)
556 { if (SHARD_PIDL
==uFlags
)
557 { FIXME("(0x%08x,pidl=%p):stub.\n", uFlags
,pv
);
560 { FIXME("(0x%08x,%s):stub.\n", uFlags
,(char*)pv
);
564 /*************************************************************************
565 * SHCreateShellFolderViewEx [SHELL32.174]
568 * see IShellFolder::CreateViewObject
570 HRESULT WINAPI
SHCreateShellFolderViewEx(
571 LPSHELLVIEWDATA psvcbi
, /*[in ] shelltemplate struct*/
572 LPVOID
* ppv
) /*[out] IShellView pointer*/
577 TRACE("sf=%p pidl=%p cb=%p mode=0x%08lx parm=0x%08lx\n",
578 psvcbi
->pShellFolder
, psvcbi
->pidl
, psvcbi
->pCallBack
, psvcbi
->viewmode
, psvcbi
->dwUserParam
);
580 psf
= IShellView_Constructor(psvcbi
->pShellFolder
);
583 return E_OUTOFMEMORY
;
585 IShellView_AddRef(psf
);
586 hRes
= IShellView_QueryInterface(psf
, &IID_IShellView
, (LPVOID
*)ppv
);
587 IShellView_Release(psf
);
591 /*************************************************************************
592 * SHWinHelp [SHELL32.127]
595 HRESULT WINAPI
SHWinHelp (DWORD v
, DWORD w
, DWORD x
, DWORD z
)
596 { FIXME("0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v
,w
,x
,z
);
599 /*************************************************************************
600 * SHRunControlPanel [SHELL32.161]
603 HRESULT WINAPI
SHRunControlPanel (DWORD x
, DWORD z
)
604 { FIXME("0x%08lx 0x%08lx stub\n",x
,z
);
607 /*************************************************************************
608 * ShellExecuteEx [SHELL32.291]
611 BOOL WINAPI
ShellExecuteExAW (LPVOID sei
)
612 { if (VERSION_OsIsUnicode())
613 return ShellExecuteExW (sei
);
614 return ShellExecuteExA (sei
);
616 /*************************************************************************
617 * ShellExecuteExA [SHELL32.292]
619 * placeholder in the commandline:
624 * %I adress of a global item ID (explorer switch /idlist)
625 * %L ??? path/url/current file ???
627 * %* all following parameters (see batfile)
629 BOOL WINAPI
ShellExecuteExA (LPSHELLEXECUTEINFOA sei
)
630 { CHAR szApplicationName
[MAX_PATH
],szCommandline
[MAX_PATH
],szPidl
[20];
633 STARTUPINFOA startup
;
634 PROCESS_INFORMATION info
;
636 WARN("mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n",
637 sei
->fMask
, sei
->hwnd
, sei
->lpVerb
, sei
->lpFile
,
638 sei
->lpParameters
, sei
->lpDirectory
, sei
->nShow
,
639 (sei
->fMask
& SEE_MASK_CLASSNAME
) ? sei
->lpClass
: "not used");
641 ZeroMemory(szApplicationName
,MAX_PATH
);
643 strcpy(szApplicationName
, sei
->lpFile
);
645 ZeroMemory(szCommandline
,MAX_PATH
);
646 if (sei
->lpParameters
)
647 strcpy(szCommandline
, sei
->lpParameters
);
649 if (sei
->fMask
& (SEE_MASK_CLASSKEY
| SEE_MASK_INVOKEIDLIST
| SEE_MASK_ICON
| SEE_MASK_HOTKEY
|
650 SEE_MASK_CONNECTNETDRV
| SEE_MASK_FLAG_DDEWAIT
|
651 SEE_MASK_DOENVSUBST
| SEE_MASK_FLAG_NO_UI
| SEE_MASK_UNICODE
|
652 SEE_MASK_NO_CONSOLE
| SEE_MASK_ASYNCOK
| SEE_MASK_HMONITOR
))
654 FIXME("flags ignored: 0x%08lx\n", sei
->fMask
);
657 /* launch a document by fileclass like 'Wordpad.Document.1' */
658 if (sei
->fMask
& SEE_MASK_CLASSNAME
)
660 /* the commandline contains 'c:\Path\wordpad.exe "%1"' */
661 HCR_GetExecuteCommand(sei
->lpClass
, (sei
->lpVerb
) ? sei
->lpVerb
: "open", szCommandline
, 256);
662 /* fixme: get the extension of lpFile, check if it fits to the lpClass */
663 TRACE("SEE_MASK_CLASSNAME->'%s'\n", szCommandline
);
666 /* process the IDList */
667 if ( (sei
->fMask
& SEE_MASK_INVOKEIDLIST
) == SEE_MASK_INVOKEIDLIST
) /*0x0c*/
669 SHGetPathFromIDListA (sei
->lpIDList
,szApplicationName
);
670 TRACE("-- idlist=%p (%s)\n", sei
->lpIDList
, szApplicationName
);
674 if (sei
->fMask
& SEE_MASK_IDLIST
)
676 pos
= strstr(szCommandline
, "%I");
679 HGLOBAL hmem
= SHAllocShared ( sei
->lpIDList
, ILGetSize(sei
->lpIDList
), 0);
680 sprintf(szPidl
,":%li",(DWORD
)SHLockShared(hmem
,0) );
681 SHUnlockShared(hmem
);
683 gap
= strlen(szPidl
);
685 memmove(pos
+gap
,pos
+2,len
);
686 memcpy(pos
,szPidl
,gap
);
692 TRACE("execute:'%s','%s'\n",szApplicationName
, szCommandline
);
694 strcat(szApplicationName
, " ");
695 strcat(szApplicationName
, szCommandline
);
697 ZeroMemory(&startup
,sizeof(STARTUPINFOA
));
698 startup
.cb
= sizeof(STARTUPINFOA
);
700 if (! CreateProcessA(NULL
, szApplicationName
,
701 NULL
, NULL
, FALSE
, 0,
702 NULL
, NULL
, &startup
, &info
))
704 sei
->hInstApp
= GetLastError();
710 /* Give 30 seconds to the app to come up */
711 if ( WaitForInputIdle ( info
.hProcess
, 30000 ) == 0xFFFFFFFF )
712 ERR("WaitForInputIdle failed: Error %ld\n", GetLastError() );
714 if(sei
->fMask
& SEE_MASK_NOCLOSEPROCESS
)
715 sei
->hProcess
= info
.hProcess
;
717 CloseHandle( info
.hProcess
);
718 CloseHandle( info
.hThread
);
721 /*************************************************************************
722 * ShellExecuteExW [SHELL32.293]
725 BOOL WINAPI
ShellExecuteExW (LPSHELLEXECUTEINFOW sei
)
726 { SHELLEXECUTEINFOA seiA
;
731 memcpy(&seiA
, sei
, sizeof(SHELLEXECUTEINFOA
));
734 seiA
.lpVerb
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpVerb
);
737 seiA
.lpFile
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpFile
);
739 if (sei
->lpParameters
)
740 seiA
.lpParameters
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpParameters
);
742 if (sei
->lpDirectory
)
743 seiA
.lpDirectory
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpDirectory
);
745 if ((sei
->fMask
& SEE_MASK_CLASSNAME
) && sei
->lpClass
)
746 seiA
.lpClass
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpClass
);
750 ret
= ShellExecuteExA(&seiA
);
752 if (seiA
.lpVerb
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpVerb
);
753 if (seiA
.lpFile
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpFile
);
754 if (seiA
.lpParameters
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpParameters
);
755 if (seiA
.lpDirectory
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpDirectory
);
756 if (seiA
.lpClass
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpClass
);
761 static LPUNKNOWN SHELL32_IExplorerInterface
=0;
762 /*************************************************************************
763 * SHSetInstanceExplorer [SHELL32.176]
768 HRESULT WINAPI
SHSetInstanceExplorer (LPUNKNOWN lpUnknown
)
769 { TRACE("%p\n", lpUnknown
);
770 SHELL32_IExplorerInterface
= lpUnknown
;
771 return (HRESULT
) lpUnknown
;
773 /*************************************************************************
774 * SHGetInstanceExplorer [SHELL32.256]
777 * gets the interface pointer of the explorer and a reference
779 HRESULT WINAPI
SHGetInstanceExplorer (LPUNKNOWN
* lpUnknown
)
780 { TRACE("%p\n", lpUnknown
);
782 *lpUnknown
= SHELL32_IExplorerInterface
;
784 if (!SHELL32_IExplorerInterface
)
787 IUnknown_AddRef(SHELL32_IExplorerInterface
);
790 /*************************************************************************
791 * SHFreeUnusedLibraries [SHELL32.123]
796 HRESULT WINAPI
SHFreeUnusedLibraries (void)
800 /*************************************************************************
801 * DAD_SetDragImage [SHELL32.136]
806 HRESULT WINAPI
DAD_SetDragImage (DWORD u
, DWORD v
)
807 { FIXME("0x%08lx 0x%08lx stub\n",u
, v
);
810 /*************************************************************************
811 * DAD_ShowDragImage [SHELL32.137]
816 HRESULT WINAPI
DAD_ShowDragImage (DWORD u
)
817 { FIXME("0x%08lx stub\n",u
);
820 /*************************************************************************
821 * SHRegCloseKey [NT4.0:SHELL32.505]
824 HRESULT WINAPI
SHRegCloseKey (HKEY hkey
)
825 { TRACE("0x%04x\n",hkey
);
826 return RegCloseKey( hkey
);
828 /*************************************************************************
829 * SHRegOpenKeyA [SHELL32.506]
832 HRESULT WINAPI
SHRegOpenKeyA(HKEY hKey
, LPSTR lpSubKey
, LPHKEY phkResult
)
834 TRACE("(0x%08x, %s, %p)\n", hKey
, debugstr_a(lpSubKey
), phkResult
);
835 return RegOpenKeyA(hKey
, lpSubKey
, phkResult
);
838 /*************************************************************************
839 * SHRegOpenKeyW [NT4.0:SHELL32.507]
842 HRESULT WINAPI
SHRegOpenKeyW (HKEY hkey
, LPCWSTR lpszSubKey
, LPHKEY retkey
)
843 { WARN("0x%04x %s %p\n",hkey
,debugstr_w(lpszSubKey
),retkey
);
844 return RegOpenKeyW( hkey
, lpszSubKey
, retkey
);
846 /*************************************************************************
847 * SHRegQueryValueExA [SHELL32.509]
850 HRESULT WINAPI
SHRegQueryValueExA(
858 TRACE("0x%04x %s %p %p %p %p\n", hkey
, lpValueName
, lpReserved
, lpType
, lpData
, lpcbData
);
859 return RegQueryValueExA (hkey
, lpValueName
, lpReserved
, lpType
, lpData
, lpcbData
);
861 /*************************************************************************
862 * SHRegQueryValueW [NT4.0:SHELL32.510]
865 HRESULT WINAPI
SHRegQueryValueW (HKEY hkey
, LPWSTR lpszSubKey
,
866 LPWSTR lpszData
, LPDWORD lpcbData
)
867 { WARN("0x%04x %s %p %p semi-stub\n",
868 hkey
, debugstr_w(lpszSubKey
), lpszData
, lpcbData
);
869 return RegQueryValueW( hkey
, lpszSubKey
, lpszData
, lpcbData
);
872 /*************************************************************************
873 * SHRegQueryValueExW [NT4.0:SHELL32.511]
876 * if the datatype REG_EXPAND_SZ then expand the string and change
877 * *pdwType to REG_SZ.
879 HRESULT WINAPI
SHRegQueryValueExW (HKEY hkey
, LPWSTR pszValue
, LPDWORD pdwReserved
,
880 LPDWORD pdwType
, LPVOID pvData
, LPDWORD pcbData
)
882 WARN("0x%04x %s %p %p %p %p semi-stub\n",
883 hkey
, debugstr_w(pszValue
), pdwReserved
, pdwType
, pvData
, pcbData
);
884 ret
= RegQueryValueExW ( hkey
, pszValue
, pdwReserved
, pdwType
, pvData
, pcbData
);
888 /*************************************************************************
891 * Gets a value from the registry
893 DWORD WINAPI
SHGetValueA(
902 FIXME("(%p),stub!\n", pSubKey
);
904 return ERROR_SUCCESS
; /* return success */
907 /*************************************************************************
910 * Gets a value from the registry
912 DWORD WINAPI
SHGetValueW(
921 FIXME("(%p),stub!\n", pSubKey
);
923 return ERROR_SUCCESS
; /* return success */
926 /*************************************************************************
929 * Gets a user-specific registry value
931 LONG WINAPI
SHRegGetUSValueA(
939 DWORD wDefaultDataSize
942 FIXME("(%p),stub!\n", pSubKey
);
944 return ERROR_SUCCESS
; /* return success */
947 /*************************************************************************
950 * Gets a user-specific registry value
952 LONG WINAPI
SHRegGetUSValueW(
960 DWORD wDefaultDataSize
963 FIXME("(%p),stub!\n", pSubKey
);
965 return ERROR_SUCCESS
; /* return success */
968 /*************************************************************************
969 * SHRegDeleteKeyA and SHDeleteKeyA
971 HRESULT WINAPI
SHRegDeleteKeyA(HKEY hkey
, LPCSTR pszSubKey
)
973 FIXME("hkey=0x%08x, %s\n", hkey
, debugstr_a(pszSubKey
));
977 /*************************************************************************
978 * SHRegDeleteKeyW and SHDeleteKeyA
980 HRESULT WINAPI
SHRegDeleteKeyW(HKEY hkey
, LPCWSTR pszSubKey
)
982 FIXME("hkey=0x%08x, %s\n", hkey
, debugstr_w(pszSubKey
));
985 /*************************************************************************
986 * ReadCabinetState [NT 4.0:SHELL32.651]
989 HRESULT WINAPI
ReadCabinetState(DWORD u
, DWORD v
)
990 { FIXME("0x%04lx 0x%04lx stub\n",u
,v
);
993 /*************************************************************************
994 * WriteCabinetState [NT 4.0:SHELL32.652]
997 HRESULT WINAPI
WriteCabinetState(DWORD u
)
998 { FIXME("0x%04lx stub\n",u
);
1001 /*************************************************************************
1002 * FileIconInit [SHELL32.660]
1005 BOOL WINAPI
FileIconInit(BOOL bFullInit
)
1006 { FIXME("(%s)\n", bFullInit
? "true" : "false");
1009 /*************************************************************************
1010 * IsUserAdmin [NT 4.0:SHELL32.680]
1013 HRESULT WINAPI
IsUserAdmin(void)
1018 /*************************************************************************
1019 * StrRetToBufA [SHLWAPI.@]
1021 * converts a STRRET to a normal string
1024 * the pidl is for STRRET OFFSET
1026 HRESULT WINAPI
StrRetToBufA (LPSTRRET src
, LPITEMIDLIST pidl
, LPSTR dest
, DWORD len
)
1028 return StrRetToStrNA(dest
, len
, src
, pidl
);
1031 /*************************************************************************
1032 * StrRetToBufW [SHLWAPI.@]
1034 * converts a STRRET to a normal string
1037 * the pidl is for STRRET OFFSET
1039 HRESULT WINAPI
StrRetToBufW (LPSTRRET src
, LPITEMIDLIST pidl
, LPWSTR dest
, DWORD len
)
1041 return StrRetToStrNW(dest
, len
, src
, pidl
);
1044 /*************************************************************************
1045 * StrRetToStrN [SHELL32.96]
1047 * converts a STRRET to a normal string
1050 * the pidl is for STRRET OFFSET
1052 HRESULT WINAPI
StrRetToStrNA (LPVOID dest
, DWORD len
, LPSTRRET src
, LPITEMIDLIST pidl
)
1054 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest
,len
,src
,pidl
);
1059 WideCharToMultiByte(CP_ACP
, 0, src
->u
.pOleStr
, -1, (LPSTR
)dest
, len
, NULL
, NULL
);
1060 SHFree(src
->u
.pOleStr
);
1064 lstrcpynA((LPSTR
)dest
, src
->u
.cStr
, len
);
1067 case STRRET_OFFSETA
:
1068 lstrcpynA((LPSTR
)dest
, ((LPCSTR
)&pidl
->mkid
)+src
->u
.uOffset
, len
);
1072 FIXME("unknown type!\n");
1075 *(LPSTR
)dest
= '\0';
1082 HRESULT WINAPI
StrRetToStrNW (LPVOID dest
, DWORD len
, LPSTRRET src
, LPITEMIDLIST pidl
)
1084 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest
,len
,src
,pidl
);
1089 lstrcpynW((LPWSTR
)dest
, src
->u
.pOleStr
, len
);
1090 SHFree(src
->u
.pOleStr
);
1094 lstrcpynAtoW((LPWSTR
)dest
, src
->u
.cStr
, len
);
1097 case STRRET_OFFSETA
:
1100 lstrcpynAtoW((LPWSTR
)dest
, ((LPCSTR
)&pidl
->mkid
)+src
->u
.uOffset
, len
);
1105 FIXME("unknown type!\n");
1107 { *(LPSTR
)dest
= '\0';
1113 HRESULT WINAPI
StrRetToStrNAW (LPVOID dest
, DWORD len
, LPSTRRET src
, LPITEMIDLIST pidl
)
1115 if(VERSION_OsIsUnicode())
1116 return StrRetToStrNW (dest
, len
, src
, pidl
);
1117 return StrRetToStrNA (dest
, len
, src
, pidl
);
1120 /*************************************************************************
1121 * StrChrW [NT 4.0:SHELL32.651]
1124 LPWSTR WINAPI
StrChrW (LPWSTR str
, WCHAR x
)
1126 TRACE("%s 0x%04x\n",debugstr_w(str
),x
);
1127 return CRTDLL_wcschr(str
, x
);
1130 /*************************************************************************
1131 * StrCmpNIW [NT 4.0:SHELL32.*]
1134 INT WINAPI
StrCmpNIW ( LPWSTR wstr1
, LPWSTR wstr2
, INT len
)
1136 TRACE("%s %s %i stub\n", debugstr_w(wstr1
),debugstr_w(wstr2
),len
);
1137 return CRTDLL__wcsnicmp(wstr1
, wstr2
, len
);
1140 /*************************************************************************
1141 * SHAllocShared [SHELL32.520]
1144 * parameter1 is return value from HeapAlloc
1145 * parameter2 is equal to the size allocated with HeapAlloc
1146 * parameter3 is return value from GetCurrentProcessId
1148 * the return value is posted as lParam with 0x402 (WM_USER+2) to somewhere
1149 * WM_USER+2 could be the undocumented CWM_SETPATH
1150 * the allocated memory contains a pidl
1152 HGLOBAL WINAPI
SHAllocShared(LPVOID psrc
, DWORD size
, DWORD procID
)
1156 TRACE("ptr=%p size=0x%04lx procID=0x%04lx\n",psrc
,size
,procID
);
1157 hmem
= GlobalAlloc(GMEM_FIXED
, size
);
1161 pmem
= GlobalLock (hmem
);
1166 memcpy (pmem
, psrc
, size
);
1170 /*************************************************************************
1171 * SHLockShared [SHELL32.521]
1174 * parameter1 is return value from SHAllocShared
1175 * parameter2 is return value from GetCurrentProcessId
1176 * the receiver of (WM_USER+2) trys to lock the HANDLE (?)
1177 * the returnvalue seems to be a memoryadress
1179 LPVOID WINAPI
SHLockShared(HANDLE hmem
, DWORD procID
)
1180 { TRACE("handle=0x%04x procID=0x%04lx\n",hmem
,procID
);
1181 return GlobalLock(hmem
);
1183 /*************************************************************************
1184 * SHUnlockShared [SHELL32.522]
1187 * parameter1 is return value from SHLockShared
1189 BOOL WINAPI
SHUnlockShared(HANDLE pmem
)
1190 { TRACE("handle=0x%04x\n",pmem
);
1191 return GlobalUnlock(pmem
);
1193 /*************************************************************************
1194 * SHFreeShared [SHELL32.523]
1197 * parameter1 is return value from SHAllocShared
1198 * parameter2 is return value from GetCurrentProcessId
1200 HANDLE WINAPI
SHFreeShared(HANDLE hmem
, DWORD procID
)
1201 { TRACE("handle=0x%04x 0x%04lx\n",hmem
,procID
);
1202 return GlobalFree(hmem
);
1205 /*************************************************************************
1206 * SetAppStartingCursor [SHELL32.99]
1209 HRESULT WINAPI
SetAppStartingCursor(HWND u
, DWORD v
)
1210 { FIXME("hwnd=0x%04x 0x%04lx stub\n",u
,v
);
1213 /*************************************************************************
1214 * SHLoadOLE [SHELL32.151]
1217 HRESULT WINAPI
SHLoadOLE(DWORD u
)
1218 { FIXME("0x%04lx stub\n",u
);
1221 /*************************************************************************
1222 * DriveType [SHELL32.64]
1225 HRESULT WINAPI
DriveType(DWORD u
)
1226 { FIXME("0x%04lx stub\n",u
);
1229 /*************************************************************************
1230 * SHAbortInvokeCommand [SHELL32.198]
1233 HRESULT WINAPI
SHAbortInvokeCommand(void)
1237 /*************************************************************************
1238 * SHOutOfMemoryMessageBox [SHELL32.126]
1241 HRESULT WINAPI
SHOutOfMemoryMessageBox(DWORD u
, DWORD v
, DWORD w
)
1242 { FIXME("0x%04lx 0x%04lx 0x%04lx stub\n",u
,v
,w
);
1245 /*************************************************************************
1246 * SHFlushClipboard [SHELL32.121]
1249 HRESULT WINAPI
SHFlushClipboard(void)
1254 /*************************************************************************
1255 * StrFormatByteSizeA [SHLWAPI]
1257 LPSTR WINAPI
StrFormatByteSizeA ( DWORD dw
, LPSTR pszBuf
, UINT cchBuf
)
1259 TRACE("%lx %p %i\n", dw
, pszBuf
, cchBuf
);
1261 { sprintf (buf
,"%3.1f bytes", (FLOAT
)dw
);
1263 else if ( dw
<1048576L)
1264 { sprintf (buf
,"%3.1f KB", (FLOAT
)dw
/1024);
1266 else if ( dw
< 1073741824L)
1267 { sprintf (buf
,"%3.1f MB", (FLOAT
)dw
/1048576L);
1270 { sprintf (buf
,"%3.1f GB", (FLOAT
)dw
/1073741824L);
1272 lstrcpynA (pszBuf
, buf
, cchBuf
);
1276 /*************************************************************************
1277 * StrFormatByteSizeW [SHLWAPI]
1279 LPWSTR WINAPI
StrFormatByteSizeW ( DWORD dw
, LPWSTR pszBuf
, UINT cchBuf
)
1281 TRACE("%lx %p %i\n", dw
, pszBuf
, cchBuf
);
1283 { sprintf (buf
,"%3.1f bytes", (FLOAT
)dw
);
1285 else if ( dw
<1048576L)
1286 { sprintf (buf
,"%3.1f KB", (FLOAT
)dw
/1024);
1288 else if ( dw
< 1073741824L)
1289 { sprintf (buf
,"%3.1f MB", (FLOAT
)dw
/1048576L);
1292 { sprintf (buf
,"%3.1f GB", (FLOAT
)dw
/1073741824L);
1294 lstrcpynAtoW (pszBuf
, buf
, cchBuf
);
1297 /*************************************************************************
1298 * SHWaitForFileToOpen [SHELL32.97]
1301 HRESULT WINAPI
SHWaitForFileToOpen(DWORD u
, DWORD v
, DWORD w
)
1302 { FIXME("0x%04lx 0x%04lx 0x%04lx stub\n",u
,v
,w
);
1305 /*************************************************************************
1306 * Control_FillCache_RunDLL [SHELL32.8]
1309 HRESULT WINAPI
Control_FillCache_RunDLL(HWND hWnd
, HANDLE hModule
, DWORD w
, DWORD x
)
1310 { FIXME("0x%04x 0x%04x 0x%04lx 0x%04lx stub\n",hWnd
, hModule
,w
,x
);
1313 /*************************************************************************
1314 * RunDLL_CallEntry16 [SHELL32.122]
1315 * the name is propably wrong
1317 HRESULT WINAPI
RunDLL_CallEntry16(DWORD v
, DWORD w
, DWORD x
, DWORD y
, DWORD z
)
1318 { FIXME("0x%04lx 0x%04lx 0x%04lx 0x%04lx 0x%04lx stub\n",v
,w
,x
,y
,z
);
1322 /************************************************************************
1323 * shell32_654 [SHELL32.654]
1325 * NOTES: first parameter seems to be a pointer (same as passed to WriteCabinetState)
1326 * second one could be a size (0x0c). The size is the same as the structure saved to
1327 * HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState
1328 * I'm (js) guessing: this one is just ReadCabinetState ;-)
1330 HRESULT WINAPI
shell32_654 (DWORD x
, DWORD y
)
1331 { FIXME("0x%08lx 0x%08lx stub\n",x
,y
);
1335 /************************************************************************
1336 * RLBuildListOfPaths [SHELL32.146]
1341 DWORD WINAPI
RLBuildListOfPaths (void)
1345 /************************************************************************
1346 * StrToOleStr [SHELL32.163]
1349 int WINAPI
StrToOleStrA (LPWSTR lpWideCharStr
, LPCSTR lpMultiByteString
)
1351 TRACE("(%p, %p %s)\n",
1352 lpWideCharStr
, lpMultiByteString
, debugstr_a(lpMultiByteString
));
1354 return MultiByteToWideChar(0, 0, lpMultiByteString
, -1, lpWideCharStr
, MAX_PATH
);
1357 int WINAPI
StrToOleStrW (LPWSTR lpWideCharStr
, LPCWSTR lpWString
)
1359 TRACE("(%p, %p %s)\n",
1360 lpWideCharStr
, lpWString
, debugstr_w(lpWString
));
1362 if (lstrcpyW (lpWideCharStr
, lpWString
))
1363 { return lstrlenW (lpWideCharStr
);
1368 BOOL WINAPI
StrToOleStrAW (LPWSTR lpWideCharStr
, LPCVOID lpString
)
1370 if (VERSION_OsIsUnicode())
1371 return StrToOleStrW (lpWideCharStr
, lpString
);
1372 return StrToOleStrA (lpWideCharStr
, lpString
);
1375 /************************************************************************
1376 * SHValidateUNC [SHELL32.173]
1379 HRESULT WINAPI
SHValidateUNC (DWORD x
, DWORD y
, DWORD z
)
1381 FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x
,y
,z
);
1385 /************************************************************************
1386 * DoEnvironmentSubstA [SHELL32.1222]
1389 HRESULT WINAPI
DoEnvironmentSubstA(LPSTR x
, LPSTR y
)
1391 FIXME("(%p %s, %p %s) stub\n", x
, debugstr_a(x
), y
, debugstr_a(y
));
1395 /************************************************************************
1396 * DoEnvironmentSubstW [SHELL32.1223]
1399 HRESULT WINAPI
DoEnvironmentSubstW(LPWSTR x
, LPWSTR y
)
1401 FIXME("(%p %s, %p %s) stub\n", x
, debugstr_w(x
), y
, debugstr_w(y
));
1405 /************************************************************************
1406 * DoEnvironmentSubst [SHELL32.53]
1409 HRESULT WINAPI
DoEnvironmentSubstAW(LPVOID x
, LPVOID y
)
1411 if (VERSION_OsIsUnicode())
1412 return DoEnvironmentSubstW(x
, y
);
1413 return DoEnvironmentSubstA(x
, y
);
1416 /*************************************************************************
1417 * shell32_243 [SHELL32.243]
1419 * Win98+ by-ordinal routine. In Win98 this routine returns zero and
1420 * does nothing else. Possibly this does something in NT or SHELL32 5.0?
1424 BOOL WINAPI
shell32_243(DWORD a
, DWORD b
)