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"
23 DEFAULT_DEBUG_CHANNEL(shell);
25 /*************************************************************************
26 * ParseFieldA [internal]
28 * copys a field from a ',' delimited string
30 * first field is nField = 1
32 DWORD WINAPI ParseFieldA(
38 WARN("('%s',0x%08lx,%p,%ld) semi-stub.\n",src,nField,dst,len);
40 if (!src || !src[0] || !dst || !len)
43 /* skip n fields delimited by ',' */
46 if (*src=='\0') return FALSE;
47 if (*(src++)==',') nField--;
50 /* copy part till the next ',' to dst */
51 while ( *src!='\0' && *src!=',' && (len--)>0 ) *(dst++)=*(src++);
53 /* finalize the string */
59 /*************************************************************************
60 * ParseFieldW [internal]
62 * copys a field from a ',' delimited string
64 * first field is nField = 1
66 DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len)
68 FIXME("('%s',0x%08lx,%p,%ld) stub.\n",
69 debugstr_w(src), nField, dst, len);
73 /*************************************************************************
74 * ParseFieldAW [SHELL32.58]
76 DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len)
78 if (VERSION_OsIsUnicode())
79 return ParseFieldW(src, nField, dst, len);
80 return ParseFieldA(src, nField, dst, len);
83 /*************************************************************************
84 * GetFileNameFromBrowse [SHELL32.63]
87 BOOL WINAPI GetFileNameFromBrowse(
91 LPCSTR lpstrInitialDir,
96 FIXME("(%04x,%s,%ld,%s,%s,%s,%s):stub.\n",
97 hwndOwner, lpstrFile, nMaxFile, lpstrInitialDir, lpstrDefExt,
98 lpstrFilter, lpstrTitle);
100 /* puts up a Open Dialog and requests input into targetbuf */
101 /* OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST|OFN_unknown */
102 lstrcpyA(lpstrFile,"x:\\dummy.exe");
106 /*************************************************************************
107 * SHGetSettings [SHELL32.68]
110 * the registry path are for win98 (tested)
111 * and possibly are the same in nt40
113 void WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask, DWORD dwx)
117 DWORD dwDataSize = sizeof (DWORD);
119 TRACE("(%p 0x%08lx 0x%08lx)\n",lpsfs,dwMask, dwx);
121 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
122 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0))
125 if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize))
126 lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1);
128 if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize))
129 lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1);
131 if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize))
132 lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1);
134 if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize))
135 lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1);
137 if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize))
138 lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1);
140 if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize))
141 lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1);
143 if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize))
145 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
146 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
148 else if (dwData == 1)
149 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 1;
150 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
152 else if (dwData == 2)
153 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
154 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 1;
159 TRACE("-- 0x%04x\n", *(WORD*)lpsfs);
162 /*************************************************************************
163 * SHShellFolderView_Message [SHELL32.73]
166 * hwndCabinet defines the explorer cabinet window that contains the
167 * shellview you need to communicate with
168 * uMsg identifying the SFVM enum to perform
172 * Message SFVM_REARRANGE = 1
173 * This message gets sent when a column gets clicked to instruct the
174 * shell view to re-sort the item list. lParam identifies the column
177 int WINAPI SHShellFolderView_Message(
182 FIXME("%04x %08lx %08lx stub\n",hwndCabinet, dwMessage, dwParam);
186 /*************************************************************************
187 * OleStrToStrN [SHELL32.78]
189 BOOL WINAPI OleStrToStrNA (LPSTR lpStr, INT nStr, LPCWSTR lpOle, INT nOle)
191 TRACE("(%p, %x, %s, %x)\n", lpStr, nStr, debugstr_wn(lpOle,nOle), nOle);
192 return WideCharToMultiByte (0, 0, lpOle, nOle, lpStr, nStr, NULL, NULL);
195 BOOL WINAPI OleStrToStrNW (LPWSTR lpwStr, INT nwStr, LPCWSTR lpOle, INT nOle)
197 TRACE("(%p, %x, %s, %x)\n", lpwStr, nwStr, debugstr_wn(lpOle,nOle), nOle);
199 if (lstrcpynW ( lpwStr, lpOle, nwStr))
200 { return lstrlenW (lpwStr);
205 BOOL WINAPI OleStrToStrNAW (LPVOID lpOut, INT nOut, LPCVOID lpIn, INT nIn)
207 if (VERSION_OsIsUnicode())
208 return OleStrToStrNW (lpOut, nOut, lpIn, nIn);
209 return OleStrToStrNA (lpOut, nOut, lpIn, nIn);
212 /*************************************************************************
213 * StrToOleStrN [SHELL32.79]
214 * lpMulti, nMulti, nWide [IN]
217 BOOL WINAPI StrToOleStrNA (LPWSTR lpWide, INT nWide, LPCSTR lpStrA, INT nStr)
219 TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_an(lpStrA,nStr), nStr);
220 return MultiByteToWideChar (0, 0, lpStrA, nStr, lpWide, nWide);
222 BOOL WINAPI StrToOleStrNW (LPWSTR lpWide, INT nWide, LPCWSTR lpStrW, INT nStr)
224 TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_wn(lpStrW, nStr), nStr);
226 if (lstrcpynW (lpWide, lpStrW, nWide))
227 { return lstrlenW (lpWide);
232 BOOL WINAPI StrToOleStrNAW (LPWSTR lpWide, INT nWide, LPCVOID lpStr, INT nStr)
234 if (VERSION_OsIsUnicode())
235 return StrToOleStrNW (lpWide, nWide, lpStr, nStr);
236 return StrToOleStrNA (lpWide, nWide, lpStr, nStr);
239 /*************************************************************************
240 * RegisterShellHook [SHELL32.181]
243 * hwnd [I] window handle
247 * exported by ordinal
249 BOOL WINAPI RegisterShellHook(
253 FIXME("(0x%08x,0x%08lx):stub.\n",hWnd, dwType);
256 /*************************************************************************
257 * ShellMessageBoxW [SHELL32.182]
259 * Format and output errormessage.
261 * idText resource ID of title or LPSTR
262 * idTitle resource ID of title or LPSTR
265 * exported by ordinal
267 int WINAPIV ShellMessageBoxW(
275 WCHAR szText[100],szTitle[100],szTemp[256];
276 LPCWSTR pszText = szText, pszTitle = szTitle;
278 va_start(args, uType);
279 /* wvsprintfA(buf,fmt, args); */
281 TRACE("(%08lx,%08lx,%p,%p,%08x)\n",
282 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType);
284 if (!HIWORD(lpCaption))
285 LoadStringW(hInstance, (DWORD)lpCaption, szTitle, 100);
287 pszTitle = lpCaption;
290 LoadStringW(hInstance, (DWORD)lpText, szText, 100);
294 FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY,
295 szText, 0, 0, szTemp, 256, (LPDWORD) args);
299 return MessageBoxW(hWnd,szTemp,szTitle,uType);
302 /*************************************************************************
303 * ShellMessageBoxA [SHELL32.183]
305 int WINAPIV ShellMessageBoxA(
313 char szText[100],szTitle[100],szTemp[256];
314 LPCSTR pszText = szText, pszTitle = szTitle;
316 va_start(args, uType);
317 /* wvsprintfA(buf,fmt, args); */
319 TRACE("(%08lx,%08lx,%p,%p,%08x)\n",
320 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType);
322 if (!HIWORD(lpCaption))
323 LoadStringA(hInstance, (DWORD)lpCaption, szTitle, 100);
325 pszTitle = lpCaption;
328 LoadStringA(hInstance, (DWORD)lpText, szText, 100);
332 FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY,
333 szText, 0, 0, szTemp, 256, (LPDWORD) args);
337 return MessageBoxA(hWnd,szTemp,szTitle,uType);
340 /*************************************************************************
341 * SHFree [SHELL32.195]
344 * free_ptr() - frees memory using IMalloc
345 * exported by ordinal
348 void WINAPI SHFree(LPVOID x)
351 WORD len = *(LPWORD)((LPBYTE)x-2);
353 if ( *(LPWORD)((LPBYTE)x+len) != 0x7384)
356 if ( (*(LPWORD)((LPBYTE)x-4)) != 0x8271)
359 memset((LPBYTE)x-4, 0xde, len+6);
361 TRACE("%p len=%u\n",x, len);
367 HeapFree(GetProcessHeap(), 0, x);
370 /*************************************************************************
371 * SHAlloc [SHELL32.196]
374 * void *task_alloc(DWORD len), uses SHMalloc allocator
375 * exported by ordinal
377 LPVOID WINAPI SHAlloc(DWORD len)
382 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len+6);
384 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len);
388 *(LPWORD)(ret) = 0x8271;
389 *(LPWORD)(ret+2) = (WORD)len;
390 *(LPWORD)(ret+4+len) = 0x7384;
392 memset(ret, 0xdf, len);
394 TRACE("%lu bytes at %p\n",len, ret);
398 /*************************************************************************
399 * SHRegisterDragDrop [SHELL32.86]
402 * exported by ordinal
404 HRESULT WINAPI SHRegisterDragDrop(
406 LPDROPTARGET pDropTarget)
408 FIXME("(0x%08x,%p):stub.\n", hWnd, pDropTarget);
409 if (GetShellOle()) return pRegisterDragDrop(hWnd, pDropTarget);
413 /*************************************************************************
414 * SHRevokeDragDrop [SHELL32.87]
417 * exported by ordinal
419 HRESULT WINAPI SHRevokeDragDrop(HWND hWnd)
421 FIXME("(0x%08x):stub.\n",hWnd);
425 /*************************************************************************
426 * SHDoDragDrop [SHELL32.88]
429 * exported by ordinal
431 HRESULT WINAPI SHDoDragDrop(
433 LPDATAOBJECT lpDataObject,
434 LPDROPSOURCE lpDropSource,
438 FIXME("(0x%04x %p %p 0x%08lx %p):stub.\n",
439 hWnd, lpDataObject, lpDropSource, dwOKEffect, pdwEffect);
443 /*************************************************************************
444 * ArrangeWindows [SHELL32.184]
447 WORD WINAPI ArrangeWindows(
454 FIXME("(0x%08x 0x%08lx %p 0x%04x %p):stub.\n",
455 hwndParent, dwReserved, lpRect, cKids, lpKids);
459 /*************************************************************************
460 * SignalFileOpen [SHELL32.103]
463 * exported by ordinal
466 SignalFileOpen (DWORD dwParam1)
468 FIXME("(0x%08lx):stub.\n", dwParam1);
473 /*************************************************************************
474 * SHAddToRecentDocs [SHELL32.234]
477 * uFlags [IN] SHARD_PATH or SHARD_PIDL
478 * pv [IN] string or pidl, NULL clears the list
483 DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
484 { if (SHARD_PIDL==uFlags)
485 { FIXME("(0x%08x,pidl=%p):stub.\n", uFlags,pv);
488 { FIXME("(0x%08x,%s):stub.\n", uFlags,(char*)pv);
492 /*************************************************************************
493 * SHCreateShellFolderViewEx [SHELL32.174]
496 * see IShellFolder::CreateViewObject
498 HRESULT WINAPI SHCreateShellFolderViewEx(
499 LPCSHELLFOLDERVIEWINFO psvcbi, /*[in ] shelltemplate struct*/
500 LPSHELLVIEW* ppv) /*[out] IShellView pointer*/
505 TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=0x%08lx\n",
506 psvcbi->pshf, psvcbi->pidlFolder, psvcbi->lpfnCallback,
507 psvcbi->uViewMode, psvcbi->dwUser);
509 psf = IShellView_Constructor(psvcbi->pshf);
512 return E_OUTOFMEMORY;
514 IShellView_AddRef(psf);
515 hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv);
516 IShellView_Release(psf);
520 /*************************************************************************
521 * SHWinHelp [SHELL32.127]
524 HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z)
525 { FIXME("0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z);
528 /*************************************************************************
529 * SHRunControlPanel [SHELL32.161]
532 HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z)
533 { FIXME("0x%08lx 0x%08lx stub\n",x,z);
536 /*************************************************************************
537 * ShellExecuteEx [SHELL32.291]
540 BOOL WINAPI ShellExecuteExAW (LPVOID sei)
541 { if (VERSION_OsIsUnicode())
542 return ShellExecuteExW (sei);
543 return ShellExecuteExA (sei);
545 /*************************************************************************
546 * ShellExecuteExA [SHELL32.292]
548 * placeholder in the commandline:
553 * %I adress of a global item ID (explorer switch /idlist)
554 * %L ??? path/url/current file ???
556 * %* all following parameters (see batfile)
558 #include "process.h" /* we can get rid of it hopefully */
560 BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei)
561 { CHAR szApplicationName[MAX_PATH],szCommandline[MAX_PATH],szPidl[20];
564 STARTUPINFOA startup;
565 PROCESS_INFORMATION info;
567 WARN("mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n",
568 sei->fMask, sei->hwnd, sei->lpVerb, sei->lpFile,
569 sei->lpParameters, sei->lpDirectory, sei->nShow,
570 (sei->fMask & SEE_MASK_CLASSNAME) ? sei->lpClass : "not used");
572 ZeroMemory(szApplicationName,MAX_PATH);
574 strcpy(szApplicationName, sei->lpFile);
576 ZeroMemory(szCommandline,MAX_PATH);
577 if (sei->lpParameters)
578 strcpy(szCommandline, sei->lpParameters);
580 if (sei->fMask & (SEE_MASK_CLASSKEY | SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY |
581 SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT |
582 SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE |
583 SEE_MASK_NO_CONSOLE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR ))
585 FIXME("flags ignored: 0x%08lx\n", sei->fMask);
588 /* launch a document by fileclass like 'Wordpad.Document.1' */
589 if (sei->fMask & SEE_MASK_CLASSNAME)
591 /* the commandline contains 'c:\Path\wordpad.exe "%1"' */
592 HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, 256);
593 /* fixme: get the extension of lpFile, check if it fits to the lpClass */
594 TRACE("SEE_MASK_CLASSNAME->'%s'\n", szCommandline);
597 /* process the IDList */
598 if ( (sei->fMask & SEE_MASK_INVOKEIDLIST) == SEE_MASK_INVOKEIDLIST) /*0x0c*/
600 SHGetPathFromIDListA (sei->lpIDList,szApplicationName);
601 TRACE("-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName);
605 if (sei->fMask & SEE_MASK_IDLIST )
607 pos = strstr(szCommandline, "%I");
611 HGLOBAL hmem = SHAllocShared ( sei->lpIDList, ILGetSize(sei->lpIDList), 0);
612 pv = SHLockShared(hmem,0);
613 sprintf(szPidl,":%p",pv );
616 gap = strlen(szPidl);
618 memmove(pos+gap,pos+2,len);
619 memcpy(pos,szPidl,gap);
625 TRACE("execute:'%s','%s'\n",szApplicationName, szCommandline);
627 strcat(szApplicationName, " ");
628 strcat(szApplicationName, szCommandline);
630 ZeroMemory(&startup,sizeof(STARTUPINFOA));
631 startup.cb = sizeof(STARTUPINFOA);
633 if (! CreateProcessA(NULL, szApplicationName,
634 NULL, NULL, FALSE, 0,
635 NULL, NULL, &startup, &info))
637 sei->hInstApp = GetLastError();
643 /* Give 30 seconds to the app to come up */
644 if ( WaitForInputIdle ( info.hProcess, 30000 ) == 0xFFFFFFFF )
645 ERR("WaitForInputIdle failed: Error %ld\n", GetLastError() );
647 if(sei->fMask & SEE_MASK_NOCLOSEPROCESS)
648 sei->hProcess = info.hProcess;
650 CloseHandle( info.hProcess );
651 CloseHandle( info.hThread );
654 /*************************************************************************
655 * ShellExecuteExW [SHELL32.293]
658 BOOL WINAPI ShellExecuteExW (LPSHELLEXECUTEINFOW sei)
659 { SHELLEXECUTEINFOA seiA;
664 memcpy(&seiA, sei, sizeof(SHELLEXECUTEINFOA));
667 seiA.lpVerb = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpVerb);
670 seiA.lpFile = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpFile);
672 if (sei->lpParameters)
673 seiA.lpParameters = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpParameters);
675 if (sei->lpDirectory)
676 seiA.lpDirectory = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpDirectory);
678 if ((sei->fMask & SEE_MASK_CLASSNAME) && sei->lpClass)
679 seiA.lpClass = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpClass);
683 ret = ShellExecuteExA(&seiA);
685 if (seiA.lpVerb) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpVerb );
686 if (seiA.lpFile) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpFile );
687 if (seiA.lpParameters) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpParameters );
688 if (seiA.lpDirectory) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpDirectory );
689 if (seiA.lpClass) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpClass );
694 static LPUNKNOWN SHELL32_IExplorerInterface=0;
695 /*************************************************************************
696 * SHSetInstanceExplorer [SHELL32.176]
701 HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown)
702 { TRACE("%p\n", lpUnknown);
703 SHELL32_IExplorerInterface = lpUnknown;
704 return (HRESULT) lpUnknown;
706 /*************************************************************************
707 * SHGetInstanceExplorer [SHELL32.256]
710 * gets the interface pointer of the explorer and a reference
712 HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown)
713 { TRACE("%p\n", lpUnknown);
715 *lpUnknown = SHELL32_IExplorerInterface;
717 if (!SHELL32_IExplorerInterface)
720 IUnknown_AddRef(SHELL32_IExplorerInterface);
723 /*************************************************************************
724 * SHFreeUnusedLibraries [SHELL32.123]
729 void WINAPI SHFreeUnusedLibraries (void)
733 /*************************************************************************
734 * DAD_SetDragImage [SHELL32.136]
739 BOOL WINAPI DAD_SetDragImage(
740 HIMAGELIST himlTrack,
743 FIXME("%p %p stub\n",himlTrack, lppt);
746 /*************************************************************************
747 * DAD_ShowDragImage [SHELL32.137]
752 BOOL WINAPI DAD_ShowDragImage(BOOL bShow)
754 FIXME("0x%08x stub\n",bShow);
757 /*************************************************************************
758 * SHRegCloseKey [NT4.0:SHELL32.505]
761 HRESULT WINAPI SHRegCloseKey (HKEY hkey)
762 { TRACE("0x%04x\n",hkey);
763 return RegCloseKey( hkey );
765 /*************************************************************************
766 * SHRegOpenKeyA [SHELL32.506]
769 HRESULT WINAPI SHRegOpenKeyA(HKEY hKey, LPSTR lpSubKey, LPHKEY phkResult)
771 TRACE("(0x%08x, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult);
772 return RegOpenKeyA(hKey, lpSubKey, phkResult);
775 /*************************************************************************
776 * SHRegOpenKeyW [NT4.0:SHELL32.507]
779 HRESULT WINAPI SHRegOpenKeyW (HKEY hkey, LPCWSTR lpszSubKey, LPHKEY retkey)
780 { WARN("0x%04x %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
781 return RegOpenKeyW( hkey, lpszSubKey, retkey );
783 /*************************************************************************
784 * SHRegQueryValueExA [SHELL32.509]
787 HRESULT WINAPI SHRegQueryValueExA(
795 TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
796 return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
798 /*************************************************************************
799 * SHRegQueryValueW [NT4.0:SHELL32.510]
802 HRESULT WINAPI SHRegQueryValueW (HKEY hkey, LPWSTR lpszSubKey,
803 LPWSTR lpszData, LPDWORD lpcbData )
804 { WARN("0x%04x %s %p %p semi-stub\n",
805 hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
806 return RegQueryValueW( hkey, lpszSubKey, lpszData, lpcbData );
809 /*************************************************************************
810 * SHRegQueryValueExW [NT4.0:SHELL32.511]
813 * if the datatype REG_EXPAND_SZ then expand the string and change
814 * *pdwType to REG_SZ.
816 HRESULT WINAPI SHRegQueryValueExW (HKEY hkey, LPWSTR pszValue, LPDWORD pdwReserved,
817 LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData)
819 WARN("0x%04x %s %p %p %p %p semi-stub\n",
820 hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
821 ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);
825 /* SHGetValue: Gets a value from the registry */
827 /*************************************************************************
830 * Gets a value from the registry
832 DWORD WINAPI SHGetValueA(
841 FIXME("(%p),stub!\n", pSubKey);
843 return ERROR_SUCCESS; /* return success */
846 /*************************************************************************
849 * Gets a value from the registry
851 DWORD WINAPI SHGetValueW(
860 FIXME("(%p),stub!\n", pSubKey);
862 return ERROR_SUCCESS; /* return success */
865 /* gets a user-specific registry value. */
867 /*************************************************************************
870 * Gets a user-specific registry value
872 LONG WINAPI SHRegGetUSValueA(
880 DWORD wDefaultDataSize
883 FIXME("(%p),stub!\n", pSubKey);
885 return ERROR_SUCCESS; /* return success */
888 /*************************************************************************
891 * Gets a user-specific registry value
893 LONG WINAPI SHRegGetUSValueW(
901 DWORD wDefaultDataSize
904 FIXME("(%p),stub!\n", pSubKey);
906 return ERROR_SUCCESS; /* return success */
909 /*************************************************************************
910 * SHRegDeleteKeyA and SHDeleteKeyA
912 HRESULT WINAPI SHRegDeleteKeyA(HKEY hkey, LPCSTR pszSubKey)
914 FIXME("hkey=0x%08x, %s\n", hkey, debugstr_a(pszSubKey));
918 /*************************************************************************
919 * SHRegDeleteKeyW and SHDeleteKeyA
921 HRESULT WINAPI SHRegDeleteKeyW(HKEY hkey, LPCWSTR pszSubKey)
923 FIXME("hkey=0x%08x, %s\n", hkey, debugstr_w(pszSubKey));
926 /*************************************************************************
927 * ReadCabinetState [NT 4.0:SHELL32.651]
930 HRESULT WINAPI ReadCabinetState(DWORD u, DWORD v)
931 { FIXME("0x%04lx 0x%04lx stub\n",u,v);
934 /*************************************************************************
935 * WriteCabinetState [NT 4.0:SHELL32.652]
938 HRESULT WINAPI WriteCabinetState(DWORD u)
939 { FIXME("0x%04lx stub\n",u);
942 /*************************************************************************
943 * FileIconInit [SHELL32.660]
946 BOOL WINAPI FileIconInit(BOOL bFullInit)
947 { FIXME("(%s)\n", bFullInit ? "true" : "false");
950 /*************************************************************************
951 * IsUserAdmin [NT 4.0:SHELL32.680]
954 HRESULT WINAPI IsUserAdmin(void)
959 /*************************************************************************
960 * StrRetToBufA [SHLWAPI.@]
962 * converts a STRRET to a normal string
965 * the pidl is for STRRET OFFSET
967 HRESULT WINAPI StrRetToBufA (LPSTRRET src, LPITEMIDLIST pidl, LPSTR dest, DWORD len)
969 return StrRetToStrNA(dest, len, src, pidl);
972 /*************************************************************************
973 * StrRetToBufW [SHLWAPI.@]
975 * converts a STRRET to a normal string
978 * the pidl is for STRRET OFFSET
980 HRESULT WINAPI StrRetToBufW (LPSTRRET src, LPITEMIDLIST pidl, LPWSTR dest, DWORD len)
982 return StrRetToStrNW(dest, len, src, pidl);
985 /*************************************************************************
986 * StrRetToStrN [SHELL32.96]
988 * converts a STRRET to a normal string
991 * the pidl is for STRRET OFFSET
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 StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
1025 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
1030 lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);
1031 SHFree(src->u.pOleStr);
1035 lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len);
1038 case STRRET_OFFSETA:
1041 lstrcpynAtoW((LPWSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
1046 FIXME("unknown type!\n");
1048 { *(LPSTR)dest = '\0';
1054 HRESULT WINAPI StrRetToStrNAW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
1056 if(VERSION_OsIsUnicode())
1057 return StrRetToStrNW (dest, len, src, pidl);
1058 return StrRetToStrNA (dest, len, src, pidl);
1061 /*************************************************************************
1062 * StrChrW [NT 4.0:SHELL32.651]
1065 LPWSTR WINAPI StrChrW (LPWSTR str, WCHAR x )
1067 TRACE("%s 0x%04x\n",debugstr_w(str),x);
1068 return CRTDLL_wcschr(str, x);
1071 /*************************************************************************
1072 * StrCmpNIW [NT 4.0:SHELL32.*]
1075 INT WINAPI StrCmpNIW ( LPWSTR wstr1, LPWSTR wstr2, INT len)
1077 TRACE("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len);
1078 return CRTDLL__wcsnicmp(wstr1, wstr2, len);
1081 /*************************************************************************
1082 * SHAllocShared [SHELL32.520]
1085 * parameter1 is return value from HeapAlloc
1086 * parameter2 is equal to the size allocated with HeapAlloc
1087 * parameter3 is return value from GetCurrentProcessId
1089 * the return value is posted as lParam with 0x402 (WM_USER+2) to somewhere
1090 * WM_USER+2 could be the undocumented CWM_SETPATH
1091 * the allocated memory contains a pidl
1093 HGLOBAL WINAPI SHAllocShared(LPVOID psrc, DWORD size, DWORD procID)
1097 TRACE("ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID);
1098 hmem = GlobalAlloc(GMEM_FIXED, size);
1102 pmem = GlobalLock (hmem);
1107 memcpy (pmem, psrc, size);
1111 /*************************************************************************
1112 * SHLockShared [SHELL32.521]
1115 * parameter1 is return value from SHAllocShared
1116 * parameter2 is return value from GetCurrentProcessId
1117 * the receiver of (WM_USER+2) trys to lock the HANDLE (?)
1118 * the returnvalue seems to be a memoryadress
1120 LPVOID WINAPI SHLockShared(HANDLE hmem, DWORD procID)
1121 { TRACE("handle=0x%04x procID=0x%04lx\n",hmem,procID);
1122 return GlobalLock(hmem);
1124 /*************************************************************************
1125 * SHUnlockShared [SHELL32.522]
1128 * parameter1 is return value from SHLockShared
1130 BOOL WINAPI SHUnlockShared(LPVOID pv)
1133 return GlobalUnlock((HANDLE)pv);
1135 /*************************************************************************
1136 * SHFreeShared [SHELL32.523]
1139 * parameter1 is return value from SHAllocShared
1140 * parameter2 is return value from GetCurrentProcessId
1142 BOOL WINAPI SHFreeShared(
1146 TRACE("handle=0x%04x 0x%04lx\n",hMem,pid);
1147 return GlobalFree(hMem);
1150 /*************************************************************************
1151 * SetAppStartingCursor [SHELL32.99]
1153 HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v)
1154 { FIXME("hwnd=0x%04x 0x%04lx stub\n",u,v );
1157 /*************************************************************************
1158 * SHLoadOLE [SHELL32.151]
1161 HRESULT WINAPI SHLoadOLE(DWORD u)
1162 { FIXME("0x%04lx stub\n",u);
1165 /*************************************************************************
1166 * DriveType [SHELL32.64]
1169 HRESULT WINAPI DriveType(DWORD u)
1170 { FIXME("0x%04lx stub\n",u);
1173 /*************************************************************************
1174 * SHAbortInvokeCommand [SHELL32.198]
1177 HRESULT WINAPI SHAbortInvokeCommand(void)
1181 /*************************************************************************
1182 * SHOutOfMemoryMessageBox [SHELL32.126]
1185 int WINAPI SHOutOfMemoryMessageBox(
1190 FIXME("0x%04x %s 0x%08x stub\n",hwndOwner, lpCaption, uType);
1193 /*************************************************************************
1194 * SHFlushClipboard [SHELL32.121]
1197 HRESULT WINAPI SHFlushClipboard(void)
1202 /*************************************************************************
1203 * StrFormatByteSizeA [SHLWAPI]
1205 LPSTR WINAPI StrFormatByteSizeA ( DWORD dw, LPSTR pszBuf, UINT cchBuf )
1207 TRACE("%lx %p %i\n", dw, pszBuf, cchBuf);
1209 { sprintf (buf,"%3.1f bytes", (FLOAT)dw);
1211 else if ( dw<1048576L)
1212 { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024);
1214 else if ( dw < 1073741824L)
1215 { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L);
1218 { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L);
1220 lstrcpynA (pszBuf, buf, cchBuf);
1224 /*************************************************************************
1225 * StrFormatByteSizeW [SHLWAPI]
1227 LPWSTR WINAPI StrFormatByteSizeW ( DWORD dw, LPWSTR pszBuf, UINT cchBuf )
1229 TRACE("%lx %p %i\n", dw, pszBuf, cchBuf);
1231 { sprintf (buf,"%3.1f bytes", (FLOAT)dw);
1233 else if ( dw<1048576L)
1234 { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024);
1236 else if ( dw < 1073741824L)
1237 { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L);
1240 { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L);
1242 lstrcpynAtoW (pszBuf, buf, cchBuf);
1245 /*************************************************************************
1246 * SHWaitForFileToOpen [SHELL32.97]
1249 BOOL WINAPI SHWaitForFileToOpen(
1254 FIXME("%p 0x%08lx 0x%08lx stub\n", pidl, dwFlags, dwTimeout);
1257 /*************************************************************************
1258 * Control_FillCache_RunDLL [SHELL32.8]
1261 HRESULT WINAPI Control_FillCache_RunDLL(HWND hWnd, HANDLE hModule, DWORD w, DWORD x)
1262 { FIXME("0x%04x 0x%04x 0x%04lx 0x%04lx stub\n",hWnd, hModule,w,x);
1265 /*************************************************************************
1266 * RunDLL_CallEntry16 [SHELL32.122]
1267 * the name is propably wrong
1269 HRESULT WINAPI RunDLL_CallEntry16(DWORD v, DWORD w, DWORD x, DWORD y, DWORD z)
1270 { FIXME("0x%04lx 0x%04lx 0x%04lx 0x%04lx 0x%04lx stub\n",v,w,x,y,z);
1274 /************************************************************************
1275 * shell32_654 [SHELL32.654]
1277 * NOTES: first parameter seems to be a pointer (same as passed to WriteCabinetState)
1278 * second one could be a size (0x0c). The size is the same as the structure saved to
1279 * HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState
1280 * I'm (js) guessing: this one is just ReadCabinetState ;-)
1282 HRESULT WINAPI shell32_654 (DWORD x, DWORD y)
1283 { FIXME("0x%08lx 0x%08lx stub\n",x,y);
1287 /************************************************************************
1288 * RLBuildListOfPaths [SHELL32.146]
1293 DWORD WINAPI RLBuildListOfPaths (void)
1297 /************************************************************************
1298 * StrToOleStr [SHELL32.163]
1301 int WINAPI StrToOleStrA (LPWSTR lpWideCharStr, LPCSTR lpMultiByteString)
1303 TRACE("(%p, %p %s)\n",
1304 lpWideCharStr, lpMultiByteString, debugstr_a(lpMultiByteString));
1306 return MultiByteToWideChar(0, 0, lpMultiByteString, -1, lpWideCharStr, MAX_PATH);
1309 int WINAPI StrToOleStrW (LPWSTR lpWideCharStr, LPCWSTR lpWString)
1311 TRACE("(%p, %p %s)\n",
1312 lpWideCharStr, lpWString, debugstr_w(lpWString));
1314 if (lstrcpyW (lpWideCharStr, lpWString ))
1315 { return lstrlenW (lpWideCharStr);
1320 BOOL WINAPI StrToOleStrAW (LPWSTR lpWideCharStr, LPCVOID lpString)
1322 if (VERSION_OsIsUnicode())
1323 return StrToOleStrW (lpWideCharStr, lpString);
1324 return StrToOleStrA (lpWideCharStr, lpString);
1327 /************************************************************************
1328 * SHValidateUNC [SHELL32.173]
1331 HRESULT WINAPI SHValidateUNC (DWORD x, DWORD y, DWORD z)
1333 FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x,y,z);
1337 /************************************************************************
1338 * DoEnvironmentSubstA [SHELL32.1222]
1341 HRESULT WINAPI DoEnvironmentSubstA(LPSTR x, LPSTR y)
1343 FIXME("(%s, %s) stub\n", debugstr_a(x), debugstr_a(y));
1347 /************************************************************************
1348 * DoEnvironmentSubstW [SHELL32.1223]
1351 HRESULT WINAPI DoEnvironmentSubstW(LPWSTR x, LPWSTR y)
1353 FIXME("(%s, %s): stub\n", debugstr_w(x), debugstr_w(y));
1357 /************************************************************************
1358 * DoEnvironmentSubst [SHELL32.53]
1361 HRESULT WINAPI DoEnvironmentSubstAW(LPVOID x, LPVOID y)
1363 if (VERSION_OsIsUnicode())
1364 return DoEnvironmentSubstW(x, y);
1365 return DoEnvironmentSubstA(x, y);
1368 /*************************************************************************
1369 * shell32_243 [SHELL32.243]
1371 * Win98+ by-ordinal routine. In Win98 this routine returns zero and
1372 * does nothing else. Possibly this does something in NT or SHELL32 5.0?
1376 BOOL WINAPI shell32_243(DWORD a, DWORD b)