1 | /* $Id: shellord.cpp,v 1.9 2000-08-02 17:53:33 bird Exp $ */
|
---|
2 | /*
|
---|
3 | * The parameters of many functions changes between different OS versions
|
---|
4 | * (NT uses Unicode strings, 95 uses ASCII strings)
|
---|
5 | *
|
---|
6 | * Copyright 1997 Marcus Meissner
|
---|
7 | * 1998 Jürgen Schmied
|
---|
8 | *
|
---|
9 | * Corel WINE 20000324 level
|
---|
10 | */
|
---|
11 |
|
---|
12 |
|
---|
13 | /*****************************************************************************
|
---|
14 | * Includes *
|
---|
15 | *****************************************************************************/
|
---|
16 |
|
---|
17 | #include <string.h>
|
---|
18 | #include <odin.h>
|
---|
19 | #include <odinwrap.h>
|
---|
20 | #include <os2sel.h>
|
---|
21 |
|
---|
22 | #define ICOM_CINTERFACE 1
|
---|
23 | #define CINTERFACE 1
|
---|
24 |
|
---|
25 | #include "winerror.h"
|
---|
26 | #include "winreg.h"
|
---|
27 | #include "debugtools.h"
|
---|
28 | #include "winnls.h"
|
---|
29 | #include "winversion.h"
|
---|
30 | #include "heap.h"
|
---|
31 |
|
---|
32 | #include "shellapi.h"
|
---|
33 | #include "shlobj.h"
|
---|
34 | #include "shell32_main.h"
|
---|
35 | #include "wine/undocshell.h"
|
---|
36 | #include "shpolicy.h"
|
---|
37 |
|
---|
38 | #include <heapstring.h>
|
---|
39 | #include <misc.h>
|
---|
40 | #include <ctype.h>
|
---|
41 | #include <wctype.h>
|
---|
42 | #include <wcstr.h>
|
---|
43 |
|
---|
44 |
|
---|
45 | /*****************************************************************************
|
---|
46 | * Local Variables *
|
---|
47 | *****************************************************************************/
|
---|
48 |
|
---|
49 | ODINDEBUGCHANNEL(shell32-shellord)
|
---|
50 |
|
---|
51 |
|
---|
52 | /*************************************************************************
|
---|
53 | * SHChangeNotifyRegister [SHELL32.2]
|
---|
54 | *
|
---|
55 | * NOTES
|
---|
56 | * Idlist is an array of structures and Count specifies how many items in the array
|
---|
57 | * (usually just one I think).
|
---|
58 | */
|
---|
59 | DWORD WINAPI
|
---|
60 | SHChangeNotifyRegister(
|
---|
61 | HWND hwnd,
|
---|
62 | LONG events1,
|
---|
63 | LONG events2,
|
---|
64 | DWORD msg,
|
---|
65 | int count,
|
---|
66 | IDSTRUCT *idlist)
|
---|
67 | {
|
---|
68 | FIXME("SHChangeNotifyRegister: (0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):stub.\n",
|
---|
69 | hwnd,events1,events2,msg,count,idlist);
|
---|
70 | return 0;
|
---|
71 | }
|
---|
72 | /*************************************************************************
|
---|
73 | * SHChangeNotifyDeregister [SHELL32.4]
|
---|
74 | */
|
---|
75 | DWORD WINAPI
|
---|
76 | SHChangeNotifyDeregister(LONG x1)
|
---|
77 | { FIXME("(0x%08lx):stub.\n",x1);
|
---|
78 | return 0;
|
---|
79 | }
|
---|
80 | /*************************************************************************
|
---|
81 | * NTSHChangeNotifyRegister [SHELL32.640]
|
---|
82 | * NOTES
|
---|
83 | * Idlist is an array of structures and Count specifies how many items in the array
|
---|
84 | * (usually just one I think).
|
---|
85 | */
|
---|
86 | DWORD WINAPI NTSHChangeNotifyRegister(
|
---|
87 | HWND hwnd,
|
---|
88 | LONG events1,
|
---|
89 | LONG events2,
|
---|
90 | DWORD msg,
|
---|
91 | int count,
|
---|
92 | IDSTRUCT *idlist)
|
---|
93 | { FIXME("(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):stub.\n",
|
---|
94 | hwnd,events1,events2,msg,count,idlist);
|
---|
95 | return 0;
|
---|
96 | }
|
---|
97 | /*************************************************************************
|
---|
98 | * NTSHChangeNotifyDeregister [SHELL32.641]
|
---|
99 | */
|
---|
100 | DWORD WINAPI NTSHChangeNotifyDeregister(LONG x1)
|
---|
101 | { FIXME("(0x%08lx):stub.\n",x1);
|
---|
102 | return 0;
|
---|
103 | }
|
---|
104 |
|
---|
105 | /*************************************************************************
|
---|
106 | * ParseField [SHELL32.58]
|
---|
107 | *
|
---|
108 | */
|
---|
109 | DWORD WINAPI ParseFieldA(LPCSTR src, DWORD field, LPSTR dst, DWORD len)
|
---|
110 | { WARN("('%s',0x%08lx,%p,%ld) semi-stub.\n",src,field,dst,len);
|
---|
111 |
|
---|
112 | if (!src || !src[0] || !dst || !len)
|
---|
113 | return 0;
|
---|
114 |
|
---|
115 | if (field >1)
|
---|
116 | { field--;
|
---|
117 | while (field)
|
---|
118 | { if (*src==0x0) return FALSE;
|
---|
119 | if (*src==',') field--;
|
---|
120 | src++;
|
---|
121 | }
|
---|
122 | }
|
---|
123 |
|
---|
124 | while (*src!=0x00 && *src!=',' && len>0)
|
---|
125 | { *dst=*src; dst++, src++; len--;
|
---|
126 | }
|
---|
127 | *dst=0x0;
|
---|
128 |
|
---|
129 | return TRUE;
|
---|
130 | }
|
---|
131 |
|
---|
132 | /*************************************************************************
|
---|
133 | * PickIconDlg [SHELL32.62]
|
---|
134 | *
|
---|
135 | */
|
---|
136 | DWORD WINAPI PickIconDlg(DWORD x,DWORD y,DWORD z,DWORD a)
|
---|
137 | { FIXME("PickIconDlg(%08lx,%08lx,%08lx,%08lx):stub.\n",x,y,z,a);
|
---|
138 | return 0xffffffff;
|
---|
139 | }
|
---|
140 |
|
---|
141 | /*************************************************************************
|
---|
142 | * GetFileNameFromBrowse [SHELL32.63]
|
---|
143 | *
|
---|
144 | */
|
---|
145 | DWORD WINAPI GetFileNameFromBrowse(HWND howner, LPSTR targetbuf, DWORD len, DWORD x, LPCSTR suffix, LPCSTR y, LPCSTR cmd)
|
---|
146 | { FIXME("(%04x,%p,%ld,%08lx,%s,%s,%s):stub.\n",
|
---|
147 | howner,targetbuf,len,x,suffix,y,cmd);
|
---|
148 | /* puts up a Open Dialog and requests input into targetbuf */
|
---|
149 | /* OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST|OFN_unknown */
|
---|
150 | lstrcpyA(targetbuf,"x:\\dummy.exe");
|
---|
151 | return 1;
|
---|
152 | }
|
---|
153 |
|
---|
154 | /*************************************************************************
|
---|
155 | * SHGetSettings [SHELL32.68]
|
---|
156 | *
|
---|
157 | * NOTES
|
---|
158 | * the registry path are for win98 (tested)
|
---|
159 | * and possibly are the same in nt40
|
---|
160 | */
|
---|
161 | void WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask, DWORD dwx)
|
---|
162 | {
|
---|
163 | HKEY hKey;
|
---|
164 | DWORD dwData;
|
---|
165 | DWORD dwDataSize = sizeof (DWORD);
|
---|
166 |
|
---|
167 | TRACE("(%p 0x%08lx 0x%08lx)\n",lpsfs,dwMask, dwx);
|
---|
168 |
|
---|
169 | if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
|
---|
170 | 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0))
|
---|
171 | return;
|
---|
172 |
|
---|
173 | if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize))
|
---|
174 | lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1);
|
---|
175 |
|
---|
176 | if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize))
|
---|
177 | lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1);
|
---|
178 |
|
---|
179 | if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize))
|
---|
180 | lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1);
|
---|
181 |
|
---|
182 | if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize))
|
---|
183 | lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1);
|
---|
184 |
|
---|
185 | if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize))
|
---|
186 | lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1);
|
---|
187 |
|
---|
188 | if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize))
|
---|
189 | lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1);
|
---|
190 |
|
---|
191 | if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize))
|
---|
192 | { if (dwData == 0)
|
---|
193 | { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
|
---|
194 | if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
|
---|
195 | }
|
---|
196 | else if (dwData == 1)
|
---|
197 | { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 1;
|
---|
198 | if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
|
---|
199 | }
|
---|
200 | else if (dwData == 2)
|
---|
201 | { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
|
---|
202 | if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 1;
|
---|
203 | }
|
---|
204 | }
|
---|
205 | RegCloseKey (hKey);
|
---|
206 |
|
---|
207 | TRACE("-- 0x%04x\n", *(WORD*)lpsfs);
|
---|
208 | }
|
---|
209 |
|
---|
210 | /*************************************************************************
|
---|
211 | * SHShellFolderView_Message [SHELL32.73]
|
---|
212 | *
|
---|
213 | * PARAMETERS
|
---|
214 | * hwndCabinet defines the explorer cabinet window that contains the
|
---|
215 | * shellview you need to communicate with
|
---|
216 | * uMsg identifying the SFVM enum to perform
|
---|
217 | * lParam
|
---|
218 | *
|
---|
219 | * NOTES
|
---|
220 | * Message SFVM_REARRANGE = 1
|
---|
221 | * This message gets sent when a column gets clicked to instruct the
|
---|
222 | * shell view to re-sort the item list. lParam identifies the column
|
---|
223 | * that was clicked.
|
---|
224 | */
|
---|
225 | int WINAPI SHShellFolderView_Message(HWND hwndCabinet,UINT uMsg,LPARAM lParam)
|
---|
226 | { FIXME("%04x %08ux %08lx stub\n",hwndCabinet,uMsg,lParam);
|
---|
227 | return 0;
|
---|
228 | }
|
---|
229 |
|
---|
230 | /*************************************************************************
|
---|
231 | * OleStrToStrN [SHELL32.78]
|
---|
232 | */
|
---|
233 | BOOL WINAPI OleStrToStrNA (LPSTR lpStr, INT nStr, LPCWSTR lpOle, INT nOle)
|
---|
234 | {
|
---|
235 | TRACE("%p %x %s %x\n", lpStr, nStr, debugstr_w(lpOle), nOle);
|
---|
236 | return WideCharToMultiByte (0, 0, lpOle, nOle, lpStr, nStr, NULL, NULL);
|
---|
237 | }
|
---|
238 |
|
---|
239 | BOOL WINAPI OleStrToStrNW (LPWSTR lpwStr, INT nwStr, LPCWSTR lpOle, INT nOle)
|
---|
240 | {
|
---|
241 | TRACE("%p %x %s %x\n", lpwStr, nwStr, debugstr_w(lpOle), nOle);
|
---|
242 |
|
---|
243 | if (lstrcpynW ( lpwStr, lpOle, nwStr))
|
---|
244 | { return lstrlenW (lpwStr);
|
---|
245 | }
|
---|
246 | return 0;
|
---|
247 | }
|
---|
248 |
|
---|
249 | BOOL WINAPI OleStrToStrNAW (LPVOID lpOut, INT nOut, LPCVOID lpIn, INT nIn)
|
---|
250 | {
|
---|
251 | if (VERSION_OsIsUnicode())
|
---|
252 | return OleStrToStrNW ((LPWSTR)lpOut, nOut, (LPCWSTR)lpIn, nIn);
|
---|
253 | return OleStrToStrNA ((LPSTR)lpOut, nOut, (LPCWSTR)lpIn, nIn);
|
---|
254 | }
|
---|
255 |
|
---|
256 | /*************************************************************************
|
---|
257 | * StrToOleStrN [SHELL32.79]
|
---|
258 | * lpMulti, nMulti, nWide [IN]
|
---|
259 | * lpWide [OUT]
|
---|
260 | */
|
---|
261 | BOOL WINAPI StrToOleStrNA (LPWSTR lpWide, INT nWide, LPCSTR lpStrA, INT nStr)
|
---|
262 | {
|
---|
263 | TRACE("%p %x %s %x\n", lpWide, nWide, lpStrA, nStr);
|
---|
264 | return MultiByteToWideChar (0, 0, lpStrA, nStr, lpWide, nWide);
|
---|
265 | }
|
---|
266 | BOOL WINAPI StrToOleStrNW (LPWSTR lpWide, INT nWide, LPCWSTR lpStrW, INT nStr)
|
---|
267 | {
|
---|
268 | TRACE("%p %x %s %x\n", lpWide, nWide, debugstr_w(lpStrW), nStr);
|
---|
269 |
|
---|
270 | if (lstrcpynW (lpWide, lpStrW, nWide))
|
---|
271 | { return lstrlenW (lpWide);
|
---|
272 | }
|
---|
273 | return 0;
|
---|
274 | }
|
---|
275 |
|
---|
276 | BOOL WINAPI StrToOleStrNAW (LPWSTR lpWide, INT nWide, LPCVOID lpStr, INT nStr)
|
---|
277 | {
|
---|
278 | if (VERSION_OsIsUnicode())
|
---|
279 | return StrToOleStrNW (lpWide, nWide, (LPWSTR)lpStr, nStr);
|
---|
280 | return StrToOleStrNA (lpWide, nWide, (LPSTR)lpStr, nStr);
|
---|
281 | }
|
---|
282 |
|
---|
283 | /*************************************************************************
|
---|
284 | * RegisterShellHook [SHELL32.181]
|
---|
285 | *
|
---|
286 | * PARAMS
|
---|
287 | * hwnd [I] window handle
|
---|
288 | * y [I] flag ????
|
---|
289 | *
|
---|
290 | * NOTES
|
---|
291 | * exported by ordinal
|
---|
292 | */
|
---|
293 | void WINAPI RegisterShellHook(HWND hwnd, DWORD y) {
|
---|
294 | FIXME("(0x%08x,0x%08lx):stub.\n",hwnd,y);
|
---|
295 | }
|
---|
296 | /*************************************************************************
|
---|
297 | * ShellMessageBoxW [SHELL32.182]
|
---|
298 | *
|
---|
299 | * Format and output errormessage.
|
---|
300 | *
|
---|
301 | * idText resource ID of title or LPSTR
|
---|
302 | * idTitle resource ID of title or LPSTR
|
---|
303 | *
|
---|
304 | * NOTES
|
---|
305 | * exported by ordinal
|
---|
306 | */
|
---|
307 | INT __cdecl
|
---|
308 | ShellMessageBoxW(HMODULE hmod,HWND hwnd,DWORD idText,DWORD idTitle,DWORD uType,LPCVOID arglist)
|
---|
309 | { WCHAR szText[100],szTitle[100],szTemp[256];
|
---|
310 | LPWSTR pszText = &szText[0], pszTitle = &szTitle[0];
|
---|
311 | LPVOID args = &arglist;
|
---|
312 |
|
---|
313 | TRACE("(%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n",(DWORD)hmod,(DWORD)hwnd,idText,idTitle,uType,arglist);
|
---|
314 |
|
---|
315 | if (!HIWORD (idTitle))
|
---|
316 | LoadStringW(hmod,idTitle,pszTitle,100);
|
---|
317 | else
|
---|
318 | pszTitle = (LPWSTR)idTitle;
|
---|
319 |
|
---|
320 | if (! HIWORD (idText))
|
---|
321 | LoadStringW(hmod,idText,pszText,100);
|
---|
322 | else
|
---|
323 | pszText = (LPWSTR)idText;
|
---|
324 |
|
---|
325 | FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY,
|
---|
326 | szText,
|
---|
327 | 0,
|
---|
328 | 0,
|
---|
329 | szTemp,
|
---|
330 | 256,
|
---|
331 | (LPDWORD)args);
|
---|
332 | return MessageBoxW(hwnd,szTemp,szTitle,uType);
|
---|
333 | }
|
---|
334 |
|
---|
335 | /*************************************************************************
|
---|
336 | * ShellMessageBoxA [SHELL32.183]
|
---|
337 | */
|
---|
338 | INT __cdecl
|
---|
339 | ShellMessageBoxA(HMODULE hmod,HWND hwnd,DWORD idText,DWORD idTitle,DWORD uType,LPCVOID arglist)
|
---|
340 | { char szText[100],szTitle[100],szTemp[256];
|
---|
341 | LPSTR pszText = &szText[0], pszTitle = &szTitle[0];
|
---|
342 | LPVOID args = &arglist;
|
---|
343 |
|
---|
344 | TRACE("(%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n", (DWORD)hmod,(DWORD)hwnd,idText,idTitle,uType,arglist);
|
---|
345 |
|
---|
346 | if (!HIWORD (idTitle))
|
---|
347 | LoadStringA(hmod,idTitle,pszTitle,100);
|
---|
348 | else
|
---|
349 | pszTitle = (LPSTR)idTitle;
|
---|
350 |
|
---|
351 | if (! HIWORD (idText))
|
---|
352 | LoadStringA(hmod,idText,pszText,100);
|
---|
353 | else
|
---|
354 | pszText = (LPSTR)idText;
|
---|
355 |
|
---|
356 | FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY ,pszText,0,0,szTemp,256,(LPDWORD)args);
|
---|
357 | return MessageBoxA(hwnd,szTemp,pszTitle,uType);
|
---|
358 | }
|
---|
359 |
|
---|
360 | /*************************************************************************
|
---|
361 | * SHRestricted [SHELL32.100]
|
---|
362 | *
|
---|
363 | * walks through policy table, queries <app> key, <type> value, returns
|
---|
364 | * queried (DWORD) value, and caches it between called to SHInitRestricted
|
---|
365 | * to prevent unnecessary registry access.
|
---|
366 | *
|
---|
367 | * NOTES
|
---|
368 | * exported by ordinal
|
---|
369 | *
|
---|
370 | * REFERENCES:
|
---|
371 | * MS System Policy Editor
|
---|
372 | * 98Lite 2.0 (which uses many of these policy keys) http://www.98lite.net/
|
---|
373 | * "The Windows 95 Registry", by John Woram, 1996 MIS: Press
|
---|
374 | */
|
---|
375 | DWORD WINAPI SHRestricted (DWORD pol) {
|
---|
376 | char regstr[256];
|
---|
377 | HKEY xhkey;
|
---|
378 | DWORD retval, polidx, i, datsize = 4;
|
---|
379 |
|
---|
380 | TRACE("(%08lx)\n",pol);
|
---|
381 |
|
---|
382 | polidx = -1;
|
---|
383 |
|
---|
384 | /* scan to see if we know this policy ID */
|
---|
385 | for (i = 0; i < SHELL_MAX_POLICIES; i++)
|
---|
386 | {
|
---|
387 | if (pol == sh32_policy_table[i].polflags)
|
---|
388 | {
|
---|
389 | polidx = i;
|
---|
390 | break;
|
---|
391 | }
|
---|
392 | }
|
---|
393 |
|
---|
394 | if (polidx == -1)
|
---|
395 | {
|
---|
396 | /* we don't know this policy, return 0 */
|
---|
397 | TRACE("unknown policy: (%08lx)\n", pol);
|
---|
398 | return 0;
|
---|
399 | }
|
---|
400 |
|
---|
401 | /* we have a known policy */
|
---|
402 | lstrcpyA(regstr, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\");
|
---|
403 | lstrcatA(regstr, sh32_policy_table[polidx].appstr);
|
---|
404 |
|
---|
405 | /* first check if this policy has been cached, return it if so */
|
---|
406 | if (sh32_policy_table[polidx].cache != SHELL_NO_POLICY)
|
---|
407 | {
|
---|
408 | return sh32_policy_table[polidx].cache;
|
---|
409 | }
|
---|
410 |
|
---|
411 | /* return 0 and don't set the cache if any registry errors occur */
|
---|
412 | retval = 0;
|
---|
413 | if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS)
|
---|
414 | {
|
---|
415 | if (RegQueryValueExA(xhkey, sh32_policy_table[polidx].keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS)
|
---|
416 | {
|
---|
417 | sh32_policy_table[polidx].cache = retval;
|
---|
418 | }
|
---|
419 |
|
---|
420 | RegCloseKey(xhkey);
|
---|
421 | }
|
---|
422 |
|
---|
423 | return retval;
|
---|
424 | }
|
---|
425 |
|
---|
426 | /*************************************************************************
|
---|
427 | * SHInitRestricted [SHELL32.244]
|
---|
428 | *
|
---|
429 | * Win98+ by-ordinal only routine called by Explorer and MSIE 4 and 5.
|
---|
430 | * Inits the policy cache used by SHRestricted to avoid excess
|
---|
431 | * registry access.
|
---|
432 | *
|
---|
433 | * INPUTS
|
---|
434 | * Two inputs: one is a string or NULL. If non-NULL the pointer
|
---|
435 | * should point to a string containing the following exact text:
|
---|
436 | * "Software\Microsoft\Windows\CurrentVersion\Policies".
|
---|
437 | * The other input is unused.
|
---|
438 | *
|
---|
439 | * NOTES
|
---|
440 | * If the input is non-NULL and does not point to a string containing
|
---|
441 | * that exact text the routine will do nothing.
|
---|
442 | *
|
---|
443 | * If the text does match or the pointer is NULL, then the routine
|
---|
444 | * will init SHRestricted()'s policy cache to all 0xffffffff and
|
---|
445 | * returns 0xffffffff as well.
|
---|
446 | *
|
---|
447 | * I haven't yet run into anything calling this with inputs other than
|
---|
448 | * (NULL, NULL), so I may have the inputs reversed.
|
---|
449 | */
|
---|
450 |
|
---|
451 | BOOL WINAPI SHInitRestricted(LPSTR inpRegKey, LPSTR parm2)
|
---|
452 | {
|
---|
453 | int i;
|
---|
454 |
|
---|
455 | dprintf(("SHELL32:SHELLORD:SHInitRestricted(%p, %p)\n", inpRegKey, parm2));
|
---|
456 |
|
---|
457 | /* first check - if input is non-NULL and points to the secret
|
---|
458 | key string, then pass. Otherwise return 0.
|
---|
459 | */
|
---|
460 |
|
---|
461 | if (inpRegKey != (LPSTR)NULL)
|
---|
462 | {
|
---|
463 | if (lstrcmpiA(inpRegKey, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies"))
|
---|
464 | {
|
---|
465 | /* doesn't match, fail */
|
---|
466 | return 0;
|
---|
467 | }
|
---|
468 | }
|
---|
469 |
|
---|
470 | /* check passed, init all policy cache entries with SHELL_NO_POLICY */
|
---|
471 | for (i = 0; i < SHELL_MAX_POLICIES; i++)
|
---|
472 | {
|
---|
473 | sh32_policy_table[i].cache = SHELL_NO_POLICY;
|
---|
474 | }
|
---|
475 |
|
---|
476 | return SHELL_NO_POLICY;
|
---|
477 | }
|
---|
478 |
|
---|
479 | /*************************************************************************
|
---|
480 | * SHCreateDirectory [SHELL32.165]
|
---|
481 | *
|
---|
482 | * NOTES
|
---|
483 | * exported by ordinal
|
---|
484 | * not sure about LPSECURITY_ATTRIBUTES
|
---|
485 | */
|
---|
486 | DWORD WINAPI SHCreateDirectory(LPSECURITY_ATTRIBUTES sec,LPCSTR path) {
|
---|
487 | TRACE("(%p,%s):stub.\n",sec,path);
|
---|
488 | if (CreateDirectoryA(path,sec))
|
---|
489 | return TRUE;
|
---|
490 | /* SHChangeNotify(8,1,path,0); */
|
---|
491 | return FALSE;
|
---|
492 | #if 0
|
---|
493 | if (SHELL32_79(path,(LPVOID)x))
|
---|
494 | return 0;
|
---|
495 | FIXME("(%08lx,%s):stub.\n",x,path);
|
---|
496 | return 0;
|
---|
497 | #endif
|
---|
498 | }
|
---|
499 |
|
---|
500 | /*************************************************************************
|
---|
501 | * SHFree [SHELL32.195]
|
---|
502 | *
|
---|
503 | * NOTES
|
---|
504 | * free_ptr() - frees memory using IMalloc
|
---|
505 | * exported by ordinal
|
---|
506 | */
|
---|
507 | #define MEM_DEBUG 0
|
---|
508 | DWORD WINAPI SHFree(LPVOID x)
|
---|
509 | {
|
---|
510 | #if MEM_DEBUG
|
---|
511 | WORD len = *(LPWORD)(x-2);
|
---|
512 |
|
---|
513 | if ( *(LPWORD)(x+len) != 0x7384)
|
---|
514 | ERR("MAGIC2!\n");
|
---|
515 |
|
---|
516 | if ( (*(LPWORD)(x-4)) != 0x8271)
|
---|
517 | ERR("MAGIC1!\n");
|
---|
518 | else
|
---|
519 | memset(x-4, 0xde, len+6);
|
---|
520 |
|
---|
521 | TRACE("%p len=%u\n",x, len);
|
---|
522 |
|
---|
523 | x -= 4;
|
---|
524 | #else
|
---|
525 | TRACE("%p\n",x);
|
---|
526 | #endif
|
---|
527 | return HeapFree(GetProcessHeap(), 0, x);
|
---|
528 | }
|
---|
529 |
|
---|
530 | /*************************************************************************
|
---|
531 | * SHAlloc [SHELL32.196]
|
---|
532 | *
|
---|
533 | * NOTES
|
---|
534 | * void *task_alloc(DWORD len), uses SHMalloc allocator
|
---|
535 | * exported by ordinal
|
---|
536 | */
|
---|
537 | LPVOID WINAPI SHAlloc(DWORD len)
|
---|
538 | {
|
---|
539 | LPBYTE ret;
|
---|
540 |
|
---|
541 | #if MEM_DEBUG
|
---|
542 | ret = (LPBYTE) HeapAlloc(GetProcessHeap(),0,len+6);
|
---|
543 | #else
|
---|
544 | ret = (LPBYTE) HeapAlloc(GetProcessHeap(),0,len);
|
---|
545 | #endif
|
---|
546 |
|
---|
547 | #if MEM_DEBUG
|
---|
548 | *(LPWORD)(ret) = 0x8271;
|
---|
549 | *(LPWORD)(ret+2) = (WORD)len;
|
---|
550 | *(LPWORD)(ret+4+len) = 0x7384;
|
---|
551 | ret += 4;
|
---|
552 | memset(ret, 0xdf, len);
|
---|
553 | #endif
|
---|
554 | TRACE("%lu bytes at %p\n",len, ret);
|
---|
555 | return (LPVOID)ret;
|
---|
556 | }
|
---|
557 |
|
---|
558 | /*************************************************************************
|
---|
559 | * SHRegisterDragDrop [SHELL32.86]
|
---|
560 | *
|
---|
561 | * NOTES
|
---|
562 | * exported by ordinal
|
---|
563 | */
|
---|
564 | DWORD WINAPI SHRegisterDragDrop(HWND hWnd,IDropTarget * pDropTarget)
|
---|
565 | {
|
---|
566 | FIXME("(0x%08x,%p):stub.\n", hWnd, pDropTarget);
|
---|
567 | return RegisterDragDrop(hWnd, pDropTarget);
|
---|
568 | }
|
---|
569 |
|
---|
570 | /*************************************************************************
|
---|
571 | * SHRevokeDragDrop [SHELL32.87]
|
---|
572 | *
|
---|
573 | * NOTES
|
---|
574 | * exported by ordinal
|
---|
575 | */
|
---|
576 | DWORD WINAPI SHRevokeDragDrop(DWORD x) {
|
---|
577 | FIXME("(0x%08lx):stub.\n",x);
|
---|
578 | return 0;
|
---|
579 | }
|
---|
580 |
|
---|
581 | /*************************************************************************
|
---|
582 | * SHDoDragDrop [SHELL32.88]
|
---|
583 | *
|
---|
584 | * NOTES
|
---|
585 | * exported by ordinal
|
---|
586 | */
|
---|
587 | DWORD WINAPI SHDoDragDrop(DWORD u, DWORD v, DWORD w, DWORD x, DWORD y, DWORD z) {
|
---|
588 | FIXME("(0x%08lx 0x%08lx 0x%08lx 0x%08lx 0x%08lx 0x%08lx):stub.\n",u,v,w,x,y,z);
|
---|
589 | return 0;
|
---|
590 | }
|
---|
591 |
|
---|
592 | /*************************************************************************
|
---|
593 | * RunFileDlg [SHELL32.61]
|
---|
594 | *
|
---|
595 | * NOTES
|
---|
596 | * Original name: RunFileDlg (exported by ordinal)
|
---|
597 | */
|
---|
598 | DWORD WINAPI
|
---|
599 | RunFileDlg (HWND hwndOwner, DWORD dwParam1, DWORD dwParam2,
|
---|
600 | LPSTR lpszTitle, LPSTR lpszPrompt, UINT uFlags)
|
---|
601 | {
|
---|
602 | FIXME("(0x%08x 0x%lx 0x%lx \"%s\" \"%s\" 0x%x):stub.\n",
|
---|
603 | hwndOwner, dwParam1, dwParam2, lpszTitle, lpszPrompt, uFlags);
|
---|
604 | return 0;
|
---|
605 | }
|
---|
606 |
|
---|
607 | /*************************************************************************
|
---|
608 | * ExitWindowsDialog [SHELL32.60]
|
---|
609 | *
|
---|
610 | * NOTES
|
---|
611 | * exported by ordinal
|
---|
612 | */
|
---|
613 | void WINAPI ExitWindowsDialog (HWND hWndOwner)
|
---|
614 | {
|
---|
615 | TRACE("(0x%08x)\n", hWndOwner);
|
---|
616 | if (MessageBoxA( hWndOwner, "Do you want to exit Odin?", "Shutdown", MB_YESNO|MB_ICONQUESTION) == IDYES)
|
---|
617 | { SendMessageA ( hWndOwner, WM_QUIT, 0, 0);
|
---|
618 | }
|
---|
619 | }
|
---|
620 |
|
---|
621 | /*************************************************************************
|
---|
622 | * ArrangeWindows [SHELL32.184]
|
---|
623 | *
|
---|
624 | */
|
---|
625 | DWORD WINAPI
|
---|
626 | ArrangeWindows (DWORD dwParam1, DWORD dwParam2, DWORD dwParam3,
|
---|
627 | DWORD dwParam4, DWORD dwParam5)
|
---|
628 | {
|
---|
629 | FIXME("(0x%lx 0x%lx 0x%lx 0x%lx 0x%lx):stub.\n",
|
---|
630 | dwParam1, dwParam2, dwParam3, dwParam4, dwParam5);
|
---|
631 | return 0;
|
---|
632 | }
|
---|
633 |
|
---|
634 | /*************************************************************************
|
---|
635 | * SignalFileOpen [SHELL32.103]
|
---|
636 | *
|
---|
637 | * NOTES
|
---|
638 | * exported by ordinal
|
---|
639 | */
|
---|
640 | DWORD WINAPI
|
---|
641 | SignalFileOpen (DWORD dwParam1)
|
---|
642 | {
|
---|
643 | FIXME("(0x%08lx):stub.\n", dwParam1);
|
---|
644 |
|
---|
645 | return 0;
|
---|
646 | }
|
---|
647 |
|
---|
648 | /*************************************************************************
|
---|
649 | * SHAddToRecentDocs [SHELL32.234]
|
---|
650 | *
|
---|
651 | * PARAMETERS
|
---|
652 | * uFlags [IN] SHARD_PATH or SHARD_PIDL
|
---|
653 | * pv [IN] string or pidl, NULL clears the list
|
---|
654 | *
|
---|
655 | * NOTES
|
---|
656 | * exported by name
|
---|
657 | */
|
---|
658 | DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
|
---|
659 | { if (SHARD_PIDL==uFlags)
|
---|
660 | { FIXME("(0x%08x,pidl=%p):stub.\n", uFlags,pv);
|
---|
661 | }
|
---|
662 | else
|
---|
663 | { FIXME("(0x%08x,%s):stub.\n", uFlags,(char*)pv);
|
---|
664 | }
|
---|
665 | return 0;
|
---|
666 | }
|
---|
667 | /*************************************************************************
|
---|
668 | * SHFileOperation [SHELL32.242]
|
---|
669 | *
|
---|
670 | */
|
---|
671 | DWORD WINAPI SHFileOperationAW(DWORD x)
|
---|
672 | { FIXME("0x%08lx stub\n",x);
|
---|
673 | return 0;
|
---|
674 |
|
---|
675 | }
|
---|
676 |
|
---|
677 | /*************************************************************************
|
---|
678 | * SHFileOperationA [SHELL32.243]
|
---|
679 | *
|
---|
680 | * NOTES
|
---|
681 | * exported by name
|
---|
682 | */
|
---|
683 | DWORD WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp)
|
---|
684 | { FIXME("(%p):stub.\n", lpFileOp);
|
---|
685 | return 1;
|
---|
686 | }
|
---|
687 | /*************************************************************************
|
---|
688 | * SHFileOperationW [SHELL32.244]
|
---|
689 | *
|
---|
690 | * NOTES
|
---|
691 | * exported by name
|
---|
692 | */
|
---|
693 | DWORD WINAPI SHFileOperationW (LPSHFILEOPSTRUCTW lpFileOp)
|
---|
694 | { FIXME("(%p):stub.\n", lpFileOp);
|
---|
695 | return 1;
|
---|
696 | }
|
---|
697 |
|
---|
698 | /*************************************************************************
|
---|
699 | * SHChangeNotify [SHELL32.239]
|
---|
700 | *
|
---|
701 | * NOTES
|
---|
702 | * exported by name
|
---|
703 | */
|
---|
704 | DWORD WINAPI SHChangeNotify (
|
---|
705 | INT wEventId, /* [IN] flags that specifies the event*/
|
---|
706 | UINT uFlags, /* [IN] the meaning of dwItem[1|2]*/
|
---|
707 | LPCVOID dwItem1,
|
---|
708 | LPCVOID dwItem2)
|
---|
709 | { FIXME("(0x%08x,0x%08ux,%p,%p):stub.\n", wEventId,uFlags,dwItem1,dwItem2);
|
---|
710 | return 0;
|
---|
711 | }
|
---|
712 | /*************************************************************************
|
---|
713 | * SHCreateShellFolderViewEx [SHELL32.174]
|
---|
714 | *
|
---|
715 | * NOTES
|
---|
716 | * see IShellFolder::CreateViewObject
|
---|
717 | */
|
---|
718 | HRESULT WINAPI SHCreateShellFolderViewEx(
|
---|
719 | LPSHELLVIEWDATA psvcbi, /*[in ] shelltemplate struct*/
|
---|
720 | LPVOID* ppv) /*[out] IShellView pointer*/
|
---|
721 | {
|
---|
722 | IShellView * psf;
|
---|
723 | HRESULT hRes;
|
---|
724 |
|
---|
725 | TRACE("sf=%p pidl=%p cb=%p mode=0x%08lx parm=0x%08lx\n",
|
---|
726 | psvcbi->pShellFolder, psvcbi->pidl, psvcbi->pCallBack, psvcbi->viewmode, psvcbi->dwUserParam);
|
---|
727 |
|
---|
728 | psf = IShellView_Constructor(psvcbi->pShellFolder);
|
---|
729 |
|
---|
730 | if (!psf)
|
---|
731 | return E_OUTOFMEMORY;
|
---|
732 |
|
---|
733 | IShellView_AddRef(psf);
|
---|
734 | hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv);
|
---|
735 | IShellView_Release(psf);
|
---|
736 |
|
---|
737 | return hRes;
|
---|
738 | }
|
---|
739 | /*************************************************************************
|
---|
740 | * SHWinHelp [SHELL32.127]
|
---|
741 | *
|
---|
742 | */
|
---|
743 | HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z)
|
---|
744 | { FIXME("0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z);
|
---|
745 | return 0;
|
---|
746 | }
|
---|
747 | /*************************************************************************
|
---|
748 | * SHRunControlPanel [SHELL32.161]
|
---|
749 | *
|
---|
750 | */
|
---|
751 | HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z)
|
---|
752 | { FIXME("0x%08lx 0x%08lx stub\n",x,z);
|
---|
753 | return 0;
|
---|
754 | }
|
---|
755 | /*************************************************************************
|
---|
756 | * ShellExecuteEx [SHELL32.291]
|
---|
757 | *
|
---|
758 | */
|
---|
759 | BOOL WINAPI ShellExecuteExAW (LPVOID sei)
|
---|
760 | { if (VERSION_OsIsUnicode())
|
---|
761 | return ShellExecuteExW ((LPSHELLEXECUTEINFOW)sei);
|
---|
762 | return ShellExecuteExA ((LPSHELLEXECUTEINFOA)sei);
|
---|
763 | }
|
---|
764 | /*************************************************************************
|
---|
765 | * ShellExecuteExA [SHELL32.292]
|
---|
766 | *
|
---|
767 | * placeholder in the commandline:
|
---|
768 | * %1 file
|
---|
769 | * %2 printer
|
---|
770 | * %3 driver
|
---|
771 | * %4 port
|
---|
772 | * %I adress of a global item ID (explorer switch /idlist)
|
---|
773 | * %L ??? path/url/current file ???
|
---|
774 | * %S ???
|
---|
775 | * %* all following parameters (see batfile)
|
---|
776 | */
|
---|
777 | #include "process.h" /* we can get rid of it hopefully */
|
---|
778 | #include "task.h"
|
---|
779 | BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei)
|
---|
780 | { CHAR szApplicationName[MAX_PATH],szCommandline[MAX_PATH],szPidl[20];
|
---|
781 | LPSTR pos;
|
---|
782 | int gap, len;
|
---|
783 | STARTUPINFOA startup;
|
---|
784 | PROCESS_INFORMATION info;
|
---|
785 |
|
---|
786 | WARN("mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n",
|
---|
787 | sei->fMask, sei->hwnd, sei->lpVerb, sei->lpFile,
|
---|
788 | sei->lpParameters, sei->lpDirectory, sei->nShow,
|
---|
789 | (sei->fMask & SEE_MASK_CLASSNAME) ? sei->lpClass : "not used");
|
---|
790 |
|
---|
791 | ZeroMemory(szApplicationName,MAX_PATH);
|
---|
792 | if (sei->lpFile)
|
---|
793 | strcpy(szApplicationName, sei->lpFile);
|
---|
794 |
|
---|
795 | ZeroMemory(szCommandline,MAX_PATH);
|
---|
796 | if (sei->lpParameters)
|
---|
797 | strcpy(szCommandline, sei->lpParameters);
|
---|
798 |
|
---|
799 | if (sei->fMask & (SEE_MASK_CLASSKEY | SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY |
|
---|
800 | SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT |
|
---|
801 | SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE |
|
---|
802 | SEE_MASK_NO_CONSOLE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR ))
|
---|
803 | {
|
---|
804 | FIXME("flags ignored: 0x%08lx\n", sei->fMask);
|
---|
805 | }
|
---|
806 |
|
---|
807 | /* launch a document by fileclass like 'Wordpad.Document.1' */
|
---|
808 | if (sei->fMask & SEE_MASK_CLASSNAME)
|
---|
809 | {
|
---|
810 | /* the commandline contains 'c:\Path\wordpad.exe "%1"' */
|
---|
811 | HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, 256);
|
---|
812 | /* fixme: get the extension of lpFile, check if it fits to the lpClass */
|
---|
813 | TRACE("SEE_MASK_CLASSNAME->'%s'\n", szCommandline);
|
---|
814 | }
|
---|
815 |
|
---|
816 | /* process the IDList */
|
---|
817 | if ( (sei->fMask & SEE_MASK_INVOKEIDLIST) == SEE_MASK_INVOKEIDLIST) /*0x0c*/
|
---|
818 | {
|
---|
819 | SHGetPathFromIDListA ((LPCITEMIDLIST)sei->lpIDList,szApplicationName);
|
---|
820 | TRACE("-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName);
|
---|
821 | }
|
---|
822 | else
|
---|
823 | {
|
---|
824 | if (sei->fMask & SEE_MASK_IDLIST )
|
---|
825 | {
|
---|
826 | pos = strstr(szCommandline, "%I");
|
---|
827 | if (pos)
|
---|
828 | {
|
---|
829 | LPVOID pv;
|
---|
830 | HGLOBAL hmem = SHAllocShared ( (LPITEMIDLIST)sei->lpIDList, ILGetSize((LPITEMIDLIST)sei->lpIDList), 0);
|
---|
831 | pv = SHLockShared(hmem,0);
|
---|
832 | sprintf(szPidl,":%p",pv );
|
---|
833 | SHUnlockShared((HANDLE)pv);
|
---|
834 |
|
---|
835 | gap = strlen(szPidl);
|
---|
836 | len = strlen(pos)-2;
|
---|
837 | memmove(pos+gap,pos+2,len);
|
---|
838 | memcpy(pos,szPidl,gap);
|
---|
839 |
|
---|
840 | }
|
---|
841 | }
|
---|
842 | }
|
---|
843 |
|
---|
844 | TRACE("execute:'%s','%s'\n",szApplicationName, szCommandline);
|
---|
845 |
|
---|
846 | strcat(szApplicationName, " ");
|
---|
847 | strcat(szApplicationName, szCommandline);
|
---|
848 |
|
---|
849 | ZeroMemory(&startup,sizeof(STARTUPINFOA));
|
---|
850 | startup.cb = sizeof(STARTUPINFOA);
|
---|
851 |
|
---|
852 | if (! CreateProcessA(NULL, szApplicationName,
|
---|
853 | NULL, NULL, FALSE, 0,
|
---|
854 | NULL, NULL, &startup, &info))
|
---|
855 | {
|
---|
856 | sei->hInstApp = GetLastError();
|
---|
857 | return FALSE;
|
---|
858 | }
|
---|
859 |
|
---|
860 | sei->hInstApp = 33;
|
---|
861 |
|
---|
862 | /* Give 30 seconds to the app to come up */
|
---|
863 | if ( WaitForInputIdle ( info.hProcess, 30000 ) == 0xFFFFFFFF )
|
---|
864 | ERR("WaitForInputIdle failed: Error %ld\n", GetLastError() );
|
---|
865 |
|
---|
866 | if(sei->fMask & SEE_MASK_NOCLOSEPROCESS)
|
---|
867 | sei->hProcess = info.hProcess;
|
---|
868 | else
|
---|
869 | CloseHandle( info.hProcess );
|
---|
870 | CloseHandle( info.hThread );
|
---|
871 | return TRUE;
|
---|
872 | }
|
---|
873 |
|
---|
874 | /*************************************************************************
|
---|
875 | * ShellExecuteExW [SHELL32.293]
|
---|
876 | *
|
---|
877 | */
|
---|
878 | BOOL WINAPI ShellExecuteExW (LPSHELLEXECUTEINFOW sei)
|
---|
879 | { SHELLEXECUTEINFOA seiA;
|
---|
880 | DWORD ret;
|
---|
881 |
|
---|
882 | TRACE("%p\n", sei);
|
---|
883 |
|
---|
884 | memcpy(&seiA, sei, sizeof(SHELLEXECUTEINFOA));
|
---|
885 |
|
---|
886 | if (sei->lpVerb)
|
---|
887 | seiA.lpVerb = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpVerb);
|
---|
888 |
|
---|
889 | if (sei->lpFile)
|
---|
890 | seiA.lpFile = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpFile);
|
---|
891 |
|
---|
892 | if (sei->lpParameters)
|
---|
893 | seiA.lpParameters = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpParameters);
|
---|
894 |
|
---|
895 | if (sei->lpDirectory)
|
---|
896 | seiA.lpDirectory = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpDirectory);
|
---|
897 |
|
---|
898 | if ((sei->fMask & SEE_MASK_CLASSNAME) && sei->lpClass)
|
---|
899 | seiA.lpClass = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpClass);
|
---|
900 | else
|
---|
901 | seiA.lpClass = NULL;
|
---|
902 |
|
---|
903 | ret = ShellExecuteExA(&seiA);
|
---|
904 |
|
---|
905 | if (seiA.lpVerb) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpVerb );
|
---|
906 | if (seiA.lpFile) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpFile );
|
---|
907 | if (seiA.lpParameters) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpParameters );
|
---|
908 | if (seiA.lpDirectory) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpDirectory );
|
---|
909 | if (seiA.lpClass) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpClass );
|
---|
910 |
|
---|
911 | return ret;
|
---|
912 | }
|
---|
913 |
|
---|
914 | static LPUNKNOWN SHELL32_IExplorerInterface=0;
|
---|
915 | /*************************************************************************
|
---|
916 | * SHSetInstanceExplorer [SHELL32.176]
|
---|
917 | *
|
---|
918 | * NOTES
|
---|
919 | * Sets the interface
|
---|
920 | */
|
---|
921 | HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown)
|
---|
922 | { TRACE("%p\n", lpUnknown);
|
---|
923 | SHELL32_IExplorerInterface = lpUnknown;
|
---|
924 | return (HRESULT) lpUnknown;
|
---|
925 | }
|
---|
926 | /*************************************************************************
|
---|
927 | * SHGetInstanceExplorer [SHELL32.256]
|
---|
928 | *
|
---|
929 | * NOTES
|
---|
930 | * gets the interface pointer of the explorer and a reference
|
---|
931 | */
|
---|
932 | HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown)
|
---|
933 | { TRACE("%p\n", lpUnknown);
|
---|
934 |
|
---|
935 | *lpUnknown = SHELL32_IExplorerInterface;
|
---|
936 |
|
---|
937 | if (!SHELL32_IExplorerInterface)
|
---|
938 | return E_FAIL;
|
---|
939 |
|
---|
940 | IUnknown_AddRef(SHELL32_IExplorerInterface);
|
---|
941 | return NOERROR;
|
---|
942 | }
|
---|
943 | /*************************************************************************
|
---|
944 | * SHFreeUnusedLibraries [SHELL32.123]
|
---|
945 | *
|
---|
946 | * NOTES
|
---|
947 | * exported by name
|
---|
948 | */
|
---|
949 | HRESULT WINAPI SHFreeUnusedLibraries (void)
|
---|
950 | { FIXME("stub\n");
|
---|
951 | return TRUE;
|
---|
952 | }
|
---|
953 | /*************************************************************************
|
---|
954 | * DAD_SetDragImage [SHELL32.136]
|
---|
955 | *
|
---|
956 | * NOTES
|
---|
957 | * exported by name
|
---|
958 | */
|
---|
959 | HRESULT WINAPI DAD_SetDragImage (DWORD u, DWORD v)
|
---|
960 | { FIXME("0x%08lx 0x%08lx stub\n",u, v);
|
---|
961 | return 0;
|
---|
962 | }
|
---|
963 | /*************************************************************************
|
---|
964 | * DAD_ShowDragImage [SHELL32.137]
|
---|
965 | *
|
---|
966 | * NOTES
|
---|
967 | * exported by name
|
---|
968 | */
|
---|
969 | HRESULT WINAPI DAD_ShowDragImage (DWORD u)
|
---|
970 | { FIXME("0x%08lx stub\n",u);
|
---|
971 | return 0;
|
---|
972 | }
|
---|
973 | /*************************************************************************
|
---|
974 | * SHRegCloseKey [NT4.0:SHELL32.505]
|
---|
975 | *
|
---|
976 | */
|
---|
977 | HRESULT WINAPI SHRegCloseKey (HKEY hkey)
|
---|
978 | { TRACE("0x%04x\n",hkey);
|
---|
979 | return RegCloseKey( hkey );
|
---|
980 | }
|
---|
981 | /*************************************************************************
|
---|
982 | * SHRegOpenKeyA [SHELL32.506]
|
---|
983 | *
|
---|
984 | */
|
---|
985 | HRESULT WINAPI SHRegOpenKeyA(HKEY hKey, LPSTR lpSubKey, LPHKEY phkResult)
|
---|
986 | {
|
---|
987 | TRACE("(0x%08x, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult);
|
---|
988 | return RegOpenKeyA(hKey, lpSubKey, phkResult);
|
---|
989 | }
|
---|
990 |
|
---|
991 | /*************************************************************************
|
---|
992 | * SHRegOpenKeyW [NT4.0:SHELL32.507]
|
---|
993 | *
|
---|
994 | */
|
---|
995 | HRESULT WINAPI SHRegOpenKeyW (HKEY hkey, LPCWSTR lpszSubKey, LPHKEY retkey)
|
---|
996 | { WARN("0x%04x %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
|
---|
997 | return RegOpenKeyW( hkey, lpszSubKey, retkey );
|
---|
998 | }
|
---|
999 | /*************************************************************************
|
---|
1000 | * SHRegQueryValueExA [SHELL32.509]
|
---|
1001 | *
|
---|
1002 | */
|
---|
1003 | HRESULT WINAPI SHRegQueryValueExA(
|
---|
1004 | HKEY hkey,
|
---|
1005 | LPSTR lpValueName,
|
---|
1006 | LPDWORD lpReserved,
|
---|
1007 | LPDWORD lpType,
|
---|
1008 | LPBYTE lpData,
|
---|
1009 | LPDWORD lpcbData)
|
---|
1010 | {
|
---|
1011 | TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
|
---|
1012 | return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
|
---|
1013 | }
|
---|
1014 | /*************************************************************************
|
---|
1015 | * SHRegQueryValueW [NT4.0:SHELL32.510]
|
---|
1016 | *
|
---|
1017 | */
|
---|
1018 | HRESULT WINAPI SHRegQueryValueW (HKEY hkey, LPWSTR lpszSubKey,
|
---|
1019 | LPWSTR lpszData, LPDWORD lpcbData )
|
---|
1020 | { WARN("0x%04x %s %p %p semi-stub\n",
|
---|
1021 | hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
|
---|
1022 | return RegQueryValueW( hkey, lpszSubKey, lpszData, (LPLONG)lpcbData );
|
---|
1023 | }
|
---|
1024 |
|
---|
1025 | /*************************************************************************
|
---|
1026 | * SHRegQueryValueExW [NT4.0:SHELL32.511]
|
---|
1027 | *
|
---|
1028 | * FIXME
|
---|
1029 | * if the datatype REG_EXPAND_SZ then expand the string and change
|
---|
1030 | * *pdwType to REG_SZ.
|
---|
1031 | */
|
---|
1032 | HRESULT WINAPI SHRegQueryValueExW (HKEY hkey, LPWSTR pszValue, LPDWORD pdwReserved,
|
---|
1033 | LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData)
|
---|
1034 | { DWORD ret;
|
---|
1035 | WARN("0x%04x %s %p %p %p %p semi-stub\n",
|
---|
1036 | hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
|
---|
1037 | ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, (LPBYTE)pvData, pcbData);
|
---|
1038 | return ret;
|
---|
1039 | }
|
---|
1040 |
|
---|
1041 | /*************************************************************************
|
---|
1042 | * ReadCabinetState [NT 4.0:SHELL32.651]
|
---|
1043 | *
|
---|
1044 | */
|
---|
1045 | HRESULT WINAPI ReadCabinetState(DWORD u, DWORD v)
|
---|
1046 | { FIXME("0x%04lx 0x%04lx stub\n",u,v);
|
---|
1047 | return 0;
|
---|
1048 | }
|
---|
1049 | /*************************************************************************
|
---|
1050 | * WriteCabinetState [NT 4.0:SHELL32.652]
|
---|
1051 | *
|
---|
1052 | */
|
---|
1053 | HRESULT WINAPI WriteCabinetState(DWORD u)
|
---|
1054 | { FIXME("0x%04lx stub\n",u);
|
---|
1055 | return 0;
|
---|
1056 | }
|
---|
1057 | /*************************************************************************
|
---|
1058 | * FileIconInit [SHELL32.660]
|
---|
1059 | *
|
---|
1060 | */
|
---|
1061 | BOOL WINAPI FileIconInit(BOOL bFullInit)
|
---|
1062 | { FIXME("(%s)\n", bFullInit ? "true" : "false");
|
---|
1063 | return 0;
|
---|
1064 | }
|
---|
1065 | /*************************************************************************
|
---|
1066 | * IsUserAdmin [NT 4.0:SHELL32.680]
|
---|
1067 | *
|
---|
1068 | */
|
---|
1069 | HRESULT WINAPI IsUserAdmin(void)
|
---|
1070 | { FIXME("stub\n");
|
---|
1071 | return TRUE;
|
---|
1072 | }
|
---|
1073 | /*************************************************************************
|
---|
1074 | * StrRetToStrN [SHELL32.96]
|
---|
1075 | *
|
---|
1076 | * converts a STRRET to a normal string
|
---|
1077 | *
|
---|
1078 | * NOTES
|
---|
1079 | * the pidl is for STRRET OFFSET
|
---|
1080 | */
|
---|
1081 | HRESULT WINAPI StrRetToBufA (LPSTRRET src, LPITEMIDLIST pidl, LPSTR dest, DWORD len)
|
---|
1082 | {
|
---|
1083 | return StrRetToStrNA(dest, len, src, pidl);
|
---|
1084 | }
|
---|
1085 |
|
---|
1086 | HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
|
---|
1087 | {
|
---|
1088 | TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
|
---|
1089 |
|
---|
1090 | switch (src->uType)
|
---|
1091 | {
|
---|
1092 | case STRRET_WSTR:
|
---|
1093 | WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL);
|
---|
1094 | SHFree(src->u.pOleStr);
|
---|
1095 | break;
|
---|
1096 |
|
---|
1097 | case STRRET_CSTRA:
|
---|
1098 | lstrcpynA((LPSTR)dest, src->u.cStr, len);
|
---|
1099 | break;
|
---|
1100 |
|
---|
1101 | case STRRET_OFFSETA:
|
---|
1102 | lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
|
---|
1103 | break;
|
---|
1104 |
|
---|
1105 | default:
|
---|
1106 | FIXME("unknown type!\n");
|
---|
1107 | if (len)
|
---|
1108 | {
|
---|
1109 | *(LPSTR)dest = '\0';
|
---|
1110 | }
|
---|
1111 | return(FALSE);
|
---|
1112 | }
|
---|
1113 | return S_OK;
|
---|
1114 | }
|
---|
1115 |
|
---|
1116 | HRESULT WINAPI StrRetToBufW (LPSTRRET src, LPITEMIDLIST pidl, LPWSTR dest, DWORD len)
|
---|
1117 | {
|
---|
1118 | return StrRetToStrNW(dest, len, src, pidl);
|
---|
1119 | }
|
---|
1120 |
|
---|
1121 | HRESULT WINAPI StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
|
---|
1122 | {
|
---|
1123 | TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
|
---|
1124 |
|
---|
1125 | switch (src->uType)
|
---|
1126 | {
|
---|
1127 | case STRRET_WSTR:
|
---|
1128 | lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);
|
---|
1129 | SHFree(src->u.pOleStr);
|
---|
1130 | break;
|
---|
1131 |
|
---|
1132 | case STRRET_CSTRA:
|
---|
1133 | lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len);
|
---|
1134 | break;
|
---|
1135 |
|
---|
1136 | case STRRET_OFFSETA:
|
---|
1137 | if (pidl)
|
---|
1138 | {
|
---|
1139 | lstrcpynAtoW((LPWSTR)dest, ((LPSTR)&pidl->mkid)+src->u.uOffset, len);
|
---|
1140 | }
|
---|
1141 | break;
|
---|
1142 |
|
---|
1143 | default:
|
---|
1144 | FIXME("unknown type!\n");
|
---|
1145 | if (len)
|
---|
1146 | { *(LPSTR)dest = '\0';
|
---|
1147 | }
|
---|
1148 | return(FALSE);
|
---|
1149 | }
|
---|
1150 | return S_OK;
|
---|
1151 | }
|
---|
1152 | HRESULT WINAPI StrRetToStrNAW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
|
---|
1153 | {
|
---|
1154 | if(VERSION_OsIsUnicode())
|
---|
1155 | return StrRetToStrNW (dest, len, src, pidl);
|
---|
1156 | return StrRetToStrNA (dest, len, src, pidl);
|
---|
1157 | }
|
---|
1158 |
|
---|
1159 | /*************************************************************************
|
---|
1160 | * StrChrA [NT 4.0:SHELL32.651]
|
---|
1161 | *
|
---|
1162 | */
|
---|
1163 | LPSTR WINAPI StrChrA (LPSTR str, CHAR x )
|
---|
1164 | { LPSTR ptr=str;
|
---|
1165 |
|
---|
1166 | do
|
---|
1167 | { if (*ptr==x)
|
---|
1168 | { return ptr;
|
---|
1169 | }
|
---|
1170 | ptr++;
|
---|
1171 | } while (*ptr);
|
---|
1172 | return NULL;
|
---|
1173 | }
|
---|
1174 |
|
---|
1175 | /*************************************************************************
|
---|
1176 | * StrChrW [NT 4.0:SHELL32.651]
|
---|
1177 | *
|
---|
1178 | */
|
---|
1179 | LPWSTR WINAPI StrChrW (LPWSTR str, WCHAR x )
|
---|
1180 | { LPWSTR ptr=str;
|
---|
1181 |
|
---|
1182 | TRACE("%s 0x%04x\n",debugstr_w(str),x);
|
---|
1183 | do
|
---|
1184 | { if (*ptr==x)
|
---|
1185 | { return ptr;
|
---|
1186 | }
|
---|
1187 | ptr++;
|
---|
1188 | } while (*ptr);
|
---|
1189 | return NULL;
|
---|
1190 | }
|
---|
1191 |
|
---|
1192 | /*************************************************************************
|
---|
1193 | * StrCmpNIW [NT 4.0:SHELL32.*]
|
---|
1194 | *
|
---|
1195 | */
|
---|
1196 | INT WINAPI StrCmpNIW ( LPWSTR wstr1, LPWSTR wstr2, INT len)
|
---|
1197 | { FIXME("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len);
|
---|
1198 | return 0;
|
---|
1199 | }
|
---|
1200 |
|
---|
1201 | /*************************************************************************
|
---|
1202 | * StrCmpNIA [NT 4.0:SHELL32.*]
|
---|
1203 | *
|
---|
1204 | */
|
---|
1205 | INT WINAPI StrCmpNIA ( LPSTR wstr1, LPSTR wstr2, INT len)
|
---|
1206 | { FIXME("%s %s %i stub\n", wstr1,wstr2,len);
|
---|
1207 | return 0;
|
---|
1208 | }
|
---|
1209 |
|
---|
1210 | /*************************************************************************
|
---|
1211 | * SHAllocShared [SHELL32.520]
|
---|
1212 | *
|
---|
1213 | * NOTES
|
---|
1214 | * parameter1 is return value from HeapAlloc
|
---|
1215 | * parameter2 is equal to the size allocated with HeapAlloc
|
---|
1216 | * parameter3 is return value from GetCurrentProcessId
|
---|
1217 | *
|
---|
1218 | * the return value is posted as lParam with 0x402 (WM_USER+2) to somewhere
|
---|
1219 | * WM_USER+2 could be the undocumented CWM_SETPATH
|
---|
1220 | * the allocated memory contains a pidl
|
---|
1221 | */
|
---|
1222 | HGLOBAL WINAPI SHAllocShared(LPVOID psrc, DWORD size, DWORD procID)
|
---|
1223 | { HGLOBAL hmem;
|
---|
1224 | LPVOID pmem;
|
---|
1225 |
|
---|
1226 | TRACE("ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID);
|
---|
1227 | hmem = GlobalAlloc(GMEM_FIXED, size);
|
---|
1228 | if (!hmem)
|
---|
1229 | return 0;
|
---|
1230 |
|
---|
1231 | pmem = GlobalLock (hmem);
|
---|
1232 |
|
---|
1233 | if (! pmem)
|
---|
1234 | return 0;
|
---|
1235 |
|
---|
1236 | memcpy (pmem, psrc, size);
|
---|
1237 | GlobalUnlock(hmem);
|
---|
1238 | return hmem;
|
---|
1239 | }
|
---|
1240 | /*************************************************************************
|
---|
1241 | * SHLockShared [SHELL32.521]
|
---|
1242 | *
|
---|
1243 | * NOTES
|
---|
1244 | * parameter1 is return value from SHAllocShared
|
---|
1245 | * parameter2 is return value from GetCurrentProcessId
|
---|
1246 | * the receiver of (WM_USER+2) trys to lock the HANDLE (?)
|
---|
1247 | * the returnvalue seems to be a memoryadress
|
---|
1248 | */
|
---|
1249 | LPVOID WINAPI SHLockShared(HANDLE hmem, DWORD procID)
|
---|
1250 | { TRACE("handle=0x%04x procID=0x%04lx\n",hmem,procID);
|
---|
1251 | return GlobalLock(hmem);
|
---|
1252 | }
|
---|
1253 | /*************************************************************************
|
---|
1254 | * SHUnlockShared [SHELL32.522]
|
---|
1255 | *
|
---|
1256 | * NOTES
|
---|
1257 | * parameter1 is return value from SHLockShared
|
---|
1258 | */
|
---|
1259 | BOOL WINAPI SHUnlockShared(HANDLE pmem)
|
---|
1260 | { TRACE("handle=0x%04x\n",pmem);
|
---|
1261 | return GlobalUnlock(pmem);
|
---|
1262 | }
|
---|
1263 | /*************************************************************************
|
---|
1264 | * SHFreeShared [SHELL32.523]
|
---|
1265 | *
|
---|
1266 | * NOTES
|
---|
1267 | * parameter1 is return value from SHAllocShared
|
---|
1268 | * parameter2 is return value from GetCurrentProcessId
|
---|
1269 | */
|
---|
1270 | HANDLE WINAPI SHFreeShared(HANDLE hmem, DWORD procID)
|
---|
1271 | { TRACE("handle=0x%04x 0x%04lx\n",hmem,procID);
|
---|
1272 | return GlobalFree(hmem);
|
---|
1273 | }
|
---|
1274 |
|
---|
1275 | /*************************************************************************
|
---|
1276 | * SetAppStartingCursor [SHELL32.99]
|
---|
1277 | *
|
---|
1278 | */
|
---|
1279 | HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v)
|
---|
1280 | { FIXME("hwnd=0x%04x 0x%04lx stub\n",u,v );
|
---|
1281 | return 0;
|
---|
1282 | }
|
---|
1283 | /*************************************************************************
|
---|
1284 | * SHLoadOLE [SHELL32.151]
|
---|
1285 | *
|
---|
1286 | */
|
---|
1287 | HRESULT WINAPI SHLoadOLE(DWORD u)
|
---|
1288 | { FIXME("0x%04lx stub\n",u);
|
---|
1289 | return S_OK;
|
---|
1290 | }
|
---|
1291 | /*************************************************************************
|
---|
1292 | * DriveType [SHELL32.64]
|
---|
1293 | *
|
---|
1294 | */
|
---|
1295 | HRESULT WINAPI DriveType(DWORD u)
|
---|
1296 | { FIXME("0x%04lx stub\n",u);
|
---|
1297 | return 0;
|
---|
1298 | }
|
---|
1299 | /*************************************************************************
|
---|
1300 | * SHAbortInvokeCommand [SHELL32.198]
|
---|
1301 | *
|
---|
1302 | */
|
---|
1303 | HRESULT WINAPI SHAbortInvokeCommand(void)
|
---|
1304 | { FIXME("stub\n");
|
---|
1305 | return 1;
|
---|
1306 | }
|
---|
1307 | /*************************************************************************
|
---|
1308 | * SHOutOfMemoryMessageBox [SHELL32.126]
|
---|
1309 | *
|
---|
1310 | */
|
---|
1311 | HRESULT WINAPI SHOutOfMemoryMessageBox(DWORD u, DWORD v, DWORD w)
|
---|
1312 | { FIXME("0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w);
|
---|
1313 | return 0;
|
---|
1314 | }
|
---|
1315 | /*************************************************************************
|
---|
1316 | * SHFlushClipboard [SHELL32.121]
|
---|
1317 | *
|
---|
1318 | */
|
---|
1319 | HRESULT WINAPI SHFlushClipboard(void)
|
---|
1320 | { FIXME("stub\n");
|
---|
1321 | return 1;
|
---|
1322 | }
|
---|
1323 | /*************************************************************************
|
---|
1324 | * StrRChrA [SHELL32.346]
|
---|
1325 | *
|
---|
1326 | */
|
---|
1327 | LPSTR WINAPI StrRChrA(LPCSTR lpStart, LPCSTR lpEnd, DWORD wMatch)
|
---|
1328 | {
|
---|
1329 | if (!lpStart)
|
---|
1330 | return NULL;
|
---|
1331 |
|
---|
1332 | /* if the end not given, search*/
|
---|
1333 | if (!lpEnd)
|
---|
1334 | { lpEnd=lpStart;
|
---|
1335 | while (*lpEnd)
|
---|
1336 | lpEnd++;
|
---|
1337 | }
|
---|
1338 |
|
---|
1339 | for (--lpEnd;lpStart <= lpEnd; lpEnd--)
|
---|
1340 | if (*lpEnd==(char)wMatch)
|
---|
1341 | return (LPSTR)lpEnd;
|
---|
1342 |
|
---|
1343 | return NULL;
|
---|
1344 | }
|
---|
1345 | /*************************************************************************
|
---|
1346 | * StrRChrW [SHELL32.320]
|
---|
1347 | *
|
---|
1348 | */
|
---|
1349 | LPWSTR WINAPI StrRChrW(LPWSTR lpStart, LPWSTR lpEnd, DWORD wMatch)
|
---|
1350 | { LPWSTR wptr=NULL;
|
---|
1351 | TRACE("%s %s 0x%04x\n",debugstr_w(lpStart),debugstr_w(lpEnd), (WCHAR)wMatch );
|
---|
1352 |
|
---|
1353 | /* if the end not given, search*/
|
---|
1354 | if (!lpEnd)
|
---|
1355 | { lpEnd=lpStart;
|
---|
1356 | while (*lpEnd)
|
---|
1357 | lpEnd++;
|
---|
1358 | }
|
---|
1359 |
|
---|
1360 | do
|
---|
1361 | { if (*lpStart==(WCHAR)wMatch)
|
---|
1362 | wptr = lpStart;
|
---|
1363 | lpStart++;
|
---|
1364 | } while ( lpStart<=lpEnd );
|
---|
1365 | return wptr;
|
---|
1366 | }
|
---|
1367 | /*************************************************************************
|
---|
1368 | * StrFormatByteSize [SHLWAPI]
|
---|
1369 | */
|
---|
1370 | LPSTR WINAPI StrFormatByteSizeA ( DWORD dw, LPSTR pszBuf, UINT cchBuf )
|
---|
1371 | { char buf[64];
|
---|
1372 | TRACE("%lx %p %i\n", dw, pszBuf, cchBuf);
|
---|
1373 | if ( dw<1024L )
|
---|
1374 | { sprintf (buf,"%3.0f bytes", (FLOAT)dw);
|
---|
1375 | }
|
---|
1376 | else if ( dw<1048576L)
|
---|
1377 | { sprintf (buf,"%3.2f KB", (FLOAT)dw/1024);
|
---|
1378 | }
|
---|
1379 | else if ( dw < 1073741824L)
|
---|
1380 | { sprintf (buf,"%3.2f MB", (FLOAT)dw/1048576L);
|
---|
1381 | }
|
---|
1382 | else
|
---|
1383 | { sprintf (buf,"%3.2f GB", (FLOAT)dw/1073741824L);
|
---|
1384 | }
|
---|
1385 | lstrcpynA (pszBuf, buf, cchBuf);
|
---|
1386 | return pszBuf;
|
---|
1387 | }
|
---|
1388 | LPWSTR WINAPI StrFormatByteSizeW ( DWORD dw, LPWSTR pszBuf, UINT cchBuf )
|
---|
1389 | { char buf[64];
|
---|
1390 | TRACE("%lx %p %i\n", dw, pszBuf, cchBuf);
|
---|
1391 | if ( dw<1024L )
|
---|
1392 | { sprintf (buf,"%3.0f bytes", (FLOAT)dw);
|
---|
1393 | }
|
---|
1394 | else if ( dw<1048576L)
|
---|
1395 | { sprintf (buf,"%3.2f KB", (FLOAT)dw/1024);
|
---|
1396 | }
|
---|
1397 | else if ( dw < 1073741824L)
|
---|
1398 | { sprintf (buf,"%3.2f MB", (FLOAT)dw/1048576L);
|
---|
1399 | }
|
---|
1400 | else
|
---|
1401 | { sprintf (buf,"%3.2f GB", (FLOAT)dw/1073741824L);
|
---|
1402 | }
|
---|
1403 | lstrcpynAtoW (pszBuf, buf, cchBuf);
|
---|
1404 | return pszBuf;
|
---|
1405 | }
|
---|
1406 | /*************************************************************************
|
---|
1407 | * SHWaitForFileToOpen [SHELL32.97]
|
---|
1408 | *
|
---|
1409 | */
|
---|
1410 | HRESULT WINAPI SHWaitForFileToOpen(DWORD u, DWORD v, DWORD w)
|
---|
1411 | { FIXME("0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w);
|
---|
1412 | return 0;
|
---|
1413 | }
|
---|
1414 | /*************************************************************************
|
---|
1415 | * Control_FillCache_RunDLL [SHELL32.8]
|
---|
1416 | *
|
---|
1417 | */
|
---|
1418 | HRESULT WINAPI Control_FillCache_RunDLL(HWND hWnd, HANDLE hModule, DWORD w, DWORD x)
|
---|
1419 | { FIXME("0x%04x 0x%04x 0x%04lx 0x%04lx stub\n",hWnd, hModule,w,x);
|
---|
1420 | return 0;
|
---|
1421 | }
|
---|
1422 | /*************************************************************************
|
---|
1423 | * RunDLL_CallEntry16 [SHELL32.122]
|
---|
1424 | * the name is propably wrong
|
---|
1425 | */
|
---|
1426 | HRESULT WINAPI RunDLL_CallEntry16(DWORD v, DWORD w, DWORD x, DWORD y, DWORD z)
|
---|
1427 | { FIXME("0x%04lx 0x%04lx 0x%04lx 0x%04lx 0x%04lx stub\n",v,w,x,y,z);
|
---|
1428 | return 0;
|
---|
1429 | }
|
---|
1430 |
|
---|
1431 | /************************************************************************
|
---|
1432 | * shell32_654 [SHELL32.654]
|
---|
1433 | *
|
---|
1434 | * NOTES: first parameter seems to be a pointer (same as passed to WriteCabinetState)
|
---|
1435 | * second one could be a size (0x0c). The size is the same as the structure saved to
|
---|
1436 | * HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState
|
---|
1437 | * I'm (js) guessing: this one is just ReadCabinetState ;-)
|
---|
1438 | */
|
---|
1439 | HRESULT WINAPI shell32_654 (DWORD x, DWORD y)
|
---|
1440 | { FIXME("0x%08lx 0x%08lx stub\n",x,y);
|
---|
1441 | return 0;
|
---|
1442 | }
|
---|
1443 |
|
---|
1444 | /************************************************************************
|
---|
1445 | * RLBuildListOfPaths [SHELL32.146]
|
---|
1446 | *
|
---|
1447 | * NOTES
|
---|
1448 | * builds a DPA
|
---|
1449 | */
|
---|
1450 | DWORD WINAPI RLBuildListOfPaths (void)
|
---|
1451 | { FIXME("stub\n");
|
---|
1452 | return 0;
|
---|
1453 | }
|
---|
1454 | /************************************************************************
|
---|
1455 | * StrToOleStr [SHELL32.163]
|
---|
1456 | *
|
---|
1457 | */
|
---|
1458 | int WINAPI StrToOleStrA (LPWSTR lpWideCharStr, LPCSTR lpMultiByteString)
|
---|
1459 | {
|
---|
1460 | TRACE("%p %p(%s)\n",
|
---|
1461 | lpWideCharStr, lpMultiByteString, lpMultiByteString);
|
---|
1462 |
|
---|
1463 | return MultiByteToWideChar(0, 0, lpMultiByteString, -1, lpWideCharStr, MAX_PATH);
|
---|
1464 |
|
---|
1465 | }
|
---|
1466 | int WINAPI StrToOleStrW (LPWSTR lpWideCharStr, LPCWSTR lpWString)
|
---|
1467 | {
|
---|
1468 | TRACE("%p %p(%s)\n",
|
---|
1469 | lpWideCharStr, lpWString, debugstr_w(lpWString));
|
---|
1470 |
|
---|
1471 | if (lstrcpyW (lpWideCharStr, lpWString ))
|
---|
1472 | { return lstrlenW (lpWideCharStr);
|
---|
1473 | }
|
---|
1474 | return 0;
|
---|
1475 | }
|
---|
1476 |
|
---|
1477 | BOOL WINAPI StrToOleStrAW (LPWSTR lpWideCharStr, LPCVOID lpString)
|
---|
1478 | {
|
---|
1479 | if (VERSION_OsIsUnicode())
|
---|
1480 | return StrToOleStrW (lpWideCharStr, (LPCWSTR)lpString);
|
---|
1481 | return StrToOleStrA (lpWideCharStr, (LPCSTR)lpString);
|
---|
1482 | }
|
---|
1483 |
|
---|
1484 | /************************************************************************
|
---|
1485 | * SHValidateUNC [SHELL32.173]
|
---|
1486 | *
|
---|
1487 | */
|
---|
1488 | HRESULT WINAPI SHValidateUNC (DWORD x, DWORD y, DWORD z)
|
---|
1489 | {
|
---|
1490 | FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x,y,z);
|
---|
1491 | return 0;
|
---|
1492 | }
|
---|
1493 |
|
---|
1494 | /************************************************************************
|
---|
1495 | * DoEnvironmentSubstW [SHELL32.53]
|
---|
1496 | *
|
---|
1497 | */
|
---|
1498 | HRESULT WINAPI DoEnvironmentSubstA(LPSTR x, LPSTR y)
|
---|
1499 | {
|
---|
1500 | FIXME("%p(%s) %p(%s) stub\n", x, x, y, y);
|
---|
1501 | return 0;
|
---|
1502 | }
|
---|
1503 |
|
---|
1504 | HRESULT WINAPI DoEnvironmentSubstW(LPWSTR x, LPWSTR y)
|
---|
1505 | {
|
---|
1506 | FIXME("%p(%s) %p(%s) stub\n", x, debugstr_w(x), y, debugstr_w(y));
|
---|
1507 | return 0;
|
---|
1508 | }
|
---|
1509 |
|
---|
1510 | HRESULT WINAPI DoEnvironmentSubstAW(LPVOID x, LPVOID y)
|
---|
1511 | {
|
---|
1512 | if (VERSION_OsIsUnicode())
|
---|
1513 | return DoEnvironmentSubstW((LPWSTR)x, (LPWSTR)y);
|
---|
1514 | return DoEnvironmentSubstA((LPSTR)x, (LPSTR)y);
|
---|
1515 | }
|
---|
1516 |
|
---|
1517 | /*************************************************************************
|
---|
1518 | * shell32_243 [SHELL32.243]
|
---|
1519 | *
|
---|
1520 | * Win98+ by-ordinal routine. In Win98 this routine returns zero and
|
---|
1521 | * does nothing else. Possibly this does something in NT or SHELL32 5.0?
|
---|
1522 | *
|
---|
1523 | */
|
---|
1524 |
|
---|
1525 | BOOL WINAPI shell32_243(DWORD a, DWORD b)
|
---|
1526 | {
|
---|
1527 | return FALSE;
|
---|
1528 | }
|
---|
1529 |
|
---|
1530 | /************************************************************************
|
---|
1531 | * Win32DeleteFile [SHELL32.164]
|
---|
1532 | *
|
---|
1533 | * Deletes a file. Also triggers a change notify if one exists, but
|
---|
1534 | * that mechanism doesn't yet exist in Wine's SHELL32.
|
---|
1535 | *
|
---|
1536 | * FIXME:
|
---|
1537 | * Verified on Win98 / IE 5 (SHELL32 4.72, March 1999 build) to be
|
---|
1538 | * ANSI. Is this Unicode on NT?
|
---|
1539 | *
|
---|
1540 | */
|
---|
1541 |
|
---|
1542 | BOOL WINAPI Win32DeleteFile(LPSTR fName)
|
---|
1543 | {
|
---|
1544 | dprintf(("SHELL32:SHELLORD:Win32DeleteFile %p(%s): partial stub\n", fName, fName));
|
---|
1545 |
|
---|
1546 | DeleteFileA(fName);
|
---|
1547 |
|
---|
1548 | return TRUE;
|
---|
1549 | }
|
---|
1550 |
|
---|
1551 |
|
---|
1552 | /*****************************************************************************
|
---|
1553 | * Name : StrChrIA
|
---|
1554 | * Purpose : Searches a string for the first occurrence of a character that
|
---|
1555 | * matches the specified character. The comparison is not case sensitive.
|
---|
1556 | * Parameters: LPCSTR lpStart Address of the string to be searched.
|
---|
1557 | * TCHAR wMatch Character to be used for comparison.
|
---|
1558 | * Variables :
|
---|
1559 | * Result : Returns the address of the first occurrence of the character in
|
---|
1560 | * the string if successful, or NULL otherwise.
|
---|
1561 | * Remark : SHELL32.
|
---|
1562 | * Status : COMPLETELY IMPLEMENTED UNTESTED UNKNOWN
|
---|
1563 | *
|
---|
1564 | * Author : Patrick Haller [Wed, 1999/12/29 09:00]
|
---|
1565 | *****************************************************************************/
|
---|
1566 |
|
---|
1567 | ODINFUNCTION2(LPSTR, StrChrIA,
|
---|
1568 | LPCSTR, lpStart,
|
---|
1569 | CHAR, wMatch)
|
---|
1570 | {
|
---|
1571 | LPSTR lpRes;
|
---|
1572 |
|
---|
1573 | wMatch = tolower(wMatch);
|
---|
1574 | lpRes = strchr(lpStart, wMatch); // lower case comparsion
|
---|
1575 | if (NULL == lpRes)
|
---|
1576 | {
|
---|
1577 | wMatch = toupper(wMatch);
|
---|
1578 | lpRes = strchr(lpStart, wMatch); // upper case comparsion
|
---|
1579 | }
|
---|
1580 |
|
---|
1581 | return lpRes;
|
---|
1582 | }
|
---|
1583 |
|
---|
1584 |
|
---|
1585 | /*****************************************************************************
|
---|
1586 | * Name : StrChrIW
|
---|
1587 | * Purpose : Searches a string for the first occurrence of a character that
|
---|
1588 | * matches the specified character. The comparison is not case sensitive.
|
---|
1589 | * Parameters: LPCSTR lpStart Address of the string to be searched.
|
---|
1590 | * TCHAR wMatch Character to be used for comparison.
|
---|
1591 | * Variables :
|
---|
1592 | * Result : Returns the address of the first occurrence of the character in
|
---|
1593 | * the string if successful, or NULL otherwise.
|
---|
1594 | * Remark : SHELL32.
|
---|
1595 | * Status : COMPLETELY IMPLEMENTED UNTESTED UNKNOWN
|
---|
1596 | *
|
---|
1597 | * Author : Patrick Haller [Wed, 1999/12/29 09:00]
|
---|
1598 | *****************************************************************************/
|
---|
1599 |
|
---|
1600 | ODINFUNCTION2(LPWSTR, StrChrIW,
|
---|
1601 | LPCWSTR, lpStart,
|
---|
1602 | WCHAR, wMatch)
|
---|
1603 | {
|
---|
1604 | LPWSTR lpRes;
|
---|
1605 |
|
---|
1606 | wMatch = towlower(wMatch);
|
---|
1607 | lpRes = (WCHAR*)wcschr((const wchar_t*)lpStart, wMatch); // lower case comparsion
|
---|
1608 | if (NULL == lpRes)
|
---|
1609 | {
|
---|
1610 | wMatch = towupper(wMatch);
|
---|
1611 | lpRes = (WCHAR*)wcschr((const wchar_t*)lpStart, wMatch); // upper case comparsion
|
---|
1612 | }
|
---|
1613 |
|
---|
1614 | return lpRes;
|
---|
1615 | }
|
---|
1616 |
|
---|
1617 |
|
---|
1618 | /*****************************************************************************
|
---|
1619 | * Name : StrStrIA
|
---|
1620 | * Purpose : Finds the first occurrence of a substring within a string. The
|
---|
1621 | * comparison is not case sensitive.
|
---|
1622 | * Parameters: LPCSTR lpFirst
|
---|
1623 | * LPCSTR lpSrch
|
---|
1624 | * Variables :
|
---|
1625 | * Result : Returns the address of the first occurrence of the matching
|
---|
1626 | * substring if successful, or NULL otherwise.
|
---|
1627 | * Remark : SHELL32.
|
---|
1628 | * Status : COMPLETELY IMPLEMENTED UNTESTED UNKNOWN
|
---|
1629 | *
|
---|
1630 | * Author : Patrick Haller [Wed, 1999/12/29 09:00]
|
---|
1631 | *****************************************************************************/
|
---|
1632 |
|
---|
1633 | ODINFUNCTION2(LPSTR, StrStrIA,
|
---|
1634 | LPCSTR, lpFirst,
|
---|
1635 | LPCSTR, lpSrch)
|
---|
1636 | {
|
---|
1637 | char ch = lpSrch[0]; // look for 1st character
|
---|
1638 | LONG lLen = lstrlenA(lpSrch); // length of search string
|
---|
1639 | int iRes; // comparsion result
|
---|
1640 |
|
---|
1641 | do
|
---|
1642 | {
|
---|
1643 | lpFirst = StrChrIA(lpFirst, // find first matching character
|
---|
1644 | ch);
|
---|
1645 | if (NULL == lpFirst) // not found
|
---|
1646 | return NULL;
|
---|
1647 |
|
---|
1648 | iRes = StrCmpNIA((LPSTR)lpFirst, // compare search string
|
---|
1649 | (LPSTR)lpSrch,
|
---|
1650 | lLen);
|
---|
1651 |
|
---|
1652 | if (0 == iRes) // Found!
|
---|
1653 | return (LPSTR)lpFirst;
|
---|
1654 |
|
---|
1655 | lpFirst = CharNextA(lpFirst); // skip to next character
|
---|
1656 | }
|
---|
1657 | while (*lpFirst != 0); // safe termination
|
---|
1658 |
|
---|
1659 | return NULL; // default result
|
---|
1660 | }
|
---|
1661 |
|
---|
1662 |
|
---|
1663 |
|
---|
1664 | /*****************************************************************************
|
---|
1665 | * Name : StrStrIW
|
---|
1666 | * Purpose : Finds the first occurrence of a substring within a string. The
|
---|
1667 | * comparison is not case sensitive.
|
---|
1668 | * Parameters: LPCWSTR lpFirst
|
---|
1669 | * LPCWSTR lpSrch
|
---|
1670 | * Variables :
|
---|
1671 | * Result : Returns the address of the first occurrence of the matching
|
---|
1672 | * substring if successful, or NULL otherwise.
|
---|
1673 | * Remark : SHELL32.
|
---|
1674 | * Status : COMPLETELY IMPLEMENTED UNTESTED UNKNOWN
|
---|
1675 | *
|
---|
1676 | * Author : Patrick Haller [Wed, 1999/12/29 09:00]
|
---|
1677 | *****************************************************************************/
|
---|
1678 |
|
---|
1679 | ODINFUNCTION2(LPWSTR, StrStrIW,
|
---|
1680 | LPCWSTR, lpFirst,
|
---|
1681 | LPCWSTR, lpSrch)
|
---|
1682 | {
|
---|
1683 | WCHAR ch = lpSrch[0]; // look for 1st character
|
---|
1684 | LONG lLen = lstrlenW(lpSrch); // length of search string
|
---|
1685 | int iRes; // comparsion result
|
---|
1686 |
|
---|
1687 | do
|
---|
1688 | {
|
---|
1689 | lpFirst = StrChrIW(lpFirst, // find first matching character
|
---|
1690 | ch);
|
---|
1691 | if (NULL == lpFirst) // not found
|
---|
1692 | return NULL;
|
---|
1693 |
|
---|
1694 | iRes = StrCmpNIW((LPWSTR)lpFirst, // compare search string
|
---|
1695 | (LPWSTR)lpSrch,
|
---|
1696 | lLen);
|
---|
1697 |
|
---|
1698 | if (0 == iRes) // Found!
|
---|
1699 | return (LPWSTR)lpFirst;
|
---|
1700 |
|
---|
1701 | lpFirst = CharNextW(lpFirst); // skip to next character
|
---|
1702 | }
|
---|
1703 | while (*lpFirst != 0); // safe termination
|
---|
1704 |
|
---|
1705 | return NULL; // default result
|
---|
1706 | }
|
---|
1707 |
|
---|
1708 |
|
---|