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); */
282 TRACE("(%08lx,%08lx,%p,%p,%08x)\n",
283 (DWORD
)hInstance
,(DWORD
)hWnd
,lpText
,lpCaption
,uType
);
285 if (!HIWORD(lpCaption
))
286 LoadStringW(hInstance
, (DWORD
)lpCaption
, szTitle
, 100);
288 pszTitle
= lpCaption
;
291 LoadStringW(hInstance
, (DWORD
)lpText
, szText
, 100);
295 FormatMessageW(FORMAT_MESSAGE_FROM_STRING
| FORMAT_MESSAGE_ARGUMENT_ARRAY
,szText
,0,0,szTemp
,256,args
);
296 return MessageBoxW(hWnd
,szTemp
,szTitle
,uType
);
299 /*************************************************************************
300 * ShellMessageBoxA [SHELL32.183]
302 int WINAPIV
ShellMessageBoxA(
310 char szText
[100],szTitle
[100],szTemp
[256];
311 LPCSTR pszText
= szText
, pszTitle
= szTitle
;
313 va_start(args
, uType
);
314 /* wvsprintfA(buf,fmt, args); */
317 TRACE("(%08lx,%08lx,%p,%p,%08x)\n",
318 (DWORD
)hInstance
,(DWORD
)hWnd
,lpText
,lpCaption
,uType
);
320 if (!HIWORD(lpCaption
))
321 LoadStringA(hInstance
, (DWORD
)lpCaption
, szTitle
, 100);
323 pszTitle
= lpCaption
;
326 LoadStringA(hInstance
, (DWORD
)lpText
, szText
, 100);
330 FormatMessageA(FORMAT_MESSAGE_FROM_STRING
| FORMAT_MESSAGE_ARGUMENT_ARRAY
,szText
,0,0,szTemp
,256,args
);
331 return MessageBoxA(hWnd
,szTemp
,szTitle
,uType
);
334 /*************************************************************************
335 * SHFree [SHELL32.195]
338 * free_ptr() - frees memory using IMalloc
339 * exported by ordinal
342 void WINAPI
SHFree(LPVOID x
)
345 WORD len
= *(LPWORD
)((LPBYTE
)x
-2);
347 if ( *(LPWORD
)((LPBYTE
)x
+len
) != 0x7384)
350 if ( (*(LPWORD
)((LPBYTE
)x
-4)) != 0x8271)
353 memset((LPBYTE
)x
-4, 0xde, len
+6);
355 TRACE("%p len=%u\n",x
, len
);
361 HeapFree(GetProcessHeap(), 0, x
);
364 /*************************************************************************
365 * SHAlloc [SHELL32.196]
368 * void *task_alloc(DWORD len), uses SHMalloc allocator
369 * exported by ordinal
371 LPVOID WINAPI
SHAlloc(DWORD len
)
376 ret
= (LPVOID
) HeapAlloc(GetProcessHeap(),0,len
+6);
378 ret
= (LPVOID
) HeapAlloc(GetProcessHeap(),0,len
);
382 *(LPWORD
)(ret
) = 0x8271;
383 *(LPWORD
)(ret
+2) = (WORD
)len
;
384 *(LPWORD
)(ret
+4+len
) = 0x7384;
386 memset(ret
, 0xdf, len
);
388 TRACE("%lu bytes at %p\n",len
, ret
);
392 /*************************************************************************
393 * SHRegisterDragDrop [SHELL32.86]
396 * exported by ordinal
398 HRESULT WINAPI
SHRegisterDragDrop(
400 LPDROPTARGET pDropTarget
)
402 FIXME("(0x%08x,%p):stub.\n", hWnd
, pDropTarget
);
403 if (GetShellOle()) return pRegisterDragDrop(hWnd
, pDropTarget
);
407 /*************************************************************************
408 * SHRevokeDragDrop [SHELL32.87]
411 * exported by ordinal
413 HRESULT WINAPI
SHRevokeDragDrop(HWND hWnd
)
415 FIXME("(0x%08x):stub.\n",hWnd
);
419 /*************************************************************************
420 * SHDoDragDrop [SHELL32.88]
423 * exported by ordinal
425 HRESULT WINAPI
SHDoDragDrop(
427 LPDATAOBJECT lpDataObject
,
428 LPDROPSOURCE lpDropSource
,
432 FIXME("(0x%04x %p %p 0x%08lx %p):stub.\n",
433 hWnd
, lpDataObject
, lpDropSource
, dwOKEffect
, pdwEffect
);
437 /*************************************************************************
438 * ArrangeWindows [SHELL32.184]
441 WORD WINAPI
ArrangeWindows(
448 FIXME("(0x%08x 0x%08lx %p 0x%04x %p):stub.\n",
449 hwndParent
, dwReserved
, lpRect
, cKids
, lpKids
);
453 /*************************************************************************
454 * SignalFileOpen [SHELL32.103]
457 * exported by ordinal
460 SignalFileOpen (DWORD dwParam1
)
462 FIXME("(0x%08lx):stub.\n", dwParam1
);
467 /*************************************************************************
468 * SHAddToRecentDocs [SHELL32.234]
471 * uFlags [IN] SHARD_PATH or SHARD_PIDL
472 * pv [IN] string or pidl, NULL clears the list
477 DWORD WINAPI
SHAddToRecentDocs (UINT uFlags
,LPCVOID pv
)
478 { if (SHARD_PIDL
==uFlags
)
479 { FIXME("(0x%08x,pidl=%p):stub.\n", uFlags
,pv
);
482 { FIXME("(0x%08x,%s):stub.\n", uFlags
,(char*)pv
);
486 /*************************************************************************
487 * SHCreateShellFolderViewEx [SHELL32.174]
490 * see IShellFolder::CreateViewObject
492 HRESULT WINAPI
SHCreateShellFolderViewEx(
493 LPCSHELLFOLDERVIEWINFO psvcbi
, /*[in ] shelltemplate struct*/
494 LPSHELLVIEW
* ppv
) /*[out] IShellView pointer*/
499 TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=0x%08lx\n",
500 psvcbi
->pshf
, psvcbi
->pidlFolder
, psvcbi
->lpfnCallback
,
501 psvcbi
->uViewMode
, psvcbi
->dwUser
);
503 psf
= IShellView_Constructor(psvcbi
->pshf
);
506 return E_OUTOFMEMORY
;
508 IShellView_AddRef(psf
);
509 hRes
= IShellView_QueryInterface(psf
, &IID_IShellView
, (LPVOID
*)ppv
);
510 IShellView_Release(psf
);
514 /*************************************************************************
515 * SHWinHelp [SHELL32.127]
518 HRESULT WINAPI
SHWinHelp (DWORD v
, DWORD w
, DWORD x
, DWORD z
)
519 { FIXME("0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v
,w
,x
,z
);
522 /*************************************************************************
523 * SHRunControlPanel [SHELL32.161]
526 HRESULT WINAPI
SHRunControlPanel (DWORD x
, DWORD z
)
527 { FIXME("0x%08lx 0x%08lx stub\n",x
,z
);
530 /*************************************************************************
531 * ShellExecuteEx [SHELL32.291]
534 BOOL WINAPI
ShellExecuteExAW (LPVOID sei
)
535 { if (VERSION_OsIsUnicode())
536 return ShellExecuteExW (sei
);
537 return ShellExecuteExA (sei
);
539 /*************************************************************************
540 * ShellExecuteExA [SHELL32.292]
542 * placeholder in the commandline:
547 * %I adress of a global item ID (explorer switch /idlist)
548 * %L ??? path/url/current file ???
550 * %* all following parameters (see batfile)
552 #include "process.h" /* we can get rid of it hopefully */
554 BOOL WINAPI
ShellExecuteExA (LPSHELLEXECUTEINFOA sei
)
555 { CHAR szApplicationName
[MAX_PATH
],szCommandline
[MAX_PATH
],szPidl
[20];
558 STARTUPINFOA startup
;
559 PROCESS_INFORMATION info
;
561 WARN("mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n",
562 sei
->fMask
, sei
->hwnd
, sei
->lpVerb
, sei
->lpFile
,
563 sei
->lpParameters
, sei
->lpDirectory
, sei
->nShow
,
564 (sei
->fMask
& SEE_MASK_CLASSNAME
) ? sei
->lpClass
: "not used");
566 ZeroMemory(szApplicationName
,MAX_PATH
);
568 strcpy(szApplicationName
, sei
->lpFile
);
570 ZeroMemory(szCommandline
,MAX_PATH
);
571 if (sei
->lpParameters
)
572 strcpy(szCommandline
, sei
->lpParameters
);
574 if (sei
->fMask
& (SEE_MASK_CLASSKEY
| SEE_MASK_INVOKEIDLIST
| SEE_MASK_ICON
| SEE_MASK_HOTKEY
|
575 SEE_MASK_CONNECTNETDRV
| SEE_MASK_FLAG_DDEWAIT
|
576 SEE_MASK_DOENVSUBST
| SEE_MASK_FLAG_NO_UI
| SEE_MASK_UNICODE
|
577 SEE_MASK_NO_CONSOLE
| SEE_MASK_ASYNCOK
| SEE_MASK_HMONITOR
))
579 FIXME("flags ignored: 0x%08lx\n", sei
->fMask
);
582 /* launch a document by fileclass like 'Wordpad.Document.1' */
583 if (sei
->fMask
& SEE_MASK_CLASSNAME
)
585 /* the commandline contains 'c:\Path\wordpad.exe "%1"' */
586 HCR_GetExecuteCommand(sei
->lpClass
, (sei
->lpVerb
) ? sei
->lpVerb
: "open", szCommandline
, 256);
587 /* fixme: get the extension of lpFile, check if it fits to the lpClass */
588 TRACE("SEE_MASK_CLASSNAME->'%s'\n", szCommandline
);
591 /* process the IDList */
592 if ( (sei
->fMask
& SEE_MASK_INVOKEIDLIST
) == SEE_MASK_INVOKEIDLIST
) /*0x0c*/
594 SHGetPathFromIDListA (sei
->lpIDList
,szApplicationName
);
595 TRACE("-- idlist=%p (%s)\n", sei
->lpIDList
, szApplicationName
);
599 if (sei
->fMask
& SEE_MASK_IDLIST
)
601 pos
= strstr(szCommandline
, "%I");
605 HGLOBAL hmem
= SHAllocShared ( sei
->lpIDList
, ILGetSize(sei
->lpIDList
), 0);
606 pv
= SHLockShared(hmem
,0);
607 sprintf(szPidl
,":%p",pv
);
610 gap
= strlen(szPidl
);
612 memmove(pos
+gap
,pos
+2,len
);
613 memcpy(pos
,szPidl
,gap
);
619 TRACE("execute:'%s','%s'\n",szApplicationName
, szCommandline
);
621 strcat(szApplicationName
, " ");
622 strcat(szApplicationName
, szCommandline
);
624 ZeroMemory(&startup
,sizeof(STARTUPINFOA
));
625 startup
.cb
= sizeof(STARTUPINFOA
);
627 if (! CreateProcessA(NULL
, szApplicationName
,
628 NULL
, NULL
, FALSE
, 0,
629 NULL
, NULL
, &startup
, &info
))
631 sei
->hInstApp
= GetLastError();
637 /* Give 30 seconds to the app to come up */
638 if ( WaitForInputIdle ( info
.hProcess
, 30000 ) == 0xFFFFFFFF )
639 ERR("WaitForInputIdle failed: Error %ld\n", GetLastError() );
641 if(sei
->fMask
& SEE_MASK_NOCLOSEPROCESS
)
642 sei
->hProcess
= info
.hProcess
;
644 CloseHandle( info
.hProcess
);
645 CloseHandle( info
.hThread
);
648 /*************************************************************************
649 * ShellExecuteExW [SHELL32.293]
652 BOOL WINAPI
ShellExecuteExW (LPSHELLEXECUTEINFOW sei
)
653 { SHELLEXECUTEINFOA seiA
;
658 memcpy(&seiA
, sei
, sizeof(SHELLEXECUTEINFOA
));
661 seiA
.lpVerb
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpVerb
);
664 seiA
.lpFile
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpFile
);
666 if (sei
->lpParameters
)
667 seiA
.lpParameters
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpParameters
);
669 if (sei
->lpDirectory
)
670 seiA
.lpDirectory
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpDirectory
);
672 if ((sei
->fMask
& SEE_MASK_CLASSNAME
) && sei
->lpClass
)
673 seiA
.lpClass
= HEAP_strdupWtoA( GetProcessHeap(), 0, sei
->lpClass
);
677 ret
= ShellExecuteExA(&seiA
);
679 if (seiA
.lpVerb
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpVerb
);
680 if (seiA
.lpFile
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpFile
);
681 if (seiA
.lpParameters
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpParameters
);
682 if (seiA
.lpDirectory
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpDirectory
);
683 if (seiA
.lpClass
) HeapFree( GetProcessHeap(), 0, (LPSTR
) seiA
.lpClass
);
688 static LPUNKNOWN SHELL32_IExplorerInterface
=0;
689 /*************************************************************************
690 * SHSetInstanceExplorer [SHELL32.176]
695 HRESULT WINAPI
SHSetInstanceExplorer (LPUNKNOWN lpUnknown
)
696 { TRACE("%p\n", lpUnknown
);
697 SHELL32_IExplorerInterface
= lpUnknown
;
698 return (HRESULT
) lpUnknown
;
700 /*************************************************************************
701 * SHGetInstanceExplorer [SHELL32.256]
704 * gets the interface pointer of the explorer and a reference
706 HRESULT WINAPI
SHGetInstanceExplorer (LPUNKNOWN
* lpUnknown
)
707 { TRACE("%p\n", lpUnknown
);
709 *lpUnknown
= SHELL32_IExplorerInterface
;
711 if (!SHELL32_IExplorerInterface
)
714 IUnknown_AddRef(SHELL32_IExplorerInterface
);
717 /*************************************************************************
718 * SHFreeUnusedLibraries [SHELL32.123]
723 void WINAPI
SHFreeUnusedLibraries (void)
727 /*************************************************************************
728 * DAD_SetDragImage [SHELL32.136]
733 BOOL WINAPI
DAD_SetDragImage(
734 HIMAGELIST himlTrack
,
737 FIXME("%p %p stub\n",himlTrack
, lppt
);
740 /*************************************************************************
741 * DAD_ShowDragImage [SHELL32.137]
746 BOOL WINAPI
DAD_ShowDragImage(BOOL bShow
)
748 FIXME("0x%08x stub\n",bShow
);
751 /*************************************************************************
752 * SHRegCloseKey [NT4.0:SHELL32.505]
755 HRESULT WINAPI
SHRegCloseKey (HKEY hkey
)
756 { TRACE("0x%04x\n",hkey
);
757 return RegCloseKey( hkey
);
759 /*************************************************************************
760 * SHRegOpenKeyA [SHELL32.506]
763 HRESULT WINAPI
SHRegOpenKeyA(HKEY hKey
, LPSTR lpSubKey
, LPHKEY phkResult
)
765 TRACE("(0x%08x, %s, %p)\n", hKey
, debugstr_a(lpSubKey
), phkResult
);
766 return RegOpenKeyA(hKey
, lpSubKey
, phkResult
);
769 /*************************************************************************
770 * SHRegOpenKeyW [NT4.0:SHELL32.507]
773 HRESULT WINAPI
SHRegOpenKeyW (HKEY hkey
, LPCWSTR lpszSubKey
, LPHKEY retkey
)
774 { WARN("0x%04x %s %p\n",hkey
,debugstr_w(lpszSubKey
),retkey
);
775 return RegOpenKeyW( hkey
, lpszSubKey
, retkey
);
777 /*************************************************************************
778 * SHRegQueryValueExA [SHELL32.509]
781 HRESULT WINAPI
SHRegQueryValueExA(
789 TRACE("0x%04x %s %p %p %p %p\n", hkey
, lpValueName
, lpReserved
, lpType
, lpData
, lpcbData
);
790 return RegQueryValueExA (hkey
, lpValueName
, lpReserved
, lpType
, lpData
, lpcbData
);
792 /*************************************************************************
793 * SHRegQueryValueW [NT4.0:SHELL32.510]
796 HRESULT WINAPI
SHRegQueryValueW (HKEY hkey
, LPWSTR lpszSubKey
,
797 LPWSTR lpszData
, LPDWORD lpcbData
)
798 { WARN("0x%04x %s %p %p semi-stub\n",
799 hkey
, debugstr_w(lpszSubKey
), lpszData
, lpcbData
);
800 return RegQueryValueW( hkey
, lpszSubKey
, lpszData
, lpcbData
);
803 /*************************************************************************
804 * SHRegQueryValueExW [NT4.0:SHELL32.511]
807 * if the datatype REG_EXPAND_SZ then expand the string and change
808 * *pdwType to REG_SZ.
810 HRESULT WINAPI
SHRegQueryValueExW (HKEY hkey
, LPWSTR pszValue
, LPDWORD pdwReserved
,
811 LPDWORD pdwType
, LPVOID pvData
, LPDWORD pcbData
)
813 WARN("0x%04x %s %p %p %p %p semi-stub\n",
814 hkey
, debugstr_w(pszValue
), pdwReserved
, pdwType
, pvData
, pcbData
);
815 ret
= RegQueryValueExW ( hkey
, pszValue
, pdwReserved
, pdwType
, pvData
, pcbData
);
819 /* SHGetValue: Gets a value from the registry */
821 /*************************************************************************
824 * Gets a value from the registry
826 DWORD WINAPI
SHGetValueA(
835 FIXME("(%p),stub!\n", pSubKey
);
837 return ERROR_SUCCESS
; /* return success */
840 /*************************************************************************
843 * Gets a value from the registry
845 DWORD WINAPI
SHGetValueW(
854 FIXME("(%p),stub!\n", pSubKey
);
856 return ERROR_SUCCESS
; /* return success */
859 /* gets a user-specific registry value. */
861 /*************************************************************************
864 * Gets a user-specific registry value
866 LONG WINAPI
SHRegGetUSValueA(
874 DWORD wDefaultDataSize
877 FIXME("(%p),stub!\n", pSubKey
);
879 return ERROR_SUCCESS
; /* return success */
882 /*************************************************************************
885 * Gets a user-specific registry value
887 LONG WINAPI
SHRegGetUSValueW(
895 DWORD wDefaultDataSize
898 FIXME("(%p),stub!\n", pSubKey
);
900 return ERROR_SUCCESS
; /* return success */
903 /*************************************************************************
904 * SHRegDeleteKeyA and SHDeleteKeyA
906 HRESULT WINAPI
SHRegDeleteKeyA(HKEY hkey
, LPCSTR pszSubKey
)
908 FIXME("hkey=0x%08x, %s\n", hkey
, debugstr_a(pszSubKey
));
912 /*************************************************************************
913 * SHRegDeleteKeyW and SHDeleteKeyA
915 HRESULT WINAPI
SHRegDeleteKeyW(HKEY hkey
, LPCWSTR pszSubKey
)
917 FIXME("hkey=0x%08x, %s\n", hkey
, debugstr_w(pszSubKey
));
920 /*************************************************************************
921 * ReadCabinetState [NT 4.0:SHELL32.651]
924 HRESULT WINAPI
ReadCabinetState(DWORD u
, DWORD v
)
925 { FIXME("0x%04lx 0x%04lx stub\n",u
,v
);
928 /*************************************************************************
929 * WriteCabinetState [NT 4.0:SHELL32.652]
932 HRESULT WINAPI
WriteCabinetState(DWORD u
)
933 { FIXME("0x%04lx stub\n",u
);
936 /*************************************************************************
937 * FileIconInit [SHELL32.660]
940 BOOL WINAPI
FileIconInit(BOOL bFullInit
)
941 { FIXME("(%s)\n", bFullInit
? "true" : "false");
944 /*************************************************************************
945 * IsUserAdmin [NT 4.0:SHELL32.680]
948 HRESULT WINAPI
IsUserAdmin(void)
953 /*************************************************************************
954 * StrRetToBufA [SHLWAPI.@]
956 * converts a STRRET to a normal string
959 * the pidl is for STRRET OFFSET
961 HRESULT WINAPI
StrRetToBufA (LPSTRRET src
, LPITEMIDLIST pidl
, LPSTR dest
, DWORD len
)
963 return StrRetToStrNA(dest
, len
, src
, pidl
);
966 /*************************************************************************
967 * StrRetToBufW [SHLWAPI.@]
969 * converts a STRRET to a normal string
972 * the pidl is for STRRET OFFSET
974 HRESULT WINAPI
StrRetToBufW (LPSTRRET src
, LPITEMIDLIST pidl
, LPWSTR dest
, DWORD len
)
976 return StrRetToStrNW(dest
, len
, src
, pidl
);
979 /*************************************************************************
980 * StrRetToStrN [SHELL32.96]
982 * converts a STRRET to a normal string
985 * the pidl is for STRRET OFFSET
987 HRESULT WINAPI
StrRetToStrNA (LPVOID dest
, DWORD len
, LPSTRRET src
, LPITEMIDLIST pidl
)
989 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest
,len
,src
,pidl
);
994 WideCharToMultiByte(CP_ACP
, 0, src
->u
.pOleStr
, -1, (LPSTR
)dest
, len
, NULL
, NULL
);
995 SHFree(src
->u
.pOleStr
);
999 lstrcpynA((LPSTR
)dest
, src
->u
.cStr
, len
);
1002 case STRRET_OFFSETA
:
1003 lstrcpynA((LPSTR
)dest
, ((LPCSTR
)&pidl
->mkid
)+src
->u
.uOffset
, len
);
1007 FIXME("unknown type!\n");
1010 *(LPSTR
)dest
= '\0';
1017 HRESULT WINAPI
StrRetToStrNW (LPVOID dest
, DWORD len
, LPSTRRET src
, LPITEMIDLIST pidl
)
1019 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest
,len
,src
,pidl
);
1024 lstrcpynW((LPWSTR
)dest
, src
->u
.pOleStr
, len
);
1025 SHFree(src
->u
.pOleStr
);
1029 lstrcpynAtoW((LPWSTR
)dest
, src
->u
.cStr
, len
);
1032 case STRRET_OFFSETA
:
1035 lstrcpynAtoW((LPWSTR
)dest
, ((LPCSTR
)&pidl
->mkid
)+src
->u
.uOffset
, len
);
1040 FIXME("unknown type!\n");
1042 { *(LPSTR
)dest
= '\0';
1048 HRESULT WINAPI
StrRetToStrNAW (LPVOID dest
, DWORD len
, LPSTRRET src
, LPITEMIDLIST pidl
)
1050 if(VERSION_OsIsUnicode())
1051 return StrRetToStrNW (dest
, len
, src
, pidl
);
1052 return StrRetToStrNA (dest
, len
, src
, pidl
);
1055 /*************************************************************************
1056 * StrChrW [NT 4.0:SHELL32.651]
1059 LPWSTR WINAPI
StrChrW (LPWSTR str
, WCHAR x
)
1061 TRACE("%s 0x%04x\n",debugstr_w(str
),x
);
1062 return CRTDLL_wcschr(str
, x
);
1065 /*************************************************************************
1066 * StrCmpNIW [NT 4.0:SHELL32.*]
1069 INT WINAPI
StrCmpNIW ( LPWSTR wstr1
, LPWSTR wstr2
, INT len
)
1071 TRACE("%s %s %i stub\n", debugstr_w(wstr1
),debugstr_w(wstr2
),len
);
1072 return CRTDLL__wcsnicmp(wstr1
, wstr2
, len
);
1075 /*************************************************************************
1076 * SHAllocShared [SHELL32.520]
1079 * parameter1 is return value from HeapAlloc
1080 * parameter2 is equal to the size allocated with HeapAlloc
1081 * parameter3 is return value from GetCurrentProcessId
1083 * the return value is posted as lParam with 0x402 (WM_USER+2) to somewhere
1084 * WM_USER+2 could be the undocumented CWM_SETPATH
1085 * the allocated memory contains a pidl
1087 HGLOBAL WINAPI
SHAllocShared(LPVOID psrc
, DWORD size
, DWORD procID
)
1091 TRACE("ptr=%p size=0x%04lx procID=0x%04lx\n",psrc
,size
,procID
);
1092 hmem
= GlobalAlloc(GMEM_FIXED
, size
);
1096 pmem
= GlobalLock (hmem
);
1101 memcpy (pmem
, psrc
, size
);
1105 /*************************************************************************
1106 * SHLockShared [SHELL32.521]
1109 * parameter1 is return value from SHAllocShared
1110 * parameter2 is return value from GetCurrentProcessId
1111 * the receiver of (WM_USER+2) trys to lock the HANDLE (?)
1112 * the returnvalue seems to be a memoryadress
1114 LPVOID WINAPI
SHLockShared(HANDLE hmem
, DWORD procID
)
1115 { TRACE("handle=0x%04x procID=0x%04lx\n",hmem
,procID
);
1116 return GlobalLock(hmem
);
1118 /*************************************************************************
1119 * SHUnlockShared [SHELL32.522]
1122 * parameter1 is return value from SHLockShared
1124 BOOL WINAPI
SHUnlockShared(LPVOID pv
)
1127 return GlobalUnlock((HANDLE
)pv
);
1129 /*************************************************************************
1130 * SHFreeShared [SHELL32.523]
1133 * parameter1 is return value from SHAllocShared
1134 * parameter2 is return value from GetCurrentProcessId
1136 BOOL WINAPI
SHFreeShared(
1140 TRACE("handle=0x%04x 0x%04lx\n",hMem
,pid
);
1141 return GlobalFree(hMem
);
1144 /*************************************************************************
1145 * SetAppStartingCursor [SHELL32.99]
1147 HRESULT WINAPI
SetAppStartingCursor(HWND u
, DWORD v
)
1148 { FIXME("hwnd=0x%04x 0x%04lx stub\n",u
,v
);
1151 /*************************************************************************
1152 * SHLoadOLE [SHELL32.151]
1155 HRESULT WINAPI
SHLoadOLE(DWORD u
)
1156 { FIXME("0x%04lx stub\n",u
);
1159 /*************************************************************************
1160 * DriveType [SHELL32.64]
1163 HRESULT WINAPI
DriveType(DWORD u
)
1164 { FIXME("0x%04lx stub\n",u
);
1167 /*************************************************************************
1168 * SHAbortInvokeCommand [SHELL32.198]
1171 HRESULT WINAPI
SHAbortInvokeCommand(void)
1175 /*************************************************************************
1176 * SHOutOfMemoryMessageBox [SHELL32.126]
1179 int WINAPI
SHOutOfMemoryMessageBox(
1184 FIXME("0x%04x %s 0x%08x stub\n",hwndOwner
, lpCaption
, uType
);
1187 /*************************************************************************
1188 * SHFlushClipboard [SHELL32.121]
1191 HRESULT WINAPI
SHFlushClipboard(void)
1196 /*************************************************************************
1197 * StrFormatByteSizeA [SHLWAPI]
1199 LPSTR WINAPI
StrFormatByteSizeA ( DWORD dw
, LPSTR pszBuf
, UINT cchBuf
)
1201 TRACE("%lx %p %i\n", dw
, pszBuf
, cchBuf
);
1203 { sprintf (buf
,"%3.1f bytes", (FLOAT
)dw
);
1205 else if ( dw
<1048576L)
1206 { sprintf (buf
,"%3.1f KB", (FLOAT
)dw
/1024);
1208 else if ( dw
< 1073741824L)
1209 { sprintf (buf
,"%3.1f MB", (FLOAT
)dw
/1048576L);
1212 { sprintf (buf
,"%3.1f GB", (FLOAT
)dw
/1073741824L);
1214 lstrcpynA (pszBuf
, buf
, cchBuf
);
1218 /*************************************************************************
1219 * StrFormatByteSizeW [SHLWAPI]
1221 LPWSTR WINAPI
StrFormatByteSizeW ( DWORD dw
, LPWSTR pszBuf
, UINT cchBuf
)
1223 TRACE("%lx %p %i\n", dw
, pszBuf
, cchBuf
);
1225 { sprintf (buf
,"%3.1f bytes", (FLOAT
)dw
);
1227 else if ( dw
<1048576L)
1228 { sprintf (buf
,"%3.1f KB", (FLOAT
)dw
/1024);
1230 else if ( dw
< 1073741824L)
1231 { sprintf (buf
,"%3.1f MB", (FLOAT
)dw
/1048576L);
1234 { sprintf (buf
,"%3.1f GB", (FLOAT
)dw
/1073741824L);
1236 lstrcpynAtoW (pszBuf
, buf
, cchBuf
);
1239 /*************************************************************************
1240 * SHWaitForFileToOpen [SHELL32.97]
1243 BOOL WINAPI
SHWaitForFileToOpen(
1248 FIXME("%p 0x%08lx 0x%08lx stub\n", pidl
, dwFlags
, dwTimeout
);
1251 /*************************************************************************
1252 * Control_FillCache_RunDLL [SHELL32.8]
1255 HRESULT WINAPI
Control_FillCache_RunDLL(HWND hWnd
, HANDLE hModule
, DWORD w
, DWORD x
)
1256 { FIXME("0x%04x 0x%04x 0x%04lx 0x%04lx stub\n",hWnd
, hModule
,w
,x
);
1259 /*************************************************************************
1260 * RunDLL_CallEntry16 [SHELL32.122]
1261 * the name is propably wrong
1263 HRESULT WINAPI
RunDLL_CallEntry16(DWORD v
, DWORD w
, DWORD x
, DWORD y
, DWORD z
)
1264 { FIXME("0x%04lx 0x%04lx 0x%04lx 0x%04lx 0x%04lx stub\n",v
,w
,x
,y
,z
);
1268 /************************************************************************
1269 * shell32_654 [SHELL32.654]
1271 * NOTES: first parameter seems to be a pointer (same as passed to WriteCabinetState)
1272 * second one could be a size (0x0c). The size is the same as the structure saved to
1273 * HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState
1274 * I'm (js) guessing: this one is just ReadCabinetState ;-)
1276 HRESULT WINAPI
shell32_654 (DWORD x
, DWORD y
)
1277 { FIXME("0x%08lx 0x%08lx stub\n",x
,y
);
1281 /************************************************************************
1282 * RLBuildListOfPaths [SHELL32.146]
1287 DWORD WINAPI
RLBuildListOfPaths (void)
1291 /************************************************************************
1292 * StrToOleStr [SHELL32.163]
1295 int WINAPI
StrToOleStrA (LPWSTR lpWideCharStr
, LPCSTR lpMultiByteString
)
1297 TRACE("(%p, %p %s)\n",
1298 lpWideCharStr
, lpMultiByteString
, debugstr_a(lpMultiByteString
));
1300 return MultiByteToWideChar(0, 0, lpMultiByteString
, -1, lpWideCharStr
, MAX_PATH
);
1303 int WINAPI
StrToOleStrW (LPWSTR lpWideCharStr
, LPCWSTR lpWString
)
1305 TRACE("(%p, %p %s)\n",
1306 lpWideCharStr
, lpWString
, debugstr_w(lpWString
));
1308 if (lstrcpyW (lpWideCharStr
, lpWString
))
1309 { return lstrlenW (lpWideCharStr
);
1314 BOOL WINAPI
StrToOleStrAW (LPWSTR lpWideCharStr
, LPCVOID lpString
)
1316 if (VERSION_OsIsUnicode())
1317 return StrToOleStrW (lpWideCharStr
, lpString
);
1318 return StrToOleStrA (lpWideCharStr
, lpString
);
1321 /************************************************************************
1322 * SHValidateUNC [SHELL32.173]
1325 HRESULT WINAPI
SHValidateUNC (DWORD x
, DWORD y
, DWORD z
)
1327 FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x
,y
,z
);
1331 /************************************************************************
1332 * DoEnvironmentSubstA [SHELL32.1222]
1335 HRESULT WINAPI
DoEnvironmentSubstA(LPSTR x
, LPSTR y
)
1337 FIXME("(%p %s, %p %s) stub\n", x
, debugstr_a(x
), y
, debugstr_a(y
));
1341 /************************************************************************
1342 * DoEnvironmentSubstW [SHELL32.1223]
1345 HRESULT WINAPI
DoEnvironmentSubstW(LPWSTR x
, LPWSTR y
)
1347 FIXME("(%p %s, %p %s) stub\n", x
, debugstr_w(x
), y
, debugstr_w(y
));
1351 /************************************************************************
1352 * DoEnvironmentSubst [SHELL32.53]
1355 HRESULT WINAPI
DoEnvironmentSubstAW(LPVOID x
, LPVOID y
)
1357 if (VERSION_OsIsUnicode())
1358 return DoEnvironmentSubstW(x
, y
);
1359 return DoEnvironmentSubstA(x
, y
);
1362 /*************************************************************************
1363 * shell32_243 [SHELL32.243]
1365 * Win98+ by-ordinal routine. In Win98 this routine returns zero and
1366 * does nothing else. Possibly this does something in NT or SHELL32 5.0?
1370 BOOL WINAPI
shell32_243(DWORD a
, DWORD b
)