2 * The parameters of many functions changes between different OS versions
3 * (NT uses Unicode strings, 95 uses ASCII strings)
5 * Copyright 1997 Marcus Meissner
11 #include "debugtools.h"
13 #include "winversion.h"
18 #include "shell32_main.h"
19 #include "wine/undocshell.h"
21 DEFAULT_DEBUG_CHANNEL(shell)
23 /* shell policy data */
24 #define SHELL_MAX_POLICIES 57 /* number in Win98 */
25 unsigned long shell_policies[SHELL_MAX_POLICIES];
27 /*************************************************************************
28 * SHChangeNotifyRegister [SHELL32.2]
31 * Idlist is an array of structures and Count specifies how many items in the array
32 * (usually just one I think).
35 SHChangeNotifyRegister(
42 { FIXME("(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):stub.\n",
43 hwnd,events1,events2,msg,count,idlist);
46 /*************************************************************************
47 * SHChangeNotifyDeregister [SHELL32.4]
50 SHChangeNotifyDeregister(LONG x1)
51 { FIXME("(0x%08lx):stub.\n",x1);
54 /*************************************************************************
55 * NTSHChangeNotifyRegister [SHELL32.640]
57 * Idlist is an array of structures and Count specifies how many items in the array
58 * (usually just one I think).
60 DWORD WINAPI NTSHChangeNotifyRegister(
67 { FIXME("(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):stub.\n",
68 hwnd,events1,events2,msg,count,idlist);
71 /*************************************************************************
72 * NTSHChangeNotifyDeregister [SHELL32.641]
74 DWORD WINAPI NTSHChangeNotifyDeregister(LONG x1)
75 { FIXME("(0x%08lx):stub.\n",x1);
79 /*************************************************************************
80 * ParseField [SHELL32.58]
83 DWORD WINAPI ParseFieldA(LPCSTR src, DWORD field, LPSTR dst, DWORD len)
84 { WARN("('%s',0x%08lx,%p,%ld) semi-stub.\n",src,field,dst,len);
86 if (!src || !src[0] || !dst || !len)
92 { if (*src==0x0) return FALSE;
93 if (*src==',') field--;
98 while (*src!=0x00 && *src!=',' && len>0)
99 { *dst=*src; dst++, src++; len--;
106 /*************************************************************************
107 * PickIconDlg [SHELL32.62]
110 DWORD WINAPI PickIconDlg(DWORD x,DWORD y,DWORD z,DWORD a)
111 { FIXME("(%08lx,%08lx,%08lx,%08lx):stub.\n",x,y,z,a);
115 /*************************************************************************
116 * GetFileNameFromBrowse [SHELL32.63]
119 DWORD WINAPI GetFileNameFromBrowse(HWND howner, LPSTR targetbuf, DWORD len, DWORD x, LPCSTR suffix, LPCSTR y, LPCSTR cmd)
120 { FIXME("(%04x,%p,%ld,%08lx,%s,%s,%s):stub.\n",
121 howner,targetbuf,len,x,suffix,y,cmd);
122 /* puts up a Open Dialog and requests input into targetbuf */
123 /* OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST|OFN_unknown */
124 lstrcpyA(targetbuf,"x:\\dummy.exe");
128 /*************************************************************************
129 * SHGetSettings [SHELL32.68]
132 * the registry path are for win98 (tested)
133 * and possibly are the same in nt40
135 void WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask, DWORD dwx)
139 DWORD dwDataSize = sizeof (DWORD);
141 TRACE("(%p 0x%08lx 0x%08lx)\n",lpsfs,dwMask, dwx);
143 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
144 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0))
147 if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize))
148 lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1);
150 if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize))
151 lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1);
153 if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize))
154 lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1);
156 if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize))
157 lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1);
159 if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize))
160 lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1);
162 if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize))
163 lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1);
165 if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize))
167 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
168 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
170 else if (dwData == 1)
171 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 1;
172 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
174 else if (dwData == 2)
175 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
176 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 1;
181 TRACE("-- 0x%04x\n", *(WORD*)lpsfs);
184 /*************************************************************************
185 * SHShellFolderView_Message [SHELL32.73]
188 * hwndCabinet defines the explorer cabinet window that contains the
189 * shellview you need to communicate with
190 * uMsg identifying the SFVM enum to perform
194 * Message SFVM_REARRANGE = 1
195 * This message gets sent when a column gets clicked to instruct the
196 * shell view to re-sort the item list. lParam identifies the column
199 int WINAPI SHShellFolderView_Message(HWND hwndCabinet,UINT uMsg,LPARAM lParam)
200 { FIXME("%04x %08ux %08lx stub\n",hwndCabinet,uMsg,lParam);
204 /*************************************************************************
205 * OleStrToStrN [SHELL32.78]
207 BOOL WINAPI OleStrToStrNA (LPSTR lpStr, INT nStr, LPCWSTR lpOle, INT nOle)
209 TRACE("%p %x %s %x\n", lpStr, nStr, debugstr_w(lpOle), nOle);
210 return WideCharToMultiByte (0, 0, lpOle, nOle, lpStr, nStr, NULL, NULL);
213 BOOL WINAPI OleStrToStrNW (LPWSTR lpwStr, INT nwStr, LPCWSTR lpOle, INT nOle)
215 TRACE("%p %x %s %x\n", lpwStr, nwStr, debugstr_w(lpOle), nOle);
217 if (lstrcpynW ( lpwStr, lpOle, nwStr))
218 { return lstrlenW (lpwStr);
223 BOOL WINAPI OleStrToStrNAW (LPVOID lpOut, INT nOut, LPCVOID lpIn, INT nIn)
225 if (VERSION_OsIsUnicode())
226 return OleStrToStrNW (lpOut, nOut, lpIn, nIn);
227 return OleStrToStrNA (lpOut, nOut, lpIn, nIn);
230 /*************************************************************************
231 * StrToOleStrN [SHELL32.79]
232 * lpMulti, nMulti, nWide [IN]
235 BOOL WINAPI StrToOleStrNA (LPWSTR lpWide, INT nWide, LPCSTR lpStrA, INT nStr)
237 TRACE("%p %x %s %x\n", lpWide, nWide, lpStrA, nStr);
238 return MultiByteToWideChar (0, 0, lpStrA, nStr, lpWide, nWide);
240 BOOL WINAPI StrToOleStrNW (LPWSTR lpWide, INT nWide, LPCWSTR lpStrW, INT nStr)
242 TRACE("%p %x %s %x\n", lpWide, nWide, debugstr_w(lpStrW), nStr);
244 if (lstrcpynW (lpWide, lpStrW, nWide))
245 { return lstrlenW (lpWide);
250 BOOL WINAPI StrToOleStrNAW (LPWSTR lpWide, INT nWide, LPCVOID lpStr, INT nStr)
252 if (VERSION_OsIsUnicode())
253 return StrToOleStrNW (lpWide, nWide, lpStr, nStr);
254 return StrToOleStrNA (lpWide, nWide, lpStr, nStr);
257 /*************************************************************************
258 * RegisterShellHook [SHELL32.181]
261 * hwnd [I] window handle
265 * exported by ordinal
267 void WINAPI RegisterShellHook(HWND hwnd, DWORD y) {
268 FIXME("(0x%08x,0x%08lx):stub.\n",hwnd,y);
270 /*************************************************************************
271 * ShellMessageBoxW [SHELL32.182]
273 * Format and output errormessage.
275 * idText resource ID of title or LPSTR
276 * idTitle resource ID of title or LPSTR
279 * exported by ordinal
282 ShellMessageBoxW(HMODULE hmod,HWND hwnd,DWORD idText,DWORD idTitle,DWORD uType,LPCVOID arglist)
283 { WCHAR szText[100],szTitle[100],szTemp[256];
284 LPWSTR pszText = &szText[0], pszTitle = &szTitle[0];
285 LPVOID args = &arglist;
287 TRACE("(%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n",(DWORD)hmod,(DWORD)hwnd,idText,idTitle,uType,arglist);
289 if (!HIWORD (idTitle))
290 LoadStringW(hmod,idTitle,pszTitle,100);
292 pszTitle = (LPWSTR)idTitle;
294 if (! HIWORD (idText))
295 LoadStringW(hmod,idText,pszText,100);
297 pszText = (LPWSTR)idText;
299 FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY ,szText,0,0,szTemp,256,args);
300 return MessageBoxW(hwnd,szTemp,szTitle,uType);
303 /*************************************************************************
304 * ShellMessageBoxA [SHELL32.183]
307 ShellMessageBoxA(HMODULE hmod,HWND hwnd,DWORD idText,DWORD idTitle,DWORD uType,LPCVOID arglist)
308 { char szText[100],szTitle[100],szTemp[256];
309 LPSTR pszText = &szText[0], pszTitle = &szTitle[0];
310 LPVOID args = &arglist;
312 TRACE("(%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n", (DWORD)hmod,(DWORD)hwnd,idText,idTitle,uType,arglist);
314 if (!HIWORD (idTitle))
315 LoadStringA(hmod,idTitle,pszTitle,100);
317 pszTitle = (LPSTR)idTitle;
319 if (! HIWORD (idText))
320 LoadStringA(hmod,idText,pszText,100);
322 pszText = (LPSTR)idText;
324 FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY ,pszText,0,0,szTemp,256,args);
325 return MessageBoxA(hwnd,szTemp,pszTitle,uType);
328 /*************************************************************************
329 * SHRestricted [SHELL32.100]
331 * walks through policy table, queries <app> key, <type> value, returns
332 * queried (DWORD) value.
333 * {0x00001,Explorer,NoRun}
334 * {0x00002,Explorer,NoClose}
335 * {0x00004,Explorer,NoSaveSettings}
336 * {0x00008,Explorer,NoFileMenu}
337 * {0x00010,Explorer,NoSetFolders}
338 * {0x00020,Explorer,NoSetTaskbar}
339 * {0x00040,Explorer,NoDesktop}
340 * {0x00080,Explorer,NoFind}
341 * {0x00100,Explorer,NoDrives}
342 * {0x00200,Explorer,NoDriveAutoRun}
343 * {0x00400,Explorer,NoDriveTypeAutoRun}
344 * {0x00800,Explorer,NoNetHood}
345 * {0x01000,Explorer,NoStartBanner}
346 * {0x02000,Explorer,RestrictRun}
347 * {0x04000,Explorer,NoPrinterTabs}
348 * {0x08000,Explorer,NoDeletePrinter}
349 * {0x10000,Explorer,NoAddPrinter}
350 * {0x20000,Explorer,NoStartMenuSubFolders}
351 * {0x40000,Explorer,MyDocsOnNet}
352 * {0x80000,WinOldApp,NoRealMode}
355 * exported by ordinal
357 DWORD WINAPI SHRestricted (DWORD pol) {
360 FIXME("(%08lx):stub.\n",pol);
361 if (RegOpenKeyA(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Policies",&xhkey))
363 /* FIXME: do nothing for now, just return 0 (== "allowed") */
368 /*************************************************************************
369 * SHInitRestricted [SHELL32.244]
371 * Win98+ by-ordinal only routine called by Explorer and MSIE 4 and 5.
374 * Two inputs: one is a string or NULL. If non-NULL the pointer
375 * should point to a string containing the following exact text:
376 * "Software\Microsoft\Windows\CurrentVersion\Policies".
377 * The other input is unused.
380 * If the input is non-NULL and does not point to a string containing
381 * that exact text the routine will do nothing.
383 * If the text does match or the pointer is NULL, then the routine
384 * will init SHRestricted()'s policy table to all 0xffffffff and
385 * returns 0xffffffff as well.
387 * I haven't yet run into anything calling this with inputs other than
388 * (NULL, NULL), so I may have the inputs reversed.
391 BOOL WINAPI SHInitRestricted(LPSTR inpRegKey, LPSTR parm2)
395 TRACE("(%p, %p)\n", inpRegKey, parm2);
397 /* first check - if input is non-NULL and points to the secret
398 key string, then pass. Otherwise return 0.
401 if (inpRegKey != (LPSTR)NULL)
403 if (lstrcmpiA(inpRegKey, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies"))
405 /* doesn't match, fail */
410 /* check passed, init all policy table entries with 0xffffffff */
411 for (i = 0; i < SHELL_MAX_POLICIES; i++)
413 shell_policies[i] = 0xffffffff;
419 /*************************************************************************
420 * SHCreateDirectory [SHELL32.165]
423 * exported by ordinal
424 * not sure about LPSECURITY_ATTRIBUTES
426 DWORD WINAPI SHCreateDirectory(LPSECURITY_ATTRIBUTES sec,LPCSTR path) {
427 TRACE("(%p,%s):stub.\n",sec,path);
428 if (CreateDirectoryA(path,sec))
430 /* SHChangeNotify(8,1,path,0); */
433 if (SHELL32_79(path,(LPVOID)x))
435 FIXME("(%08lx,%s):stub.\n",x,path);
440 /*************************************************************************
441 * SHFree [SHELL32.195]
444 * free_ptr() - frees memory using IMalloc
445 * exported by ordinal
447 /*#define MEM_DEBUG 1*/
448 DWORD WINAPI SHFree(LPVOID x)
451 WORD len = *(LPWORD)(x-2);
453 if ( *(LPWORD)(x+len) != 0x7384)
456 if ( (*(LPWORD)(x-4)) != 0x8271)
459 memset(x-4, 0xde, len+6);
461 TRACE("%p len=%u\n",x, len);
467 return HeapFree(GetProcessHeap(), 0, x);
470 /*************************************************************************
471 * SHAlloc [SHELL32.196]
474 * void *task_alloc(DWORD len), uses SHMalloc allocator
475 * exported by ordinal
477 LPVOID WINAPI SHAlloc(DWORD len)
482 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len+6);
484 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len);
488 *(LPWORD)(ret) = 0x8271;
489 *(LPWORD)(ret+2) = (WORD)len;
490 *(LPWORD)(ret+4+len) = 0x7384;
492 memset(ret, 0xdf, len);
494 TRACE("%lu bytes at %p\n",len, ret);
498 /*************************************************************************
499 * SHRegisterDragDrop [SHELL32.86]
502 * exported by ordinal
504 DWORD WINAPI SHRegisterDragDrop(HWND hWnd,IDropTarget * pDropTarget)
506 FIXME("(0x%08x,%p):stub.\n", hWnd, pDropTarget);
507 return RegisterDragDrop(hWnd, pDropTarget);
510 /*************************************************************************
511 * SHRevokeDragDrop [SHELL32.87]
514 * exported by ordinal
516 DWORD WINAPI SHRevokeDragDrop(DWORD x) {
517 FIXME("(0x%08lx):stub.\n",x);
521 /*************************************************************************
522 * SHDoDragDrop [SHELL32.88]
525 * exported by ordinal
527 DWORD WINAPI SHDoDragDrop(DWORD u, DWORD v, DWORD w, DWORD x, DWORD y, DWORD z) {
528 FIXME("(0x%08lx 0x%08lx 0x%08lx 0x%08lx 0x%08lx 0x%08lx):stub.\n",u,v,w,x,y,z);
532 /*************************************************************************
533 * RunFileDlg [SHELL32.61]
536 * Original name: RunFileDlg (exported by ordinal)
539 RunFileDlg (HWND hwndOwner, DWORD dwParam1, DWORD dwParam2,
540 LPSTR lpszTitle, LPSTR lpszPrompt, UINT uFlags)
542 FIXME("(0x%08x 0x%lx 0x%lx \"%s\" \"%s\" 0x%x):stub.\n",
543 hwndOwner, dwParam1, dwParam2, lpszTitle, lpszPrompt, uFlags);
547 /*************************************************************************
548 * ExitWindowsDialog [SHELL32.60]
551 * exported by ordinal
553 void WINAPI ExitWindowsDialog (HWND hWndOwner)
555 TRACE("(0x%08x)\n", hWndOwner);
556 if (MessageBoxA( hWndOwner, "Do you want to exit WINE?", "Shutdown", MB_YESNO|MB_ICONQUESTION) == IDOK)
557 { SendMessageA ( hWndOwner, WM_QUIT, 0, 0);
561 /*************************************************************************
562 * ArrangeWindows [SHELL32.184]
566 ArrangeWindows (DWORD dwParam1, DWORD dwParam2, DWORD dwParam3,
567 DWORD dwParam4, DWORD dwParam5)
569 FIXME("(0x%lx 0x%lx 0x%lx 0x%lx 0x%lx):stub.\n",
570 dwParam1, dwParam2, dwParam3, dwParam4, dwParam5);
574 /*************************************************************************
575 * SignalFileOpen [SHELL32.103]
578 * exported by ordinal
581 SignalFileOpen (DWORD dwParam1)
583 FIXME("(0x%08lx):stub.\n", dwParam1);
588 /*************************************************************************
589 * SHAddToRecentDocs [SHELL32.234]
592 * uFlags [IN] SHARD_PATH or SHARD_PIDL
593 * pv [IN] string or pidl, NULL clears the list
598 DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
599 { if (SHARD_PIDL==uFlags)
600 { FIXME("(0x%08x,pidl=%p):stub.\n", uFlags,pv);
603 { FIXME("(0x%08x,%s):stub.\n", uFlags,(char*)pv);
607 /*************************************************************************
608 * SHFileOperation [SHELL32.242]
611 DWORD WINAPI SHFileOperationAW(DWORD x)
612 { FIXME("0x%08lx stub\n",x);
617 /*************************************************************************
618 * SHFileOperationA [SHELL32.243]
623 DWORD WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp)
624 { FIXME("(%p):stub.\n", lpFileOp);
627 /*************************************************************************
628 * SHFileOperationW [SHELL32.244]
633 DWORD WINAPI SHFileOperationW (LPSHFILEOPSTRUCTW lpFileOp)
634 { FIXME("(%p):stub.\n", lpFileOp);
638 /*************************************************************************
639 * SHChangeNotify [SHELL32.239]
644 DWORD WINAPI SHChangeNotify (
645 INT wEventId, /* [IN] flags that specifies the event*/
646 UINT uFlags, /* [IN] the meaning of dwItem[1|2]*/
649 { FIXME("(0x%08x,0x%08ux,%p,%p):stub.\n", wEventId,uFlags,dwItem1,dwItem2);
652 /*************************************************************************
653 * SHCreateShellFolderViewEx [SHELL32.174]
656 * see IShellFolder::CreateViewObject
658 HRESULT WINAPI SHCreateShellFolderViewEx(
659 LPSHELLVIEWDATA psvcbi, /*[in ] shelltemplate struct*/
660 LPVOID* ppv) /*[out] IShellView pointer*/
665 TRACE("sf=%p pidl=%p cb=%p mode=0x%08lx parm=0x%08lx\n",
666 psvcbi->pShellFolder, psvcbi->pidl, psvcbi->pCallBack, psvcbi->viewmode, psvcbi->dwUserParam);
668 psf = IShellView_Constructor(psvcbi->pShellFolder);
671 return E_OUTOFMEMORY;
673 IShellView_AddRef(psf);
674 hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv);
675 IShellView_Release(psf);
679 /*************************************************************************
680 * SHWinHelp [SHELL32.127]
683 HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z)
684 { FIXME("0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z);
687 /*************************************************************************
688 * SHRunControlPanel [SHELL32.161]
691 HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z)
692 { FIXME("0x%08lx 0x%08lx stub\n",x,z);
695 /*************************************************************************
696 * ShellExecuteEx [SHELL32.291]
699 BOOL WINAPI ShellExecuteExAW (LPVOID sei)
700 { if (VERSION_OsIsUnicode())
701 return ShellExecuteExW (sei);
702 return ShellExecuteExA (sei);
704 /*************************************************************************
705 * ShellExecuteExA [SHELL32.292]
708 BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei)
709 { CHAR szApplicationName[MAX_PATH],szCommandline[MAX_PATH],szPidl[20];
712 STARTUPINFOA startupinfo;
713 PROCESS_INFORMATION processinformation;
715 WARN("mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n",
716 sei->fMask, sei->hwnd, sei->lpVerb, sei->lpFile,
717 sei->lpParameters, sei->lpDirectory, sei->nShow,
718 (sei->fMask & SEE_MASK_CLASSNAME) ? sei->lpClass : "not used");
720 ZeroMemory(szApplicationName,MAX_PATH);
722 strcpy(szApplicationName, sei->lpFile);
724 ZeroMemory(szCommandline,MAX_PATH);
725 if (sei->lpParameters)
726 strcpy(szCommandline, sei->lpParameters);
728 if (sei->fMask & (SEE_MASK_CLASSKEY | SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY |
729 SEE_MASK_NOCLOSEPROCESS | SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT |
730 SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE |
731 SEE_MASK_NO_CONSOLE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR ))
732 { FIXME("flags ignored: 0x%08lx\n", sei->fMask);
735 if (sei->fMask & SEE_MASK_CLASSNAME)
736 { HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, 256);
739 /* process the IDList */
740 if ( (sei->fMask & SEE_MASK_INVOKEIDLIST) == SEE_MASK_INVOKEIDLIST) /*0x0c*/
741 { SHGetPathFromIDListA (sei->lpIDList,szApplicationName);
742 TRACE("-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName);
745 { if (sei->fMask & SEE_MASK_IDLIST )
746 { /* %I is the adress of a global item ID*/
747 pos = strstr(szCommandline, "%I");
749 { HGLOBAL hmem = SHAllocShared ( sei->lpIDList, ILGetSize(sei->lpIDList), 0);
750 sprintf(szPidl,":%li",(DWORD)SHLockShared(hmem,0) );
751 SHUnlockShared(hmem);
753 gap = strlen(szPidl);
755 memmove(pos+gap,pos+2,len);
756 memcpy(pos,szPidl,gap);
762 pos = strstr(szCommandline, ",%L"); /* dunno what it means: kill it*/
764 { len = strlen(pos)-2;
766 memmove(pos,pos+3,len);
769 TRACE("execute: %s %s\n",szApplicationName, szCommandline);
771 ZeroMemory(&startupinfo,sizeof(STARTUPINFOA));
772 startupinfo.cb = sizeof(STARTUPINFOA);
774 return CreateProcessA(szApplicationName[0] ? szApplicationName:NULL,
775 szCommandline[0] ? szCommandline : NULL,
776 NULL, NULL, FALSE, 0,
777 NULL, NULL, &startupinfo, &processinformation);
781 /*************************************************************************
782 * ShellExecuteExW [SHELL32.293]
785 BOOL WINAPI ShellExecuteExW (LPSHELLEXECUTEINFOW sei)
786 { SHELLEXECUTEINFOA seiA;
791 memcpy(&seiA, sei, sizeof(SHELLEXECUTEINFOA));
794 seiA.lpVerb = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpVerb);
797 seiA.lpFile = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpFile);
799 if (sei->lpParameters)
800 seiA.lpParameters = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpParameters);
802 if (sei->lpDirectory)
803 seiA.lpDirectory = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpDirectory);
805 if ((sei->fMask & SEE_MASK_CLASSNAME) && sei->lpClass)
806 seiA.lpClass = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpClass);
810 ret = ShellExecuteExA(&seiA);
812 if (seiA.lpVerb) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpVerb );
813 if (seiA.lpFile) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpFile );
814 if (seiA.lpParameters) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpParameters );
815 if (seiA.lpDirectory) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpDirectory );
816 if (seiA.lpClass) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpClass );
821 static LPUNKNOWN SHELL32_IExplorerInterface=0;
822 /*************************************************************************
823 * SHSetInstanceExplorer [SHELL32.176]
828 HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown)
829 { TRACE("%p\n", lpUnknown);
830 SHELL32_IExplorerInterface = lpUnknown;
831 return (HRESULT) lpUnknown;
833 /*************************************************************************
834 * SHGetInstanceExplorer [SHELL32.256]
837 * gets the interface pointer of the explorer and a reference
839 HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown)
840 { TRACE("%p\n", lpUnknown);
842 *lpUnknown = SHELL32_IExplorerInterface;
844 if (!SHELL32_IExplorerInterface)
847 IUnknown_AddRef(SHELL32_IExplorerInterface);
850 /*************************************************************************
851 * SHFreeUnusedLibraries [SHELL32.123]
856 HRESULT WINAPI SHFreeUnusedLibraries (void)
860 /*************************************************************************
861 * DAD_SetDragImage [SHELL32.136]
866 HRESULT WINAPI DAD_SetDragImage (DWORD u, DWORD v)
867 { FIXME("0x%08lx 0x%08lx stub\n",u, v);
870 /*************************************************************************
871 * DAD_ShowDragImage [SHELL32.137]
876 HRESULT WINAPI DAD_ShowDragImage (DWORD u)
877 { FIXME("0x%08lx stub\n",u);
880 /*************************************************************************
881 * SHRegCloseKey [NT4.0:SHELL32.505]
884 HRESULT WINAPI SHRegCloseKey (HKEY hkey)
885 { TRACE("0x%04x\n",hkey);
886 return RegCloseKey( hkey );
888 /*************************************************************************
889 * SHRegOpenKeyA [SHELL32.506]
892 HRESULT WINAPI SHRegOpenKeyA(HKEY hKey, LPSTR lpSubKey, LPHKEY phkResult)
894 TRACE("(0x%08x, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult);
895 return RegOpenKeyA(hKey, lpSubKey, phkResult);
898 /*************************************************************************
899 * SHRegOpenKeyW [NT4.0:SHELL32.507]
902 HRESULT WINAPI SHRegOpenKeyW (HKEY hkey, LPCWSTR lpszSubKey, LPHKEY retkey)
903 { WARN("0x%04x %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
904 return RegOpenKeyW( hkey, lpszSubKey, retkey );
906 /*************************************************************************
907 * SHRegQueryValueExA [SHELL32.509]
910 HRESULT WINAPI SHRegQueryValueExA(
918 TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
919 return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
921 /*************************************************************************
922 * SHRegQueryValueW [NT4.0:SHELL32.510]
925 HRESULT WINAPI SHRegQueryValueW (HKEY hkey, LPWSTR lpszSubKey,
926 LPWSTR lpszData, LPDWORD lpcbData )
927 { WARN("0x%04x %s %p %p semi-stub\n",
928 hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
929 return RegQueryValueW( hkey, lpszSubKey, lpszData, lpcbData );
932 /*************************************************************************
933 * SHRegQueryValueExW [NT4.0:SHELL32.511]
936 * if the datatype REG_EXPAND_SZ then expand the string and change
937 * *pdwType to REG_SZ.
939 HRESULT WINAPI SHRegQueryValueExW (HKEY hkey, LPWSTR pszValue, LPDWORD pdwReserved,
940 LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData)
942 WARN("0x%04x %s %p %p %p %p semi-stub\n",
943 hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
944 ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);
948 /*************************************************************************
949 * ReadCabinetState [NT 4.0:SHELL32.651]
952 HRESULT WINAPI ReadCabinetState(DWORD u, DWORD v)
953 { FIXME("0x%04lx 0x%04lx stub\n",u,v);
956 /*************************************************************************
957 * WriteCabinetState [NT 4.0:SHELL32.652]
960 HRESULT WINAPI WriteCabinetState(DWORD u)
961 { FIXME("0x%04lx stub\n",u);
964 /*************************************************************************
965 * FileIconInit [SHELL32.660]
968 BOOL WINAPI FileIconInit(BOOL bFullInit)
969 { FIXME("(%s)\n", bFullInit ? "true" : "false");
972 /*************************************************************************
973 * IsUserAdmin [NT 4.0:SHELL32.680]
976 HRESULT WINAPI IsUserAdmin(void)
980 /*************************************************************************
981 * StrRetToStrN [SHELL32.96]
983 * converts a STRRET to a normal string
986 * the pidl is for STRRET OFFSET
988 HRESULT WINAPI StrRetToBufA (LPSTRRET src, LPITEMIDLIST pidl, LPSTR dest, DWORD len)
990 return StrRetToStrNA(dest, len, src, pidl);
993 HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
995 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
1000 WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL);
1001 SHFree(src->u.pOleStr);
1005 lstrcpynA((LPSTR)dest, src->u.cStr, len);
1008 case STRRET_OFFSETA:
1009 lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
1013 FIXME("unknown type!\n");
1016 *(LPSTR)dest = '\0';
1023 HRESULT WINAPI StrRetToBufW (LPSTRRET src, LPITEMIDLIST pidl, LPWSTR dest, DWORD len)
1025 return StrRetToStrNW(dest, len, src, pidl);
1028 HRESULT WINAPI StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
1030 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
1035 lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);
1036 SHFree(src->u.pOleStr);
1040 lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len);
1043 case STRRET_OFFSETA:
1046 lstrcpynAtoW((LPWSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
1051 FIXME("unknown type!\n");
1053 { *(LPSTR)dest = '\0';
1059 HRESULT WINAPI StrRetToStrNAW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
1061 if(VERSION_OsIsUnicode())
1062 return StrRetToStrNW (dest, len, src, pidl);
1063 return StrRetToStrNA (dest, len, src, pidl);
1066 /*************************************************************************
1067 * StrChrW [NT 4.0:SHELL32.651]
1070 LPWSTR WINAPI StrChrW (LPWSTR str, WCHAR x )
1073 TRACE("%s 0x%04x\n",debugstr_w(str),x);
1083 /*************************************************************************
1084 * StrCmpNIW [NT 4.0:SHELL32.*]
1087 INT WINAPI StrCmpNIW ( LPWSTR wstr1, LPWSTR wstr2, INT len)
1088 { FIXME("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len);
1092 /*************************************************************************
1093 * SHAllocShared [SHELL32.520]
1096 * parameter1 is return value from HeapAlloc
1097 * parameter2 is equal to the size allocated with HeapAlloc
1098 * parameter3 is return value from GetCurrentProcessId
1100 * the return value is posted as lParam with 0x402 (WM_USER+2) to somewhere
1101 * WM_USER+2 could be the undocumented CWM_SETPATH
1102 * the allocated memory contains a pidl
1104 HGLOBAL WINAPI SHAllocShared(LPVOID psrc, DWORD size, DWORD procID)
1108 TRACE("ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID);
1109 hmem = GlobalAlloc(GMEM_FIXED, size);
1113 pmem = GlobalLock (hmem);
1118 memcpy (pmem, psrc, size);
1122 /*************************************************************************
1123 * SHLockShared [SHELL32.521]
1126 * parameter1 is return value from SHAllocShared
1127 * parameter2 is return value from GetCurrentProcessId
1128 * the receiver of (WM_USER+2) trys to lock the HANDLE (?)
1129 * the returnvalue seems to be a memoryadress
1131 LPVOID WINAPI SHLockShared(HANDLE hmem, DWORD procID)
1132 { TRACE("handle=0x%04x procID=0x%04lx\n",hmem,procID);
1133 return GlobalLock(hmem);
1135 /*************************************************************************
1136 * SHUnlockShared [SHELL32.522]
1139 * parameter1 is return value from SHLockShared
1141 BOOL WINAPI SHUnlockShared(HANDLE pmem)
1142 { TRACE("handle=0x%04x\n",pmem);
1143 return GlobalUnlock(pmem);
1145 /*************************************************************************
1146 * SHFreeShared [SHELL32.523]
1149 * parameter1 is return value from SHAllocShared
1150 * parameter2 is return value from GetCurrentProcessId
1152 HANDLE WINAPI SHFreeShared(HANDLE hmem, DWORD procID)
1153 { TRACE("handle=0x%04x 0x%04lx\n",hmem,procID);
1154 return GlobalFree(hmem);
1157 /*************************************************************************
1158 * SetAppStartingCursor [SHELL32.99]
1161 HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v)
1162 { FIXME("hwnd=0x%04x 0x%04lx stub\n",u,v );
1165 /*************************************************************************
1166 * SHLoadOLE [SHELL32.151]
1169 HRESULT WINAPI SHLoadOLE(DWORD u)
1170 { FIXME("0x%04lx stub\n",u);
1173 /*************************************************************************
1174 * DriveType [SHELL32.64]
1177 HRESULT WINAPI DriveType(DWORD u)
1178 { FIXME("0x%04lx stub\n",u);
1181 /*************************************************************************
1182 * SHAbortInvokeCommand [SHELL32.198]
1185 HRESULT WINAPI SHAbortInvokeCommand(void)
1189 /*************************************************************************
1190 * SHOutOfMemoryMessageBox [SHELL32.126]
1193 HRESULT WINAPI SHOutOfMemoryMessageBox(DWORD u, DWORD v, DWORD w)
1194 { FIXME("0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w);
1197 /*************************************************************************
1198 * SHFlushClipboard [SHELL32.121]
1201 HRESULT WINAPI SHFlushClipboard(void)
1205 /*************************************************************************
1206 * StrRChrW [SHELL32.320]
1209 LPWSTR WINAPI StrRChrW(LPWSTR lpStart, LPWSTR lpEnd, DWORD wMatch)
1211 TRACE("%s %s 0x%04x\n",debugstr_w(lpStart),debugstr_w(lpEnd), (WCHAR)wMatch );
1213 /* if the end not given, search*/
1221 { if (*lpStart==(WCHAR)wMatch)
1224 } while ( lpStart<=lpEnd );
1227 /*************************************************************************
1228 * StrFormatByteSize [SHLWAPI]
1230 LPSTR WINAPI StrFormatByteSizeA ( DWORD dw, LPSTR pszBuf, UINT cchBuf )
1232 TRACE("%lx %p %i\n", dw, pszBuf, cchBuf);
1234 { sprintf (buf,"%3.1f bytes", (FLOAT)dw);
1236 else if ( dw<1048576L)
1237 { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024);
1239 else if ( dw < 1073741824L)
1240 { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L);
1243 { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L);
1245 lstrcpynA (pszBuf, buf, cchBuf);
1248 LPWSTR WINAPI StrFormatByteSizeW ( DWORD dw, LPWSTR pszBuf, UINT cchBuf )
1250 TRACE("%lx %p %i\n", dw, pszBuf, cchBuf);
1252 { sprintf (buf,"%3.1f bytes", (FLOAT)dw);
1254 else if ( dw<1048576L)
1255 { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024);
1257 else if ( dw < 1073741824L)
1258 { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L);
1261 { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L);
1263 lstrcpynAtoW (pszBuf, buf, cchBuf);
1266 /*************************************************************************
1267 * SHWaitForFileToOpen [SHELL32.97]
1270 HRESULT WINAPI SHWaitForFileToOpen(DWORD u, DWORD v, DWORD w)
1271 { FIXME("0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w);
1274 /*************************************************************************
1275 * Control_FillCache_RunDLL [SHELL32.8]
1278 HRESULT WINAPI Control_FillCache_RunDLL(HWND hWnd, HANDLE hModule, DWORD w, DWORD x)
1279 { FIXME("0x%04x 0x%04x 0x%04lx 0x%04lx stub\n",hWnd, hModule,w,x);
1282 /*************************************************************************
1283 * RunDLL_CallEntry16 [SHELL32.122]
1284 * the name is propably wrong
1286 HRESULT WINAPI RunDLL_CallEntry16(DWORD v, DWORD w, DWORD x, DWORD y, DWORD z)
1287 { FIXME("0x%04lx 0x%04lx 0x%04lx 0x%04lx 0x%04lx stub\n",v,w,x,y,z);
1291 /************************************************************************
1292 * shell32_654 [SHELL32.654]
1294 * NOTES: first parameter seems to be a pointer (same as passed to WriteCabinetState)
1295 * second one could be a size (0x0c). The size is the same as the structure saved to
1296 * HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState
1297 * I'm (js) guessing: this one is just ReadCabinetState ;-)
1299 HRESULT WINAPI shell32_654 (DWORD x, DWORD y)
1300 { FIXME("0x%08lx 0x%08lx stub\n",x,y);
1304 /************************************************************************
1305 * RLBuildListOfPaths [SHELL32.146]
1310 DWORD WINAPI RLBuildListOfPaths (void)
1314 /************************************************************************
1315 * StrToOleStr [SHELL32.163]
1318 int WINAPI StrToOleStrA (LPWSTR lpWideCharStr, LPCSTR lpMultiByteString)
1320 TRACE("%p %p(%s)\n",
1321 lpWideCharStr, lpMultiByteString, lpMultiByteString);
1323 return MultiByteToWideChar(0, 0, lpMultiByteString, -1, lpWideCharStr, MAX_PATH);
1326 int WINAPI StrToOleStrW (LPWSTR lpWideCharStr, LPCWSTR lpWString)
1328 TRACE("%p %p(%s)\n",
1329 lpWideCharStr, lpWString, debugstr_w(lpWString));
1331 if (lstrcpyW (lpWideCharStr, lpWString ))
1332 { return lstrlenW (lpWideCharStr);
1337 BOOL WINAPI StrToOleStrAW (LPWSTR lpWideCharStr, LPCVOID lpString)
1339 if (VERSION_OsIsUnicode())
1340 return StrToOleStrW (lpWideCharStr, lpString);
1341 return StrToOleStrA (lpWideCharStr, lpString);
1344 /************************************************************************
1345 * SHValidateUNC [SHELL32.173]
1348 HRESULT WINAPI SHValidateUNC (DWORD x, DWORD y, DWORD z)
1350 FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x,y,z);
1354 /************************************************************************
1355 * DoEnvironmentSubstW [SHELL32.53]
1358 HRESULT WINAPI DoEnvironmentSubstA(LPSTR x, LPSTR y)
1360 FIXME("%p(%s) %p(%s) stub\n", x, x, y, y);
1364 HRESULT WINAPI DoEnvironmentSubstW(LPWSTR x, LPWSTR y)
1366 FIXME("%p(%s) %p(%s) stub\n", x, debugstr_w(x), y, debugstr_w(y));
1370 HRESULT WINAPI DoEnvironmentSubstAW(LPVOID x, LPVOID y)
1372 if (VERSION_OsIsUnicode())
1373 return DoEnvironmentSubstW(x, y);
1374 return DoEnvironmentSubstA(x, y);
1377 /*************************************************************************
1378 * shell32_243 [SHELL32.243]
1380 * Win98+ by-ordinal routine. In Win98 this routine returns zero and
1381 * does nothing else. Possibly this does something in NT or SHELL32 5.0?
1385 BOOL WINAPI shell32_243(DWORD a, DWORD b)