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"
22 DEFAULT_DEBUG_CHANNEL(shell)
24 /*************************************************************************
25 * SHChangeNotifyRegister [SHELL32.2]
28 * Idlist is an array of structures and Count specifies how many items in the array
29 * (usually just one I think).
32 SHChangeNotifyRegister(
39 { FIXME("(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):stub.\n",
40 hwnd,events1,events2,msg,count,idlist);
43 /*************************************************************************
44 * SHChangeNotifyDeregister [SHELL32.4]
47 SHChangeNotifyDeregister(LONG x1)
48 { FIXME("(0x%08lx):stub.\n",x1);
51 /*************************************************************************
52 * NTSHChangeNotifyRegister [SHELL32.640]
54 * Idlist is an array of structures and Count specifies how many items in the array
55 * (usually just one I think).
57 DWORD WINAPI NTSHChangeNotifyRegister(
64 { FIXME("(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):stub.\n",
65 hwnd,events1,events2,msg,count,idlist);
68 /*************************************************************************
69 * NTSHChangeNotifyDeregister [SHELL32.641]
71 DWORD WINAPI NTSHChangeNotifyDeregister(LONG x1)
72 { FIXME("(0x%08lx):stub.\n",x1);
76 /*************************************************************************
77 * ParseField [SHELL32.58]
80 DWORD WINAPI ParseFieldA(LPCSTR src, DWORD field, LPSTR dst, DWORD len)
81 { WARN("('%s',0x%08lx,%p,%ld) semi-stub.\n",src,field,dst,len);
83 if (!src || !src[0] || !dst || !len)
89 { if (*src==0x0) return FALSE;
90 if (*src==',') field--;
95 while (*src!=0x00 && *src!=',' && len>0)
96 { *dst=*src; dst++, src++; len--;
103 /*************************************************************************
104 * PickIconDlg [SHELL32.62]
107 DWORD WINAPI PickIconDlg(DWORD x,DWORD y,DWORD z,DWORD a)
108 { FIXME("(%08lx,%08lx,%08lx,%08lx):stub.\n",x,y,z,a);
112 /*************************************************************************
113 * GetFileNameFromBrowse [SHELL32.63]
116 DWORD WINAPI GetFileNameFromBrowse(HWND howner, LPSTR targetbuf, DWORD len, DWORD x, LPCSTR suffix, LPCSTR y, LPCSTR cmd)
117 { FIXME("(%04x,%p,%ld,%08lx,%s,%s,%s):stub.\n",
118 howner,targetbuf,len,x,suffix,y,cmd);
119 /* puts up a Open Dialog and requests input into targetbuf */
120 /* OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST|OFN_unknown */
121 lstrcpyA(targetbuf,"x:\\dummy.exe");
125 /*************************************************************************
126 * SHGetSettings [SHELL32.68]
129 * the registry path are for win98 (tested)
130 * and possibly are the same in nt40
132 void WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask, DWORD dwx)
136 DWORD dwDataSize = sizeof (DWORD);
138 TRACE("(%p 0x%08lx 0x%08lx)\n",lpsfs,dwMask, dwx);
140 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
141 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0))
144 if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize))
145 lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1);
147 if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize))
148 lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1);
150 if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize))
151 lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1);
153 if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize))
154 lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1);
156 if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize))
157 lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1);
159 if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize))
160 lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1);
162 if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize))
164 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
165 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
167 else if (dwData == 1)
168 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 1;
169 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
171 else if (dwData == 2)
172 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
173 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 1;
178 TRACE("-- 0x%04x\n", *(WORD*)lpsfs);
181 /*************************************************************************
182 * SHShellFolderView_Message [SHELL32.73]
185 * hwndCabinet defines the explorer cabinet window that contains the
186 * shellview you need to communicate with
187 * uMsg identifying the SFVM enum to perform
191 * Message SFVM_REARRANGE = 1
192 * This message gets sent when a column gets clicked to instruct the
193 * shell view to re-sort the item list. lParam identifies the column
196 int WINAPI SHShellFolderView_Message(HWND hwndCabinet,UINT uMsg,LPARAM lParam)
197 { FIXME("%04x %08ux %08lx stub\n",hwndCabinet,uMsg,lParam);
201 /*************************************************************************
202 * OleStrToStrN [SHELL32.78]
204 BOOL WINAPI OleStrToStrNA (LPSTR lpStr, INT nStr, LPCWSTR lpOle, INT nOle)
206 TRACE("(%p, %x, %s, %x)\n", lpStr, nStr, debugstr_wn(lpOle,nOle), nOle);
207 return WideCharToMultiByte (0, 0, lpOle, nOle, lpStr, nStr, NULL, NULL);
210 BOOL WINAPI OleStrToStrNW (LPWSTR lpwStr, INT nwStr, LPCWSTR lpOle, INT nOle)
212 TRACE("(%p, %x, %s, %x)\n", lpwStr, nwStr, debugstr_wn(lpOle,nOle), nOle);
214 if (lstrcpynW ( lpwStr, lpOle, nwStr))
215 { return lstrlenW (lpwStr);
220 BOOL WINAPI OleStrToStrNAW (LPVOID lpOut, INT nOut, LPCVOID lpIn, INT nIn)
222 if (VERSION_OsIsUnicode())
223 return OleStrToStrNW (lpOut, nOut, lpIn, nIn);
224 return OleStrToStrNA (lpOut, nOut, lpIn, nIn);
227 /*************************************************************************
228 * StrToOleStrN [SHELL32.79]
229 * lpMulti, nMulti, nWide [IN]
232 BOOL WINAPI StrToOleStrNA (LPWSTR lpWide, INT nWide, LPCSTR lpStrA, INT nStr)
234 TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_an(lpStrA,nStr), nStr);
235 return MultiByteToWideChar (0, 0, lpStrA, nStr, lpWide, nWide);
237 BOOL WINAPI StrToOleStrNW (LPWSTR lpWide, INT nWide, LPCWSTR lpStrW, INT nStr)
239 TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_wn(lpStrW, nStr), nStr);
241 if (lstrcpynW (lpWide, lpStrW, nWide))
242 { return lstrlenW (lpWide);
247 BOOL WINAPI StrToOleStrNAW (LPWSTR lpWide, INT nWide, LPCVOID lpStr, INT nStr)
249 if (VERSION_OsIsUnicode())
250 return StrToOleStrNW (lpWide, nWide, lpStr, nStr);
251 return StrToOleStrNA (lpWide, nWide, lpStr, nStr);
254 /*************************************************************************
255 * RegisterShellHook [SHELL32.181]
258 * hwnd [I] window handle
262 * exported by ordinal
264 void WINAPI RegisterShellHook(HWND hwnd, DWORD y) {
265 FIXME("(0x%08x,0x%08lx):stub.\n",hwnd,y);
267 /*************************************************************************
268 * ShellMessageBoxW [SHELL32.182]
270 * Format and output errormessage.
272 * idText resource ID of title or LPSTR
273 * idTitle resource ID of title or LPSTR
276 * exported by ordinal
279 ShellMessageBoxW(HMODULE hmod,HWND hwnd,DWORD idText,DWORD idTitle,DWORD uType,LPCVOID arglist)
280 { WCHAR szText[100],szTitle[100],szTemp[256];
281 LPWSTR pszText = &szText[0], pszTitle = &szTitle[0];
282 LPVOID args = &arglist;
284 TRACE("(%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n",(DWORD)hmod,(DWORD)hwnd,idText,idTitle,uType,arglist);
286 if (!HIWORD (idTitle))
287 LoadStringW(hmod,idTitle,pszTitle,100);
289 pszTitle = (LPWSTR)idTitle;
291 if (! HIWORD (idText))
292 LoadStringW(hmod,idText,pszText,100);
294 pszText = (LPWSTR)idText;
296 FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY ,szText,0,0,szTemp,256,args);
297 return MessageBoxW(hwnd,szTemp,szTitle,uType);
300 /*************************************************************************
301 * ShellMessageBoxA [SHELL32.183]
304 ShellMessageBoxA(HMODULE hmod,HWND hwnd,DWORD idText,DWORD idTitle,DWORD uType,LPCVOID arglist)
305 { char szText[100],szTitle[100],szTemp[256];
306 LPSTR pszText = &szText[0], pszTitle = &szTitle[0];
307 LPVOID args = &arglist;
309 TRACE("(%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n", (DWORD)hmod,(DWORD)hwnd,idText,idTitle,uType,arglist);
311 if (!HIWORD (idTitle))
312 LoadStringA(hmod,idTitle,pszTitle,100);
314 pszTitle = (LPSTR)idTitle;
316 if (! HIWORD (idText))
317 LoadStringA(hmod,idText,pszText,100);
319 pszText = (LPSTR)idText;
321 FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY ,pszText,0,0,szTemp,256,args);
322 return MessageBoxA(hwnd,szTemp,pszTitle,uType);
325 /*************************************************************************
326 * SHRestricted [SHELL32.100]
328 * walks through policy table, queries <app> key, <type> value, returns
329 * queried (DWORD) value, and caches it between called to SHInitRestricted
330 * to prevent unnecessary registry access.
333 * exported by ordinal
336 * MS System Policy Editor
337 * 98Lite 2.0 (which uses many of these policy keys) http://www.98lite.net/
338 * "The Windows 95 Registry", by John Woram, 1996 MIS: Press
340 DWORD WINAPI SHRestricted (DWORD pol) {
343 DWORD retval, polidx, i, datsize = 4;
345 TRACE("(%08lx)\n",pol);
349 /* scan to see if we know this policy ID */
350 for (i = 0; i < SHELL_MAX_POLICIES; i++)
352 if (pol == sh32_policy_table[i].polflags)
361 /* we don't know this policy, return 0 */
362 TRACE("unknown policy: (%08lx)\n", pol);
366 /* we have a known policy */
367 lstrcpyA(regstr, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\");
368 lstrcatA(regstr, sh32_policy_table[polidx].appstr);
370 /* first check if this policy has been cached, return it if so */
371 if (sh32_policy_table[polidx].cache != SHELL_NO_POLICY)
373 return sh32_policy_table[polidx].cache;
376 /* return 0 and don't set the cache if any registry errors occur */
378 if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS)
380 if (RegQueryValueExA(xhkey, sh32_policy_table[polidx].keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS)
382 sh32_policy_table[polidx].cache = retval;
391 /*************************************************************************
392 * SHInitRestricted [SHELL32.244]
394 * Win98+ by-ordinal only routine called by Explorer and MSIE 4 and 5.
395 * Inits the policy cache used by SHRestricted to avoid excess
399 * Two inputs: one is a string or NULL. If non-NULL the pointer
400 * should point to a string containing the following exact text:
401 * "Software\Microsoft\Windows\CurrentVersion\Policies".
402 * The other input is unused.
405 * If the input is non-NULL and does not point to a string containing
406 * that exact text the routine will do nothing.
408 * If the text does match or the pointer is NULL, then the routine
409 * will init SHRestricted()'s policy cache to all 0xffffffff and
410 * returns 0xffffffff as well.
412 * I haven't yet run into anything calling this with inputs other than
413 * (NULL, NULL), so I may have the inputs reversed.
416 BOOL WINAPI SHInitRestricted(LPSTR inpRegKey, LPSTR parm2)
420 TRACE("(%p, %p)\n", inpRegKey, parm2);
422 /* first check - if input is non-NULL and points to the secret
423 key string, then pass. Otherwise return 0.
426 if (inpRegKey != (LPSTR)NULL)
428 if (lstrcmpiA(inpRegKey, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies"))
430 /* doesn't match, fail */
435 /* check passed, init all policy cache entries with SHELL_NO_POLICY */
436 for (i = 0; i < SHELL_MAX_POLICIES; i++)
438 sh32_policy_table[i].cache = SHELL_NO_POLICY;
441 return SHELL_NO_POLICY;
444 /*************************************************************************
445 * SHCreateDirectory [SHELL32.165]
448 * exported by ordinal
449 * not sure about LPSECURITY_ATTRIBUTES
451 DWORD WINAPI SHCreateDirectory(LPSECURITY_ATTRIBUTES sec,LPCSTR path) {
452 TRACE("(%p,%s):stub.\n",sec,path);
453 if (CreateDirectoryA(path,sec))
455 /* SHChangeNotify(8,1,path,0); */
458 if (SHELL32_79(path,(LPVOID)x))
460 FIXME("(%08lx,%s):stub.\n",x,path);
465 /*************************************************************************
466 * SHFree [SHELL32.195]
469 * free_ptr() - frees memory using IMalloc
470 * exported by ordinal
473 DWORD WINAPI SHFree(LPVOID x)
476 WORD len = *(LPWORD)(x-2);
478 if ( *(LPWORD)(x+len) != 0x7384)
481 if ( (*(LPWORD)(x-4)) != 0x8271)
484 memset(x-4, 0xde, len+6);
486 TRACE("%p len=%u\n",x, len);
492 return HeapFree(GetProcessHeap(), 0, x);
495 /*************************************************************************
496 * SHAlloc [SHELL32.196]
499 * void *task_alloc(DWORD len), uses SHMalloc allocator
500 * exported by ordinal
502 LPVOID WINAPI SHAlloc(DWORD len)
507 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len+6);
509 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len);
513 *(LPWORD)(ret) = 0x8271;
514 *(LPWORD)(ret+2) = (WORD)len;
515 *(LPWORD)(ret+4+len) = 0x7384;
517 memset(ret, 0xdf, len);
519 TRACE("%lu bytes at %p\n",len, ret);
523 /*************************************************************************
524 * SHRegisterDragDrop [SHELL32.86]
527 * exported by ordinal
529 DWORD WINAPI SHRegisterDragDrop(HWND hWnd,IDropTarget * pDropTarget)
531 FIXME("(0x%08x,%p):stub.\n", hWnd, pDropTarget);
532 return RegisterDragDrop(hWnd, pDropTarget);
535 /*************************************************************************
536 * SHRevokeDragDrop [SHELL32.87]
539 * exported by ordinal
541 DWORD WINAPI SHRevokeDragDrop(DWORD x) {
542 FIXME("(0x%08lx):stub.\n",x);
546 /*************************************************************************
547 * SHDoDragDrop [SHELL32.88]
550 * exported by ordinal
552 DWORD WINAPI SHDoDragDrop(DWORD u, DWORD v, DWORD w, DWORD x, DWORD y, DWORD z) {
553 FIXME("(0x%08lx 0x%08lx 0x%08lx 0x%08lx 0x%08lx 0x%08lx):stub.\n",u,v,w,x,y,z);
557 /*************************************************************************
558 * RunFileDlg [SHELL32.61]
561 * Original name: RunFileDlg (exported by ordinal)
564 RunFileDlg (HWND hwndOwner, DWORD dwParam1, DWORD dwParam2,
565 LPSTR lpszTitle, LPSTR lpszPrompt, UINT uFlags)
567 FIXME("(0x%08x 0x%lx 0x%lx \"%s\" \"%s\" 0x%x):stub.\n",
568 hwndOwner, dwParam1, dwParam2, lpszTitle, lpszPrompt, uFlags);
572 /*************************************************************************
573 * ExitWindowsDialog [SHELL32.60]
576 * exported by ordinal
578 void WINAPI ExitWindowsDialog (HWND hWndOwner)
580 TRACE("(0x%08x)\n", hWndOwner);
581 if (MessageBoxA( hWndOwner, "Do you want to exit WINE?", "Shutdown", MB_YESNO|MB_ICONQUESTION) == IDOK)
582 { SendMessageA ( hWndOwner, WM_QUIT, 0, 0);
586 /*************************************************************************
587 * ArrangeWindows [SHELL32.184]
591 ArrangeWindows (DWORD dwParam1, DWORD dwParam2, DWORD dwParam3,
592 DWORD dwParam4, DWORD dwParam5)
594 FIXME("(0x%lx 0x%lx 0x%lx 0x%lx 0x%lx):stub.\n",
595 dwParam1, dwParam2, dwParam3, dwParam4, dwParam5);
599 /*************************************************************************
600 * SignalFileOpen [SHELL32.103]
603 * exported by ordinal
606 SignalFileOpen (DWORD dwParam1)
608 FIXME("(0x%08lx):stub.\n", dwParam1);
613 /*************************************************************************
614 * SHAddToRecentDocs [SHELL32.234]
617 * uFlags [IN] SHARD_PATH or SHARD_PIDL
618 * pv [IN] string or pidl, NULL clears the list
623 DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
624 { if (SHARD_PIDL==uFlags)
625 { FIXME("(0x%08x,pidl=%p):stub.\n", uFlags,pv);
628 { FIXME("(0x%08x,%s):stub.\n", uFlags,(char*)pv);
632 /*************************************************************************
633 * SHFileOperation [SHELL32.242]
636 DWORD WINAPI SHFileOperationAW(DWORD x)
637 { FIXME("0x%08lx stub\n",x);
642 /*************************************************************************
643 * SHFileOperationA [SHELL32.243]
648 DWORD WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp)
649 { FIXME("(%p):stub.\n", lpFileOp);
652 /*************************************************************************
653 * SHFileOperationW [SHELL32.244]
658 DWORD WINAPI SHFileOperationW (LPSHFILEOPSTRUCTW lpFileOp)
659 { FIXME("(%p):stub.\n", lpFileOp);
663 /*************************************************************************
664 * SHChangeNotify [SHELL32.239]
669 DWORD WINAPI SHChangeNotify (
670 INT wEventId, /* [IN] flags that specifies the event*/
671 UINT uFlags, /* [IN] the meaning of dwItem[1|2]*/
674 { FIXME("(0x%08x,0x%08ux,%p,%p):stub.\n", wEventId,uFlags,dwItem1,dwItem2);
677 /*************************************************************************
678 * SHCreateShellFolderViewEx [SHELL32.174]
681 * see IShellFolder::CreateViewObject
683 HRESULT WINAPI SHCreateShellFolderViewEx(
684 LPSHELLVIEWDATA psvcbi, /*[in ] shelltemplate struct*/
685 LPVOID* ppv) /*[out] IShellView pointer*/
690 TRACE("sf=%p pidl=%p cb=%p mode=0x%08lx parm=0x%08lx\n",
691 psvcbi->pShellFolder, psvcbi->pidl, psvcbi->pCallBack, psvcbi->viewmode, psvcbi->dwUserParam);
693 psf = IShellView_Constructor(psvcbi->pShellFolder);
696 return E_OUTOFMEMORY;
698 IShellView_AddRef(psf);
699 hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv);
700 IShellView_Release(psf);
704 /*************************************************************************
705 * SHWinHelp [SHELL32.127]
708 HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z)
709 { FIXME("0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z);
712 /*************************************************************************
713 * SHRunControlPanel [SHELL32.161]
716 HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z)
717 { FIXME("0x%08lx 0x%08lx stub\n",x,z);
720 /*************************************************************************
721 * ShellExecuteEx [SHELL32.291]
724 BOOL WINAPI ShellExecuteExAW (LPVOID sei)
725 { if (VERSION_OsIsUnicode())
726 return ShellExecuteExW (sei);
727 return ShellExecuteExA (sei);
729 /*************************************************************************
730 * ShellExecuteExA [SHELL32.292]
733 BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei)
734 { CHAR szApplicationName[MAX_PATH],szCommandline[MAX_PATH],szPidl[20];
737 STARTUPINFOA startupinfo;
738 PROCESS_INFORMATION processinformation;
740 WARN("mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n",
741 sei->fMask, sei->hwnd, sei->lpVerb, sei->lpFile,
742 sei->lpParameters, sei->lpDirectory, sei->nShow,
743 (sei->fMask & SEE_MASK_CLASSNAME) ? sei->lpClass : "not used");
745 ZeroMemory(szApplicationName,MAX_PATH);
747 strcpy(szApplicationName, sei->lpFile);
749 ZeroMemory(szCommandline,MAX_PATH);
750 if (sei->lpParameters)
751 strcpy(szCommandline, sei->lpParameters);
753 if (sei->fMask & (SEE_MASK_CLASSKEY | SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY |
754 SEE_MASK_NOCLOSEPROCESS | SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT |
755 SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE |
756 SEE_MASK_NO_CONSOLE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR ))
757 { FIXME("flags ignored: 0x%08lx\n", sei->fMask);
760 if (sei->fMask & SEE_MASK_CLASSNAME)
761 { HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, 256);
764 /* process the IDList */
765 if ( (sei->fMask & SEE_MASK_INVOKEIDLIST) == SEE_MASK_INVOKEIDLIST) /*0x0c*/
766 { SHGetPathFromIDListA (sei->lpIDList,szApplicationName);
767 TRACE("-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName);
770 { if (sei->fMask & SEE_MASK_IDLIST )
771 { /* %I is the adress of a global item ID*/
772 pos = strstr(szCommandline, "%I");
774 { HGLOBAL hmem = SHAllocShared ( sei->lpIDList, ILGetSize(sei->lpIDList), 0);
775 sprintf(szPidl,":%li",(DWORD)SHLockShared(hmem,0) );
776 SHUnlockShared(hmem);
778 gap = strlen(szPidl);
780 memmove(pos+gap,pos+2,len);
781 memcpy(pos,szPidl,gap);
787 pos = strstr(szCommandline, ",%L"); /* dunno what it means: kill it*/
789 { len = strlen(pos)-2;
791 memmove(pos,pos+3,len);
794 TRACE("execute: %s %s\n",szApplicationName, szCommandline);
796 ZeroMemory(&startupinfo,sizeof(STARTUPINFOA));
797 startupinfo.cb = sizeof(STARTUPINFOA);
799 return CreateProcessA(szApplicationName[0] ? szApplicationName:NULL,
800 szCommandline[0] ? szCommandline : NULL,
801 NULL, NULL, FALSE, 0,
802 NULL, NULL, &startupinfo, &processinformation);
806 /*************************************************************************
807 * ShellExecuteExW [SHELL32.293]
810 BOOL WINAPI ShellExecuteExW (LPSHELLEXECUTEINFOW sei)
811 { SHELLEXECUTEINFOA seiA;
816 memcpy(&seiA, sei, sizeof(SHELLEXECUTEINFOA));
819 seiA.lpVerb = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpVerb);
822 seiA.lpFile = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpFile);
824 if (sei->lpParameters)
825 seiA.lpParameters = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpParameters);
827 if (sei->lpDirectory)
828 seiA.lpDirectory = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpDirectory);
830 if ((sei->fMask & SEE_MASK_CLASSNAME) && sei->lpClass)
831 seiA.lpClass = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpClass);
835 ret = ShellExecuteExA(&seiA);
837 if (seiA.lpVerb) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpVerb );
838 if (seiA.lpFile) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpFile );
839 if (seiA.lpParameters) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpParameters );
840 if (seiA.lpDirectory) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpDirectory );
841 if (seiA.lpClass) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpClass );
846 static LPUNKNOWN SHELL32_IExplorerInterface=0;
847 /*************************************************************************
848 * SHSetInstanceExplorer [SHELL32.176]
853 HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown)
854 { TRACE("%p\n", lpUnknown);
855 SHELL32_IExplorerInterface = lpUnknown;
856 return (HRESULT) lpUnknown;
858 /*************************************************************************
859 * SHGetInstanceExplorer [SHELL32.256]
862 * gets the interface pointer of the explorer and a reference
864 HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown)
865 { TRACE("%p\n", lpUnknown);
867 *lpUnknown = SHELL32_IExplorerInterface;
869 if (!SHELL32_IExplorerInterface)
872 IUnknown_AddRef(SHELL32_IExplorerInterface);
875 /*************************************************************************
876 * SHFreeUnusedLibraries [SHELL32.123]
881 HRESULT WINAPI SHFreeUnusedLibraries (void)
885 /*************************************************************************
886 * DAD_SetDragImage [SHELL32.136]
891 HRESULT WINAPI DAD_SetDragImage (DWORD u, DWORD v)
892 { FIXME("0x%08lx 0x%08lx stub\n",u, v);
895 /*************************************************************************
896 * DAD_ShowDragImage [SHELL32.137]
901 HRESULT WINAPI DAD_ShowDragImage (DWORD u)
902 { FIXME("0x%08lx stub\n",u);
905 /*************************************************************************
906 * SHRegCloseKey [NT4.0:SHELL32.505]
909 HRESULT WINAPI SHRegCloseKey (HKEY hkey)
910 { TRACE("0x%04x\n",hkey);
911 return RegCloseKey( hkey );
913 /*************************************************************************
914 * SHRegOpenKeyA [SHELL32.506]
917 HRESULT WINAPI SHRegOpenKeyA(HKEY hKey, LPSTR lpSubKey, LPHKEY phkResult)
919 TRACE("(0x%08x, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult);
920 return RegOpenKeyA(hKey, lpSubKey, phkResult);
923 /*************************************************************************
924 * SHRegOpenKeyW [NT4.0:SHELL32.507]
927 HRESULT WINAPI SHRegOpenKeyW (HKEY hkey, LPCWSTR lpszSubKey, LPHKEY retkey)
928 { WARN("0x%04x %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
929 return RegOpenKeyW( hkey, lpszSubKey, retkey );
931 /*************************************************************************
932 * SHRegQueryValueExA [SHELL32.509]
935 HRESULT WINAPI SHRegQueryValueExA(
943 TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
944 return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
946 /*************************************************************************
947 * SHRegQueryValueW [NT4.0:SHELL32.510]
950 HRESULT WINAPI SHRegQueryValueW (HKEY hkey, LPWSTR lpszSubKey,
951 LPWSTR lpszData, LPDWORD lpcbData )
952 { WARN("0x%04x %s %p %p semi-stub\n",
953 hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
954 return RegQueryValueW( hkey, lpszSubKey, lpszData, lpcbData );
957 /*************************************************************************
958 * SHRegQueryValueExW [NT4.0:SHELL32.511]
961 * if the datatype REG_EXPAND_SZ then expand the string and change
962 * *pdwType to REG_SZ.
964 HRESULT WINAPI SHRegQueryValueExW (HKEY hkey, LPWSTR pszValue, LPDWORD pdwReserved,
965 LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData)
967 WARN("0x%04x %s %p %p %p %p semi-stub\n",
968 hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
969 ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);
973 /*************************************************************************
974 * ReadCabinetState [NT 4.0:SHELL32.651]
977 HRESULT WINAPI ReadCabinetState(DWORD u, DWORD v)
978 { FIXME("0x%04lx 0x%04lx stub\n",u,v);
981 /*************************************************************************
982 * WriteCabinetState [NT 4.0:SHELL32.652]
985 HRESULT WINAPI WriteCabinetState(DWORD u)
986 { FIXME("0x%04lx stub\n",u);
989 /*************************************************************************
990 * FileIconInit [SHELL32.660]
993 BOOL WINAPI FileIconInit(BOOL bFullInit)
994 { FIXME("(%s)\n", bFullInit ? "true" : "false");
997 /*************************************************************************
998 * IsUserAdmin [NT 4.0:SHELL32.680]
1001 HRESULT WINAPI IsUserAdmin(void)
1005 /*************************************************************************
1006 * StrRetToStrN [SHELL32.96]
1008 * converts a STRRET to a normal string
1011 * the pidl is for STRRET OFFSET
1013 HRESULT WINAPI StrRetToBufA (LPSTRRET src, LPITEMIDLIST pidl, LPSTR dest, DWORD len)
1015 return StrRetToStrNA(dest, len, src, pidl);
1018 HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
1020 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
1025 WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL);
1026 SHFree(src->u.pOleStr);
1030 lstrcpynA((LPSTR)dest, src->u.cStr, len);
1033 case STRRET_OFFSETA:
1034 lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
1038 FIXME("unknown type!\n");
1041 *(LPSTR)dest = '\0';
1048 HRESULT WINAPI StrRetToBufW (LPSTRRET src, LPITEMIDLIST pidl, LPWSTR dest, DWORD len)
1050 return StrRetToStrNW(dest, len, src, pidl);
1053 HRESULT WINAPI StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
1055 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
1060 lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);
1061 SHFree(src->u.pOleStr);
1065 lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len);
1068 case STRRET_OFFSETA:
1071 lstrcpynAtoW((LPWSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
1076 FIXME("unknown type!\n");
1078 { *(LPSTR)dest = '\0';
1084 HRESULT WINAPI StrRetToStrNAW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
1086 if(VERSION_OsIsUnicode())
1087 return StrRetToStrNW (dest, len, src, pidl);
1088 return StrRetToStrNA (dest, len, src, pidl);
1091 /*************************************************************************
1092 * StrChrW [NT 4.0:SHELL32.651]
1095 LPWSTR WINAPI StrChrW (LPWSTR str, WCHAR x )
1098 TRACE("%s 0x%04x\n",debugstr_w(str),x);
1108 /*************************************************************************
1109 * StrCmpNIW [NT 4.0:SHELL32.*]
1112 INT WINAPI StrCmpNIW ( LPWSTR wstr1, LPWSTR wstr2, INT len)
1113 { FIXME("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len);
1117 /*************************************************************************
1118 * SHAllocShared [SHELL32.520]
1121 * parameter1 is return value from HeapAlloc
1122 * parameter2 is equal to the size allocated with HeapAlloc
1123 * parameter3 is return value from GetCurrentProcessId
1125 * the return value is posted as lParam with 0x402 (WM_USER+2) to somewhere
1126 * WM_USER+2 could be the undocumented CWM_SETPATH
1127 * the allocated memory contains a pidl
1129 HGLOBAL WINAPI SHAllocShared(LPVOID psrc, DWORD size, DWORD procID)
1133 TRACE("ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID);
1134 hmem = GlobalAlloc(GMEM_FIXED, size);
1138 pmem = GlobalLock (hmem);
1143 memcpy (pmem, psrc, size);
1147 /*************************************************************************
1148 * SHLockShared [SHELL32.521]
1151 * parameter1 is return value from SHAllocShared
1152 * parameter2 is return value from GetCurrentProcessId
1153 * the receiver of (WM_USER+2) trys to lock the HANDLE (?)
1154 * the returnvalue seems to be a memoryadress
1156 LPVOID WINAPI SHLockShared(HANDLE hmem, DWORD procID)
1157 { TRACE("handle=0x%04x procID=0x%04lx\n",hmem,procID);
1158 return GlobalLock(hmem);
1160 /*************************************************************************
1161 * SHUnlockShared [SHELL32.522]
1164 * parameter1 is return value from SHLockShared
1166 BOOL WINAPI SHUnlockShared(HANDLE pmem)
1167 { TRACE("handle=0x%04x\n",pmem);
1168 return GlobalUnlock(pmem);
1170 /*************************************************************************
1171 * SHFreeShared [SHELL32.523]
1174 * parameter1 is return value from SHAllocShared
1175 * parameter2 is return value from GetCurrentProcessId
1177 HANDLE WINAPI SHFreeShared(HANDLE hmem, DWORD procID)
1178 { TRACE("handle=0x%04x 0x%04lx\n",hmem,procID);
1179 return GlobalFree(hmem);
1182 /*************************************************************************
1183 * SetAppStartingCursor [SHELL32.99]
1186 HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v)
1187 { FIXME("hwnd=0x%04x 0x%04lx stub\n",u,v );
1190 /*************************************************************************
1191 * SHLoadOLE [SHELL32.151]
1194 HRESULT WINAPI SHLoadOLE(DWORD u)
1195 { FIXME("0x%04lx stub\n",u);
1198 /*************************************************************************
1199 * DriveType [SHELL32.64]
1202 HRESULT WINAPI DriveType(DWORD u)
1203 { FIXME("0x%04lx stub\n",u);
1206 /*************************************************************************
1207 * SHAbortInvokeCommand [SHELL32.198]
1210 HRESULT WINAPI SHAbortInvokeCommand(void)
1214 /*************************************************************************
1215 * SHOutOfMemoryMessageBox [SHELL32.126]
1218 HRESULT WINAPI SHOutOfMemoryMessageBox(DWORD u, DWORD v, DWORD w)
1219 { FIXME("0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w);
1222 /*************************************************************************
1223 * SHFlushClipboard [SHELL32.121]
1226 HRESULT WINAPI SHFlushClipboard(void)
1230 /*************************************************************************
1231 * StrRChrA [SHELL32.346]
1234 LPSTR WINAPI StrRChrA(LPCSTR lpStart, LPCSTR lpEnd, DWORD wMatch)
1239 /* if the end not given, search*/
1246 for (--lpEnd;lpStart <= lpEnd; lpEnd--)
1247 if (*lpEnd==(char)wMatch)
1248 return (LPSTR)lpEnd;
1252 /*************************************************************************
1253 * StrRChrW [SHELL32.320]
1256 LPWSTR WINAPI StrRChrW(LPWSTR lpStart, LPWSTR lpEnd, DWORD wMatch)
1258 TRACE("%s %s 0x%04x\n",debugstr_w(lpStart),debugstr_w(lpEnd), (WCHAR)wMatch );
1260 /* if the end not given, search*/
1268 { if (*lpStart==(WCHAR)wMatch)
1271 } while ( lpStart<=lpEnd );
1274 /*************************************************************************
1275 * StrFormatByteSize [SHLWAPI]
1277 LPSTR WINAPI StrFormatByteSizeA ( DWORD dw, LPSTR pszBuf, UINT cchBuf )
1279 TRACE("%lx %p %i\n", dw, pszBuf, cchBuf);
1281 { sprintf (buf,"%3.1f bytes", (FLOAT)dw);
1283 else if ( dw<1048576L)
1284 { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024);
1286 else if ( dw < 1073741824L)
1287 { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L);
1290 { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L);
1292 lstrcpynA (pszBuf, buf, cchBuf);
1295 LPWSTR WINAPI StrFormatByteSizeW ( DWORD dw, LPWSTR pszBuf, UINT cchBuf )
1297 TRACE("%lx %p %i\n", dw, pszBuf, cchBuf);
1299 { sprintf (buf,"%3.1f bytes", (FLOAT)dw);
1301 else if ( dw<1048576L)
1302 { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024);
1304 else if ( dw < 1073741824L)
1305 { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L);
1308 { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L);
1310 lstrcpynAtoW (pszBuf, buf, cchBuf);
1313 /*************************************************************************
1314 * SHWaitForFileToOpen [SHELL32.97]
1317 HRESULT WINAPI SHWaitForFileToOpen(DWORD u, DWORD v, DWORD w)
1318 { FIXME("0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w);
1321 /*************************************************************************
1322 * Control_FillCache_RunDLL [SHELL32.8]
1325 HRESULT WINAPI Control_FillCache_RunDLL(HWND hWnd, HANDLE hModule, DWORD w, DWORD x)
1326 { FIXME("0x%04x 0x%04x 0x%04lx 0x%04lx stub\n",hWnd, hModule,w,x);
1329 /*************************************************************************
1330 * RunDLL_CallEntry16 [SHELL32.122]
1331 * the name is propably wrong
1333 HRESULT WINAPI RunDLL_CallEntry16(DWORD v, DWORD w, DWORD x, DWORD y, DWORD z)
1334 { FIXME("0x%04lx 0x%04lx 0x%04lx 0x%04lx 0x%04lx stub\n",v,w,x,y,z);
1338 /************************************************************************
1339 * shell32_654 [SHELL32.654]
1341 * NOTES: first parameter seems to be a pointer (same as passed to WriteCabinetState)
1342 * second one could be a size (0x0c). The size is the same as the structure saved to
1343 * HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState
1344 * I'm (js) guessing: this one is just ReadCabinetState ;-)
1346 HRESULT WINAPI shell32_654 (DWORD x, DWORD y)
1347 { FIXME("0x%08lx 0x%08lx stub\n",x,y);
1351 /************************************************************************
1352 * RLBuildListOfPaths [SHELL32.146]
1357 DWORD WINAPI RLBuildListOfPaths (void)
1361 /************************************************************************
1362 * StrToOleStr [SHELL32.163]
1365 int WINAPI StrToOleStrA (LPWSTR lpWideCharStr, LPCSTR lpMultiByteString)
1367 TRACE("(%p, %p %s)\n",
1368 lpWideCharStr, lpMultiByteString, debugstr_a(lpMultiByteString));
1370 return MultiByteToWideChar(0, 0, lpMultiByteString, -1, lpWideCharStr, MAX_PATH);
1373 int WINAPI StrToOleStrW (LPWSTR lpWideCharStr, LPCWSTR lpWString)
1375 TRACE("(%p, %p %s)\n",
1376 lpWideCharStr, lpWString, debugstr_w(lpWString));
1378 if (lstrcpyW (lpWideCharStr, lpWString ))
1379 { return lstrlenW (lpWideCharStr);
1384 BOOL WINAPI StrToOleStrAW (LPWSTR lpWideCharStr, LPCVOID lpString)
1386 if (VERSION_OsIsUnicode())
1387 return StrToOleStrW (lpWideCharStr, lpString);
1388 return StrToOleStrA (lpWideCharStr, lpString);
1391 /************************************************************************
1392 * SHValidateUNC [SHELL32.173]
1395 HRESULT WINAPI SHValidateUNC (DWORD x, DWORD y, DWORD z)
1397 FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x,y,z);
1401 /************************************************************************
1402 * DoEnvironmentSubstW [SHELL32.53]
1405 HRESULT WINAPI DoEnvironmentSubstA(LPSTR x, LPSTR y)
1407 FIXME("(%p %s, %p %s) stub\n", x, debugstr_a(x), y, debugstr_a(y));
1411 HRESULT WINAPI DoEnvironmentSubstW(LPWSTR x, LPWSTR y)
1413 FIXME("(%p %s, %p %s) stub\n", x, debugstr_w(x), y, debugstr_w(y));
1417 HRESULT WINAPI DoEnvironmentSubstAW(LPVOID x, LPVOID y)
1419 if (VERSION_OsIsUnicode())
1420 return DoEnvironmentSubstW(x, y);
1421 return DoEnvironmentSubstA(x, y);
1424 /*************************************************************************
1425 * shell32_243 [SHELL32.243]
1427 * Win98+ by-ordinal routine. In Win98 this routine returns zero and
1428 * does nothing else. Possibly this does something in NT or SHELL32 5.0?
1432 BOOL WINAPI shell32_243(DWORD a, DWORD b)
1437 /************************************************************************
1438 * Win32DeleteFile [SHELL32.164]
1440 * Deletes a file. Also triggers a change notify if one exists, but
1441 * that mechanism doesn't yet exist in Wine's SHELL32.
1444 * Verified on Win98 / IE 5 (SHELL32 4.72, March 1999 build) to be
1445 * ANSI. Is this Unicode on NT?
1449 BOOL WINAPI Win32DeleteFile(LPSTR fName)
1451 FIXME("%p(%s): partial stub\n", fName, fName);
1458 LPSTR WINAPI StrCpyNA(LPSTR psz1, LPCSTR psz2, int cchMax)
1460 return lstrcpynA(psz1, psz2, cchMax);
1463 LPWSTR WINAPI StrCpyNW(LPWSTR psz1, LPCWSTR psz2, int cchMax)
1465 return lstrcpynW(psz1, psz2, cchMax);