Fixed wrong parameter count for SHChangeNotifyDeregister, SHFreeUnusedLibraries.
[wine/gsoc_dplay.git] / dlls / shell32 / shellord.c
blob9268d020acbf3b4e41ef4cd990fe82325acc7787
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 "graphics.h"
28 #include "cursoricon.h"
29 #include "interfaces.h"
30 #include "shlobj.h"
31 #include "debug.h"
32 #include "winreg.h"
33 #include "winnls.h"
34 #include "winversion.h"
35 #include "shell32_main.h"
37 /*************************************************************************
38 * SHChangeNotifyRegister [SHELL32.2]
39 * NOTES
40 * Idlist is an array of structures and Count specifies how many items in the array
41 * (usually just one I think).
43 DWORD WINAPI
44 SHChangeNotifyRegister(
45 HWND32 hwnd,
46 LONG events1,
47 LONG events2,
48 DWORD msg,
49 int count,
50 IDSTRUCT *idlist)
51 { FIXME(shell,"(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):stub.\n",
52 hwnd,events1,events2,msg,count,idlist);
53 return 0;
55 /*************************************************************************
56 * SHChangeNotifyDeregister [SHELL32.4]
58 DWORD WINAPI
59 SHChangeNotifyDeregister(LONG x1)
60 { FIXME(shell,"(0x%08lx):stub.\n",x1);
61 return 0;
64 /*************************************************************************
65 * ParseField [SHELL32.58]
68 DWORD WINAPI ParseField(LPCSTR src,DWORD field,LPSTR dst,DWORD len)
69 { FIXME(shell,"(%s,0x%08lx,%p,%ld):stub.\n",src,field,dst,len);
71 if (!src || !src[0] || !dst || !len)
72 return 0;
74 if (field >1)
75 { field--;
76 while (field)
77 { if (*src==0x0) return FALSE;
78 if (*src==',') field--;
79 src++;
83 while (*src!=0x00 && *src!=',' && len>0)
84 { *dst=*src; dst++, src++; len--;
86 *dst=0x0;
88 return TRUE;
91 /*************************************************************************
92 * PickIconDlg [SHELL32.62]
95 DWORD WINAPI PickIconDlg(DWORD x,DWORD y,DWORD z,DWORD a) {
96 FIXME(shell,"(%08lx,%08lx,%08lx,%08lx):stub.\n",x,y,z,a);
97 return 0xffffffff;
100 /*************************************************************************
101 * GetFileNameFromBrowse [SHELL32.63]
104 DWORD WINAPI GetFileNameFromBrowse(HWND32 howner, LPSTR targetbuf, DWORD len, DWORD x, LPCSTR suffix, LPCSTR y, LPCSTR cmd) {
105 FIXME(shell,"(%04x,%p,%ld,%08lx,%s,%s,%s):stub.\n",
106 howner,targetbuf,len,x,suffix,y,cmd
108 /* puts up a Open Dialog and requests input into targetbuf */
109 /* OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST|OFN_unknown */
110 lstrcpy32A(targetbuf,"x:\\s3.exe");
111 return 1;
114 /*************************************************************************
115 * SHGetSettings [SHELL32.68]
118 DWORD WINAPI SHGetSettings(DWORD x,DWORD y,DWORD z) {
119 FIXME(shell,"(0x%08lx,0x%08lx,0x%08lx):stub.\n",
120 x,y,z
122 return 0;
125 /*************************************************************************
126 * Shell_GetCachedImageIndex [SHELL32.72]
129 void WINAPI Shell_GetCachedImageIndex(LPVOID x,DWORD y,DWORD z)
130 { if( VERSION_OsIsUnicode())
131 { FIXME(shell,"(L%s,%08lx,%08lx):stub.\n",debugstr_w((LPWSTR)x),y,z);
133 else
134 { FIXME(shell,"(%s,%08lx,%08lx):stub.\n",debugstr_a((LPSTR)x),y,z);
138 /*************************************************************************
139 * SHShellFolderView_Message [SHELL32.73]
141 * PARAMETERS
142 * hwndCabinet defines the explorer cabinet window that contains the
143 * shellview you need to communicate with
144 * uMsg identifying the SFVM enum to perform
145 * lParam
147 * NOTES
148 * Message SFVM_REARRANGE = 1
149 * This message gets sent when a column gets clicked to instruct the
150 * shell view to re-sort the item list. lParam identifies the column
151 * that was clicked.
153 int WINAPI SHShellFolderView_Message(HWND32 hwndCabinet,UINT32 uMsg,LPARAM lParam)
154 { FIXME(shell,"%04x %08ux %08lx stub\n",hwndCabinet,uMsg,lParam);
155 return 0;
158 /*************************************************************************
159 * OleStrToStrN [SHELL32.78]
161 * NOTES
162 * exported by ordinal
163 * FIXME
164 * wrong implemented OleStr is NOT wide string !!!! (jsch)
166 BOOL32 WINAPI
167 OleStrToStrN (LPSTR lpMulti, INT32 nMulti, LPCWSTR lpWide, INT32 nWide) {
168 return WideCharToMultiByte (0, 0, lpWide, nWide,
169 lpMulti, nMulti, NULL, NULL);
172 /*************************************************************************
173 * StrToOleStrN [SHELL32.79]
175 * NOTES
176 * exported by ordinal
177 * FIXME
178 * wrong implemented OleStr is NOT wide string !!!! (jsch)
180 BOOL32 WINAPI
181 StrToOleStrN (LPWSTR lpWide, INT32 nWide, LPCSTR lpMulti, INT32 nMulti) {
182 return MultiByteToWideChar (0, 0, lpMulti, nMulti, lpWide, nWide);
185 /*************************************************************************
186 * SHCloneSpecialIDList [SHELL32.89]
188 * PARAMETERS
189 * hwndOwner [in]
190 * nFolder [in] CSIDL_xxxxx ??
192 * RETURNS
193 * pidl ??
194 * NOTES
195 * exported by ordinal
197 LPITEMIDLIST WINAPI SHCloneSpecialIDList(HWND32 hwndOwner,DWORD nFolder,DWORD x3)
198 { LPITEMIDLIST ppidl;
199 WARN(shell,"(hwnd=0x%x,csidl=0x%lx,0x%lx):semi-stub.\n",
200 hwndOwner,nFolder,x3);
202 SHGetSpecialFolderLocation(hwndOwner, nFolder, &ppidl);
204 return ppidl;
208 /*************************************************************************
209 * SHGetSpecialFolderPath [SHELL32.175]
211 * NOTES
212 * exported by ordinal
214 void WINAPI SHGetSpecialFolderPath(DWORD x1,DWORD x2,DWORD x3,DWORD x4) {
215 FIXME(shell,"(0x%04lx,0x%04lx,csidl=0x%04lx,0x%04lx):stub.\n",
216 x1,x2,x3,x4
220 /*************************************************************************
221 * RegisterShellHook [SHELL32.181]
223 * PARAMS
224 * hwnd [I] window handle
225 * y [I] flag ????
227 * NOTES
228 * exported by ordinal
230 void WINAPI RegisterShellHook32(HWND32 hwnd, DWORD y) {
231 FIXME(shell,"(0x%08x,0x%08lx):stub.\n",hwnd,y);
234 /*************************************************************************
235 * ShellMessageBoxA [SHELL32.183]
237 * Format and output errormessage.
239 * NOTES
240 * exported by ordinal
242 void __cdecl
243 ShellMessageBoxA(HMODULE32 hmod,HWND32 hwnd,DWORD id,DWORD x,DWORD type,LPVOID arglist) {
244 char buf[100],buf2[100]/*,*buf3*/;
245 /* LPVOID args = &arglist;*/
247 if (!LoadString32A(hmod,x,buf,100))
248 strcpy(buf,"Desktop");
249 // LoadString32A(hmod,id,buf2,100);
250 /* FIXME: the varargs handling doesn't. */
251 // FormatMessage32A(0x500,buf2,0,0,(LPSTR)&buf3,256,(LPDWORD)&args);
253 FIXME(shell,"(%08lx,%08lx,%08lx(%s),%08lx(%s),%08lx,%p):stub.\n",
254 (DWORD)hmod,(DWORD)hwnd,id,buf2,x,buf,type,arglist
256 /*MessageBox32A(hwnd,buf3,buf,id|0x10000);*/
259 /*************************************************************************
260 * SHRestricted [SHELL32.100]
262 * walks through policy table, queries <app> key, <type> value, returns
263 * queried (DWORD) value.
264 * {0x00001,Explorer,NoRun}
265 * {0x00002,Explorer,NoClose}
266 * {0x00004,Explorer,NoSaveSettings}
267 * {0x00008,Explorer,NoFileMenu}
268 * {0x00010,Explorer,NoSetFolders}
269 * {0x00020,Explorer,NoSetTaskbar}
270 * {0x00040,Explorer,NoDesktop}
271 * {0x00080,Explorer,NoFind}
272 * {0x00100,Explorer,NoDrives}
273 * {0x00200,Explorer,NoDriveAutoRun}
274 * {0x00400,Explorer,NoDriveTypeAutoRun}
275 * {0x00800,Explorer,NoNetHood}
276 * {0x01000,Explorer,NoStartBanner}
277 * {0x02000,Explorer,RestrictRun}
278 * {0x04000,Explorer,NoPrinterTabs}
279 * {0x08000,Explorer,NoDeletePrinter}
280 * {0x10000,Explorer,NoAddPrinter}
281 * {0x20000,Explorer,NoStartMenuSubFolders}
282 * {0x40000,Explorer,MyDocsOnNet}
283 * {0x80000,WinOldApp,NoRealMode}
285 * NOTES
286 * exported by ordinal
288 DWORD WINAPI SHRestricted (DWORD pol) {
289 HKEY xhkey;
291 FIXME(shell,"(%08lx):stub.\n",pol);
292 if (RegOpenKey32A(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Policies",&xhkey))
293 return 0;
294 /* FIXME: do nothing for now, just return 0 (== "allowed") */
295 RegCloseKey(xhkey);
296 return 0;
299 /*************************************************************************
300 * SHCreateDirectory [SHELL32.165]
302 * NOTES
303 * exported by ordinal
304 * not sure about LPSECURITY_ATTRIBUTES
306 DWORD WINAPI SHCreateDirectory(LPSECURITY_ATTRIBUTES sec,LPCSTR path) {
307 TRACE(shell,"(%p,%s):stub.\n",sec,path);
308 if (CreateDirectory32A(path,sec))
309 return TRUE;
310 /* SHChangeNotify(8,1,path,0); */
311 return FALSE;
312 #if 0
313 if (SHELL32_79(path,(LPVOID)x))
314 return 0;
315 FIXME(shell,"(%08lx,%s):stub.\n",x,path);
316 return 0;
317 #endif
320 /*************************************************************************
321 * SHFree [SHELL32.195]
323 * NOTES
324 * free_ptr() - frees memory using IMalloc
325 * exported by ordinal
327 DWORD WINAPI SHFree(LPVOID x) {
328 TRACE(shell,"%p\n",x);
329 /*return LocalFree32((HANDLE32)x);*/ /* crashes */
330 return HeapFree(GetProcessHeap(),0,x);
333 /*************************************************************************
334 * SHAlloc [SHELL32.196]
336 * NOTES
337 * void *task_alloc(DWORD len), uses SHMalloc allocator
338 * exported by ordinal
340 LPVOID WINAPI SHAlloc(DWORD len) {
341 /* void * ret = (LPVOID)LocalAlloc32(len,LMEM_ZEROINIT);*/ /* chrashes */
342 void * ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len);
343 TRACE(shell,"%lu bytes at %p\n",len, ret);
344 return ret;
347 /*************************************************************************
348 * OpenRegStream [SHELL32.85]
350 * NOTES
351 * exported by ordinal
353 DWORD WINAPI OpenRegStream(DWORD x1,DWORD x2,DWORD x3,DWORD x4) {
354 FIXME(shell,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub.\n",
355 x1,x2,x3,x4
357 return 0;
360 /*************************************************************************
361 * SHRegisterDragDrop [SHELL32.86]
363 * NOTES
364 * exported by ordinal
366 DWORD WINAPI SHRegisterDragDrop(HWND32 hwnd,DWORD x2) {
367 FIXME (shell, "(0x%08x,0x%08lx):stub.\n", hwnd, x2);
368 return 0;
371 /*************************************************************************
372 * SHRevokeDragDrop [SHELL32.87]
374 * NOTES
375 * exported by ordinal
377 DWORD WINAPI SHRevokeDragDrop(DWORD x) {
378 FIXME(shell,"(0x%08lx):stub.\n",x);
379 return 0;
382 /*************************************************************************
383 * RunFileDlg [SHELL32.61]
385 * NOTES
386 * Original name: RunFileDlg (exported by ordinal)
388 DWORD WINAPI
389 RunFileDlg (HWND32 hwndOwner, DWORD dwParam1, DWORD dwParam2,
390 LPSTR lpszTitle, LPSTR lpszPrompt, UINT32 uFlags)
392 FIXME (shell,"(0x%08x 0x%lx 0x%lx \"%s\" \"%s\" 0x%x):stub.\n",
393 hwndOwner, dwParam1, dwParam2, lpszTitle, lpszPrompt, uFlags);
394 return 0;
397 /*************************************************************************
398 * ExitWindowsDialog [SHELL32.60]
400 * NOTES
401 * exported by ordinal
403 DWORD WINAPI
404 ExitWindowsDialog (HWND32 hwndOwner)
406 FIXME (shell,"(0x%08x):stub.\n", hwndOwner);
407 return 0;
410 /*************************************************************************
411 * ArrangeWindows [SHELL32.184]
414 DWORD WINAPI
415 ArrangeWindows (DWORD dwParam1, DWORD dwParam2, DWORD dwParam3,
416 DWORD dwParam4, DWORD dwParam5)
418 FIXME (shell,"(0x%lx 0x%lx 0x%lx 0x%lx 0x%lx):stub.\n",
419 dwParam1, dwParam2, dwParam3, dwParam4, dwParam5);
420 return 0;
423 /*************************************************************************
424 * SHCLSIDFromString [SHELL32.147]
426 * NOTES
427 * exported by ordinal
429 DWORD WINAPI
430 SHCLSIDFromString (DWORD dwParam1, DWORD dwParam2)
432 FIXME (shell,"(0x%lx 0x%lx):stub.\n", dwParam1, dwParam2);
433 FIXME (shell,"(\"%s\" \"%s\"):stub.\n", (LPSTR)dwParam1, (LPSTR)dwParam2);
435 return 0;
439 /*************************************************************************
440 * SignalFileOpen [SHELL32.103]
442 * NOTES
443 * exported by ordinal
445 DWORD WINAPI
446 SignalFileOpen (DWORD dwParam1)
448 FIXME (shell,"(0x%08lx):stub.\n", dwParam1);
450 return 0;
453 /*************************************************************************
454 * SHAddToRecentDocs [SHELL32.234]
456 * PARAMETERS
457 * uFlags [IN] SHARD_PATH or SHARD_PIDL
458 * pv [IN] string or pidl, NULL clears the list
460 * NOTES
461 * exported by name
463 DWORD WINAPI SHAddToRecentDocs32 (UINT32 uFlags,LPCVOID pv)
464 { if (SHARD_PIDL==uFlags)
465 { FIXME (shell,"(0x%08x,pidl=%p):stub.\n", uFlags,pv);
467 else
468 { FIXME (shell,"(0x%08x,%s):stub.\n", uFlags,(char*)pv);
470 return 0;
472 /*************************************************************************
473 * SHFileOperation32 [SHELL32.242]
476 DWORD WINAPI SHFileOperation32(DWORD x)
477 { FIXME(shell,"0x%08lx stub\n",x);
478 return 0;
482 /*************************************************************************
483 * SHFileOperation32A [SHELL32.243]
485 * NOTES
486 * exported by name
488 DWORD WINAPI SHFileOperation32A (LPSHFILEOPSTRUCT32A lpFileOp)
489 { FIXME (shell,"(%p):stub.\n", lpFileOp);
490 return 1;
492 /*************************************************************************
493 * SHFileOperation32W [SHELL32.244]
495 * NOTES
496 * exported by name
498 DWORD WINAPI SHFileOperation32W (LPSHFILEOPSTRUCT32W lpFileOp)
499 { FIXME (shell,"(%p):stub.\n", lpFileOp);
500 return 1;
503 /*************************************************************************
504 * SHChangeNotify [SHELL32.239]
506 * NOTES
507 * exported by name
509 DWORD WINAPI SHChangeNotify32 (
510 INT32 wEventId, /* [IN] flags that specifies the event*/
511 UINT32 uFlags, /* [IN] the meaning of dwItem[1|2]*/
512 LPCVOID dwItem1,
513 LPCVOID dwItem2)
514 { FIXME (shell,"(0x%08x,0x%08ux,%p,%p):stub.\n", wEventId,uFlags,dwItem1,dwItem2);
515 return 0;
517 /*************************************************************************
518 * SHCreateShellFolderViewEx [SHELL32.174]
520 * NOTES
521 * see IShellFolder::CreateViewObject
523 HRESULT WINAPI SHCreateShellFolderViewEx32(
524 LPSHELLVIEWDATA psvcbi, /*[in ] shelltemplate struct*/
525 LPVOID* ppv) /*[out] IShellView pointer*/
526 { FIXME (shell,"(%p,%p):stub.\n", psvcbi,ppv);
527 return 0;
529 /*************************************************************************
530 * SHFind_InitMenuPopup [SHELL32.149]
532 * NOTES
533 * Registers the menu behind the "Start" button
535 * PARAMETERS
536 * hMenu [in] handel of menu previously created
537 * hWndParent [in] parent window
538 * w [in] no pointer
539 * x [in] no pointer
541 HRESULT WINAPI SHFind_InitMenuPopup (HMENU32 hMenu, HWND32 hWndParent, DWORD w, DWORD x)
542 { FIXME(shell,"hmenu=0x%08x hwnd=0x%08x 0x%08lx 0x%08lx stub\n",
543 hMenu,hWndParent,w,x);
544 return 0;
546 /*************************************************************************
547 * FileMenu_InitMenuPopup [SHELL32.109]
550 HRESULT WINAPI FileMenu_InitMenuPopup (DWORD hmenu)
551 { FIXME(shell,"hmenu=0x%lx stub\n",hmenu);
552 return 0;
554 /*************************************************************************
555 * FileMenu_Create [SHELL32.114]
557 * w retval from LoadBitmapA
561 HRESULT WINAPI FileMenu_Create (DWORD u, DWORD v, DWORD w, DWORD x, DWORD z)
562 { FIXME(shell,"0x%08lx 0x%08lx hbmp=0x%lx 0x%08lx 0x%08lx stub\n",u,v,w,x,z);
563 return 0;
565 /*************************************************************************
566 * FileMenu_TrackPopupMenuEx [SHELL32.116]
568 * PARAMETERS
569 * uFlags [in] according to TrackPopupMenuEx
570 * posX [in]
571 * posY [in]
572 * hWndParent [in]
573 * z could be rect (trace) or TPMPARAMS (TrackPopupMenuEx)
575 HRESULT WINAPI FileMenu_TrackPopupMenuEx (DWORD t, DWORD uFlags, DWORD posX, DWORD posY, HWND32 hWndParent, DWORD z)
576 { FIXME(shell,"0x%lx flags=0x%lx posx=0x%lx posy=0x%lx hwndp=0x%x 0x%lx stub\n",
577 t,uFlags,posX,posY, hWndParent,z);
578 return 0;
580 /*************************************************************************
581 * SHWinHelp [SHELL32.127]
584 HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z)
585 { FIXME(shell,"0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z);
586 return 0;
588 /*************************************************************************
589 * SHRunControlPanel [SHELL32.161]
592 HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z)
593 { FIXME(shell,"0x%08lx 0x%08lx stub\n",x,z);
594 return 0;
596 /*************************************************************************
597 * ShellExecuteEx [SHELL32.291]
600 BOOL32 WINAPI ShellExecuteEx32 (LPVOID sei)
601 { if (VERSION_OsIsUnicode())
602 return ShellExecuteEx32W (sei);
603 return ShellExecuteEx32A (sei);
605 /*************************************************************************
606 * ShellExecuteEx32A [SHELL32.292]
609 BOOL32 WINAPI ShellExecuteEx32A (LPSHELLEXECUTEINFO32A sei)
610 { CHAR szTemp[MAX_PATH];
612 FIXME(shell,"(%p): stub\n",sei);
614 if (sei->fMask & SEE_MASK_IDLIST)
615 { SHGetPathFromIDList32A (sei->lpIDList,szTemp);
616 TRACE (shell,"-- idlist=%p (%s)\n", sei->lpIDList, szTemp);
619 if (sei->fMask & SEE_MASK_CLASSNAME)
620 { TRACE (shell,"-- classname= %s\n", sei->lpClass);
623 if (sei->lpVerb)
624 { TRACE (shell,"-- action=%s\n", sei->lpVerb);
627 return 0;
629 /*************************************************************************
630 * ShellExecuteEx [SHELL32.293]
633 BOOL32 WINAPI ShellExecuteEx32W (LPSHELLEXECUTEINFO32W sei)
634 { WCHAR szTemp[MAX_PATH];
636 FIXME(shell,"(%p): stub\n",sei);
638 if (sei->fMask & SEE_MASK_IDLIST)
639 { SHGetPathFromIDList32W (sei->lpIDList,szTemp);
640 TRACE (shell,"-- idlist=%p (%s)\n", sei->lpIDList, debugstr_w(szTemp));
643 if (sei->fMask & SEE_MASK_CLASSNAME)
644 { TRACE (shell,"-- classname= %s\n", debugstr_w(sei->lpClass));
647 if (sei->lpVerb)
648 { TRACE (shell,"-- action=%s\n", debugstr_w(sei->lpVerb));
651 return 0;
653 static LPUNKNOWN SHELL32_IExplorerInterface=0;
654 /*************************************************************************
655 * SHSetInstanceExplorer [SHELL32.176]
657 * NOTES
658 * Sets the interface
660 HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown)
661 { TRACE (shell,"%p\n", lpUnknown);
662 SHELL32_IExplorerInterface = lpUnknown;
663 return (HRESULT) lpUnknown;
665 /*************************************************************************
666 * SHGetInstanceExplorer [SHELL32.256]
668 * NOTES
669 * gets the interface pointer of the explorer and a reference
671 HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown)
672 { TRACE(shell,"%p\n", lpUnknown);
674 *lpUnknown = SHELL32_IExplorerInterface;
676 if (!SHELL32_IExplorerInterface)
677 return E_FAIL;
679 SHELL32_IExplorerInterface->lpvtbl->fnAddRef(SHELL32_IExplorerInterface);
680 return NOERROR;
682 /*************************************************************************
683 * SHFreeUnusedLibraries [SHELL32.123]
685 * NOTES
686 * exported by name
688 HRESULT WINAPI SHFreeUnusedLibraries (void)
689 { FIXME(shell,"stub\n");
690 return TRUE;
692 /*************************************************************************
693 * DAD_ShowDragImage [SHELL32.137]
695 * NOTES
696 * exported by name
698 HRESULT WINAPI DAD_ShowDragImage (DWORD u)
699 { FIXME(shell,"0x%08lx stub\n",u);
700 return 0;
702 /*************************************************************************
703 * FileMenu_Destroy [SHELL32.118]
705 * NOTES
706 * exported by name
708 HRESULT WINAPI FileMenu_Destroy (DWORD u)
709 { FIXME(shell,"0x%08lx stub\n",u);
710 return 0;
712 /*************************************************************************
713 * SHGetDataFromIDListA [SHELL32.247]
716 HRESULT WINAPI SHGetDataFromIDListA(DWORD u, DWORD v, DWORD w, DWORD x, DWORD y)
717 { FIXME(shell,"0x%04lx 0x%04lx 0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w,x,y);
718 return 0;
720 /*************************************************************************
721 * SHRegCloseKey32 [NT4.0:SHELL32.505]
724 HRESULT WINAPI SHRegCloseKey32 (HKEY hkey)
725 { TRACE(shell,"0x%04x\n",hkey);
726 return RegCloseKey( hkey );
728 /*************************************************************************
729 * SHRegOpenKey32A [SHELL32.506]
732 HRESULT WINAPI SHRegOpenKey32A(HKEY hKey, LPSTR lpSubKey, LPHKEY phkResult)
733 { FIXME(shell,"(0x%08x, %s, %p)\n", hKey, debugstr_a(lpSubKey),
734 phkResult);
735 return RegOpenKey32A(hKey, lpSubKey, phkResult);
738 /*************************************************************************
739 * SHRegOpenKey32W [NT4.0:SHELL32.507]
742 HRESULT WINAPI SHRegOpenKey32W (HKEY hkey, LPCWSTR lpszSubKey, LPHKEY retkey)
743 { WARN(shell,"0x%04x %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
744 return RegOpenKey32W( hkey, lpszSubKey, retkey );
746 /*************************************************************************
747 * SHRegQueryValueExA [SHELL32.509]
750 HRESULT WINAPI SHRegQueryValueEx32A(DWORD u, LPSTR v, DWORD w, DWORD x,
751 DWORD y, DWORD z)
752 { FIXME(shell,"0x%04lx %s 0x%04lx 0x%04lx 0x%04lx 0x%04lx stub\n",
753 u,debugstr_a(v),w,x,y,z);
754 return 0;
756 /*************************************************************************
757 * SHRegQueryValue32W [NT4.0:SHELL32.510]
760 HRESULT WINAPI SHRegQueryValue32W (HKEY hkey, LPWSTR lpszSubKey,
761 LPWSTR lpszData, LPDWORD lpcbData )
762 { WARN(shell,"0x%04x %s %p %p semi-stub\n",
763 hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
764 return RegQueryValue32W( hkey, lpszSubKey, lpszData, lpcbData );
767 /*************************************************************************
768 * SHRegQueryValueEx32W [NT4.0:SHELL32.511]
770 * FIXME
771 * if the datatype REG_EXPAND_SZ then expand the string and change
772 * *pdwType to REG_SZ.
774 HRESULT WINAPI SHRegQueryValueEx32W (HKEY hkey, LPWSTR pszValue, LPDWORD pdwReserved,
775 LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData)
776 { DWORD ret;
777 WARN(shell,"0x%04x %s %p %p %p %p semi-stub\n",
778 hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
779 ret = RegQueryValueEx32W ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);
780 return ret;
783 /*************************************************************************
784 * ReadCabinetState [NT 4.0:SHELL32.651]
787 HRESULT WINAPI ReadCabinetState(DWORD u, DWORD v)
788 { FIXME(shell,"0x%04lx 0x%04lx stub\n",u,v);
789 return 0;
791 /*************************************************************************
792 * WriteCabinetState [NT 4.0:SHELL32.652]
795 HRESULT WINAPI WriteCabinetState(DWORD u)
796 { FIXME(shell,"0x%04lx stub\n",u);
797 return 0;
799 /*************************************************************************
800 * FileIconInit [SHELL32.660]
803 BOOL32 WINAPI FileIconInit(BOOL32 bFullInit)
804 { FIXME(shell,"(%s)\n", bFullInit ? "true" : "false");
805 return 0;
807 /*************************************************************************
808 * IsUserAdmin [NT 4.0:SHELL32.680]
811 HRESULT WINAPI IsUserAdmin(void)
812 { FIXME(shell,"stub\n");
813 return TRUE;
815 /*************************************************************************
816 * StrRetToStrN [SHELL32.96]
818 * converts a STRRET to a normal string
820 * NOTES
821 * FIXME the string handling is to simple (different STRRET choices)
822 * at the moment only CSTR
823 * the pidl is for STRRET OFFSET
825 HRESULT WINAPI StrRetToStrN (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
826 { TRACE(shell,"dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
828 switch (src->uType)
829 { case STRRET_WSTR:
830 WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL);
831 SHFree(src->u.pOleStr);
832 break;
834 case STRRET_CSTRA:
835 if (VERSION_OsIsUnicode())
836 lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len);
837 else
838 strncpy((LPSTR)dest, src->u.cStr, len);
839 break;
841 case STRRET_OFFSETA:
842 if (pidl)
843 { if(VERSION_OsIsUnicode())
844 lstrcpynAtoW((LPWSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
845 else
846 strncpy((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
847 break;
850 default:
851 FIXME(shell,"unknown type!\n");
852 if (len)
853 { *(LPSTR)dest = '\0';
855 return(FALSE);
857 return(TRUE);
860 /*************************************************************************
861 * StrChrW [NT 4.0:SHELL32.651]
864 LPWSTR WINAPI StrChrW (LPWSTR str, WCHAR x )
865 { LPWSTR ptr=str;
867 TRACE(shell,"%s 0x%04x\n",debugstr_w(str),x);
869 { if (*ptr==x)
870 { return ptr;
872 ptr++;
873 } while (*ptr);
874 return NULL;
877 /*************************************************************************
878 * StrCmpNIW [NT 4.0:SHELL32.*]
881 INT32 WINAPI StrCmpNIW ( LPWSTR wstr1, LPWSTR wstr2, INT32 len)
882 { FIXME( shell,"%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len);
883 return 0;
886 /*************************************************************************
887 * SHAllocShared [SHELL32.520]
889 * NOTES
890 * parameter1 is return value from HeapAlloc
891 * parameter2 is equal to the size allocated with HeapAlloc
892 * parameter3 is return value from GetCurrentProcessId
894 * the return value is posted as lParam with 0x402 (WM_USER+2) to somewhere
895 * WM_USER+2 could be the undocumented CWM_SETPATH
896 * the allocated memory contains a pidl
898 HGLOBAL32 WINAPI SHAllocShared(LPVOID psrc, DWORD size, DWORD procID)
899 { HGLOBAL32 hmem;
900 LPVOID pmem;
902 TRACE(shell,"ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID);
903 hmem = GlobalAlloc32(GMEM_FIXED, size);
904 if (!hmem)
905 return 0;
907 pmem = GlobalLock32 (hmem);
909 if (! pmem)
910 return 0;
912 memcpy (pmem, psrc, size);
913 GlobalUnlock32(hmem);
914 return hmem;
916 /*************************************************************************
917 * SHLockShared [SHELL32.521]
919 * NOTES
920 * parameter1 is return value from SHAllocShared
921 * parameter2 is return value from GetCurrentProcessId
922 * the receiver of (WM_USER+2) trys to lock the HANDLE (?)
923 * the returnvalue seems to be a memoryadress
925 LPVOID WINAPI SHLockShared(HANDLE32 hmem, DWORD procID)
926 { TRACE(shell,"handle=0x%04x procID=0x%04lx\n",hmem,procID);
927 return GlobalLock32(hmem);
929 /*************************************************************************
930 * SHUnlockShared [SHELL32.522]
932 * NOTES
933 * parameter1 is return value from SHLockShared
935 BOOL32 WINAPI SHUnlockShared(HANDLE32 pmem)
936 { TRACE(shell,"handle=0x%04x\n",pmem);
937 return GlobalUnlock32(pmem);
939 /*************************************************************************
940 * SHFreeShared [SHELL32.523]
942 * NOTES
943 * parameter1 is return value from SHAllocShared
944 * parameter2 is return value from GetCurrentProcessId
946 HANDLE32 WINAPI SHFreeShared(HANDLE32 hmem, DWORD procID)
947 { TRACE(shell,"handle=0x%04x 0x%04lx\n",hmem,procID);
948 return GlobalFree32(hmem);
951 /*************************************************************************
952 * SetAppStartingCursor32 [SHELL32.99]
955 HRESULT WINAPI SetAppStartingCursor32(DWORD u, DWORD v)
956 { FIXME(shell,"0x%04lx 0x%04lx stub\n",u,v );
957 return 0;
959 /*************************************************************************
960 * SHLoadOLE32 [SHELL32.151]
963 HRESULT WINAPI SHLoadOLE32(DWORD u)
964 { FIXME(shell,"0x%04lx stub\n",u);
965 return S_OK;
967 /*************************************************************************
968 * Shell_MergeMenus32 [SHELL32.67]
971 BOOL32 _SHIsMenuSeparator(HMENU32 hm, int i)
973 MENUITEMINFO32A mii;
975 mii.cbSize = sizeof(MENUITEMINFO32A);
976 mii.fMask = MIIM_TYPE;
977 mii.cch = 0; /* WARNING: We MUST initialize it to 0*/
978 if (!GetMenuItemInfo32A(hm, i, TRUE, &mii))
979 { return(FALSE);
982 if (mii.fType & MFT_SEPARATOR)
983 { return(TRUE);
986 return(FALSE);
988 #define MM_ADDSEPARATOR 0x00000001L
989 #define MM_SUBMENUSHAVEIDS 0x00000002L
990 HRESULT WINAPI Shell_MergeMenus32 (HMENU32 hmDst, HMENU32 hmSrc, UINT32 uInsert, UINT32 uIDAdjust, UINT32 uIDAdjustMax, ULONG uFlags)
991 { int nItem;
992 HMENU32 hmSubMenu;
993 BOOL32 bAlreadySeparated;
994 MENUITEMINFO32A miiSrc;
995 char szName[256];
996 UINT32 uTemp, uIDMax = uIDAdjust;
998 FIXME(shell,"hmenu1=0x%04x hmenu2=0x%04x 0x%04x 0x%04x 0x%04x 0x%04lx stub\n",
999 hmDst, hmSrc, uInsert, uIDAdjust, uIDAdjustMax, uFlags);
1001 if (!hmDst || !hmSrc)
1002 { return uIDMax;
1005 nItem = GetMenuItemCount32(hmDst);
1006 if (uInsert >= (UINT32)nItem)
1007 { uInsert = (UINT32)nItem;
1008 bAlreadySeparated = TRUE;
1010 else
1011 { bAlreadySeparated = _SHIsMenuSeparator(hmDst, uInsert);;
1013 if ((uFlags & MM_ADDSEPARATOR) && !bAlreadySeparated)
1014 { /* Add a separator between the menus */
1015 InsertMenu32A(hmDst, uInsert, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
1016 bAlreadySeparated = TRUE;
1020 /* Go through the menu items and clone them*/
1021 for (nItem = GetMenuItemCount32(hmSrc) - 1; nItem >= 0; nItem--)
1022 { miiSrc.cbSize = sizeof(MENUITEMINFO32A);
1023 miiSrc.fMask = MIIM_STATE | MIIM_ID | MIIM_SUBMENU | MIIM_CHECKMARKS | MIIM_TYPE | MIIM_DATA;
1024 /* We need to reset this every time through the loop in case
1025 menus DON'T have IDs*/
1026 miiSrc.fType = MFT_STRING;
1027 miiSrc.dwTypeData = szName;
1028 miiSrc.dwItemData = 0;
1029 miiSrc.cch = sizeof(szName);
1031 if (!GetMenuItemInfo32A(hmSrc, nItem, TRUE, &miiSrc))
1032 { continue;
1034 if (miiSrc.fType & MFT_SEPARATOR)
1035 { /* This is a separator; don't put two of them in a row*/
1036 if (bAlreadySeparated)
1037 { continue;
1039 bAlreadySeparated = TRUE;
1041 else if (miiSrc.hSubMenu)
1042 { if (uFlags & MM_SUBMENUSHAVEIDS)
1043 { /* Adjust the ID and check it*/
1044 miiSrc.wID += uIDAdjust;
1045 if (miiSrc.wID > uIDAdjustMax)
1046 { continue;
1048 if (uIDMax <= miiSrc.wID)
1049 { uIDMax = miiSrc.wID + 1;
1052 else
1053 { /* Don't set IDs for submenus that didn't have them already */
1054 miiSrc.fMask &= ~MIIM_ID;
1056 hmSubMenu = miiSrc.hSubMenu;
1057 miiSrc.hSubMenu = CreatePopupMenu32();
1058 if (!miiSrc.hSubMenu)
1059 { return(uIDMax);
1061 uTemp = Shell_MergeMenus32(miiSrc.hSubMenu, hmSubMenu, 0, uIDAdjust, uIDAdjustMax, uFlags&MM_SUBMENUSHAVEIDS);
1062 if (uIDMax <= uTemp)
1063 { uIDMax = uTemp;
1065 bAlreadySeparated = FALSE;
1067 else
1068 { /* Adjust the ID and check it*/
1069 miiSrc.wID += uIDAdjust;
1070 if (miiSrc.wID > uIDAdjustMax)
1071 { continue;
1073 if (uIDMax <= miiSrc.wID)
1074 { uIDMax = miiSrc.wID + 1;
1076 bAlreadySeparated = FALSE;
1078 if (!InsertMenuItem32A(hmDst, uInsert, TRUE, &miiSrc))
1079 { return(uIDMax);
1083 /* Ensure the correct number of separators at the beginning of the
1084 inserted menu items*/
1085 if (uInsert == 0)
1086 { if (bAlreadySeparated)
1087 { DeleteMenu32(hmDst, uInsert, MF_BYPOSITION);
1090 else
1091 { if (_SHIsMenuSeparator(hmDst, uInsert-1))
1092 { if (bAlreadySeparated)
1093 { DeleteMenu32(hmDst, uInsert, MF_BYPOSITION);
1096 else
1097 { if ((uFlags & MM_ADDSEPARATOR) && !bAlreadySeparated)
1098 { /* Add a separator between the menus*/
1099 InsertMenu32A(hmDst, uInsert, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
1103 return(uIDMax);
1106 /*************************************************************************
1107 * DriveType32 [SHELL32.64]
1110 HRESULT WINAPI DriveType32(DWORD u)
1111 { FIXME(shell,"0x%04lx stub\n",u);
1112 return 0;
1114 /*************************************************************************
1115 * SHAbortInvokeCommand [SHELL32.198]
1118 HRESULT WINAPI SHAbortInvokeCommand(void)
1119 { FIXME(shell,"stub\n");
1120 return 1;
1122 /*************************************************************************
1123 * SHOutOfMemoryMessageBox [SHELL32.126]
1126 HRESULT WINAPI SHOutOfMemoryMessageBox(DWORD u, DWORD v, DWORD w)
1127 { FIXME(shell,"0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w);
1128 return 0;
1130 /*************************************************************************
1131 * SHFlushClipboard [SHELL32.121]
1134 HRESULT WINAPI SHFlushClipboard(void)
1135 { FIXME(shell,"stub\n");
1136 return 1;
1138 /*************************************************************************
1139 * StrRChrW [SHELL32.320]
1142 LPWSTR WINAPI StrRChrW(LPWSTR lpStart, LPWSTR lpEnd, DWORD wMatch)
1143 { LPWSTR wptr=NULL;
1144 TRACE(shell,"%s %s 0x%04x\n",debugstr_w(lpStart),debugstr_w(lpEnd), (WCHAR)wMatch );
1146 /* if the end not given, search*/
1147 if (!lpEnd)
1148 { lpEnd=lpStart;
1149 while (*lpEnd)
1150 lpEnd++;
1154 { if (*lpStart==(WCHAR)wMatch)
1155 wptr = lpStart;
1156 lpStart++;
1157 } while ( lpStart<=lpEnd );
1158 return wptr;
1160 /*************************************************************************
1161 * StrFormatByteSize [SHLWAPI]
1163 LPSTR WINAPI StrFormatByteSize32A ( DWORD dw, LPSTR pszBuf, UINT32 cchBuf )
1164 { char buf[64];
1165 TRACE(shell,"%lx %p %i\n", dw, pszBuf, cchBuf);
1166 if ( dw<1024L )
1167 { sprintf (buf,"%3.1f bytes", (FLOAT)dw);
1169 else if ( dw<1048576L)
1170 { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024);
1172 else if ( dw < 1073741824L)
1173 { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L);
1175 else
1176 { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L);
1178 strncpy (pszBuf, buf, cchBuf);
1179 return pszBuf;
1181 LPWSTR WINAPI StrFormatByteSize32W ( DWORD dw, LPWSTR pszBuf, UINT32 cchBuf )
1182 { char buf[64];
1183 TRACE(shell,"%lx %p %i\n", dw, pszBuf, cchBuf);
1184 if ( dw<1024L )
1185 { sprintf (buf,"%3.1f bytes", (FLOAT)dw);
1187 else if ( dw<1048576L)
1188 { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024);
1190 else if ( dw < 1073741824L)
1191 { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L);
1193 else
1194 { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L);
1196 lstrcpynAtoW (pszBuf, buf, cchBuf);
1197 return pszBuf;
1199 /*************************************************************************
1200 * SHWaitForFileToOpen [SHELL32.97]
1203 HRESULT WINAPI SHWaitForFileToOpen(DWORD u, DWORD v, DWORD w)
1204 { FIXME(shell,"0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w);
1205 return 0;