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
13 #include "winversion.h"
17 #include "shell32_main.h"
19 /*************************************************************************
20 * SHChangeNotifyRegister [SHELL32.2]
22 * Idlist is an array of structures and Count specifies how many items in the array
23 * (usually just one I think).
26 SHChangeNotifyRegister(
33 { FIXME(shell
,"(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):stub.\n",
34 hwnd
,events1
,events2
,msg
,count
,idlist
);
37 /*************************************************************************
38 * SHChangeNotifyDeregister [SHELL32.4]
41 SHChangeNotifyDeregister(LONG x1
)
42 { FIXME(shell
,"(0x%08lx):stub.\n",x1
);
45 /*************************************************************************
46 * NTSHChangeNotifyRegister [SHELL32.640]
48 * Idlist is an array of structures and Count specifies how many items in the array
49 * (usually just one I think).
51 DWORD WINAPI
NTSHChangeNotifyRegister(
58 { FIXME(shell
,"(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):stub.\n",
59 hwnd
,events1
,events2
,msg
,count
,idlist
);
62 /*************************************************************************
63 * NTSHChangeNotifyDeregister [SHELL32.641]
65 DWORD WINAPI
NTSHChangeNotifyDeregister(LONG x1
)
66 { FIXME(shell
,"(0x%08lx):stub.\n",x1
);
70 /*************************************************************************
71 * ParseField [SHELL32.58]
74 DWORD WINAPI
ParseFieldA(LPCSTR src
, DWORD field
, LPSTR dst
, DWORD len
)
75 { WARN(shell
,"('%s',0x%08lx,%p,%ld) semi-stub.\n",src
,field
,dst
,len
);
77 if (!src
|| !src
[0] || !dst
|| !len
)
83 { if (*src
==0x0) return FALSE
;
84 if (*src
==',') field
--;
89 while (*src
!=0x00 && *src
!=',' && len
>0)
90 { *dst
=*src
; dst
++, src
++; len
--;
97 /*************************************************************************
98 * PickIconDlg [SHELL32.62]
101 DWORD WINAPI
PickIconDlg(DWORD x
,DWORD y
,DWORD z
,DWORD a
)
102 { FIXME(shell
,"(%08lx,%08lx,%08lx,%08lx):stub.\n",x
,y
,z
,a
);
106 /*************************************************************************
107 * GetFileNameFromBrowse [SHELL32.63]
110 DWORD WINAPI
GetFileNameFromBrowse(HWND howner
, LPSTR targetbuf
, DWORD len
, DWORD x
, LPCSTR suffix
, LPCSTR y
, LPCSTR cmd
)
111 { FIXME(shell
,"(%04x,%p,%ld,%08lx,%s,%s,%s):stub.\n",
112 howner
,targetbuf
,len
,x
,suffix
,y
,cmd
);
113 /* puts up a Open Dialog and requests input into targetbuf */
114 /* OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST|OFN_unknown */
115 lstrcpyA(targetbuf
,"x:\\dummy.exe");
119 /*************************************************************************
120 * SHGetSettings [SHELL32.68]
123 DWORD WINAPI
SHGetSettings(DWORD x
,DWORD y
,DWORD z
)
124 { FIXME(shell
,"(0x%08lx,0x%08lx,0x%08lx):stub.\n",x
,y
,z
);
128 /*************************************************************************
129 * SHShellFolderView_Message [SHELL32.73]
132 * hwndCabinet defines the explorer cabinet window that contains the
133 * shellview you need to communicate with
134 * uMsg identifying the SFVM enum to perform
138 * Message SFVM_REARRANGE = 1
139 * This message gets sent when a column gets clicked to instruct the
140 * shell view to re-sort the item list. lParam identifies the column
143 int WINAPI
SHShellFolderView_Message(HWND hwndCabinet
,UINT uMsg
,LPARAM lParam
)
144 { FIXME(shell
,"%04x %08ux %08lx stub\n",hwndCabinet
,uMsg
,lParam
);
148 /*************************************************************************
149 * OleStrToStrN [SHELL32.78]
152 * exported by ordinal
154 * wrong implemented OleStr is NOT wide string !!!! (jsch)
157 OleStrToStrN (LPSTR lpMulti
, INT nMulti
, LPCWSTR lpWide
, INT nWide
) {
158 return WideCharToMultiByte (0, 0, lpWide
, nWide
,
159 lpMulti
, nMulti
, NULL
, NULL
);
162 /*************************************************************************
163 * StrToOleStrN [SHELL32.79]
166 * exported by ordinal
168 * wrong implemented OleStr is NOT wide string !!!! (jsch)
171 StrToOleStrN (LPWSTR lpWide
, INT nWide
, LPCSTR lpMulti
, INT nMulti
) {
172 return MultiByteToWideChar (0, 0, lpMulti
, nMulti
, lpWide
, nWide
);
175 /*************************************************************************
176 * RegisterShellHook [SHELL32.181]
179 * hwnd [I] window handle
183 * exported by ordinal
185 void WINAPI
RegisterShellHook(HWND hwnd
, DWORD y
) {
186 FIXME(shell
,"(0x%08x,0x%08lx):stub.\n",hwnd
,y
);
188 /*************************************************************************
189 * ShellMessageBoxW [SHELL32.182]
191 * Format and output errormessage.
193 * idText resource ID of title or LPSTR
194 * idTitle resource ID of title or LPSTR
197 * exported by ordinal
200 ShellMessageBoxW(HMODULE hmod
,HWND hwnd
,DWORD idText
,DWORD idTitle
,DWORD uType
,LPCVOID arglist
)
201 { WCHAR szText
[100],szTitle
[100],szTemp
[256];
202 LPWSTR pszText
= &szText
[0], pszTitle
= &szTitle
[0];
203 LPVOID args
= &arglist
;
205 TRACE(shell
,"(%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n",(DWORD
)hmod
,(DWORD
)hwnd
,idText
,idTitle
,uType
,arglist
);
207 if (!HIWORD (idTitle
))
208 LoadStringW(hmod
,idTitle
,pszTitle
,100);
210 pszTitle
= (LPWSTR
)idTitle
;
212 if (! HIWORD (idText
))
213 LoadStringW(hmod
,idText
,pszText
,100);
215 pszText
= (LPWSTR
)idText
;
217 FormatMessageW(FORMAT_MESSAGE_FROM_STRING
| FORMAT_MESSAGE_ARGUMENT_ARRAY
,szText
,0,0,szTemp
,256,args
);
218 return MessageBoxW(hwnd
,szTemp
,szTitle
,uType
);
221 /*************************************************************************
222 * ShellMessageBoxA [SHELL32.183]
225 ShellMessageBoxA(HMODULE hmod
,HWND hwnd
,DWORD idText
,DWORD idTitle
,DWORD uType
,LPCVOID arglist
)
226 { char szText
[100],szTitle
[100],szTemp
[256];
227 LPSTR pszText
= &szText
[0], pszTitle
= &szTitle
[0];
228 LPVOID args
= &arglist
;
230 TRACE(shell
,"(%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n", (DWORD
)hmod
,(DWORD
)hwnd
,idText
,idTitle
,uType
,arglist
);
232 if (!HIWORD (idTitle
))
233 LoadStringA(hmod
,idTitle
,pszTitle
,100);
235 pszTitle
= (LPSTR
)idTitle
;
237 if (! HIWORD (idText
))
238 LoadStringA(hmod
,idText
,pszText
,100);
240 pszText
= (LPSTR
)idText
;
242 FormatMessageA(FORMAT_MESSAGE_FROM_STRING
| FORMAT_MESSAGE_ARGUMENT_ARRAY
,pszText
,0,0,szTemp
,256,args
);
243 return MessageBoxA(hwnd
,szTemp
,pszTitle
,uType
);
246 /*************************************************************************
247 * SHRestricted [SHELL32.100]
249 * walks through policy table, queries <app> key, <type> value, returns
250 * queried (DWORD) value.
251 * {0x00001,Explorer,NoRun}
252 * {0x00002,Explorer,NoClose}
253 * {0x00004,Explorer,NoSaveSettings}
254 * {0x00008,Explorer,NoFileMenu}
255 * {0x00010,Explorer,NoSetFolders}
256 * {0x00020,Explorer,NoSetTaskbar}
257 * {0x00040,Explorer,NoDesktop}
258 * {0x00080,Explorer,NoFind}
259 * {0x00100,Explorer,NoDrives}
260 * {0x00200,Explorer,NoDriveAutoRun}
261 * {0x00400,Explorer,NoDriveTypeAutoRun}
262 * {0x00800,Explorer,NoNetHood}
263 * {0x01000,Explorer,NoStartBanner}
264 * {0x02000,Explorer,RestrictRun}
265 * {0x04000,Explorer,NoPrinterTabs}
266 * {0x08000,Explorer,NoDeletePrinter}
267 * {0x10000,Explorer,NoAddPrinter}
268 * {0x20000,Explorer,NoStartMenuSubFolders}
269 * {0x40000,Explorer,MyDocsOnNet}
270 * {0x80000,WinOldApp,NoRealMode}
273 * exported by ordinal
275 DWORD WINAPI
SHRestricted (DWORD pol
) {
278 FIXME(shell
,"(%08lx):stub.\n",pol
);
279 if (RegOpenKeyA(HKEY_CURRENT_USER
,"Software\\Microsoft\\Windows\\CurrentVersion\\Policies",&xhkey
))
281 /* FIXME: do nothing for now, just return 0 (== "allowed") */
286 /*************************************************************************
287 * SHCreateDirectory [SHELL32.165]
290 * exported by ordinal
291 * not sure about LPSECURITY_ATTRIBUTES
293 DWORD WINAPI
SHCreateDirectory(LPSECURITY_ATTRIBUTES sec
,LPCSTR path
) {
294 TRACE(shell
,"(%p,%s):stub.\n",sec
,path
);
295 if (CreateDirectoryA(path
,sec
))
297 /* SHChangeNotify(8,1,path,0); */
300 if (SHELL32_79(path
,(LPVOID
)x
))
302 FIXME(shell
,"(%08lx,%s):stub.\n",x
,path
);
307 /*************************************************************************
308 * SHFree [SHELL32.195]
311 * free_ptr() - frees memory using IMalloc
312 * exported by ordinal
314 DWORD WINAPI
SHFree(LPVOID x
) {
315 TRACE(shell
,"%p\n",x
);
317 { *(LPDWORD
)0xdeaf0000 = 0;
319 return HeapFree(GetProcessHeap(),0,x
);
322 /*************************************************************************
323 * SHAlloc [SHELL32.196]
326 * void *task_alloc(DWORD len), uses SHMalloc allocator
327 * exported by ordinal
329 LPVOID WINAPI
SHAlloc(DWORD len
) {
330 /* void * ret = (LPVOID)LocalAlloc32(len,LMEM_ZEROINIT);*/ /* chrashes */
331 void * ret
= (LPVOID
) HeapAlloc(GetProcessHeap(),0,len
);
332 TRACE(shell
,"%lu bytes at %p\n",len
, ret
);
336 /*************************************************************************
337 * OpenRegStream [SHELL32.85]
340 * exported by ordinal
342 DWORD WINAPI
OpenRegStream(DWORD x1
,DWORD x2
,DWORD x3
,DWORD x4
) {
343 FIXME(shell
,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub.\n",
349 /*************************************************************************
350 * SHRegisterDragDrop [SHELL32.86]
353 * exported by ordinal
355 DWORD WINAPI
SHRegisterDragDrop(HWND hwnd
,DWORD x2
) {
356 FIXME (shell
, "(0x%08x,0x%08lx):stub.\n", hwnd
, x2
);
360 /*************************************************************************
361 * SHRevokeDragDrop [SHELL32.87]
364 * exported by ordinal
366 DWORD WINAPI
SHRevokeDragDrop(DWORD x
) {
367 FIXME(shell
,"(0x%08lx):stub.\n",x
);
371 /*************************************************************************
372 * RunFileDlg [SHELL32.61]
375 * Original name: RunFileDlg (exported by ordinal)
378 RunFileDlg (HWND hwndOwner
, DWORD dwParam1
, DWORD dwParam2
,
379 LPSTR lpszTitle
, LPSTR lpszPrompt
, UINT uFlags
)
381 FIXME (shell
,"(0x%08x 0x%lx 0x%lx \"%s\" \"%s\" 0x%x):stub.\n",
382 hwndOwner
, dwParam1
, dwParam2
, lpszTitle
, lpszPrompt
, uFlags
);
386 /*************************************************************************
387 * ExitWindowsDialog [SHELL32.60]
390 * exported by ordinal
393 ExitWindowsDialog (HWND hwndOwner
)
395 FIXME (shell
,"(0x%08x):stub.\n", hwndOwner
);
399 /*************************************************************************
400 * ArrangeWindows [SHELL32.184]
404 ArrangeWindows (DWORD dwParam1
, DWORD dwParam2
, DWORD dwParam3
,
405 DWORD dwParam4
, DWORD dwParam5
)
407 FIXME (shell
,"(0x%lx 0x%lx 0x%lx 0x%lx 0x%lx):stub.\n",
408 dwParam1
, dwParam2
, dwParam3
, dwParam4
, dwParam5
);
412 /*************************************************************************
413 * SHCLSIDFromString [SHELL32.147]
416 * exported by ordinal
419 SHCLSIDFromString (DWORD dwParam1
, DWORD dwParam2
)
421 FIXME (shell
,"(0x%lx 0x%lx):stub.\n", dwParam1
, dwParam2
);
422 FIXME (shell
,"(\"%s\" \"%s\"):stub.\n", (LPSTR
)dwParam1
, (LPSTR
)dwParam2
);
428 /*************************************************************************
429 * SignalFileOpen [SHELL32.103]
432 * exported by ordinal
435 SignalFileOpen (DWORD dwParam1
)
437 FIXME (shell
,"(0x%08lx):stub.\n", dwParam1
);
442 /*************************************************************************
443 * SHAddToRecentDocs [SHELL32.234]
446 * uFlags [IN] SHARD_PATH or SHARD_PIDL
447 * pv [IN] string or pidl, NULL clears the list
452 DWORD WINAPI
SHAddToRecentDocs (UINT uFlags
,LPCVOID pv
)
453 { if (SHARD_PIDL
==uFlags
)
454 { FIXME (shell
,"(0x%08x,pidl=%p):stub.\n", uFlags
,pv
);
457 { FIXME (shell
,"(0x%08x,%s):stub.\n", uFlags
,(char*)pv
);
461 /*************************************************************************
462 * SHFileOperation32 [SHELL32.242]
465 DWORD WINAPI
SHFileOperationAW(DWORD x
)
466 { FIXME(shell
,"0x%08lx stub\n",x
);
471 /*************************************************************************
472 * SHFileOperation32A [SHELL32.243]
477 DWORD WINAPI
SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp
)
478 { FIXME (shell
,"(%p):stub.\n", lpFileOp
);
481 /*************************************************************************
482 * SHFileOperation32W [SHELL32.244]
487 DWORD WINAPI
SHFileOperationW (LPSHFILEOPSTRUCTW lpFileOp
)
488 { FIXME (shell
,"(%p):stub.\n", lpFileOp
);
492 /*************************************************************************
493 * SHChangeNotify [SHELL32.239]
498 DWORD WINAPI
SHChangeNotify (
499 INT wEventId
, /* [IN] flags that specifies the event*/
500 UINT uFlags
, /* [IN] the meaning of dwItem[1|2]*/
503 { FIXME (shell
,"(0x%08x,0x%08ux,%p,%p):stub.\n", wEventId
,uFlags
,dwItem1
,dwItem2
);
506 /*************************************************************************
507 * SHCreateShellFolderViewEx [SHELL32.174]
510 * see IShellFolder::CreateViewObject
512 HRESULT WINAPI
SHCreateShellFolderViewEx(
513 LPSHELLVIEWDATA psvcbi
, /*[in ] shelltemplate struct*/
514 LPVOID
* ppv
) /*[out] IShellView pointer*/
515 { FIXME (shell
,"(%p,%p):stub.\n", psvcbi
,ppv
);
518 /*************************************************************************
519 * SHFind_InitMenuPopup [SHELL32.149]
522 * Registers the menu behind the "Start" button
525 * hMenu [in] handel of menu previously created
526 * hWndParent [in] parent window
530 HRESULT WINAPI
SHFind_InitMenuPopup (HMENU hMenu
, HWND hWndParent
, DWORD w
, DWORD x
)
531 { FIXME(shell
,"hmenu=0x%08x hwnd=0x%08x 0x%08lx 0x%08lx stub\n",
532 hMenu
,hWndParent
,w
,x
);
535 /*************************************************************************
536 * FileMenu_InitMenuPopup [SHELL32.109]
539 HRESULT WINAPI
FileMenu_InitMenuPopup (DWORD hmenu
)
540 { FIXME(shell
,"hmenu=0x%lx stub\n",hmenu
);
543 /*************************************************************************
544 * FileMenu_Create [SHELL32.114]
546 * w retval from LoadBitmapA
550 HRESULT WINAPI
FileMenu_Create (DWORD u
, DWORD v
, DWORD w
, DWORD x
, DWORD z
)
551 { FIXME(shell
,"0x%08lx 0x%08lx hbmp=0x%lx 0x%08lx 0x%08lx stub\n",u
,v
,w
,x
,z
);
554 /*************************************************************************
555 * FileMenu_TrackPopupMenuEx [SHELL32.116]
558 * uFlags [in] according to TrackPopupMenuEx
562 * z could be rect (trace) or TPMPARAMS (TrackPopupMenuEx)
564 HRESULT WINAPI
FileMenu_TrackPopupMenuEx (DWORD t
, DWORD uFlags
, DWORD posX
, DWORD posY
, HWND hWndParent
, DWORD z
)
565 { FIXME(shell
,"0x%lx flags=0x%lx posx=0x%lx posy=0x%lx hwndp=0x%x 0x%lx stub\n",
566 t
,uFlags
,posX
,posY
, hWndParent
,z
);
569 /*************************************************************************
570 * SHWinHelp [SHELL32.127]
573 HRESULT WINAPI
SHWinHelp (DWORD v
, DWORD w
, DWORD x
, DWORD z
)
574 { FIXME(shell
,"0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v
,w
,x
,z
);
577 /*************************************************************************
578 * SHRunControlPanel [SHELL32.161]
581 HRESULT WINAPI
SHRunControlPanel (DWORD x
, DWORD z
)
582 { FIXME(shell
,"0x%08lx 0x%08lx stub\n",x
,z
);
585 /*************************************************************************
586 * ShellExecuteEx [SHELL32.291]
589 BOOL WINAPI
ShellExecuteExAW (LPVOID sei
)
590 { if (VERSION_OsIsUnicode())
591 return ShellExecuteExW (sei
);
592 return ShellExecuteExA (sei
);
594 /*************************************************************************
595 * ShellExecuteEx32A [SHELL32.292]
598 BOOL WINAPI
ShellExecuteExA (LPSHELLEXECUTEINFOA sei
)
599 { CHAR szApplicationName
[MAX_PATH
],szCommandline
[MAX_PATH
],szPidl
[20];
602 STARTUPINFOA startupinfo
;
603 PROCESS_INFORMATION processinformation
;
605 WARN(shell
,"mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n",
606 sei
->fMask
, sei
->hwnd
, sei
->lpVerb
, sei
->lpFile
,
607 sei
->lpParameters
, sei
->lpDirectory
, sei
->nShow
, sei
->lpClass
);
609 ZeroMemory(szApplicationName
,MAX_PATH
);
611 strcpy(szApplicationName
, sei
->lpFile
);
613 ZeroMemory(szCommandline
,MAX_PATH
);
614 if (sei
->lpParameters
)
615 strcpy(szCommandline
, sei
->lpParameters
);
617 if (sei
->fMask
& (SEE_MASK_CLASSKEY
| SEE_MASK_INVOKEIDLIST
| SEE_MASK_ICON
| SEE_MASK_HOTKEY
|
618 SEE_MASK_NOCLOSEPROCESS
| SEE_MASK_CONNECTNETDRV
| SEE_MASK_FLAG_DDEWAIT
|
619 SEE_MASK_DOENVSUBST
| SEE_MASK_FLAG_NO_UI
| SEE_MASK_UNICODE
|
620 SEE_MASK_NO_CONSOLE
| SEE_MASK_ASYNCOK
| SEE_MASK_HMONITOR
))
621 { FIXME (shell
,"flags ignored: 0x%08lx\n", sei
->fMask
);
624 if (sei
->fMask
& SEE_MASK_CLASSNAME
)
625 { HCR_GetExecuteCommand(sei
->lpClass
, (sei
->lpVerb
) ? sei
->lpVerb
: "open", szCommandline
, 256);
628 /* process the IDList */
629 if ( (sei
->fMask
& SEE_MASK_INVOKEIDLIST
) == SEE_MASK_INVOKEIDLIST
) /*0x0c*/
630 { SHGetPathFromIDListA (sei
->lpIDList
,szApplicationName
);
631 TRACE(shell
,"-- idlist=%p (%s)\n", sei
->lpIDList
, szApplicationName
);
634 { if (sei
->fMask
& SEE_MASK_IDLIST
)
635 { /* %I is the adress of a global item ID*/
636 pos
= strstr(szCommandline
, "%I");
638 { HGLOBAL hmem
= SHAllocShared ( sei
->lpIDList
, ILGetSize(sei
->lpIDList
), 0);
639 sprintf(szPidl
,":%li",(DWORD
)SHLockShared(hmem
,0) );
640 SHUnlockShared(hmem
);
642 gap
= strlen(szPidl
);
644 memmove(pos
+gap
,pos
+2,len
);
645 memcpy(pos
,szPidl
,gap
);
651 pos
= strstr(szCommandline
, ",%L"); /* dunno what it means: kill it*/
653 { len
= strlen(pos
)-2;
655 memmove(pos
,pos
+3,len
);
658 TRACE(shell
,"execute: %s %s\n",szApplicationName
, szCommandline
);
660 ZeroMemory(&startupinfo
,sizeof(STARTUPINFOA
));
661 startupinfo
.cb
= sizeof(STARTUPINFOA
);
663 return CreateProcessA(szApplicationName
[0] ? szApplicationName
:NULL
,
664 szCommandline
[0] ? szCommandline
: NULL
,
665 NULL
, NULL
, FALSE
, 0,
666 NULL
, NULL
, &startupinfo
, &processinformation
);
670 /*************************************************************************
671 * ShellExecuteEx32W [SHELL32.293]
674 BOOL WINAPI
ShellExecuteExW (LPSHELLEXECUTEINFOW sei
)
675 { SHELLEXECUTEINFOA seiA
;
678 TRACE (shell
,"%p\n", sei
);
680 memcpy(&seiA
, sei
, sizeof(SHELLEXECUTEINFOA
));
683 seiA
.lpVerb
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpVerb
);
686 seiA
.lpFile
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpFile
);
688 if (sei
->lpParameters
)
689 seiA
.lpParameters
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpParameters
);
691 if (sei
->lpDirectory
)
692 seiA
.lpDirectory
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpDirectory
);
694 if ((sei
->fMask
& SEE_MASK_CLASSNAME
) && sei
->lpClass
)
695 seiA
.lpClass
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpClass
);
699 ret
= ShellExecuteExA(&seiA
);
701 if (seiA
.lpVerb
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpVerb
);
702 if (seiA
.lpFile
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpFile
);
703 if (seiA
.lpParameters
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpParameters
);
704 if (seiA
.lpDirectory
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpDirectory
);
705 if (seiA
.lpClass
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpClass
);
710 static LPUNKNOWN SHELL32_IExplorerInterface
=0;
711 /*************************************************************************
712 * SHSetInstanceExplorer [SHELL32.176]
717 HRESULT WINAPI
SHSetInstanceExplorer (LPUNKNOWN lpUnknown
)
718 { TRACE (shell
,"%p\n", lpUnknown
);
719 SHELL32_IExplorerInterface
= lpUnknown
;
720 return (HRESULT
) lpUnknown
;
722 /*************************************************************************
723 * SHGetInstanceExplorer [SHELL32.256]
726 * gets the interface pointer of the explorer and a reference
728 HRESULT WINAPI
SHGetInstanceExplorer (LPUNKNOWN
* lpUnknown
)
729 { TRACE(shell
,"%p\n", lpUnknown
);
731 *lpUnknown
= SHELL32_IExplorerInterface
;
733 if (!SHELL32_IExplorerInterface
)
736 SHELL32_IExplorerInterface
->lpvtbl
->fnAddRef(SHELL32_IExplorerInterface
);
739 /*************************************************************************
740 * SHFreeUnusedLibraries [SHELL32.123]
745 HRESULT WINAPI
SHFreeUnusedLibraries (void)
746 { FIXME(shell
,"stub\n");
749 /*************************************************************************
750 * DAD_ShowDragImage [SHELL32.137]
755 HRESULT WINAPI
DAD_ShowDragImage (DWORD u
)
756 { FIXME(shell
,"0x%08lx stub\n",u
);
759 /*************************************************************************
760 * FileMenu_Destroy [SHELL32.118]
765 HRESULT WINAPI
FileMenu_Destroy (DWORD u
)
766 { FIXME(shell
,"0x%08lx stub\n",u
);
769 /*************************************************************************
770 * SHRegCloseKey32 [NT4.0:SHELL32.505]
773 HRESULT WINAPI
SHRegCloseKey (HKEY hkey
)
774 { TRACE(shell
,"0x%04x\n",hkey
);
775 return RegCloseKey( hkey
);
777 /*************************************************************************
778 * SHRegOpenKey32A [SHELL32.506]
781 HRESULT WINAPI
SHRegOpenKeyA(HKEY hKey
, LPSTR lpSubKey
, LPHKEY phkResult
)
782 { FIXME(shell
,"(0x%08x, %s, %p)\n", hKey
, debugstr_a(lpSubKey
),
784 return RegOpenKeyA(hKey
, lpSubKey
, phkResult
);
787 /*************************************************************************
788 * SHRegOpenKey32W [NT4.0:SHELL32.507]
791 HRESULT WINAPI
SHRegOpenKeyW (HKEY hkey
, LPCWSTR lpszSubKey
, LPHKEY retkey
)
792 { WARN(shell
,"0x%04x %s %p\n",hkey
,debugstr_w(lpszSubKey
),retkey
);
793 return RegOpenKeyW( hkey
, lpszSubKey
, retkey
);
795 /*************************************************************************
796 * SHRegQueryValueExA [SHELL32.509]
799 HRESULT WINAPI
SHRegQueryValueExA(DWORD u
, LPSTR v
, DWORD w
, DWORD x
,
801 { FIXME(shell
,"0x%04lx %s 0x%04lx 0x%04lx 0x%04lx 0x%04lx stub\n",
802 u
,debugstr_a(v
),w
,x
,y
,z
);
805 /*************************************************************************
806 * SHRegQueryValue32W [NT4.0:SHELL32.510]
809 HRESULT WINAPI
SHRegQueryValueW (HKEY hkey
, LPWSTR lpszSubKey
,
810 LPWSTR lpszData
, LPDWORD lpcbData
)
811 { WARN(shell
,"0x%04x %s %p %p semi-stub\n",
812 hkey
, debugstr_w(lpszSubKey
), lpszData
, lpcbData
);
813 return RegQueryValueW( hkey
, lpszSubKey
, lpszData
, lpcbData
);
816 /*************************************************************************
817 * SHRegQueryValueEx32W [NT4.0:SHELL32.511]
820 * if the datatype REG_EXPAND_SZ then expand the string and change
821 * *pdwType to REG_SZ.
823 HRESULT WINAPI
SHRegQueryValueExW (HKEY hkey
, LPWSTR pszValue
, LPDWORD pdwReserved
,
824 LPDWORD pdwType
, LPVOID pvData
, LPDWORD pcbData
)
826 WARN(shell
,"0x%04x %s %p %p %p %p semi-stub\n",
827 hkey
, debugstr_w(pszValue
), pdwReserved
, pdwType
, pvData
, pcbData
);
828 ret
= RegQueryValueExW ( hkey
, pszValue
, pdwReserved
, pdwType
, pvData
, pcbData
);
832 /*************************************************************************
833 * ReadCabinetState [NT 4.0:SHELL32.651]
836 HRESULT WINAPI
ReadCabinetState(DWORD u
, DWORD v
)
837 { FIXME(shell
,"0x%04lx 0x%04lx stub\n",u
,v
);
840 /*************************************************************************
841 * WriteCabinetState [NT 4.0:SHELL32.652]
844 HRESULT WINAPI
WriteCabinetState(DWORD u
)
845 { FIXME(shell
,"0x%04lx stub\n",u
);
848 /*************************************************************************
849 * FileIconInit [SHELL32.660]
852 BOOL WINAPI
FileIconInit(BOOL bFullInit
)
853 { FIXME(shell
,"(%s)\n", bFullInit
? "true" : "false");
856 /*************************************************************************
857 * IsUserAdmin [NT 4.0:SHELL32.680]
860 HRESULT WINAPI
IsUserAdmin(void)
861 { FIXME(shell
,"stub\n");
864 /*************************************************************************
865 * StrRetToStrN [SHELL32.96]
867 * converts a STRRET to a normal string
870 * the pidl is for STRRET OFFSET
872 HRESULT WINAPI
StrRetToStrN (LPVOID dest
, DWORD len
, LPSTRRET src
, LPITEMIDLIST pidl
)
873 { TRACE(shell
,"dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest
,len
,src
,pidl
);
877 WideCharToMultiByte(CP_ACP
, 0, src
->u
.pOleStr
, -1, (LPSTR
)dest
, len
, NULL
, NULL
);
878 SHFree(src
->u
.pOleStr
);
882 if (VERSION_OsIsUnicode())
883 lstrcpynAtoW((LPWSTR
)dest
, src
->u
.cStr
, len
);
885 strncpy((LPSTR
)dest
, src
->u
.cStr
, len
);
890 { if(VERSION_OsIsUnicode())
891 lstrcpynAtoW((LPWSTR
)dest
, ((LPCSTR
)&pidl
->mkid
)+src
->u
.uOffset
, len
);
893 strncpy((LPSTR
)dest
, ((LPCSTR
)&pidl
->mkid
)+src
->u
.uOffset
, len
);
898 FIXME(shell
,"unknown type!\n");
900 { *(LPSTR
)dest
= '\0';
907 /*************************************************************************
908 * StrChrW [NT 4.0:SHELL32.651]
911 LPWSTR WINAPI
StrChrW (LPWSTR str
, WCHAR x
)
914 TRACE(shell
,"%s 0x%04x\n",debugstr_w(str
),x
);
924 /*************************************************************************
925 * StrCmpNIW [NT 4.0:SHELL32.*]
928 INT WINAPI
StrCmpNIW ( LPWSTR wstr1
, LPWSTR wstr2
, INT len
)
929 { FIXME( shell
,"%s %s %i stub\n", debugstr_w(wstr1
),debugstr_w(wstr2
),len
);
933 /*************************************************************************
934 * SHAllocShared [SHELL32.520]
937 * parameter1 is return value from HeapAlloc
938 * parameter2 is equal to the size allocated with HeapAlloc
939 * parameter3 is return value from GetCurrentProcessId
941 * the return value is posted as lParam with 0x402 (WM_USER+2) to somewhere
942 * WM_USER+2 could be the undocumented CWM_SETPATH
943 * the allocated memory contains a pidl
945 HGLOBAL WINAPI
SHAllocShared(LPVOID psrc
, DWORD size
, DWORD procID
)
949 TRACE(shell
,"ptr=%p size=0x%04lx procID=0x%04lx\n",psrc
,size
,procID
);
950 hmem
= GlobalAlloc(GMEM_FIXED
, size
);
954 pmem
= GlobalLock (hmem
);
959 memcpy (pmem
, psrc
, size
);
963 /*************************************************************************
964 * SHLockShared [SHELL32.521]
967 * parameter1 is return value from SHAllocShared
968 * parameter2 is return value from GetCurrentProcessId
969 * the receiver of (WM_USER+2) trys to lock the HANDLE (?)
970 * the returnvalue seems to be a memoryadress
972 LPVOID WINAPI
SHLockShared(HANDLE hmem
, DWORD procID
)
973 { TRACE(shell
,"handle=0x%04x procID=0x%04lx\n",hmem
,procID
);
974 return GlobalLock(hmem
);
976 /*************************************************************************
977 * SHUnlockShared [SHELL32.522]
980 * parameter1 is return value from SHLockShared
982 BOOL WINAPI
SHUnlockShared(HANDLE pmem
)
983 { TRACE(shell
,"handle=0x%04x\n",pmem
);
984 return GlobalUnlock(pmem
);
986 /*************************************************************************
987 * SHFreeShared [SHELL32.523]
990 * parameter1 is return value from SHAllocShared
991 * parameter2 is return value from GetCurrentProcessId
993 HANDLE WINAPI
SHFreeShared(HANDLE hmem
, DWORD procID
)
994 { TRACE(shell
,"handle=0x%04x 0x%04lx\n",hmem
,procID
);
995 return GlobalFree(hmem
);
998 /*************************************************************************
999 * SetAppStartingCursor32 [SHELL32.99]
1002 HRESULT WINAPI
SetAppStartingCursor(HWND u
, DWORD v
)
1003 { FIXME(shell
,"hwnd=0x%04x 0x%04lx stub\n",u
,v
);
1006 /*************************************************************************
1007 * SHLoadOLE32 [SHELL32.151]
1010 HRESULT WINAPI
SHLoadOLE(DWORD u
)
1011 { FIXME(shell
,"0x%04lx stub\n",u
);
1014 /*************************************************************************
1015 * Shell_MergeMenus32 [SHELL32.67]
1018 BOOL
_SHIsMenuSeparator(HMENU hm
, int i
)
1022 mii
.cbSize
= sizeof(MENUITEMINFOA
);
1023 mii
.fMask
= MIIM_TYPE
;
1024 mii
.cch
= 0; /* WARNING: We MUST initialize it to 0*/
1025 if (!GetMenuItemInfoA(hm
, i
, TRUE
, &mii
))
1029 if (mii
.fType
& MFT_SEPARATOR
)
1035 #define MM_ADDSEPARATOR 0x00000001L
1036 #define MM_SUBMENUSHAVEIDS 0x00000002L
1037 HRESULT WINAPI
Shell_MergeMenus (HMENU hmDst
, HMENU hmSrc
, UINT uInsert
, UINT uIDAdjust
, UINT uIDAdjustMax
, ULONG uFlags
)
1040 BOOL bAlreadySeparated
;
1041 MENUITEMINFOA miiSrc
;
1043 UINT uTemp
, uIDMax
= uIDAdjust
;
1045 FIXME(shell
,"hmenu1=0x%04x hmenu2=0x%04x 0x%04x 0x%04x 0x%04x 0x%04lx stub\n",
1046 hmDst
, hmSrc
, uInsert
, uIDAdjust
, uIDAdjustMax
, uFlags
);
1048 if (!hmDst
|| !hmSrc
)
1052 nItem
= GetMenuItemCount(hmDst
);
1053 if (uInsert
>= (UINT
)nItem
)
1054 { uInsert
= (UINT
)nItem
;
1055 bAlreadySeparated
= TRUE
;
1058 { bAlreadySeparated
= _SHIsMenuSeparator(hmDst
, uInsert
);;
1060 if ((uFlags
& MM_ADDSEPARATOR
) && !bAlreadySeparated
)
1061 { /* Add a separator between the menus */
1062 InsertMenuA(hmDst
, uInsert
, MF_BYPOSITION
| MF_SEPARATOR
, 0, NULL
);
1063 bAlreadySeparated
= TRUE
;
1067 /* Go through the menu items and clone them*/
1068 for (nItem
= GetMenuItemCount(hmSrc
) - 1; nItem
>= 0; nItem
--)
1069 { miiSrc
.cbSize
= sizeof(MENUITEMINFOA
);
1070 miiSrc
.fMask
= MIIM_STATE
| MIIM_ID
| MIIM_SUBMENU
| MIIM_CHECKMARKS
| MIIM_TYPE
| MIIM_DATA
;
1071 /* We need to reset this every time through the loop in case
1072 menus DON'T have IDs*/
1073 miiSrc
.fType
= MFT_STRING
;
1074 miiSrc
.dwTypeData
= szName
;
1075 miiSrc
.dwItemData
= 0;
1076 miiSrc
.cch
= sizeof(szName
);
1078 if (!GetMenuItemInfoA(hmSrc
, nItem
, TRUE
, &miiSrc
))
1081 if (miiSrc
.fType
& MFT_SEPARATOR
)
1082 { /* This is a separator; don't put two of them in a row*/
1083 if (bAlreadySeparated
)
1086 bAlreadySeparated
= TRUE
;
1088 else if (miiSrc
.hSubMenu
)
1089 { if (uFlags
& MM_SUBMENUSHAVEIDS
)
1090 { /* Adjust the ID and check it*/
1091 miiSrc
.wID
+= uIDAdjust
;
1092 if (miiSrc
.wID
> uIDAdjustMax
)
1095 if (uIDMax
<= miiSrc
.wID
)
1096 { uIDMax
= miiSrc
.wID
+ 1;
1100 { /* Don't set IDs for submenus that didn't have them already */
1101 miiSrc
.fMask
&= ~MIIM_ID
;
1103 hmSubMenu
= miiSrc
.hSubMenu
;
1104 miiSrc
.hSubMenu
= CreatePopupMenu();
1105 if (!miiSrc
.hSubMenu
)
1108 uTemp
= Shell_MergeMenus(miiSrc
.hSubMenu
, hmSubMenu
, 0, uIDAdjust
, uIDAdjustMax
, uFlags
&MM_SUBMENUSHAVEIDS
);
1109 if (uIDMax
<= uTemp
)
1112 bAlreadySeparated
= FALSE
;
1115 { /* Adjust the ID and check it*/
1116 miiSrc
.wID
+= uIDAdjust
;
1117 if (miiSrc
.wID
> uIDAdjustMax
)
1120 if (uIDMax
<= miiSrc
.wID
)
1121 { uIDMax
= miiSrc
.wID
+ 1;
1123 bAlreadySeparated
= FALSE
;
1125 if (!InsertMenuItemA(hmDst
, uInsert
, TRUE
, &miiSrc
))
1130 /* Ensure the correct number of separators at the beginning of the
1131 inserted menu items*/
1133 { if (bAlreadySeparated
)
1134 { DeleteMenu(hmDst
, uInsert
, MF_BYPOSITION
);
1138 { if (_SHIsMenuSeparator(hmDst
, uInsert
-1))
1139 { if (bAlreadySeparated
)
1140 { DeleteMenu(hmDst
, uInsert
, MF_BYPOSITION
);
1144 { if ((uFlags
& MM_ADDSEPARATOR
) && !bAlreadySeparated
)
1145 { /* Add a separator between the menus*/
1146 InsertMenuA(hmDst
, uInsert
, MF_BYPOSITION
| MF_SEPARATOR
, 0, NULL
);
1153 /*************************************************************************
1154 * DriveType32 [SHELL32.64]
1157 HRESULT WINAPI
DriveType(DWORD u
)
1158 { FIXME(shell
,"0x%04lx stub\n",u
);
1161 /*************************************************************************
1162 * SHAbortInvokeCommand [SHELL32.198]
1165 HRESULT WINAPI
SHAbortInvokeCommand(void)
1166 { FIXME(shell
,"stub\n");
1169 /*************************************************************************
1170 * SHOutOfMemoryMessageBox [SHELL32.126]
1173 HRESULT WINAPI
SHOutOfMemoryMessageBox(DWORD u
, DWORD v
, DWORD w
)
1174 { FIXME(shell
,"0x%04lx 0x%04lx 0x%04lx stub\n",u
,v
,w
);
1177 /*************************************************************************
1178 * SHFlushClipboard [SHELL32.121]
1181 HRESULT WINAPI
SHFlushClipboard(void)
1182 { FIXME(shell
,"stub\n");
1185 /*************************************************************************
1186 * StrRChrW [SHELL32.320]
1189 LPWSTR WINAPI
StrRChrW(LPWSTR lpStart
, LPWSTR lpEnd
, DWORD wMatch
)
1191 TRACE(shell
,"%s %s 0x%04x\n",debugstr_w(lpStart
),debugstr_w(lpEnd
), (WCHAR
)wMatch
);
1193 /* if the end not given, search*/
1201 { if (*lpStart
==(WCHAR
)wMatch
)
1204 } while ( lpStart
<=lpEnd
);
1207 /*************************************************************************
1208 * StrFormatByteSize [SHLWAPI]
1210 LPSTR WINAPI
StrFormatByteSizeA ( DWORD dw
, LPSTR pszBuf
, UINT cchBuf
)
1212 TRACE(shell
,"%lx %p %i\n", dw
, pszBuf
, cchBuf
);
1214 { sprintf (buf
,"%3.1f bytes", (FLOAT
)dw
);
1216 else if ( dw
<1048576L)
1217 { sprintf (buf
,"%3.1f KB", (FLOAT
)dw
/1024);
1219 else if ( dw
< 1073741824L)
1220 { sprintf (buf
,"%3.1f MB", (FLOAT
)dw
/1048576L);
1223 { sprintf (buf
,"%3.1f GB", (FLOAT
)dw
/1073741824L);
1225 strncpy (pszBuf
, buf
, cchBuf
);
1228 LPWSTR WINAPI
StrFormatByteSizeW ( DWORD dw
, LPWSTR pszBuf
, UINT cchBuf
)
1230 TRACE(shell
,"%lx %p %i\n", dw
, pszBuf
, cchBuf
);
1232 { sprintf (buf
,"%3.1f bytes", (FLOAT
)dw
);
1234 else if ( dw
<1048576L)
1235 { sprintf (buf
,"%3.1f KB", (FLOAT
)dw
/1024);
1237 else if ( dw
< 1073741824L)
1238 { sprintf (buf
,"%3.1f MB", (FLOAT
)dw
/1048576L);
1241 { sprintf (buf
,"%3.1f GB", (FLOAT
)dw
/1073741824L);
1243 lstrcpynAtoW (pszBuf
, buf
, cchBuf
);
1246 /*************************************************************************
1247 * SHWaitForFileToOpen [SHELL32.97]
1250 HRESULT WINAPI
SHWaitForFileToOpen(DWORD u
, DWORD v
, DWORD w
)
1251 { FIXME(shell
,"0x%04lx 0x%04lx 0x%04lx stub\n",u
,v
,w
);
1254 /*************************************************************************
1255 * Control_FillCache_RunDLL [SHELL32.8]
1258 HRESULT WINAPI
Control_FillCache_RunDLL(HWND hWnd
, HANDLE hModule
, DWORD w
, DWORD x
)
1259 { FIXME(shell
,"0x%04x 0x%04x 0x%04lx 0x%04lx stub\n",hWnd
, hModule
,w
,x
);
1262 /*************************************************************************
1263 * RunDLL_CallEntry16 [SHELL32.122]
1264 * the name is propably wrong
1266 HRESULT WINAPI
RunDLL_CallEntry16(DWORD v
, DWORD w
, DWORD x
, DWORD y
, DWORD z
)
1267 { FIXME(shell
,"0x%04lx 0x%04lx 0x%04lx 0x%04lx 0x%04lx stub\n",v
,w
,x
,y
,z
);