Large-scale renaming of all Win32 functions and types to use the
[wine/multimedia.git] / dlls / shell32 / shellord.c
blob230a38bdfe1d992c9ac3439fc6e2b8447b6481af
1 /*
2 * The parameters of many functions changes between different OS versions
3 * (NT uses Unicode strings, 95 uses ASCII strings)
4 *
5 * Copyright 1997 Marcus Meissner
6 * 1998 Jürgen Schmied
7 */
8 #include <string.h>
9 #include "winerror.h"
10 #include "winreg.h"
11 #include "debug.h"
12 #include "winnls.h"
13 #include "winversion.h"
14 #include "heap.h"
16 #include "shlobj.h"
17 #include "shell32_main.h"
19 /*************************************************************************
20 * SHChangeNotifyRegister [SHELL32.2]
21 * NOTES
22 * Idlist is an array of structures and Count specifies how many items in the array
23 * (usually just one I think).
25 DWORD WINAPI
26 SHChangeNotifyRegister(
27 HWND hwnd,
28 LONG events1,
29 LONG events2,
30 DWORD msg,
31 int count,
32 IDSTRUCT *idlist)
33 { FIXME(shell,"(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):stub.\n",
34 hwnd,events1,events2,msg,count,idlist);
35 return 0;
37 /*************************************************************************
38 * SHChangeNotifyDeregister [SHELL32.4]
40 DWORD WINAPI
41 SHChangeNotifyDeregister(LONG x1)
42 { FIXME(shell,"(0x%08lx):stub.\n",x1);
43 return 0;
45 /*************************************************************************
46 * NTSHChangeNotifyRegister [SHELL32.640]
47 * NOTES
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(
52 HWND hwnd,
53 LONG events1,
54 LONG events2,
55 DWORD msg,
56 int count,
57 IDSTRUCT *idlist)
58 { FIXME(shell,"(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):stub.\n",
59 hwnd,events1,events2,msg,count,idlist);
60 return 0;
62 /*************************************************************************
63 * NTSHChangeNotifyDeregister [SHELL32.641]
65 DWORD WINAPI NTSHChangeNotifyDeregister(LONG x1)
66 { FIXME(shell,"(0x%08lx):stub.\n",x1);
67 return 0;
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)
78 return 0;
80 if (field >1)
81 { field--;
82 while (field)
83 { if (*src==0x0) return FALSE;
84 if (*src==',') field--;
85 src++;
89 while (*src!=0x00 && *src!=',' && len>0)
90 { *dst=*src; dst++, src++; len--;
92 *dst=0x0;
94 return TRUE;
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);
103 return 0xffffffff;
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");
116 return 1;
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);
125 return 0;
128 /*************************************************************************
129 * SHShellFolderView_Message [SHELL32.73]
131 * PARAMETERS
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
135 * lParam
137 * NOTES
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
141 * that was clicked.
143 int WINAPI SHShellFolderView_Message(HWND hwndCabinet,UINT uMsg,LPARAM lParam)
144 { FIXME(shell,"%04x %08ux %08lx stub\n",hwndCabinet,uMsg,lParam);
145 return 0;
148 /*************************************************************************
149 * OleStrToStrN [SHELL32.78]
151 * NOTES
152 * exported by ordinal
153 * FIXME
154 * wrong implemented OleStr is NOT wide string !!!! (jsch)
156 BOOL WINAPI
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]
165 * NOTES
166 * exported by ordinal
167 * FIXME
168 * wrong implemented OleStr is NOT wide string !!!! (jsch)
170 BOOL WINAPI
171 StrToOleStrN (LPWSTR lpWide, INT nWide, LPCSTR lpMulti, INT nMulti) {
172 return MultiByteToWideChar (0, 0, lpMulti, nMulti, lpWide, nWide);
175 /*************************************************************************
176 * RegisterShellHook [SHELL32.181]
178 * PARAMS
179 * hwnd [I] window handle
180 * y [I] flag ????
182 * NOTES
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
196 * NOTES
197 * exported by ordinal
199 INT __cdecl
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);
209 else
210 pszTitle = (LPWSTR)idTitle;
212 if (! HIWORD (idText))
213 LoadStringW(hmod,idText,pszText,100);
214 else
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]
224 INT __cdecl
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);
234 else
235 pszTitle = (LPSTR)idTitle;
237 if (! HIWORD (idText))
238 LoadStringA(hmod,idText,pszText,100);
239 else
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}
272 * NOTES
273 * exported by ordinal
275 DWORD WINAPI SHRestricted (DWORD pol) {
276 HKEY xhkey;
278 FIXME(shell,"(%08lx):stub.\n",pol);
279 if (RegOpenKeyA(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Policies",&xhkey))
280 return 0;
281 /* FIXME: do nothing for now, just return 0 (== "allowed") */
282 RegCloseKey(xhkey);
283 return 0;
286 /*************************************************************************
287 * SHCreateDirectory [SHELL32.165]
289 * NOTES
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))
296 return TRUE;
297 /* SHChangeNotify(8,1,path,0); */
298 return FALSE;
299 #if 0
300 if (SHELL32_79(path,(LPVOID)x))
301 return 0;
302 FIXME(shell,"(%08lx,%s):stub.\n",x,path);
303 return 0;
304 #endif
307 /*************************************************************************
308 * SHFree [SHELL32.195]
310 * NOTES
311 * free_ptr() - frees memory using IMalloc
312 * exported by ordinal
314 DWORD WINAPI SHFree(LPVOID x) {
315 TRACE(shell,"%p\n",x);
316 if (!HIWORD(x))
317 { *(LPDWORD)0xdeaf0000 = 0;
319 return HeapFree(GetProcessHeap(),0,x);
322 /*************************************************************************
323 * SHAlloc [SHELL32.196]
325 * NOTES
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);
333 return ret;
336 /*************************************************************************
337 * OpenRegStream [SHELL32.85]
339 * NOTES
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",
344 x1,x2,x3,x4
346 return 0;
349 /*************************************************************************
350 * SHRegisterDragDrop [SHELL32.86]
352 * NOTES
353 * exported by ordinal
355 DWORD WINAPI SHRegisterDragDrop(HWND hwnd,DWORD x2) {
356 FIXME (shell, "(0x%08x,0x%08lx):stub.\n", hwnd, x2);
357 return 0;
360 /*************************************************************************
361 * SHRevokeDragDrop [SHELL32.87]
363 * NOTES
364 * exported by ordinal
366 DWORD WINAPI SHRevokeDragDrop(DWORD x) {
367 FIXME(shell,"(0x%08lx):stub.\n",x);
368 return 0;
371 /*************************************************************************
372 * RunFileDlg [SHELL32.61]
374 * NOTES
375 * Original name: RunFileDlg (exported by ordinal)
377 DWORD WINAPI
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);
383 return 0;
386 /*************************************************************************
387 * ExitWindowsDialog [SHELL32.60]
389 * NOTES
390 * exported by ordinal
392 DWORD WINAPI
393 ExitWindowsDialog (HWND hwndOwner)
395 FIXME (shell,"(0x%08x):stub.\n", hwndOwner);
396 return 0;
399 /*************************************************************************
400 * ArrangeWindows [SHELL32.184]
403 DWORD WINAPI
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);
409 return 0;
412 /*************************************************************************
413 * SHCLSIDFromString [SHELL32.147]
415 * NOTES
416 * exported by ordinal
418 DWORD WINAPI
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);
424 return 0;
428 /*************************************************************************
429 * SignalFileOpen [SHELL32.103]
431 * NOTES
432 * exported by ordinal
434 DWORD WINAPI
435 SignalFileOpen (DWORD dwParam1)
437 FIXME (shell,"(0x%08lx):stub.\n", dwParam1);
439 return 0;
442 /*************************************************************************
443 * SHAddToRecentDocs [SHELL32.234]
445 * PARAMETERS
446 * uFlags [IN] SHARD_PATH or SHARD_PIDL
447 * pv [IN] string or pidl, NULL clears the list
449 * NOTES
450 * exported by name
452 DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
453 { if (SHARD_PIDL==uFlags)
454 { FIXME (shell,"(0x%08x,pidl=%p):stub.\n", uFlags,pv);
456 else
457 { FIXME (shell,"(0x%08x,%s):stub.\n", uFlags,(char*)pv);
459 return 0;
461 /*************************************************************************
462 * SHFileOperation32 [SHELL32.242]
465 DWORD WINAPI SHFileOperationAW(DWORD x)
466 { FIXME(shell,"0x%08lx stub\n",x);
467 return 0;
471 /*************************************************************************
472 * SHFileOperation32A [SHELL32.243]
474 * NOTES
475 * exported by name
477 DWORD WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp)
478 { FIXME (shell,"(%p):stub.\n", lpFileOp);
479 return 1;
481 /*************************************************************************
482 * SHFileOperation32W [SHELL32.244]
484 * NOTES
485 * exported by name
487 DWORD WINAPI SHFileOperationW (LPSHFILEOPSTRUCTW lpFileOp)
488 { FIXME (shell,"(%p):stub.\n", lpFileOp);
489 return 1;
492 /*************************************************************************
493 * SHChangeNotify [SHELL32.239]
495 * NOTES
496 * exported by name
498 DWORD WINAPI SHChangeNotify (
499 INT wEventId, /* [IN] flags that specifies the event*/
500 UINT uFlags, /* [IN] the meaning of dwItem[1|2]*/
501 LPCVOID dwItem1,
502 LPCVOID dwItem2)
503 { FIXME (shell,"(0x%08x,0x%08ux,%p,%p):stub.\n", wEventId,uFlags,dwItem1,dwItem2);
504 return 0;
506 /*************************************************************************
507 * SHCreateShellFolderViewEx [SHELL32.174]
509 * NOTES
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);
516 return 0;
518 /*************************************************************************
519 * SHFind_InitMenuPopup [SHELL32.149]
521 * NOTES
522 * Registers the menu behind the "Start" button
524 * PARAMETERS
525 * hMenu [in] handel of menu previously created
526 * hWndParent [in] parent window
527 * w [in] no pointer
528 * x [in] no pointer
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);
533 return 0;
535 /*************************************************************************
536 * FileMenu_InitMenuPopup [SHELL32.109]
539 HRESULT WINAPI FileMenu_InitMenuPopup (DWORD hmenu)
540 { FIXME(shell,"hmenu=0x%lx stub\n",hmenu);
541 return 0;
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);
552 return 0;
554 /*************************************************************************
555 * FileMenu_TrackPopupMenuEx [SHELL32.116]
557 * PARAMETERS
558 * uFlags [in] according to TrackPopupMenuEx
559 * posX [in]
560 * posY [in]
561 * hWndParent [in]
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);
567 return 0;
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);
575 return 0;
577 /*************************************************************************
578 * SHRunControlPanel [SHELL32.161]
581 HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z)
582 { FIXME(shell,"0x%08lx 0x%08lx stub\n",x,z);
583 return 0;
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];
600 LPSTR pos;
601 int gap, len;
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);
610 if (sei->lpFile)
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);
633 else
634 { if (sei->fMask & SEE_MASK_IDLIST )
635 { /* %I is the adress of a global item ID*/
636 pos = strstr(szCommandline, "%I");
637 if (pos)
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);
643 len = strlen(pos)-2;
644 memmove(pos+gap,pos+2,len);
645 memcpy(pos,szPidl,gap);
651 pos = strstr(szCommandline, ",%L"); /* dunno what it means: kill it*/
652 if (pos)
653 { len = strlen(pos)-2;
654 *pos=0x0;
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;
676 DWORD ret;
678 TRACE (shell,"%p\n", sei);
680 memcpy(&seiA, sei, sizeof(SHELLEXECUTEINFOA));
682 if (sei->lpVerb)
683 seiA.lpVerb = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpVerb);
685 if (sei->lpFile)
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);
696 else
697 seiA.lpClass = NULL;
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 );
707 return ret;
710 static LPUNKNOWN SHELL32_IExplorerInterface=0;
711 /*************************************************************************
712 * SHSetInstanceExplorer [SHELL32.176]
714 * NOTES
715 * Sets the interface
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]
725 * NOTES
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)
734 return E_FAIL;
736 SHELL32_IExplorerInterface->lpvtbl->fnAddRef(SHELL32_IExplorerInterface);
737 return NOERROR;
739 /*************************************************************************
740 * SHFreeUnusedLibraries [SHELL32.123]
742 * NOTES
743 * exported by name
745 HRESULT WINAPI SHFreeUnusedLibraries (void)
746 { FIXME(shell,"stub\n");
747 return TRUE;
749 /*************************************************************************
750 * DAD_ShowDragImage [SHELL32.137]
752 * NOTES
753 * exported by name
755 HRESULT WINAPI DAD_ShowDragImage (DWORD u)
756 { FIXME(shell,"0x%08lx stub\n",u);
757 return 0;
759 /*************************************************************************
760 * FileMenu_Destroy [SHELL32.118]
762 * NOTES
763 * exported by name
765 HRESULT WINAPI FileMenu_Destroy (DWORD u)
766 { FIXME(shell,"0x%08lx stub\n",u);
767 return 0;
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),
783 phkResult);
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,
800 DWORD y, DWORD z)
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);
803 return 0;
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]
819 * FIXME
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)
825 { DWORD ret;
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);
829 return ret;
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);
838 return 0;
840 /*************************************************************************
841 * WriteCabinetState [NT 4.0:SHELL32.652]
844 HRESULT WINAPI WriteCabinetState(DWORD u)
845 { FIXME(shell,"0x%04lx stub\n",u);
846 return 0;
848 /*************************************************************************
849 * FileIconInit [SHELL32.660]
852 BOOL WINAPI FileIconInit(BOOL bFullInit)
853 { FIXME(shell,"(%s)\n", bFullInit ? "true" : "false");
854 return 0;
856 /*************************************************************************
857 * IsUserAdmin [NT 4.0:SHELL32.680]
860 HRESULT WINAPI IsUserAdmin(void)
861 { FIXME(shell,"stub\n");
862 return TRUE;
864 /*************************************************************************
865 * StrRetToStrN [SHELL32.96]
867 * converts a STRRET to a normal string
869 * NOTES
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);
875 switch (src->uType)
876 { case STRRET_WSTR:
877 WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL);
878 SHFree(src->u.pOleStr);
879 break;
881 case STRRET_CSTRA:
882 if (VERSION_OsIsUnicode())
883 lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len);
884 else
885 strncpy((LPSTR)dest, src->u.cStr, len);
886 break;
888 case STRRET_OFFSETA:
889 if (pidl)
890 { if(VERSION_OsIsUnicode())
891 lstrcpynAtoW((LPWSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
892 else
893 strncpy((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
894 break;
897 default:
898 FIXME(shell,"unknown type!\n");
899 if (len)
900 { *(LPSTR)dest = '\0';
902 return(FALSE);
904 return(TRUE);
907 /*************************************************************************
908 * StrChrW [NT 4.0:SHELL32.651]
911 LPWSTR WINAPI StrChrW (LPWSTR str, WCHAR x )
912 { LPWSTR ptr=str;
914 TRACE(shell,"%s 0x%04x\n",debugstr_w(str),x);
916 { if (*ptr==x)
917 { return ptr;
919 ptr++;
920 } while (*ptr);
921 return NULL;
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);
930 return 0;
933 /*************************************************************************
934 * SHAllocShared [SHELL32.520]
936 * NOTES
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)
946 { HGLOBAL hmem;
947 LPVOID pmem;
949 TRACE(shell,"ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID);
950 hmem = GlobalAlloc(GMEM_FIXED, size);
951 if (!hmem)
952 return 0;
954 pmem = GlobalLock (hmem);
956 if (! pmem)
957 return 0;
959 memcpy (pmem, psrc, size);
960 GlobalUnlock(hmem);
961 return hmem;
963 /*************************************************************************
964 * SHLockShared [SHELL32.521]
966 * NOTES
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]
979 * NOTES
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]
989 * NOTES
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 );
1004 return 0;
1006 /*************************************************************************
1007 * SHLoadOLE32 [SHELL32.151]
1010 HRESULT WINAPI SHLoadOLE(DWORD u)
1011 { FIXME(shell,"0x%04lx stub\n",u);
1012 return S_OK;
1014 /*************************************************************************
1015 * Shell_MergeMenus32 [SHELL32.67]
1018 BOOL _SHIsMenuSeparator(HMENU hm, int i)
1020 MENUITEMINFOA mii;
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))
1026 { return(FALSE);
1029 if (mii.fType & MFT_SEPARATOR)
1030 { return(TRUE);
1033 return(FALSE);
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)
1038 { int nItem;
1039 HMENU hmSubMenu;
1040 BOOL bAlreadySeparated;
1041 MENUITEMINFOA miiSrc;
1042 char szName[256];
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)
1049 { return uIDMax;
1052 nItem = GetMenuItemCount(hmDst);
1053 if (uInsert >= (UINT)nItem)
1054 { uInsert = (UINT)nItem;
1055 bAlreadySeparated = TRUE;
1057 else
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))
1079 { continue;
1081 if (miiSrc.fType & MFT_SEPARATOR)
1082 { /* This is a separator; don't put two of them in a row*/
1083 if (bAlreadySeparated)
1084 { continue;
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)
1093 { continue;
1095 if (uIDMax <= miiSrc.wID)
1096 { uIDMax = miiSrc.wID + 1;
1099 else
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)
1106 { return(uIDMax);
1108 uTemp = Shell_MergeMenus(miiSrc.hSubMenu, hmSubMenu, 0, uIDAdjust, uIDAdjustMax, uFlags&MM_SUBMENUSHAVEIDS);
1109 if (uIDMax <= uTemp)
1110 { uIDMax = uTemp;
1112 bAlreadySeparated = FALSE;
1114 else
1115 { /* Adjust the ID and check it*/
1116 miiSrc.wID += uIDAdjust;
1117 if (miiSrc.wID > uIDAdjustMax)
1118 { continue;
1120 if (uIDMax <= miiSrc.wID)
1121 { uIDMax = miiSrc.wID + 1;
1123 bAlreadySeparated = FALSE;
1125 if (!InsertMenuItemA(hmDst, uInsert, TRUE, &miiSrc))
1126 { return(uIDMax);
1130 /* Ensure the correct number of separators at the beginning of the
1131 inserted menu items*/
1132 if (uInsert == 0)
1133 { if (bAlreadySeparated)
1134 { DeleteMenu(hmDst, uInsert, MF_BYPOSITION);
1137 else
1138 { if (_SHIsMenuSeparator(hmDst, uInsert-1))
1139 { if (bAlreadySeparated)
1140 { DeleteMenu(hmDst, uInsert, MF_BYPOSITION);
1143 else
1144 { if ((uFlags & MM_ADDSEPARATOR) && !bAlreadySeparated)
1145 { /* Add a separator between the menus*/
1146 InsertMenuA(hmDst, uInsert, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
1150 return(uIDMax);
1153 /*************************************************************************
1154 * DriveType32 [SHELL32.64]
1157 HRESULT WINAPI DriveType(DWORD u)
1158 { FIXME(shell,"0x%04lx stub\n",u);
1159 return 0;
1161 /*************************************************************************
1162 * SHAbortInvokeCommand [SHELL32.198]
1165 HRESULT WINAPI SHAbortInvokeCommand(void)
1166 { FIXME(shell,"stub\n");
1167 return 1;
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);
1175 return 0;
1177 /*************************************************************************
1178 * SHFlushClipboard [SHELL32.121]
1181 HRESULT WINAPI SHFlushClipboard(void)
1182 { FIXME(shell,"stub\n");
1183 return 1;
1185 /*************************************************************************
1186 * StrRChrW [SHELL32.320]
1189 LPWSTR WINAPI StrRChrW(LPWSTR lpStart, LPWSTR lpEnd, DWORD wMatch)
1190 { LPWSTR wptr=NULL;
1191 TRACE(shell,"%s %s 0x%04x\n",debugstr_w(lpStart),debugstr_w(lpEnd), (WCHAR)wMatch );
1193 /* if the end not given, search*/
1194 if (!lpEnd)
1195 { lpEnd=lpStart;
1196 while (*lpEnd)
1197 lpEnd++;
1201 { if (*lpStart==(WCHAR)wMatch)
1202 wptr = lpStart;
1203 lpStart++;
1204 } while ( lpStart<=lpEnd );
1205 return wptr;
1207 /*************************************************************************
1208 * StrFormatByteSize [SHLWAPI]
1210 LPSTR WINAPI StrFormatByteSizeA ( DWORD dw, LPSTR pszBuf, UINT cchBuf )
1211 { char buf[64];
1212 TRACE(shell,"%lx %p %i\n", dw, pszBuf, cchBuf);
1213 if ( dw<1024L )
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);
1222 else
1223 { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L);
1225 strncpy (pszBuf, buf, cchBuf);
1226 return pszBuf;
1228 LPWSTR WINAPI StrFormatByteSizeW ( DWORD dw, LPWSTR pszBuf, UINT cchBuf )
1229 { char buf[64];
1230 TRACE(shell,"%lx %p %i\n", dw, pszBuf, cchBuf);
1231 if ( dw<1024L )
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);
1240 else
1241 { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L);
1243 lstrcpynAtoW (pszBuf, buf, cchBuf);
1244 return pszBuf;
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);
1252 return 0;
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);
1260 return 0;
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);
1268 return 0;