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
12 #include "debugtools.h"
14 #include "winversion.h"
20 #include "shell32_main.h"
21 #include "wine/undocshell.h"
24 DEFAULT_DEBUG_CHANNEL(shell);
26 /*************************************************************************
27 * ParseField [SHELL32.58]
29 * copys a field from a ',' delimited string
31 * first field is nField = 1
33 DWORD WINAPI ParseFieldA(LPCSTR src, DWORD nField, LPSTR dst, DWORD len)
35 WARN("('%s',0x%08lx,%p,%ld) semi-stub.\n",src,nField,dst,len);
37 if (!src || !src[0] || !dst || !len)
40 /* skip n fields delimited by ',' */
43 if (*src=='\0') return FALSE;
44 if (*(src++)==',') nField--;
47 /* copy part till the next ',' to dst */
48 while ( *src!='\0' && *src!=',' && (len--)>0 ) *(dst++)=*(src++);
50 /* finalize the string */
56 /*************************************************************************
57 * PickIconDlg [SHELL32.62]
60 DWORD WINAPI PickIconDlg(DWORD x,DWORD y,DWORD z,DWORD a)
61 { FIXME("(%08lx,%08lx,%08lx,%08lx):stub.\n",x,y,z,a);
65 /*************************************************************************
66 * GetFileNameFromBrowse [SHELL32.63]
69 DWORD WINAPI GetFileNameFromBrowse(HWND howner, LPSTR targetbuf, DWORD len, DWORD x, LPCSTR suffix, LPCSTR y, LPCSTR cmd)
70 { FIXME("(%04x,%p,%ld,%08lx,%s,%s,%s):stub.\n",
71 howner,targetbuf,len,x,suffix,y,cmd);
72 /* puts up a Open Dialog and requests input into targetbuf */
73 /* OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST|OFN_unknown */
74 lstrcpyA(targetbuf,"x:\\dummy.exe");
78 /*************************************************************************
79 * SHGetSettings [SHELL32.68]
82 * the registry path are for win98 (tested)
83 * and possibly are the same in nt40
85 void WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask, DWORD dwx)
89 DWORD dwDataSize = sizeof (DWORD);
91 TRACE("(%p 0x%08lx 0x%08lx)\n",lpsfs,dwMask, dwx);
93 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
94 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0))
97 if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize))
98 lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1);
100 if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize))
101 lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1);
103 if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize))
104 lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1);
106 if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize))
107 lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1);
109 if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize))
110 lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1);
112 if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize))
113 lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1);
115 if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize))
117 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
118 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
120 else if (dwData == 1)
121 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 1;
122 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
124 else if (dwData == 2)
125 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
126 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 1;
131 TRACE("-- 0x%04x\n", *(WORD*)lpsfs);
134 /*************************************************************************
135 * SHShellFolderView_Message [SHELL32.73]
138 * hwndCabinet defines the explorer cabinet window that contains the
139 * shellview you need to communicate with
140 * uMsg identifying the SFVM enum to perform
144 * Message SFVM_REARRANGE = 1
145 * This message gets sent when a column gets clicked to instruct the
146 * shell view to re-sort the item list. lParam identifies the column
149 int WINAPI SHShellFolderView_Message(HWND hwndCabinet,UINT uMsg,LPARAM lParam)
150 { FIXME("%04x %08ux %08lx stub\n",hwndCabinet,uMsg,lParam);
154 /*************************************************************************
155 * OleStrToStrN [SHELL32.78]
157 BOOL WINAPI OleStrToStrNA (LPSTR lpStr, INT nStr, LPCWSTR lpOle, INT nOle)
159 TRACE("(%p, %x, %s, %x)\n", lpStr, nStr, debugstr_wn(lpOle,nOle), nOle);
160 return WideCharToMultiByte (0, 0, lpOle, nOle, lpStr, nStr, NULL, NULL);
163 BOOL WINAPI OleStrToStrNW (LPWSTR lpwStr, INT nwStr, LPCWSTR lpOle, INT nOle)
165 TRACE("(%p, %x, %s, %x)\n", lpwStr, nwStr, debugstr_wn(lpOle,nOle), nOle);
167 if (lstrcpynW ( lpwStr, lpOle, nwStr))
168 { return lstrlenW (lpwStr);
173 BOOL WINAPI OleStrToStrNAW (LPVOID lpOut, INT nOut, LPCVOID lpIn, INT nIn)
175 if (VERSION_OsIsUnicode())
176 return OleStrToStrNW (lpOut, nOut, lpIn, nIn);
177 return OleStrToStrNA (lpOut, nOut, lpIn, nIn);
180 /*************************************************************************
181 * StrToOleStrN [SHELL32.79]
182 * lpMulti, nMulti, nWide [IN]
185 BOOL WINAPI StrToOleStrNA (LPWSTR lpWide, INT nWide, LPCSTR lpStrA, INT nStr)
187 TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_an(lpStrA,nStr), nStr);
188 return MultiByteToWideChar (0, 0, lpStrA, nStr, lpWide, nWide);
190 BOOL WINAPI StrToOleStrNW (LPWSTR lpWide, INT nWide, LPCWSTR lpStrW, INT nStr)
192 TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_wn(lpStrW, nStr), nStr);
194 if (lstrcpynW (lpWide, lpStrW, nWide))
195 { return lstrlenW (lpWide);
200 BOOL WINAPI StrToOleStrNAW (LPWSTR lpWide, INT nWide, LPCVOID lpStr, INT nStr)
202 if (VERSION_OsIsUnicode())
203 return StrToOleStrNW (lpWide, nWide, lpStr, nStr);
204 return StrToOleStrNA (lpWide, nWide, lpStr, nStr);
207 /*************************************************************************
208 * RegisterShellHook [SHELL32.181]
211 * hwnd [I] window handle
215 * exported by ordinal
217 void WINAPI RegisterShellHook(HWND hwnd, DWORD y) {
218 FIXME("(0x%08x,0x%08lx):stub.\n",hwnd,y);
220 /*************************************************************************
221 * ShellMessageBoxW [SHELL32.182]
223 * Format and output errormessage.
225 * idText resource ID of title or LPSTR
226 * idTitle resource ID of title or LPSTR
229 * exported by ordinal
232 ShellMessageBoxW(HMODULE hmod,HWND hwnd,DWORD idText,DWORD idTitle,DWORD uType,LPCVOID arglist)
233 { WCHAR szText[100],szTitle[100],szTemp[256];
234 LPWSTR pszText = &szText[0], pszTitle = &szTitle[0];
235 LPVOID args = &arglist;
237 TRACE("(%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n",(DWORD)hmod,(DWORD)hwnd,idText,idTitle,uType,arglist);
239 if (!HIWORD (idTitle))
240 LoadStringW(hmod,idTitle,pszTitle,100);
242 pszTitle = (LPWSTR)idTitle;
244 if (! HIWORD (idText))
245 LoadStringW(hmod,idText,pszText,100);
247 pszText = (LPWSTR)idText;
249 FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY ,szText,0,0,szTemp,256,args);
250 return MessageBoxW(hwnd,szTemp,szTitle,uType);
253 /*************************************************************************
254 * ShellMessageBoxA [SHELL32.183]
257 ShellMessageBoxA(HMODULE hmod,HWND hwnd,DWORD idText,DWORD idTitle,DWORD uType,LPCVOID arglist)
258 { char szText[100],szTitle[100],szTemp[256];
259 LPSTR pszText = &szText[0], pszTitle = &szTitle[0];
260 LPVOID args = &arglist;
262 TRACE("(%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n", (DWORD)hmod,(DWORD)hwnd,idText,idTitle,uType,arglist);
264 if (!HIWORD (idTitle))
265 LoadStringA(hmod,idTitle,pszTitle,100);
267 pszTitle = (LPSTR)idTitle;
269 if (! HIWORD (idText))
270 LoadStringA(hmod,idText,pszText,100);
272 pszText = (LPSTR)idText;
274 FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY ,pszText,0,0,szTemp,256,args);
275 return MessageBoxA(hwnd,szTemp,pszTitle,uType);
278 /*************************************************************************
279 * SHRestricted [SHELL32.100]
281 * walks through policy table, queries <app> key, <type> value, returns
282 * queried (DWORD) value, and caches it between called to SHInitRestricted
283 * to prevent unnecessary registry access.
286 * exported by ordinal
289 * MS System Policy Editor
290 * 98Lite 2.0 (which uses many of these policy keys) http://www.98lite.net/
291 * "The Windows 95 Registry", by John Woram, 1996 MIS: Press
293 DWORD WINAPI SHRestricted (DWORD pol) {
296 DWORD retval, polidx, i, datsize = 4;
298 TRACE("(%08lx)\n",pol);
302 /* scan to see if we know this policy ID */
303 for (i = 0; i < SHELL_MAX_POLICIES; i++)
305 if (pol == sh32_policy_table[i].polflags)
314 /* we don't know this policy, return 0 */
315 TRACE("unknown policy: (%08lx)\n", pol);
319 /* we have a known policy */
320 lstrcpyA(regstr, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\");
321 lstrcatA(regstr, sh32_policy_table[polidx].appstr);
323 /* first check if this policy has been cached, return it if so */
324 if (sh32_policy_table[polidx].cache != SHELL_NO_POLICY)
326 return sh32_policy_table[polidx].cache;
329 /* return 0 and don't set the cache if any registry errors occur */
331 if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS)
333 if (RegQueryValueExA(xhkey, sh32_policy_table[polidx].keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS)
335 sh32_policy_table[polidx].cache = retval;
344 /*************************************************************************
345 * SHInitRestricted [SHELL32.244]
347 * Win98+ by-ordinal only routine called by Explorer and MSIE 4 and 5.
348 * Inits the policy cache used by SHRestricted to avoid excess
352 * Two inputs: one is a string or NULL. If non-NULL the pointer
353 * should point to a string containing the following exact text:
354 * "Software\Microsoft\Windows\CurrentVersion\Policies".
355 * The other input is unused.
358 * If the input is non-NULL and does not point to a string containing
359 * that exact text the routine will do nothing.
361 * If the text does match or the pointer is NULL, then the routine
362 * will init SHRestricted()'s policy cache to all 0xffffffff and
363 * returns 0xffffffff as well.
365 * I haven't yet run into anything calling this with inputs other than
366 * (NULL, NULL), so I may have the inputs reversed.
369 BOOL WINAPI SHInitRestricted(LPSTR inpRegKey, LPSTR parm2)
373 TRACE("(%p, %p)\n", inpRegKey, parm2);
375 /* first check - if input is non-NULL and points to the secret
376 key string, then pass. Otherwise return 0.
379 if (inpRegKey != (LPSTR)NULL)
381 if (lstrcmpiA(inpRegKey, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies"))
383 /* doesn't match, fail */
388 /* check passed, init all policy cache entries with SHELL_NO_POLICY */
389 for (i = 0; i < SHELL_MAX_POLICIES; i++)
391 sh32_policy_table[i].cache = SHELL_NO_POLICY;
394 return SHELL_NO_POLICY;
397 /*************************************************************************
398 * SHFree [SHELL32.195]
401 * free_ptr() - frees memory using IMalloc
402 * exported by ordinal
405 DWORD WINAPI SHFree(LPVOID x)
408 WORD len = *(LPWORD)((LPBYTE)x-2);
410 if ( *(LPWORD)((LPBYTE)x+len) != 0x7384)
413 if ( (*(LPWORD)((LPBYTE)x-4)) != 0x8271)
416 memset((LPBYTE)x-4, 0xde, len+6);
418 TRACE("%p len=%u\n",x, len);
424 return HeapFree(GetProcessHeap(), 0, x);
427 /*************************************************************************
428 * SHAlloc [SHELL32.196]
431 * void *task_alloc(DWORD len), uses SHMalloc allocator
432 * exported by ordinal
434 LPVOID WINAPI SHAlloc(DWORD len)
439 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len+6);
441 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len);
445 *(LPWORD)(ret) = 0x8271;
446 *(LPWORD)(ret+2) = (WORD)len;
447 *(LPWORD)(ret+4+len) = 0x7384;
449 memset(ret, 0xdf, len);
451 TRACE("%lu bytes at %p\n",len, ret);
455 /*************************************************************************
456 * SHRegisterDragDrop [SHELL32.86]
459 * exported by ordinal
461 DWORD WINAPI SHRegisterDragDrop(HWND hWnd,IDropTarget * pDropTarget)
463 FIXME("(0x%08x,%p):stub.\n", hWnd, pDropTarget);
464 return RegisterDragDrop(hWnd, pDropTarget);
467 /*************************************************************************
468 * SHRevokeDragDrop [SHELL32.87]
471 * exported by ordinal
473 DWORD WINAPI SHRevokeDragDrop(DWORD x) {
474 FIXME("(0x%08lx):stub.\n",x);
478 /*************************************************************************
479 * SHDoDragDrop [SHELL32.88]
482 * exported by ordinal
484 DWORD WINAPI SHDoDragDrop(DWORD u, DWORD v, DWORD w, DWORD x, DWORD y, DWORD z) {
485 FIXME("(0x%08lx 0x%08lx 0x%08lx 0x%08lx 0x%08lx 0x%08lx):stub.\n",u,v,w,x,y,z);
489 /*************************************************************************
490 * RunFileDlg [SHELL32.61]
493 * Original name: RunFileDlg (exported by ordinal)
496 RunFileDlg (HWND hwndOwner, DWORD dwParam1, DWORD dwParam2,
497 LPSTR lpszTitle, LPSTR lpszPrompt, UINT uFlags)
499 FIXME("(0x%08x 0x%lx 0x%lx \"%s\" \"%s\" 0x%x):stub.\n",
500 hwndOwner, dwParam1, dwParam2, lpszTitle, lpszPrompt, uFlags);
504 /*************************************************************************
505 * ExitWindowsDialog [SHELL32.60]
508 * exported by ordinal
510 void WINAPI ExitWindowsDialog (HWND hWndOwner)
512 TRACE("(0x%08x)\n", hWndOwner);
513 if (MessageBoxA( hWndOwner, "Do you want to exit WINE?", "Shutdown", MB_YESNO|MB_ICONQUESTION) == IDOK)
514 { SendMessageA ( hWndOwner, WM_QUIT, 0, 0);
518 /*************************************************************************
519 * ArrangeWindows [SHELL32.184]
523 ArrangeWindows (DWORD dwParam1, DWORD dwParam2, DWORD dwParam3,
524 DWORD dwParam4, DWORD dwParam5)
526 FIXME("(0x%lx 0x%lx 0x%lx 0x%lx 0x%lx):stub.\n",
527 dwParam1, dwParam2, dwParam3, dwParam4, dwParam5);
531 /*************************************************************************
532 * SignalFileOpen [SHELL32.103]
535 * exported by ordinal
538 SignalFileOpen (DWORD dwParam1)
540 FIXME("(0x%08lx):stub.\n", dwParam1);
545 /*************************************************************************
546 * SHAddToRecentDocs [SHELL32.234]
549 * uFlags [IN] SHARD_PATH or SHARD_PIDL
550 * pv [IN] string or pidl, NULL clears the list
555 DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
556 { if (SHARD_PIDL==uFlags)
557 { FIXME("(0x%08x,pidl=%p):stub.\n", uFlags,pv);
560 { FIXME("(0x%08x,%s):stub.\n", uFlags,(char*)pv);
564 /*************************************************************************
565 * SHCreateShellFolderViewEx [SHELL32.174]
568 * see IShellFolder::CreateViewObject
570 HRESULT WINAPI SHCreateShellFolderViewEx(
571 LPSHELLVIEWDATA psvcbi, /*[in ] shelltemplate struct*/
572 LPVOID* ppv) /*[out] IShellView pointer*/
577 TRACE("sf=%p pidl=%p cb=%p mode=0x%08lx parm=0x%08lx\n",
578 psvcbi->pShellFolder, psvcbi->pidl, psvcbi->pCallBack, psvcbi->viewmode, psvcbi->dwUserParam);
580 psf = IShellView_Constructor(psvcbi->pShellFolder);
583 return E_OUTOFMEMORY;
585 IShellView_AddRef(psf);
586 hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv);
587 IShellView_Release(psf);
591 /*************************************************************************
592 * SHWinHelp [SHELL32.127]
595 HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z)
596 { FIXME("0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z);
599 /*************************************************************************
600 * SHRunControlPanel [SHELL32.161]
603 HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z)
604 { FIXME("0x%08lx 0x%08lx stub\n",x,z);
607 /*************************************************************************
608 * ShellExecuteEx [SHELL32.291]
611 BOOL WINAPI ShellExecuteExAW (LPVOID sei)
612 { if (VERSION_OsIsUnicode())
613 return ShellExecuteExW (sei);
614 return ShellExecuteExA (sei);
616 /*************************************************************************
617 * ShellExecuteExA [SHELL32.292]
619 * placeholder in the commandline:
624 * %I adress of a global item ID (explorer switch /idlist)
625 * %L ??? path/url/current file ???
627 * %* all following parameters (see batfile)
629 BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei)
630 { CHAR szApplicationName[MAX_PATH],szCommandline[MAX_PATH],szPidl[20];
633 STARTUPINFOA startup;
634 PROCESS_INFORMATION info;
636 WARN("mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n",
637 sei->fMask, sei->hwnd, sei->lpVerb, sei->lpFile,
638 sei->lpParameters, sei->lpDirectory, sei->nShow,
639 (sei->fMask & SEE_MASK_CLASSNAME) ? sei->lpClass : "not used");
641 ZeroMemory(szApplicationName,MAX_PATH);
643 strcpy(szApplicationName, sei->lpFile);
645 ZeroMemory(szCommandline,MAX_PATH);
646 if (sei->lpParameters)
647 strcpy(szCommandline, sei->lpParameters);
649 if (sei->fMask & (SEE_MASK_CLASSKEY | SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY |
650 SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT |
651 SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE |
652 SEE_MASK_NO_CONSOLE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR ))
654 FIXME("flags ignored: 0x%08lx\n", sei->fMask);
657 /* launch a document by fileclass like 'Wordpad.Document.1' */
658 if (sei->fMask & SEE_MASK_CLASSNAME)
660 /* the commandline contains 'c:\Path\wordpad.exe "%1"' */
661 HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, 256);
662 /* fixme: get the extension of lpFile, check if it fits to the lpClass */
663 TRACE("SEE_MASK_CLASSNAME->'%s'\n", szCommandline);
666 /* process the IDList */
667 if ( (sei->fMask & SEE_MASK_INVOKEIDLIST) == SEE_MASK_INVOKEIDLIST) /*0x0c*/
669 SHGetPathFromIDListA (sei->lpIDList,szApplicationName);
670 TRACE("-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName);
674 if (sei->fMask & SEE_MASK_IDLIST )
676 pos = strstr(szCommandline, "%I");
679 HGLOBAL hmem = SHAllocShared ( sei->lpIDList, ILGetSize(sei->lpIDList), 0);
680 sprintf(szPidl,":%li",(DWORD)SHLockShared(hmem,0) );
681 SHUnlockShared(hmem);
683 gap = strlen(szPidl);
685 memmove(pos+gap,pos+2,len);
686 memcpy(pos,szPidl,gap);
692 TRACE("execute:'%s','%s'\n",szApplicationName, szCommandline);
694 strcat(szApplicationName, " ");
695 strcat(szApplicationName, szCommandline);
697 ZeroMemory(&startup,sizeof(STARTUPINFOA));
698 startup.cb = sizeof(STARTUPINFOA);
700 if (! CreateProcessA(NULL, szApplicationName,
701 NULL, NULL, FALSE, 0,
702 NULL, NULL, &startup, &info))
704 sei->hInstApp = GetLastError();
710 /* Give 30 seconds to the app to come up */
711 if ( WaitForInputIdle ( info.hProcess, 30000 ) == 0xFFFFFFFF )
712 ERR("WaitForInputIdle failed: Error %ld\n", GetLastError() );
714 if(sei->fMask & SEE_MASK_NOCLOSEPROCESS)
715 sei->hProcess = info.hProcess;
717 CloseHandle( info.hProcess );
718 CloseHandle( info.hThread );
721 /*************************************************************************
722 * ShellExecuteExW [SHELL32.293]
725 BOOL WINAPI ShellExecuteExW (LPSHELLEXECUTEINFOW sei)
726 { SHELLEXECUTEINFOA seiA;
731 memcpy(&seiA, sei, sizeof(SHELLEXECUTEINFOA));
734 seiA.lpVerb = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpVerb);
737 seiA.lpFile = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpFile);
739 if (sei->lpParameters)
740 seiA.lpParameters = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpParameters);
742 if (sei->lpDirectory)
743 seiA.lpDirectory = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpDirectory);
745 if ((sei->fMask & SEE_MASK_CLASSNAME) && sei->lpClass)
746 seiA.lpClass = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpClass);
750 ret = ShellExecuteExA(&seiA);
752 if (seiA.lpVerb) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpVerb );
753 if (seiA.lpFile) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpFile );
754 if (seiA.lpParameters) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpParameters );
755 if (seiA.lpDirectory) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpDirectory );
756 if (seiA.lpClass) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpClass );
761 static LPUNKNOWN SHELL32_IExplorerInterface=0;
762 /*************************************************************************
763 * SHSetInstanceExplorer [SHELL32.176]
768 HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown)
769 { TRACE("%p\n", lpUnknown);
770 SHELL32_IExplorerInterface = lpUnknown;
771 return (HRESULT) lpUnknown;
773 /*************************************************************************
774 * SHGetInstanceExplorer [SHELL32.256]
777 * gets the interface pointer of the explorer and a reference
779 HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown)
780 { TRACE("%p\n", lpUnknown);
782 *lpUnknown = SHELL32_IExplorerInterface;
784 if (!SHELL32_IExplorerInterface)
787 IUnknown_AddRef(SHELL32_IExplorerInterface);
790 /*************************************************************************
791 * SHFreeUnusedLibraries [SHELL32.123]
796 HRESULT WINAPI SHFreeUnusedLibraries (void)
800 /*************************************************************************
801 * DAD_SetDragImage [SHELL32.136]
806 HRESULT WINAPI DAD_SetDragImage (DWORD u, DWORD v)
807 { FIXME("0x%08lx 0x%08lx stub\n",u, v);
810 /*************************************************************************
811 * DAD_ShowDragImage [SHELL32.137]
816 HRESULT WINAPI DAD_ShowDragImage (DWORD u)
817 { FIXME("0x%08lx stub\n",u);
820 /*************************************************************************
821 * SHRegCloseKey [NT4.0:SHELL32.505]
824 HRESULT WINAPI SHRegCloseKey (HKEY hkey)
825 { TRACE("0x%04x\n",hkey);
826 return RegCloseKey( hkey );
828 /*************************************************************************
829 * SHRegOpenKeyA [SHELL32.506]
832 HRESULT WINAPI SHRegOpenKeyA(HKEY hKey, LPSTR lpSubKey, LPHKEY phkResult)
834 TRACE("(0x%08x, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult);
835 return RegOpenKeyA(hKey, lpSubKey, phkResult);
838 /*************************************************************************
839 * SHRegOpenKeyW [NT4.0:SHELL32.507]
842 HRESULT WINAPI SHRegOpenKeyW (HKEY hkey, LPCWSTR lpszSubKey, LPHKEY retkey)
843 { WARN("0x%04x %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
844 return RegOpenKeyW( hkey, lpszSubKey, retkey );
846 /*************************************************************************
847 * SHRegQueryValueExA [SHELL32.509]
850 HRESULT WINAPI SHRegQueryValueExA(
858 TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
859 return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
861 /*************************************************************************
862 * SHRegQueryValueW [NT4.0:SHELL32.510]
865 HRESULT WINAPI SHRegQueryValueW (HKEY hkey, LPWSTR lpszSubKey,
866 LPWSTR lpszData, LPDWORD lpcbData )
867 { WARN("0x%04x %s %p %p semi-stub\n",
868 hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
869 return RegQueryValueW( hkey, lpszSubKey, lpszData, lpcbData );
872 /*************************************************************************
873 * SHRegQueryValueExW [NT4.0:SHELL32.511]
876 * if the datatype REG_EXPAND_SZ then expand the string and change
877 * *pdwType to REG_SZ.
879 HRESULT WINAPI SHRegQueryValueExW (HKEY hkey, LPWSTR pszValue, LPDWORD pdwReserved,
880 LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData)
882 WARN("0x%04x %s %p %p %p %p semi-stub\n",
883 hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
884 ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);
888 /* SHGetValue: Gets a value from the registry */
890 DWORD WINAPI SHGetValueA(
899 FIXME("(%p),stub!\n", pSubKey);
901 return ERROR_SUCCESS; /* return success */
904 DWORD WINAPI SHGetValueW(
913 FIXME("(%p),stub!\n", pSubKey);
915 return ERROR_SUCCESS; /* return success */
918 /* gets a user-specific registry value. */
920 LONG WINAPI SHRegGetUSValueA(
928 DWORD wDefaultDataSize
931 FIXME("(%p),stub!\n", pSubKey);
933 return ERROR_SUCCESS; /* return success */
936 LONG WINAPI SHRegGetUSValueW(
944 DWORD wDefaultDataSize
947 FIXME("(%p),stub!\n", pSubKey);
949 return ERROR_SUCCESS; /* return success */
952 /*************************************************************************
953 * SHRegDeleteKeyA and SHDeleteKeyA
955 HRESULT WINAPI SHRegDeleteKeyA(HKEY hkey, LPCSTR pszSubKey)
957 FIXME("hkey=0x%08x, %s\n", hkey, debugstr_a(pszSubKey));
961 /*************************************************************************
962 * SHRegDeleteKeyW and SHDeleteKeyA
964 HRESULT WINAPI SHRegDeleteKeyW(HKEY hkey, LPCWSTR pszSubKey)
966 FIXME("hkey=0x%08x, %s\n", hkey, debugstr_w(pszSubKey));
969 /*************************************************************************
970 * ReadCabinetState [NT 4.0:SHELL32.651]
973 HRESULT WINAPI ReadCabinetState(DWORD u, DWORD v)
974 { FIXME("0x%04lx 0x%04lx stub\n",u,v);
977 /*************************************************************************
978 * WriteCabinetState [NT 4.0:SHELL32.652]
981 HRESULT WINAPI WriteCabinetState(DWORD u)
982 { FIXME("0x%04lx stub\n",u);
985 /*************************************************************************
986 * FileIconInit [SHELL32.660]
989 BOOL WINAPI FileIconInit(BOOL bFullInit)
990 { FIXME("(%s)\n", bFullInit ? "true" : "false");
993 /*************************************************************************
994 * IsUserAdmin [NT 4.0:SHELL32.680]
997 HRESULT WINAPI IsUserAdmin(void)
1001 /*************************************************************************
1002 * StrRetToStrN [SHELL32.96]
1004 * converts a STRRET to a normal string
1007 * the pidl is for STRRET OFFSET
1009 HRESULT WINAPI StrRetToBufA (LPSTRRET src, LPITEMIDLIST pidl, LPSTR dest, DWORD len)
1011 return StrRetToStrNA(dest, len, src, pidl);
1014 HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
1016 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
1021 WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL);
1022 SHFree(src->u.pOleStr);
1026 lstrcpynA((LPSTR)dest, src->u.cStr, len);
1029 case STRRET_OFFSETA:
1030 lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
1034 FIXME("unknown type!\n");
1037 *(LPSTR)dest = '\0';
1044 HRESULT WINAPI StrRetToBufW (LPSTRRET src, LPITEMIDLIST pidl, LPWSTR dest, DWORD len)
1046 return StrRetToStrNW(dest, len, src, pidl);
1049 HRESULT WINAPI StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
1051 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
1056 lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);
1057 SHFree(src->u.pOleStr);
1061 lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len);
1064 case STRRET_OFFSETA:
1067 lstrcpynAtoW((LPWSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
1072 FIXME("unknown type!\n");
1074 { *(LPSTR)dest = '\0';
1080 HRESULT WINAPI StrRetToStrNAW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
1082 if(VERSION_OsIsUnicode())
1083 return StrRetToStrNW (dest, len, src, pidl);
1084 return StrRetToStrNA (dest, len, src, pidl);
1087 /*************************************************************************
1088 * StrChrW [NT 4.0:SHELL32.651]
1091 LPWSTR WINAPI StrChrW (LPWSTR str, WCHAR x )
1093 TRACE("%s 0x%04x\n",debugstr_w(str),x);
1094 return CRTDLL_wcschr(str, x);
1097 /*************************************************************************
1098 * StrCmpNIW [NT 4.0:SHELL32.*]
1101 INT WINAPI StrCmpNIW ( LPWSTR wstr1, LPWSTR wstr2, INT len)
1103 TRACE("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len);
1104 return CRTDLL__wcsnicmp(wstr1, wstr2, len);
1107 /*************************************************************************
1108 * SHAllocShared [SHELL32.520]
1111 * parameter1 is return value from HeapAlloc
1112 * parameter2 is equal to the size allocated with HeapAlloc
1113 * parameter3 is return value from GetCurrentProcessId
1115 * the return value is posted as lParam with 0x402 (WM_USER+2) to somewhere
1116 * WM_USER+2 could be the undocumented CWM_SETPATH
1117 * the allocated memory contains a pidl
1119 HGLOBAL WINAPI SHAllocShared(LPVOID psrc, DWORD size, DWORD procID)
1123 TRACE("ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID);
1124 hmem = GlobalAlloc(GMEM_FIXED, size);
1128 pmem = GlobalLock (hmem);
1133 memcpy (pmem, psrc, size);
1137 /*************************************************************************
1138 * SHLockShared [SHELL32.521]
1141 * parameter1 is return value from SHAllocShared
1142 * parameter2 is return value from GetCurrentProcessId
1143 * the receiver of (WM_USER+2) trys to lock the HANDLE (?)
1144 * the returnvalue seems to be a memoryadress
1146 LPVOID WINAPI SHLockShared(HANDLE hmem, DWORD procID)
1147 { TRACE("handle=0x%04x procID=0x%04lx\n",hmem,procID);
1148 return GlobalLock(hmem);
1150 /*************************************************************************
1151 * SHUnlockShared [SHELL32.522]
1154 * parameter1 is return value from SHLockShared
1156 BOOL WINAPI SHUnlockShared(HANDLE pmem)
1157 { TRACE("handle=0x%04x\n",pmem);
1158 return GlobalUnlock(pmem);
1160 /*************************************************************************
1161 * SHFreeShared [SHELL32.523]
1164 * parameter1 is return value from SHAllocShared
1165 * parameter2 is return value from GetCurrentProcessId
1167 HANDLE WINAPI SHFreeShared(HANDLE hmem, DWORD procID)
1168 { TRACE("handle=0x%04x 0x%04lx\n",hmem,procID);
1169 return GlobalFree(hmem);
1172 /*************************************************************************
1173 * SetAppStartingCursor [SHELL32.99]
1176 HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v)
1177 { FIXME("hwnd=0x%04x 0x%04lx stub\n",u,v );
1180 /*************************************************************************
1181 * SHLoadOLE [SHELL32.151]
1184 HRESULT WINAPI SHLoadOLE(DWORD u)
1185 { FIXME("0x%04lx stub\n",u);
1188 /*************************************************************************
1189 * DriveType [SHELL32.64]
1192 HRESULT WINAPI DriveType(DWORD u)
1193 { FIXME("0x%04lx stub\n",u);
1196 /*************************************************************************
1197 * SHAbortInvokeCommand [SHELL32.198]
1200 HRESULT WINAPI SHAbortInvokeCommand(void)
1204 /*************************************************************************
1205 * SHOutOfMemoryMessageBox [SHELL32.126]
1208 HRESULT WINAPI SHOutOfMemoryMessageBox(DWORD u, DWORD v, DWORD w)
1209 { FIXME("0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w);
1212 /*************************************************************************
1213 * SHFlushClipboard [SHELL32.121]
1216 HRESULT WINAPI SHFlushClipboard(void)
1221 /*************************************************************************
1222 * StrFormatByteSize [SHLWAPI]
1224 LPSTR WINAPI StrFormatByteSizeA ( DWORD dw, LPSTR pszBuf, UINT cchBuf )
1226 TRACE("%lx %p %i\n", dw, pszBuf, cchBuf);
1228 { sprintf (buf,"%3.1f bytes", (FLOAT)dw);
1230 else if ( dw<1048576L)
1231 { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024);
1233 else if ( dw < 1073741824L)
1234 { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L);
1237 { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L);
1239 lstrcpynA (pszBuf, buf, cchBuf);
1242 LPWSTR WINAPI StrFormatByteSizeW ( DWORD dw, LPWSTR pszBuf, UINT cchBuf )
1244 TRACE("%lx %p %i\n", dw, pszBuf, cchBuf);
1246 { sprintf (buf,"%3.1f bytes", (FLOAT)dw);
1248 else if ( dw<1048576L)
1249 { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024);
1251 else if ( dw < 1073741824L)
1252 { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L);
1255 { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L);
1257 lstrcpynAtoW (pszBuf, buf, cchBuf);
1260 /*************************************************************************
1261 * SHWaitForFileToOpen [SHELL32.97]
1264 HRESULT WINAPI SHWaitForFileToOpen(DWORD u, DWORD v, DWORD w)
1265 { FIXME("0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w);
1268 /*************************************************************************
1269 * Control_FillCache_RunDLL [SHELL32.8]
1272 HRESULT WINAPI Control_FillCache_RunDLL(HWND hWnd, HANDLE hModule, DWORD w, DWORD x)
1273 { FIXME("0x%04x 0x%04x 0x%04lx 0x%04lx stub\n",hWnd, hModule,w,x);
1276 /*************************************************************************
1277 * RunDLL_CallEntry16 [SHELL32.122]
1278 * the name is propably wrong
1280 HRESULT WINAPI RunDLL_CallEntry16(DWORD v, DWORD w, DWORD x, DWORD y, DWORD z)
1281 { FIXME("0x%04lx 0x%04lx 0x%04lx 0x%04lx 0x%04lx stub\n",v,w,x,y,z);
1285 /************************************************************************
1286 * shell32_654 [SHELL32.654]
1288 * NOTES: first parameter seems to be a pointer (same as passed to WriteCabinetState)
1289 * second one could be a size (0x0c). The size is the same as the structure saved to
1290 * HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState
1291 * I'm (js) guessing: this one is just ReadCabinetState ;-)
1293 HRESULT WINAPI shell32_654 (DWORD x, DWORD y)
1294 { FIXME("0x%08lx 0x%08lx stub\n",x,y);
1298 /************************************************************************
1299 * RLBuildListOfPaths [SHELL32.146]
1304 DWORD WINAPI RLBuildListOfPaths (void)
1308 /************************************************************************
1309 * StrToOleStr [SHELL32.163]
1312 int WINAPI StrToOleStrA (LPWSTR lpWideCharStr, LPCSTR lpMultiByteString)
1314 TRACE("(%p, %p %s)\n",
1315 lpWideCharStr, lpMultiByteString, debugstr_a(lpMultiByteString));
1317 return MultiByteToWideChar(0, 0, lpMultiByteString, -1, lpWideCharStr, MAX_PATH);
1320 int WINAPI StrToOleStrW (LPWSTR lpWideCharStr, LPCWSTR lpWString)
1322 TRACE("(%p, %p %s)\n",
1323 lpWideCharStr, lpWString, debugstr_w(lpWString));
1325 if (lstrcpyW (lpWideCharStr, lpWString ))
1326 { return lstrlenW (lpWideCharStr);
1331 BOOL WINAPI StrToOleStrAW (LPWSTR lpWideCharStr, LPCVOID lpString)
1333 if (VERSION_OsIsUnicode())
1334 return StrToOleStrW (lpWideCharStr, lpString);
1335 return StrToOleStrA (lpWideCharStr, lpString);
1338 /************************************************************************
1339 * SHValidateUNC [SHELL32.173]
1342 HRESULT WINAPI SHValidateUNC (DWORD x, DWORD y, DWORD z)
1344 FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x,y,z);
1348 /************************************************************************
1349 * DoEnvironmentSubstW [SHELL32.53]
1352 HRESULT WINAPI DoEnvironmentSubstA(LPSTR x, LPSTR y)
1354 FIXME("(%p %s, %p %s) stub\n", x, debugstr_a(x), y, debugstr_a(y));
1358 HRESULT WINAPI DoEnvironmentSubstW(LPWSTR x, LPWSTR y)
1360 FIXME("(%p %s, %p %s) stub\n", x, debugstr_w(x), y, debugstr_w(y));
1364 HRESULT WINAPI DoEnvironmentSubstAW(LPVOID x, LPVOID y)
1366 if (VERSION_OsIsUnicode())
1367 return DoEnvironmentSubstW(x, y);
1368 return DoEnvironmentSubstA(x, y);
1371 /*************************************************************************
1372 * shell32_243 [SHELL32.243]
1374 * Win98+ by-ordinal routine. In Win98 this routine returns zero and
1375 * does nothing else. Possibly this does something in NT or SHELL32 5.0?
1379 BOOL WINAPI shell32_243(DWORD a, DWORD b)