Recovery of release 990110 after disk crash.
[wine.git] / dlls / shell32 / shellord.c
blob2edd0dfc2e906bd84112d52f16f6b7fd56b2a13f
1 /*
2 * Shell Ordinal Functions
4 * These are completely undocumented. The meaning of the functions changes
5 * between different OS versions (NT uses Unicode strings, 95 uses ASCII
6 * strings, etc. etc.)
7 *
8 * They are just here so that explorer.exe and iexplore.exe can be tested.
10 * Copyright 1997 Marcus Meissner
11 * 1998 Jürgen Schmied
13 #include <stdlib.h>
14 #include <string.h>
15 #include <unistd.h>
16 #include <ctype.h>
17 #include "windows.h"
18 #include "winerror.h"
19 #include "file.h"
20 #include "shell.h"
21 #include "heap.h"
22 #include "module.h"
23 #include "neexe.h"
24 #include "resource.h"
25 #include "dlgs.h"
26 #include "win.h"
27 #include "cursoricon.h"
28 #include "shlobj.h"
29 #include "debug.h"
30 #include "winreg.h"
31 #include "winnls.h"
32 #include "winversion.h"
33 #include "shell32_main.h"
35 /*************************************************************************
36 * SHChangeNotifyRegister [SHELL32.2]
37 * NOTES
38 * Idlist is an array of structures and Count specifies how many items in the array
39 * (usually just one I think).
41 DWORD WINAPI
42 SHChangeNotifyRegister(
43 HWND32 hwnd,
44 LONG events1,
45 LONG events2,
46 DWORD msg,
47 int count,
48 IDSTRUCT *idlist)
49 { FIXME(shell,"(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):stub.\n",
50 hwnd,events1,events2,msg,count,idlist);
51 return 0;
53 /*************************************************************************
54 * SHChangeNotifyDeregister [SHELL32.4]
56 DWORD WINAPI
57 SHChangeNotifyDeregister(LONG x1)
58 { FIXME(shell,"(0x%08lx):stub.\n",x1);
59 return 0;
61 /*************************************************************************
62 * NTSHChangeNotifyRegister [SHELL32.640]
63 * NOTES
64 * Idlist is an array of structures and Count specifies how many items in the array
65 * (usually just one I think).
67 DWORD WINAPI NTSHChangeNotifyRegister(
68 HWND32 hwnd,
69 LONG events1,
70 LONG events2,
71 DWORD msg,
72 int count,
73 IDSTRUCT *idlist)
74 { FIXME(shell,"(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):stub.\n",
75 hwnd,events1,events2,msg,count,idlist);
76 return 0;
78 /*************************************************************************
79 * NTSHChangeNotifyDeregister [SHELL32.641]
81 DWORD WINAPI NTSHChangeNotifyDeregister(LONG x1)
82 { FIXME(shell,"(0x%08lx):stub.\n",x1);
83 return 0;
86 /*************************************************************************
87 * ParseField [SHELL32.58]
90 DWORD WINAPI ParseField32A(LPCSTR src, DWORD field, LPSTR dst, DWORD len)
91 { WARN(shell,"('%s',0x%08lx,%p,%ld) semi-stub.\n",src,field,dst,len);
93 if (!src || !src[0] || !dst || !len)
94 return 0;
96 if (field >1)
97 { field--;
98 while (field)
99 { if (*src==0x0) return FALSE;
100 if (*src==',') field--;
101 src++;
105 while (*src!=0x00 && *src!=',' && len>0)
106 { *dst=*src; dst++, src++; len--;
108 *dst=0x0;
110 return TRUE;
113 /*************************************************************************
114 * PickIconDlg [SHELL32.62]
117 DWORD WINAPI PickIconDlg(DWORD x,DWORD y,DWORD z,DWORD a)
118 { FIXME(shell,"(%08lx,%08lx,%08lx,%08lx):stub.\n",x,y,z,a);
119 return 0xffffffff;
122 /*************************************************************************
123 * GetFileNameFromBrowse [SHELL32.63]
126 DWORD WINAPI GetFileNameFromBrowse(HWND32 howner, LPSTR targetbuf, DWORD len, DWORD x, LPCSTR suffix, LPCSTR y, LPCSTR cmd)
127 { FIXME(shell,"(%04x,%p,%ld,%08lx,%s,%s,%s):stub.\n",
128 howner,targetbuf,len,x,suffix,y,cmd);
129 /* puts up a Open Dialog and requests input into targetbuf */
130 /* OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST|OFN_unknown */
131 lstrcpy32A(targetbuf,"x:\\dummy.exe");
132 return 1;
135 /*************************************************************************
136 * SHGetSettings [SHELL32.68]
139 DWORD WINAPI SHGetSettings(DWORD x,DWORD y,DWORD z)
140 { FIXME(shell,"(0x%08lx,0x%08lx,0x%08lx):stub.\n",x,y,z);
141 return 0;
144 /*************************************************************************
145 * SHShellFolderView_Message [SHELL32.73]
147 * PARAMETERS
148 * hwndCabinet defines the explorer cabinet window that contains the
149 * shellview you need to communicate with
150 * uMsg identifying the SFVM enum to perform
151 * lParam
153 * NOTES
154 * Message SFVM_REARRANGE = 1
155 * This message gets sent when a column gets clicked to instruct the
156 * shell view to re-sort the item list. lParam identifies the column
157 * that was clicked.
159 int WINAPI SHShellFolderView_Message(HWND32 hwndCabinet,UINT32 uMsg,LPARAM lParam)
160 { FIXME(shell,"%04x %08ux %08lx stub\n",hwndCabinet,uMsg,lParam);
161 return 0;
164 /*************************************************************************
165 * OleStrToStrN [SHELL32.78]
167 * NOTES
168 * exported by ordinal
169 * FIXME
170 * wrong implemented OleStr is NOT wide string !!!! (jsch)
172 BOOL32 WINAPI
173 OleStrToStrN (LPSTR lpMulti, INT32 nMulti, LPCWSTR lpWide, INT32 nWide) {
174 return WideCharToMultiByte (0, 0, lpWide, nWide,
175 lpMulti, nMulti, NULL, NULL);
178 /*************************************************************************
179 * StrToOleStrN [SHELL32.79]
181 * NOTES
182 * exported by ordinal
183 * FIXME
184 * wrong implemented OleStr is NOT wide string !!!! (jsch)
186 BOOL32 WINAPI
187 StrToOleStrN (LPWSTR lpWide, INT32 nWide, LPCSTR lpMulti, INT32 nMulti) {
188 return MultiByteToWideChar (0, 0, lpMulti, nMulti, lpWide, nWide);
192 /*************************************************************************
193 * SHGetSpecialFolderPath [SHELL32.175]
195 * NOTES
196 * exported by ordinal
198 void WINAPI SHGetSpecialFolderPath(DWORD x1,DWORD x2,DWORD x3,DWORD x4) {
199 FIXME(shell,"(0x%04lx,0x%04lx,csidl=0x%04lx,0x%04lx):stub.\n",
200 x1,x2,x3,x4
204 /*************************************************************************
205 * RegisterShellHook [SHELL32.181]
207 * PARAMS
208 * hwnd [I] window handle
209 * y [I] flag ????
211 * NOTES
212 * exported by ordinal
214 void WINAPI RegisterShellHook32(HWND32 hwnd, DWORD y) {
215 FIXME(shell,"(0x%08x,0x%08lx):stub.\n",hwnd,y);
218 /*************************************************************************
219 * ShellMessageBoxA [SHELL32.183]
221 * Format and output errormessage.
223 * NOTES
224 * exported by ordinal
226 void __cdecl
227 ShellMessageBoxA(HMODULE32 hmod,HWND32 hwnd,DWORD id,DWORD x,DWORD type,LPVOID arglist) {
228 char buf[100],buf2[100]/*,*buf3*/;
229 /* LPVOID args = &arglist;*/
231 if (!LoadString32A(hmod,x,buf,100))
232 strcpy(buf,"Desktop");
233 /* LoadString32A(hmod,id,buf2,100); */
234 /* FIXME: the varargs handling doesn't. */
235 /* FormatMessage32A(0x500,buf2,0,0,(LPSTR)&buf3,256,(LPDWORD)&args); */
237 FIXME(shell,"(%08lx,%08lx,%08lx(%s),%08lx(%s),%08lx,%p):stub.\n",
238 (DWORD)hmod,(DWORD)hwnd,id,buf2,x,buf,type,arglist
240 /*MessageBox32A(hwnd,buf3,buf,id|0x10000);*/
243 /*************************************************************************
244 * SHRestricted [SHELL32.100]
246 * walks through policy table, queries <app> key, <type> value, returns
247 * queried (DWORD) value.
248 * {0x00001,Explorer,NoRun}
249 * {0x00002,Explorer,NoClose}
250 * {0x00004,Explorer,NoSaveSettings}
251 * {0x00008,Explorer,NoFileMenu}
252 * {0x00010,Explorer,NoSetFolders}
253 * {0x00020,Explorer,NoSetTaskbar}
254 * {0x00040,Explorer,NoDesktop}
255 * {0x00080,Explorer,NoFind}
256 * {0x00100,Explorer,NoDrives}
257 * {0x00200,Explorer,NoDriveAutoRun}
258 * {0x00400,Explorer,NoDriveTypeAutoRun}
259 * {0x00800,Explorer,NoNetHood}
260 * {0x01000,Explorer,NoStartBanner}
261 * {0x02000,Explorer,RestrictRun}
262 * {0x04000,Explorer,NoPrinterTabs}
263 * {0x08000,Explorer,NoDeletePrinter}
264 * {0x10000,Explorer,NoAddPrinter}
265 * {0x20000,Explorer,NoStartMenuSubFolders}
266 * {0x40000,Explorer,MyDocsOnNet}
267 * {0x80000,WinOldApp,NoRealMode}
269 * NOTES
270 * exported by ordinal
272 DWORD WINAPI SHRestricted (DWORD pol) {
273 HKEY xhkey;
275 FIXME(shell,"(%08lx):stub.\n",pol);
276 if (RegOpenKey32A(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Policies",&xhkey))
277 return 0;
278 /* FIXME: do nothing for now, just return 0 (== "allowed") */
279 RegCloseKey(xhkey);
280 return 0;
283 /*************************************************************************
284 * SHCreateDirectory [SHELL32.165]
286 * NOTES
287 * exported by ordinal
288 * not sure about LPSECURITY_ATTRIBUTES
290 DWORD WINAPI SHCreateDirectory(LPSECURITY_ATTRIBUTES sec,LPCSTR path) {
291 TRACE(shell,"(%p,%s):stub.\n",sec,path);
292 if (CreateDirectory32A(path,sec))
293 return TRUE;
294 /* SHChangeNotify(8,1,path,0); */
295 return FALSE;
296 #if 0
297 if (SHELL32_79(path,(LPVOID)x))
298 return 0;
299 FIXME(shell,"(%08lx,%s):stub.\n",x,path);
300 return 0;
301 #endif
304 /*************************************************************************
305 * SHFree [SHELL32.195]
307 * NOTES
308 * free_ptr() - frees memory using IMalloc
309 * exported by ordinal
311 DWORD WINAPI SHFree(LPVOID x) {
312 TRACE(shell,"%p\n",x);
313 if (!HIWORD(x))
314 { *(LPDWORD)0xdeaf0000 = 0;
316 return HeapFree(GetProcessHeap(),0,x);
319 /*************************************************************************
320 * SHAlloc [SHELL32.196]
322 * NOTES
323 * void *task_alloc(DWORD len), uses SHMalloc allocator
324 * exported by ordinal
326 LPVOID WINAPI SHAlloc(DWORD len) {
327 /* void * ret = (LPVOID)LocalAlloc32(len,LMEM_ZEROINIT);*/ /* chrashes */
328 void * ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len);
329 TRACE(shell,"%lu bytes at %p\n",len, ret);
330 return ret;
333 /*************************************************************************
334 * OpenRegStream [SHELL32.85]
336 * NOTES
337 * exported by ordinal
339 DWORD WINAPI OpenRegStream(DWORD x1,DWORD x2,DWORD x3,DWORD x4) {
340 FIXME(shell,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub.\n",
341 x1,x2,x3,x4
343 return 0;
346 /*************************************************************************
347 * SHRegisterDragDrop [SHELL32.86]
349 * NOTES
350 * exported by ordinal
352 DWORD WINAPI SHRegisterDragDrop(HWND32 hwnd,DWORD x2) {
353 FIXME (shell, "(0x%08x,0x%08lx):stub.\n", hwnd, x2);
354 return 0;
357 /*************************************************************************
358 * SHRevokeDragDrop [SHELL32.87]
360 * NOTES
361 * exported by ordinal
363 DWORD WINAPI SHRevokeDragDrop(DWORD x) {
364 FIXME(shell,"(0x%08lx):stub.\n",x);
365 return 0;
368 /*************************************************************************
369 * RunFileDlg [SHELL32.61]
371 * NOTES
372 * Original name: RunFileDlg (exported by ordinal)
374 DWORD WINAPI
375 RunFileDlg (HWND32 hwndOwner, DWORD dwParam1, DWORD dwParam2,
376 LPSTR lpszTitle, LPSTR lpszPrompt, UINT32 uFlags)
378 FIXME (shell,"(0x%08x 0x%lx 0x%lx \"%s\" \"%s\" 0x%x):stub.\n",
379 hwndOwner, dwParam1, dwParam2, lpszTitle, lpszPrompt, uFlags);
380 return 0;
383 /*************************************************************************
384 * ExitWindowsDialog [SHELL32.60]
386 * NOTES
387 * exported by ordinal
389 DWORD WINAPI
390 ExitWindowsDialog (HWND32 hwndOwner)
392 FIXME (shell,"(0x%08x):stub.\n", hwndOwner);
393 return 0;
396 /*************************************************************************
397 * ArrangeWindows [SHELL32.184]
400 DWORD WINAPI
401 ArrangeWindows (DWORD dwParam1, DWORD dwParam2, DWORD dwParam3,
402 DWORD dwParam4, DWORD dwParam5)
404 FIXME (shell,"(0x%lx 0x%lx 0x%lx 0x%lx 0x%lx):stub.\n",
405 dwParam1, dwParam2, dwParam3, dwParam4, dwParam5);
406 return 0;
409 /*************************************************************************
410 * SHCLSIDFromString [SHELL32.147]
412 * NOTES
413 * exported by ordinal
415 DWORD WINAPI
416 SHCLSIDFromString (DWORD dwParam1, DWORD dwParam2)
418 FIXME (shell,"(0x%lx 0x%lx):stub.\n", dwParam1, dwParam2);
419 FIXME (shell,"(\"%s\" \"%s\"):stub.\n", (LPSTR)dwParam1, (LPSTR)dwParam2);
421 return 0;
425 /*************************************************************************
426 * SignalFileOpen [SHELL32.103]
428 * NOTES
429 * exported by ordinal
431 DWORD WINAPI
432 SignalFileOpen (DWORD dwParam1)
434 FIXME (shell,"(0x%08lx):stub.\n", dwParam1);
436 return 0;
439 /*************************************************************************
440 * SHAddToRecentDocs [SHELL32.234]
442 * PARAMETERS
443 * uFlags [IN] SHARD_PATH or SHARD_PIDL
444 * pv [IN] string or pidl, NULL clears the list
446 * NOTES
447 * exported by name
449 DWORD WINAPI SHAddToRecentDocs32 (UINT32 uFlags,LPCVOID pv)
450 { if (SHARD_PIDL==uFlags)
451 { FIXME (shell,"(0x%08x,pidl=%p):stub.\n", uFlags,pv);
453 else
454 { FIXME (shell,"(0x%08x,%s):stub.\n", uFlags,(char*)pv);
456 return 0;
458 /*************************************************************************
459 * SHFileOperation32 [SHELL32.242]
462 DWORD WINAPI SHFileOperation32(DWORD x)
463 { FIXME(shell,"0x%08lx stub\n",x);
464 return 0;
468 /*************************************************************************
469 * SHFileOperation32A [SHELL32.243]
471 * NOTES
472 * exported by name
474 DWORD WINAPI SHFileOperation32A (LPSHFILEOPSTRUCT32A lpFileOp)
475 { FIXME (shell,"(%p):stub.\n", lpFileOp);
476 return 1;
478 /*************************************************************************
479 * SHFileOperation32W [SHELL32.244]
481 * NOTES
482 * exported by name
484 DWORD WINAPI SHFileOperation32W (LPSHFILEOPSTRUCT32W lpFileOp)
485 { FIXME (shell,"(%p):stub.\n", lpFileOp);
486 return 1;
489 /*************************************************************************
490 * SHChangeNotify [SHELL32.239]
492 * NOTES
493 * exported by name
495 DWORD WINAPI SHChangeNotify32 (
496 INT32 wEventId, /* [IN] flags that specifies the event*/
497 UINT32 uFlags, /* [IN] the meaning of dwItem[1|2]*/
498 LPCVOID dwItem1,
499 LPCVOID dwItem2)
500 { FIXME (shell,"(0x%08x,0x%08ux,%p,%p):stub.\n", wEventId,uFlags,dwItem1,dwItem2);
501 return 0;
503 /*************************************************************************
504 * SHCreateShellFolderViewEx [SHELL32.174]
506 * NOTES
507 * see IShellFolder::CreateViewObject
509 HRESULT WINAPI SHCreateShellFolderViewEx32(
510 LPSHELLVIEWDATA psvcbi, /*[in ] shelltemplate struct*/
511 LPVOID* ppv) /*[out] IShellView pointer*/
512 { FIXME (shell,"(%p,%p):stub.\n", psvcbi,ppv);
513 return 0;
515 /*************************************************************************
516 * SHFind_InitMenuPopup [SHELL32.149]
518 * NOTES
519 * Registers the menu behind the "Start" button
521 * PARAMETERS
522 * hMenu [in] handel of menu previously created
523 * hWndParent [in] parent window
524 * w [in] no pointer
525 * x [in] no pointer
527 HRESULT WINAPI SHFind_InitMenuPopup (HMENU32 hMenu, HWND32 hWndParent, DWORD w, DWORD x)
528 { FIXME(shell,"hmenu=0x%08x hwnd=0x%08x 0x%08lx 0x%08lx stub\n",
529 hMenu,hWndParent,w,x);
530 return 0;
532 /*************************************************************************
533 * FileMenu_InitMenuPopup [SHELL32.109]
536 HRESULT WINAPI FileMenu_InitMenuPopup (DWORD hmenu)
537 { FIXME(shell,"hmenu=0x%lx stub\n",hmenu);
538 return 0;
540 /*************************************************************************
541 * FileMenu_Create [SHELL32.114]
543 * w retval from LoadBitmapA
547 HRESULT WINAPI FileMenu_Create (DWORD u, DWORD v, DWORD w, DWORD x, DWORD z)
548 { FIXME(shell,"0x%08lx 0x%08lx hbmp=0x%lx 0x%08lx 0x%08lx stub\n",u,v,w,x,z);
549 return 0;
551 /*************************************************************************
552 * FileMenu_TrackPopupMenuEx [SHELL32.116]
554 * PARAMETERS
555 * uFlags [in] according to TrackPopupMenuEx
556 * posX [in]
557 * posY [in]
558 * hWndParent [in]
559 * z could be rect (trace) or TPMPARAMS (TrackPopupMenuEx)
561 HRESULT WINAPI FileMenu_TrackPopupMenuEx (DWORD t, DWORD uFlags, DWORD posX, DWORD posY, HWND32 hWndParent, DWORD z)
562 { FIXME(shell,"0x%lx flags=0x%lx posx=0x%lx posy=0x%lx hwndp=0x%x 0x%lx stub\n",
563 t,uFlags,posX,posY, hWndParent,z);
564 return 0;
566 /*************************************************************************
567 * SHWinHelp [SHELL32.127]
570 HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z)
571 { FIXME(shell,"0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z);
572 return 0;
574 /*************************************************************************
575 * SHRunControlPanel [SHELL32.161]
578 HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z)
579 { FIXME(shell,"0x%08lx 0x%08lx stub\n",x,z);
580 return 0;
582 /*************************************************************************
583 * ShellExecuteEx [SHELL32.291]
586 BOOL32 WINAPI ShellExecuteEx32 (LPVOID sei)
587 { if (VERSION_OsIsUnicode())
588 return ShellExecuteEx32W (sei);
589 return ShellExecuteEx32A (sei);
591 /*************************************************************************
592 * ShellExecuteEx32A [SHELL32.292]
595 BOOL32 WINAPI ShellExecuteEx32A (LPSHELLEXECUTEINFO32A sei)
596 { CHAR szApplicationName[MAX_PATH],szCommandline[MAX_PATH],szPidl[20];
597 LPSTR pos;
598 int gap, len;
599 STARTUPINFO32A startupinfo;
600 PROCESS_INFORMATION processinformation;
602 FIXME(shell,"mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%sstub\n",
603 sei->fMask, sei->hwnd, sei->lpVerb, sei->lpFile,
604 sei->lpParameters, sei->lpDirectory, sei->nShow, sei->lpClass);
606 ZeroMemory(szApplicationName,MAX_PATH);
607 if (sei->lpFile)
608 strcpy(szApplicationName, sei->lpFile);
610 ZeroMemory(szCommandline,MAX_PATH);
611 if (sei->lpParameters)
612 strcpy(szCommandline, sei->lpParameters);
614 if (sei->fMask & (SEE_MASK_CLASSKEY | SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY |
615 SEE_MASK_NOCLOSEPROCESS | SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT |
616 SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE |
617 SEE_MASK_NO_CONSOLE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR ))
618 { FIXME (shell,"flags ignored: 0x%08lx\n", sei->fMask);
621 if (sei->fMask & SEE_MASK_CLASSNAME)
622 { HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, 256);
625 /* process the IDList */
626 if ( (sei->fMask & SEE_MASK_INVOKEIDLIST) == SEE_MASK_INVOKEIDLIST) /*0x0c*/
627 { SHGetPathFromIDList32A (sei->lpIDList,szApplicationName);
628 FIXME(shell,"-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName);
630 else
631 { if (sei->fMask & SEE_MASK_IDLIST )
632 { /* %I is the adress of a global item ID*/
633 pos = strstr(szCommandline, "%I");
634 if (pos)
635 { HGLOBAL32 hmem = SHAllocShared ( sei->lpIDList, ILGetSize(sei->lpIDList), 0);
636 sprintf(szPidl,":%li",(DWORD)SHLockShared(hmem,0) );
637 SHUnlockShared(hmem);
639 gap = strlen(szPidl);
640 len = strlen(pos)-2;
641 memmove(pos+gap,pos+2,len);
642 memcpy(pos,szPidl,gap);
648 pos = strstr(szCommandline, ",%L"); /* dunno what it means: kill it*/
649 if (pos)
650 { len = strlen(pos)-2;
651 *pos=0x0;
652 memmove(pos,pos+3,len);
655 FIXME(shell,"-- %s\n",szCommandline);
657 ZeroMemory(&startupinfo,sizeof(STARTUPINFO32A));
658 startupinfo.cb = sizeof(STARTUPINFO32A);
660 CreateProcess32A(szApplicationName[0] ? szApplicationName:NULL,
661 szCommandline[0] ? szCommandline : NULL,
662 NULL, NULL, FALSE, 0,
663 NULL, NULL, &startupinfo, &processinformation);
666 return 0;
668 /*************************************************************************
669 * ShellExecuteEx [SHELL32.293]
672 BOOL32 WINAPI ShellExecuteEx32W (LPSHELLEXECUTEINFO32W sei)
673 { WCHAR szTemp[MAX_PATH];
675 FIXME(shell,"(%p): stub\n",sei);
677 if (sei->fMask & SEE_MASK_IDLIST)
678 { SHGetPathFromIDList32W (sei->lpIDList,szTemp);
679 TRACE (shell,"-- idlist=%p (%s)\n", sei->lpIDList, debugstr_w(szTemp));
682 if (sei->fMask & SEE_MASK_CLASSNAME)
683 { TRACE (shell,"-- classname= %s\n", debugstr_w(sei->lpClass));
686 if (sei->lpVerb)
687 { TRACE (shell,"-- action=%s\n", debugstr_w(sei->lpVerb));
690 return 0;
692 static LPUNKNOWN SHELL32_IExplorerInterface=0;
693 /*************************************************************************
694 * SHSetInstanceExplorer [SHELL32.176]
696 * NOTES
697 * Sets the interface
699 HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown)
700 { TRACE (shell,"%p\n", lpUnknown);
701 SHELL32_IExplorerInterface = lpUnknown;
702 return (HRESULT) lpUnknown;
704 /*************************************************************************
705 * SHGetInstanceExplorer [SHELL32.256]
707 * NOTES
708 * gets the interface pointer of the explorer and a reference
710 HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown)
711 { TRACE(shell,"%p\n", lpUnknown);
713 *lpUnknown = SHELL32_IExplorerInterface;
715 if (!SHELL32_IExplorerInterface)
716 return E_FAIL;
718 SHELL32_IExplorerInterface->lpvtbl->fnAddRef(SHELL32_IExplorerInterface);
719 return NOERROR;
721 /*************************************************************************
722 * SHFreeUnusedLibraries [SHELL32.123]
724 * NOTES
725 * exported by name
727 HRESULT WINAPI SHFreeUnusedLibraries (void)
728 { FIXME(shell,"stub\n");
729 return TRUE;
731 /*************************************************************************
732 * DAD_ShowDragImage [SHELL32.137]
734 * NOTES
735 * exported by name
737 HRESULT WINAPI DAD_ShowDragImage (DWORD u)
738 { FIXME(shell,"0x%08lx stub\n",u);
739 return 0;
741 /*************************************************************************
742 * FileMenu_Destroy [SHELL32.118]
744 * NOTES
745 * exported by name
747 HRESULT WINAPI FileMenu_Destroy (DWORD u)
748 { FIXME(shell,"0x%08lx stub\n",u);
749 return 0;
751 /*************************************************************************
752 * SHRegCloseKey32 [NT4.0:SHELL32.505]
755 HRESULT WINAPI SHRegCloseKey32 (HKEY hkey)
756 { TRACE(shell,"0x%04x\n",hkey);
757 return RegCloseKey( hkey );
759 /*************************************************************************
760 * SHRegOpenKey32A [SHELL32.506]
763 HRESULT WINAPI SHRegOpenKey32A(HKEY hKey, LPSTR lpSubKey, LPHKEY phkResult)
764 { FIXME(shell,"(0x%08x, %s, %p)\n", hKey, debugstr_a(lpSubKey),
765 phkResult);
766 return RegOpenKey32A(hKey, lpSubKey, phkResult);
769 /*************************************************************************
770 * SHRegOpenKey32W [NT4.0:SHELL32.507]
773 HRESULT WINAPI SHRegOpenKey32W (HKEY hkey, LPCWSTR lpszSubKey, LPHKEY retkey)
774 { WARN(shell,"0x%04x %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
775 return RegOpenKey32W( hkey, lpszSubKey, retkey );
777 /*************************************************************************
778 * SHRegQueryValueExA [SHELL32.509]
781 HRESULT WINAPI SHRegQueryValueEx32A(DWORD u, LPSTR v, DWORD w, DWORD x,
782 DWORD y, DWORD z)
783 { FIXME(shell,"0x%04lx %s 0x%04lx 0x%04lx 0x%04lx 0x%04lx stub\n",
784 u,debugstr_a(v),w,x,y,z);
785 return 0;
787 /*************************************************************************
788 * SHRegQueryValue32W [NT4.0:SHELL32.510]
791 HRESULT WINAPI SHRegQueryValue32W (HKEY hkey, LPWSTR lpszSubKey,
792 LPWSTR lpszData, LPDWORD lpcbData )
793 { WARN(shell,"0x%04x %s %p %p semi-stub\n",
794 hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
795 return RegQueryValue32W( hkey, lpszSubKey, lpszData, lpcbData );
798 /*************************************************************************
799 * SHRegQueryValueEx32W [NT4.0:SHELL32.511]
801 * FIXME
802 * if the datatype REG_EXPAND_SZ then expand the string and change
803 * *pdwType to REG_SZ.
805 HRESULT WINAPI SHRegQueryValueEx32W (HKEY hkey, LPWSTR pszValue, LPDWORD pdwReserved,
806 LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData)
807 { DWORD ret;
808 WARN(shell,"0x%04x %s %p %p %p %p semi-stub\n",
809 hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
810 ret = RegQueryValueEx32W ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);
811 return ret;
814 /*************************************************************************
815 * ReadCabinetState [NT 4.0:SHELL32.651]
818 HRESULT WINAPI ReadCabinetState(DWORD u, DWORD v)
819 { FIXME(shell,"0x%04lx 0x%04lx stub\n",u,v);
820 return 0;
822 /*************************************************************************
823 * WriteCabinetState [NT 4.0:SHELL32.652]
826 HRESULT WINAPI WriteCabinetState(DWORD u)
827 { FIXME(shell,"0x%04lx stub\n",u);
828 return 0;
830 /*************************************************************************
831 * FileIconInit [SHELL32.660]
834 BOOL32 WINAPI FileIconInit(BOOL32 bFullInit)
835 { FIXME(shell,"(%s)\n", bFullInit ? "true" : "false");
836 return 0;
838 /*************************************************************************
839 * IsUserAdmin [NT 4.0:SHELL32.680]
842 HRESULT WINAPI IsUserAdmin(void)
843 { FIXME(shell,"stub\n");
844 return TRUE;
846 /*************************************************************************
847 * StrRetToStrN [SHELL32.96]
849 * converts a STRRET to a normal string
851 * NOTES
852 * FIXME the string handling is to simple (different STRRET choices)
853 * at the moment only CSTR
854 * the pidl is for STRRET OFFSET
856 HRESULT WINAPI StrRetToStrN (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
857 { TRACE(shell,"dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
859 switch (src->uType)
860 { case STRRET_WSTR:
861 WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL);
862 SHFree(src->u.pOleStr);
863 break;
865 case STRRET_CSTRA:
866 if (VERSION_OsIsUnicode())
867 lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len);
868 else
869 strncpy((LPSTR)dest, src->u.cStr, len);
870 break;
872 case STRRET_OFFSETA:
873 if (pidl)
874 { if(VERSION_OsIsUnicode())
875 lstrcpynAtoW((LPWSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
876 else
877 strncpy((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
878 break;
881 default:
882 FIXME(shell,"unknown type!\n");
883 if (len)
884 { *(LPSTR)dest = '\0';
886 return(FALSE);
888 return(TRUE);
891 /*************************************************************************
892 * StrChrW [NT 4.0:SHELL32.651]
895 LPWSTR WINAPI StrChrW (LPWSTR str, WCHAR x )
896 { LPWSTR ptr=str;
898 TRACE(shell,"%s 0x%04x\n",debugstr_w(str),x);
900 { if (*ptr==x)
901 { return ptr;
903 ptr++;
904 } while (*ptr);
905 return NULL;
908 /*************************************************************************
909 * StrCmpNIW [NT 4.0:SHELL32.*]
912 INT32 WINAPI StrCmpNIW ( LPWSTR wstr1, LPWSTR wstr2, INT32 len)
913 { FIXME( shell,"%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len);
914 return 0;
917 /*************************************************************************
918 * SHAllocShared [SHELL32.520]
920 * NOTES
921 * parameter1 is return value from HeapAlloc
922 * parameter2 is equal to the size allocated with HeapAlloc
923 * parameter3 is return value from GetCurrentProcessId
925 * the return value is posted as lParam with 0x402 (WM_USER+2) to somewhere
926 * WM_USER+2 could be the undocumented CWM_SETPATH
927 * the allocated memory contains a pidl
929 HGLOBAL32 WINAPI SHAllocShared(LPVOID psrc, DWORD size, DWORD procID)
930 { HGLOBAL32 hmem;
931 LPVOID pmem;
933 TRACE(shell,"ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID);
934 hmem = GlobalAlloc32(GMEM_FIXED, size);
935 if (!hmem)
936 return 0;
938 pmem = GlobalLock32 (hmem);
940 if (! pmem)
941 return 0;
943 memcpy (pmem, psrc, size);
944 GlobalUnlock32(hmem);
945 return hmem;
947 /*************************************************************************
948 * SHLockShared [SHELL32.521]
950 * NOTES
951 * parameter1 is return value from SHAllocShared
952 * parameter2 is return value from GetCurrentProcessId
953 * the receiver of (WM_USER+2) trys to lock the HANDLE (?)
954 * the returnvalue seems to be a memoryadress
956 LPVOID WINAPI SHLockShared(HANDLE32 hmem, DWORD procID)
957 { TRACE(shell,"handle=0x%04x procID=0x%04lx\n",hmem,procID);
958 return GlobalLock32(hmem);
960 /*************************************************************************
961 * SHUnlockShared [SHELL32.522]
963 * NOTES
964 * parameter1 is return value from SHLockShared
966 BOOL32 WINAPI SHUnlockShared(HANDLE32 pmem)
967 { TRACE(shell,"handle=0x%04x\n",pmem);
968 return GlobalUnlock32(pmem);
970 /*************************************************************************
971 * SHFreeShared [SHELL32.523]
973 * NOTES
974 * parameter1 is return value from SHAllocShared
975 * parameter2 is return value from GetCurrentProcessId
977 HANDLE32 WINAPI SHFreeShared(HANDLE32 hmem, DWORD procID)
978 { TRACE(shell,"handle=0x%04x 0x%04lx\n",hmem,procID);
979 return GlobalFree32(hmem);
982 /*************************************************************************
983 * SetAppStartingCursor32 [SHELL32.99]
986 HRESULT WINAPI SetAppStartingCursor32(HWND32 u, DWORD v)
987 { FIXME(shell,"hwnd=0x%04x 0x%04lx stub\n",u,v );
988 return 0;
990 /*************************************************************************
991 * SHLoadOLE32 [SHELL32.151]
994 HRESULT WINAPI SHLoadOLE32(DWORD u)
995 { FIXME(shell,"0x%04lx stub\n",u);
996 return S_OK;
998 /*************************************************************************
999 * Shell_MergeMenus32 [SHELL32.67]
1002 BOOL32 _SHIsMenuSeparator(HMENU32 hm, int i)
1004 MENUITEMINFO32A mii;
1006 mii.cbSize = sizeof(MENUITEMINFO32A);
1007 mii.fMask = MIIM_TYPE;
1008 mii.cch = 0; /* WARNING: We MUST initialize it to 0*/
1009 if (!GetMenuItemInfo32A(hm, i, TRUE, &mii))
1010 { return(FALSE);
1013 if (mii.fType & MFT_SEPARATOR)
1014 { return(TRUE);
1017 return(FALSE);
1019 #define MM_ADDSEPARATOR 0x00000001L
1020 #define MM_SUBMENUSHAVEIDS 0x00000002L
1021 HRESULT WINAPI Shell_MergeMenus32 (HMENU32 hmDst, HMENU32 hmSrc, UINT32 uInsert, UINT32 uIDAdjust, UINT32 uIDAdjustMax, ULONG uFlags)
1022 { int nItem;
1023 HMENU32 hmSubMenu;
1024 BOOL32 bAlreadySeparated;
1025 MENUITEMINFO32A miiSrc;
1026 char szName[256];
1027 UINT32 uTemp, uIDMax = uIDAdjust;
1029 FIXME(shell,"hmenu1=0x%04x hmenu2=0x%04x 0x%04x 0x%04x 0x%04x 0x%04lx stub\n",
1030 hmDst, hmSrc, uInsert, uIDAdjust, uIDAdjustMax, uFlags);
1032 if (!hmDst || !hmSrc)
1033 { return uIDMax;
1036 nItem = GetMenuItemCount32(hmDst);
1037 if (uInsert >= (UINT32)nItem)
1038 { uInsert = (UINT32)nItem;
1039 bAlreadySeparated = TRUE;
1041 else
1042 { bAlreadySeparated = _SHIsMenuSeparator(hmDst, uInsert);;
1044 if ((uFlags & MM_ADDSEPARATOR) && !bAlreadySeparated)
1045 { /* Add a separator between the menus */
1046 InsertMenu32A(hmDst, uInsert, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
1047 bAlreadySeparated = TRUE;
1051 /* Go through the menu items and clone them*/
1052 for (nItem = GetMenuItemCount32(hmSrc) - 1; nItem >= 0; nItem--)
1053 { miiSrc.cbSize = sizeof(MENUITEMINFO32A);
1054 miiSrc.fMask = MIIM_STATE | MIIM_ID | MIIM_SUBMENU | MIIM_CHECKMARKS | MIIM_TYPE | MIIM_DATA;
1055 /* We need to reset this every time through the loop in case
1056 menus DON'T have IDs*/
1057 miiSrc.fType = MFT_STRING;
1058 miiSrc.dwTypeData = szName;
1059 miiSrc.dwItemData = 0;
1060 miiSrc.cch = sizeof(szName);
1062 if (!GetMenuItemInfo32A(hmSrc, nItem, TRUE, &miiSrc))
1063 { continue;
1065 if (miiSrc.fType & MFT_SEPARATOR)
1066 { /* This is a separator; don't put two of them in a row*/
1067 if (bAlreadySeparated)
1068 { continue;
1070 bAlreadySeparated = TRUE;
1072 else if (miiSrc.hSubMenu)
1073 { if (uFlags & MM_SUBMENUSHAVEIDS)
1074 { /* Adjust the ID and check it*/
1075 miiSrc.wID += uIDAdjust;
1076 if (miiSrc.wID > uIDAdjustMax)
1077 { continue;
1079 if (uIDMax <= miiSrc.wID)
1080 { uIDMax = miiSrc.wID + 1;
1083 else
1084 { /* Don't set IDs for submenus that didn't have them already */
1085 miiSrc.fMask &= ~MIIM_ID;
1087 hmSubMenu = miiSrc.hSubMenu;
1088 miiSrc.hSubMenu = CreatePopupMenu32();
1089 if (!miiSrc.hSubMenu)
1090 { return(uIDMax);
1092 uTemp = Shell_MergeMenus32(miiSrc.hSubMenu, hmSubMenu, 0, uIDAdjust, uIDAdjustMax, uFlags&MM_SUBMENUSHAVEIDS);
1093 if (uIDMax <= uTemp)
1094 { uIDMax = uTemp;
1096 bAlreadySeparated = FALSE;
1098 else
1099 { /* Adjust the ID and check it*/
1100 miiSrc.wID += uIDAdjust;
1101 if (miiSrc.wID > uIDAdjustMax)
1102 { continue;
1104 if (uIDMax <= miiSrc.wID)
1105 { uIDMax = miiSrc.wID + 1;
1107 bAlreadySeparated = FALSE;
1109 if (!InsertMenuItem32A(hmDst, uInsert, TRUE, &miiSrc))
1110 { return(uIDMax);
1114 /* Ensure the correct number of separators at the beginning of the
1115 inserted menu items*/
1116 if (uInsert == 0)
1117 { if (bAlreadySeparated)
1118 { DeleteMenu32(hmDst, uInsert, MF_BYPOSITION);
1121 else
1122 { if (_SHIsMenuSeparator(hmDst, uInsert-1))
1123 { if (bAlreadySeparated)
1124 { DeleteMenu32(hmDst, uInsert, MF_BYPOSITION);
1127 else
1128 { if ((uFlags & MM_ADDSEPARATOR) && !bAlreadySeparated)
1129 { /* Add a separator between the menus*/
1130 InsertMenu32A(hmDst, uInsert, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
1134 return(uIDMax);
1137 /*************************************************************************
1138 * DriveType32 [SHELL32.64]
1141 HRESULT WINAPI DriveType32(DWORD u)
1142 { FIXME(shell,"0x%04lx stub\n",u);
1143 return 0;
1145 /*************************************************************************
1146 * SHAbortInvokeCommand [SHELL32.198]
1149 HRESULT WINAPI SHAbortInvokeCommand(void)
1150 { FIXME(shell,"stub\n");
1151 return 1;
1153 /*************************************************************************
1154 * SHOutOfMemoryMessageBox [SHELL32.126]
1157 HRESULT WINAPI SHOutOfMemoryMessageBox(DWORD u, DWORD v, DWORD w)
1158 { FIXME(shell,"0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w);
1159 return 0;
1161 /*************************************************************************
1162 * SHFlushClipboard [SHELL32.121]
1165 HRESULT WINAPI SHFlushClipboard(void)
1166 { FIXME(shell,"stub\n");
1167 return 1;
1169 /*************************************************************************
1170 * StrRChrW [SHELL32.320]
1173 LPWSTR WINAPI StrRChrW(LPWSTR lpStart, LPWSTR lpEnd, DWORD wMatch)
1174 { LPWSTR wptr=NULL;
1175 TRACE(shell,"%s %s 0x%04x\n",debugstr_w(lpStart),debugstr_w(lpEnd), (WCHAR)wMatch );
1177 /* if the end not given, search*/
1178 if (!lpEnd)
1179 { lpEnd=lpStart;
1180 while (*lpEnd)
1181 lpEnd++;
1185 { if (*lpStart==(WCHAR)wMatch)
1186 wptr = lpStart;
1187 lpStart++;
1188 } while ( lpStart<=lpEnd );
1189 return wptr;
1191 /*************************************************************************
1192 * StrFormatByteSize [SHLWAPI]
1194 LPSTR WINAPI StrFormatByteSize32A ( DWORD dw, LPSTR pszBuf, UINT32 cchBuf )
1195 { char buf[64];
1196 TRACE(shell,"%lx %p %i\n", dw, pszBuf, cchBuf);
1197 if ( dw<1024L )
1198 { sprintf (buf,"%3.1f bytes", (FLOAT)dw);
1200 else if ( dw<1048576L)
1201 { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024);
1203 else if ( dw < 1073741824L)
1204 { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L);
1206 else
1207 { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L);
1209 strncpy (pszBuf, buf, cchBuf);
1210 return pszBuf;
1212 LPWSTR WINAPI StrFormatByteSize32W ( DWORD dw, LPWSTR pszBuf, UINT32 cchBuf )
1213 { char buf[64];
1214 TRACE(shell,"%lx %p %i\n", dw, pszBuf, cchBuf);
1215 if ( dw<1024L )
1216 { sprintf (buf,"%3.1f bytes", (FLOAT)dw);
1218 else if ( dw<1048576L)
1219 { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024);
1221 else if ( dw < 1073741824L)
1222 { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L);
1224 else
1225 { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L);
1227 lstrcpynAtoW (pszBuf, buf, cchBuf);
1228 return pszBuf;
1230 /*************************************************************************
1231 * SHWaitForFileToOpen [SHELL32.97]
1234 HRESULT WINAPI SHWaitForFileToOpen(DWORD u, DWORD v, DWORD w)
1235 { FIXME(shell,"0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w);
1236 return 0;
1238 /*************************************************************************
1239 * Control_FillCache_RunDLL [SHELL32.8]
1242 HRESULT WINAPI Control_FillCache_RunDLL(HWND32 hWnd, HANDLE32 hModule, DWORD w, DWORD x)
1243 { FIXME(shell,"0x%04x 0x%04x 0x%04lx 0x%04lx stub\n",hWnd, hModule,w,x);
1244 return 0;