source: trunk/src/shell32/shellord.cpp@ 3243

Last change on this file since 3243 was 3243, checked in by cbratschi, 25 years ago

merged with Corel WINE 20000324

File size: 52.1 KB
Line 
1/* $Id: shellord.cpp,v 1.6 2000-03-26 16:34:51 cbratschi 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
49ODINDEBUGCHANNEL(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 */
59DWORD WINAPI
60SHChangeNotifyRegister(
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 */
75DWORD WINAPI
76SHChangeNotifyDeregister(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 */
86DWORD 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 */
100DWORD WINAPI NTSHChangeNotifyDeregister(LONG x1)
101{ FIXME("(0x%08lx):stub.\n",x1);
102 return 0;
103}
104
105/*************************************************************************
106 * ParseField [SHELL32.58]
107 *
108 */
109DWORD 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 */
136DWORD 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 */
145DWORD 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 */
161void 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 */
225int 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 */
233BOOL 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
239BOOL 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
249BOOL 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 */
261BOOL 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}
266BOOL 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
276BOOL 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 */
293void 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 */
307INT __cdecl
308ShellMessageBoxW(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 */
338INT __cdecl
339ShellMessageBoxA(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 */
375DWORD 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
451BOOL 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 */
486DWORD 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
508DWORD 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 */
537LPVOID 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 */
564DWORD 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 */
576DWORD 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 */
587DWORD 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 */
598DWORD WINAPI
599RunFileDlg (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 */
613void WINAPI ExitWindowsDialog (HWND hWndOwner)
614{
615 TRACE("(0x%08x)\n", hWndOwner);
616 if (MessageBoxA( hWndOwner, "Do you want to exit WINE?", "Shutdown", MB_YESNO|MB_ICONQUESTION) == IDOK)
617 { SendMessageA ( hWndOwner, WM_QUIT, 0, 0);
618 }
619}
620
621/*************************************************************************
622 * ArrangeWindows [SHELL32.184]
623 *
624 */
625DWORD WINAPI
626ArrangeWindows (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 */
640DWORD WINAPI
641SignalFileOpen (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 */
658DWORD 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 */
671DWORD 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 */
683DWORD 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 */
693DWORD 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 */
704DWORD 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 */
718HRESULT 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 */
743HRESULT 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 */
751HRESULT 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 */
759BOOL 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 */
768BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei)
769{ CHAR szApplicationName[MAX_PATH],szCommandline[MAX_PATH],szPidl[20];
770 LPSTR pos;
771 int gap, len;
772 STARTUPINFOA startupinfo;
773 PROCESS_INFORMATION processinformation;
774
775 WARN("mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n",
776 sei->fMask, sei->hwnd, sei->lpVerb, sei->lpFile,
777 sei->lpParameters, sei->lpDirectory, sei->nShow,
778 (sei->fMask & SEE_MASK_CLASSNAME) ? sei->lpClass : "not used");
779
780 ZeroMemory(szApplicationName,MAX_PATH);
781 if (sei->lpFile)
782 strcpy(szApplicationName, sei->lpFile);
783
784 ZeroMemory(szCommandline,MAX_PATH);
785 if (sei->lpParameters)
786 strcpy(szCommandline, sei->lpParameters);
787
788 if (sei->fMask & (SEE_MASK_CLASSKEY | SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY |
789 SEE_MASK_NOCLOSEPROCESS | SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT |
790 SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE |
791 SEE_MASK_NO_CONSOLE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR ))
792 { FIXME("flags ignored: 0x%08lx\n", sei->fMask);
793 }
794
795 if (sei->fMask & SEE_MASK_CLASSNAME)
796 { HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, 256);
797 }
798
799 /* process the IDList */
800 if ( (sei->fMask & SEE_MASK_INVOKEIDLIST) == SEE_MASK_INVOKEIDLIST) /*0x0c*/
801 { SHGetPathFromIDListA ((LPCITEMIDLIST)sei->lpIDList,szApplicationName);
802 TRACE("-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName);
803 }
804 else
805 { if (sei->fMask & SEE_MASK_IDLIST )
806 { /* %I is the adress of a global item ID*/
807 pos = strstr(szCommandline, "%I");
808 if (pos)
809 { HGLOBAL hmem = SHAllocShared ( sei->lpIDList, ILGetSize((LPCITEMIDLIST)sei->lpIDList), 0);
810 sprintf(szPidl,":%li",(DWORD)SHLockShared(hmem,0) );
811 SHUnlockShared(hmem);
812
813 gap = strlen(szPidl);
814 len = strlen(pos)-2;
815 memmove(pos+gap,pos+2,len);
816 memcpy(pos,szPidl,gap);
817
818 }
819 }
820 }
821
822 pos = strstr(szCommandline, ",%L"); /* dunno what it means: kill it*/
823 if (pos)
824 { len = strlen(pos)-2;
825 *pos=0x0;
826 memmove(pos,pos+3,len);
827 }
828
829 TRACE("execute: %s %s\n",szApplicationName, szCommandline);
830
831 ZeroMemory(&startupinfo,sizeof(STARTUPINFOA));
832 startupinfo.cb = sizeof(STARTUPINFOA);
833
834 return CreateProcessA(szApplicationName[0] ? szApplicationName:NULL,
835 szCommandline[0] ? szCommandline : NULL,
836 NULL, NULL, FALSE, 0,
837 NULL, NULL, &startupinfo, &processinformation);
838
839
840}
841/*************************************************************************
842 * ShellExecuteExW [SHELL32.293]
843 *
844 */
845BOOL WINAPI ShellExecuteExW (LPSHELLEXECUTEINFOW sei)
846{ SHELLEXECUTEINFOA seiA;
847 DWORD ret;
848
849 TRACE("%p\n", sei);
850
851 memcpy(&seiA, sei, sizeof(SHELLEXECUTEINFOA));
852
853 if (sei->lpVerb)
854 seiA.lpVerb = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpVerb);
855
856 if (sei->lpFile)
857 seiA.lpFile = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpFile);
858
859 if (sei->lpParameters)
860 seiA.lpParameters = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpParameters);
861
862 if (sei->lpDirectory)
863 seiA.lpDirectory = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpDirectory);
864
865 if ((sei->fMask & SEE_MASK_CLASSNAME) && sei->lpClass)
866 seiA.lpClass = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpClass);
867 else
868 seiA.lpClass = NULL;
869
870 ret = ShellExecuteExA(&seiA);
871
872 if (seiA.lpVerb) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpVerb );
873 if (seiA.lpFile) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpFile );
874 if (seiA.lpParameters) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpParameters );
875 if (seiA.lpDirectory) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpDirectory );
876 if (seiA.lpClass) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpClass );
877
878 return ret;
879}
880
881static LPUNKNOWN SHELL32_IExplorerInterface=0;
882/*************************************************************************
883 * SHSetInstanceExplorer [SHELL32.176]
884 *
885 * NOTES
886 * Sets the interface
887 */
888HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown)
889{ TRACE("%p\n", lpUnknown);
890 SHELL32_IExplorerInterface = lpUnknown;
891 return (HRESULT) lpUnknown;
892}
893/*************************************************************************
894 * SHGetInstanceExplorer [SHELL32.256]
895 *
896 * NOTES
897 * gets the interface pointer of the explorer and a reference
898 */
899HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown)
900{ TRACE("%p\n", lpUnknown);
901
902 *lpUnknown = SHELL32_IExplorerInterface;
903
904 if (!SHELL32_IExplorerInterface)
905 return E_FAIL;
906
907 IUnknown_AddRef(SHELL32_IExplorerInterface);
908 return NOERROR;
909}
910/*************************************************************************
911 * SHFreeUnusedLibraries [SHELL32.123]
912 *
913 * NOTES
914 * exported by name
915 */
916HRESULT WINAPI SHFreeUnusedLibraries (void)
917{ FIXME("stub\n");
918 return TRUE;
919}
920/*************************************************************************
921 * DAD_SetDragImage [SHELL32.136]
922 *
923 * NOTES
924 * exported by name
925 */
926HRESULT WINAPI DAD_SetDragImage (DWORD u, DWORD v)
927{ FIXME("0x%08lx 0x%08lx stub\n",u, v);
928 return 0;
929}
930/*************************************************************************
931 * DAD_ShowDragImage [SHELL32.137]
932 *
933 * NOTES
934 * exported by name
935 */
936HRESULT WINAPI DAD_ShowDragImage (DWORD u)
937{ FIXME("0x%08lx stub\n",u);
938 return 0;
939}
940/*************************************************************************
941 * SHRegCloseKey [NT4.0:SHELL32.505]
942 *
943 */
944HRESULT WINAPI SHRegCloseKey (HKEY hkey)
945{ TRACE("0x%04x\n",hkey);
946 return RegCloseKey( hkey );
947}
948/*************************************************************************
949 * SHRegOpenKeyA [SHELL32.506]
950 *
951 */
952HRESULT WINAPI SHRegOpenKeyA(HKEY hKey, LPSTR lpSubKey, LPHKEY phkResult)
953{
954 TRACE("(0x%08x, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult);
955 return RegOpenKeyA(hKey, lpSubKey, phkResult);
956}
957
958/*************************************************************************
959 * SHRegOpenKeyW [NT4.0:SHELL32.507]
960 *
961 */
962HRESULT WINAPI SHRegOpenKeyW (HKEY hkey, LPCWSTR lpszSubKey, LPHKEY retkey)
963{ WARN("0x%04x %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
964 return RegOpenKeyW( hkey, lpszSubKey, retkey );
965}
966/*************************************************************************
967 * SHRegQueryValueExA [SHELL32.509]
968 *
969 */
970HRESULT WINAPI SHRegQueryValueExA(
971 HKEY hkey,
972 LPSTR lpValueName,
973 LPDWORD lpReserved,
974 LPDWORD lpType,
975 LPBYTE lpData,
976 LPDWORD lpcbData)
977{
978 TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
979 return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
980}
981/*************************************************************************
982 * SHRegQueryValueW [NT4.0:SHELL32.510]
983 *
984 */
985HRESULT WINAPI SHRegQueryValueW (HKEY hkey, LPWSTR lpszSubKey,
986 LPWSTR lpszData, LPDWORD lpcbData )
987{ WARN("0x%04x %s %p %p semi-stub\n",
988 hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
989 return RegQueryValueW( hkey, lpszSubKey, lpszData, (LPLONG)lpcbData );
990}
991
992/*************************************************************************
993 * SHRegQueryValueExW [NT4.0:SHELL32.511]
994 *
995 * FIXME
996 * if the datatype REG_EXPAND_SZ then expand the string and change
997 * *pdwType to REG_SZ.
998 */
999HRESULT WINAPI SHRegQueryValueExW (HKEY hkey, LPWSTR pszValue, LPDWORD pdwReserved,
1000 LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData)
1001{ DWORD ret;
1002 WARN("0x%04x %s %p %p %p %p semi-stub\n",
1003 hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
1004 ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, (LPBYTE)pvData, pcbData);
1005 return ret;
1006}
1007
1008/*************************************************************************
1009 * ReadCabinetState [NT 4.0:SHELL32.651]
1010 *
1011 */
1012HRESULT WINAPI ReadCabinetState(DWORD u, DWORD v)
1013{ FIXME("0x%04lx 0x%04lx stub\n",u,v);
1014 return 0;
1015}
1016/*************************************************************************
1017 * WriteCabinetState [NT 4.0:SHELL32.652]
1018 *
1019 */
1020HRESULT WINAPI WriteCabinetState(DWORD u)
1021{ FIXME("0x%04lx stub\n",u);
1022 return 0;
1023}
1024/*************************************************************************
1025 * FileIconInit [SHELL32.660]
1026 *
1027 */
1028BOOL WINAPI FileIconInit(BOOL bFullInit)
1029{ FIXME("(%s)\n", bFullInit ? "true" : "false");
1030 return 0;
1031}
1032/*************************************************************************
1033 * IsUserAdmin [NT 4.0:SHELL32.680]
1034 *
1035 */
1036HRESULT WINAPI IsUserAdmin(void)
1037{ FIXME("stub\n");
1038 return TRUE;
1039}
1040/*************************************************************************
1041 * StrRetToStrN [SHELL32.96]
1042 *
1043 * converts a STRRET to a normal string
1044 *
1045 * NOTES
1046 * the pidl is for STRRET OFFSET
1047 */
1048HRESULT WINAPI StrRetToBufA (LPSTRRET src, LPITEMIDLIST pidl, LPSTR dest, DWORD len)
1049{
1050 return StrRetToStrNA(dest, len, src, pidl);
1051}
1052
1053HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
1054{
1055 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
1056
1057 switch (src->uType)
1058 {
1059 case STRRET_WSTR:
1060 WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL);
1061 SHFree(src->u.pOleStr);
1062 break;
1063
1064 case STRRET_CSTRA:
1065 lstrcpynA((LPSTR)dest, src->u.cStr, len);
1066 break;
1067
1068 case STRRET_OFFSETA:
1069 lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
1070 break;
1071
1072 default:
1073 FIXME("unknown type!\n");
1074 if (len)
1075 {
1076 *(LPSTR)dest = '\0';
1077 }
1078 return(FALSE);
1079 }
1080 return S_OK;
1081}
1082
1083HRESULT WINAPI StrRetToBufW (LPSTRRET src, LPITEMIDLIST pidl, LPWSTR dest, DWORD len)
1084{
1085 return StrRetToStrNW(dest, len, src, pidl);
1086}
1087
1088HRESULT WINAPI StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
1089{
1090 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
1091
1092 switch (src->uType)
1093 {
1094 case STRRET_WSTR:
1095 lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);
1096 SHFree(src->u.pOleStr);
1097 break;
1098
1099 case STRRET_CSTRA:
1100 lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len);
1101 break;
1102
1103 case STRRET_OFFSETA:
1104 if (pidl)
1105 {
1106 lstrcpynAtoW((LPWSTR)dest, ((LPSTR)&pidl->mkid)+src->u.uOffset, len);
1107 }
1108 break;
1109
1110 default:
1111 FIXME("unknown type!\n");
1112 if (len)
1113 { *(LPSTR)dest = '\0';
1114 }
1115 return(FALSE);
1116 }
1117 return S_OK;
1118}
1119HRESULT WINAPI StrRetToStrNAW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
1120{
1121 if(VERSION_OsIsUnicode())
1122 return StrRetToStrNW (dest, len, src, pidl);
1123 return StrRetToStrNA (dest, len, src, pidl);
1124}
1125
1126/*************************************************************************
1127 * StrChrA [NT 4.0:SHELL32.651]
1128 *
1129 */
1130LPSTR WINAPI StrChrA (LPSTR str, CHAR x )
1131{ LPSTR ptr=str;
1132
1133 do
1134 { if (*ptr==x)
1135 { return ptr;
1136 }
1137 ptr++;
1138 } while (*ptr);
1139 return NULL;
1140}
1141
1142/*************************************************************************
1143 * StrChrW [NT 4.0:SHELL32.651]
1144 *
1145 */
1146LPWSTR WINAPI StrChrW (LPWSTR str, WCHAR x )
1147{ LPWSTR ptr=str;
1148
1149 TRACE("%s 0x%04x\n",debugstr_w(str),x);
1150 do
1151 { if (*ptr==x)
1152 { return ptr;
1153 }
1154 ptr++;
1155 } while (*ptr);
1156 return NULL;
1157}
1158
1159/*************************************************************************
1160 * StrCmpNIW [NT 4.0:SHELL32.*]
1161 *
1162 */
1163INT WINAPI StrCmpNIW ( LPWSTR wstr1, LPWSTR wstr2, INT len)
1164{ FIXME("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len);
1165 return 0;
1166}
1167
1168/*************************************************************************
1169 * StrCmpNIA [NT 4.0:SHELL32.*]
1170 *
1171 */
1172INT WINAPI StrCmpNIA ( LPSTR wstr1, LPSTR wstr2, INT len)
1173{ FIXME("%s %s %i stub\n", wstr1,wstr2,len);
1174 return 0;
1175}
1176
1177/*************************************************************************
1178 * SHAllocShared [SHELL32.520]
1179 *
1180 * NOTES
1181 * parameter1 is return value from HeapAlloc
1182 * parameter2 is equal to the size allocated with HeapAlloc
1183 * parameter3 is return value from GetCurrentProcessId
1184 *
1185 * the return value is posted as lParam with 0x402 (WM_USER+2) to somewhere
1186 * WM_USER+2 could be the undocumented CWM_SETPATH
1187 * the allocated memory contains a pidl
1188 */
1189HGLOBAL WINAPI SHAllocShared(LPVOID psrc, DWORD size, DWORD procID)
1190{ HGLOBAL hmem;
1191 LPVOID pmem;
1192
1193 TRACE("ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID);
1194 hmem = GlobalAlloc(GMEM_FIXED, size);
1195 if (!hmem)
1196 return 0;
1197
1198 pmem = GlobalLock (hmem);
1199
1200 if (! pmem)
1201 return 0;
1202
1203 memcpy (pmem, psrc, size);
1204 GlobalUnlock(hmem);
1205 return hmem;
1206}
1207/*************************************************************************
1208 * SHLockShared [SHELL32.521]
1209 *
1210 * NOTES
1211 * parameter1 is return value from SHAllocShared
1212 * parameter2 is return value from GetCurrentProcessId
1213 * the receiver of (WM_USER+2) trys to lock the HANDLE (?)
1214 * the returnvalue seems to be a memoryadress
1215 */
1216LPVOID WINAPI SHLockShared(HANDLE hmem, DWORD procID)
1217{ TRACE("handle=0x%04x procID=0x%04lx\n",hmem,procID);
1218 return GlobalLock(hmem);
1219}
1220/*************************************************************************
1221 * SHUnlockShared [SHELL32.522]
1222 *
1223 * NOTES
1224 * parameter1 is return value from SHLockShared
1225 */
1226BOOL WINAPI SHUnlockShared(HANDLE pmem)
1227{ TRACE("handle=0x%04x\n",pmem);
1228 return GlobalUnlock(pmem);
1229}
1230/*************************************************************************
1231 * SHFreeShared [SHELL32.523]
1232 *
1233 * NOTES
1234 * parameter1 is return value from SHAllocShared
1235 * parameter2 is return value from GetCurrentProcessId
1236 */
1237HANDLE WINAPI SHFreeShared(HANDLE hmem, DWORD procID)
1238{ TRACE("handle=0x%04x 0x%04lx\n",hmem,procID);
1239 return GlobalFree(hmem);
1240}
1241
1242/*************************************************************************
1243 * SetAppStartingCursor [SHELL32.99]
1244 *
1245 */
1246HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v)
1247{ FIXME("hwnd=0x%04x 0x%04lx stub\n",u,v );
1248 return 0;
1249}
1250/*************************************************************************
1251 * SHLoadOLE [SHELL32.151]
1252 *
1253 */
1254HRESULT WINAPI SHLoadOLE(DWORD u)
1255{ FIXME("0x%04lx stub\n",u);
1256 return S_OK;
1257}
1258/*************************************************************************
1259 * DriveType [SHELL32.64]
1260 *
1261 */
1262HRESULT WINAPI DriveType(DWORD u)
1263{ FIXME("0x%04lx stub\n",u);
1264 return 0;
1265}
1266/*************************************************************************
1267 * SHAbortInvokeCommand [SHELL32.198]
1268 *
1269 */
1270HRESULT WINAPI SHAbortInvokeCommand(void)
1271{ FIXME("stub\n");
1272 return 1;
1273}
1274/*************************************************************************
1275 * SHOutOfMemoryMessageBox [SHELL32.126]
1276 *
1277 */
1278HRESULT WINAPI SHOutOfMemoryMessageBox(DWORD u, DWORD v, DWORD w)
1279{ FIXME("0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w);
1280 return 0;
1281}
1282/*************************************************************************
1283 * SHFlushClipboard [SHELL32.121]
1284 *
1285 */
1286HRESULT WINAPI SHFlushClipboard(void)
1287{ FIXME("stub\n");
1288 return 1;
1289}
1290/*************************************************************************
1291 * StrRChrA [SHELL32.346]
1292 *
1293 */
1294LPSTR WINAPI StrRChrA(LPCSTR lpStart, LPCSTR lpEnd, DWORD wMatch)
1295{
1296 if (!lpStart)
1297 return NULL;
1298
1299 /* if the end not given, search*/
1300 if (!lpEnd)
1301 { lpEnd=lpStart;
1302 while (*lpEnd)
1303 lpEnd++;
1304 }
1305
1306 for (--lpEnd;lpStart <= lpEnd; lpEnd--)
1307 if (*lpEnd==(char)wMatch)
1308 return (LPSTR)lpEnd;
1309
1310 return NULL;
1311}
1312/*************************************************************************
1313 * StrRChrW [SHELL32.320]
1314 *
1315 */
1316LPWSTR WINAPI StrRChrW(LPWSTR lpStart, LPWSTR lpEnd, DWORD wMatch)
1317{ LPWSTR wptr=NULL;
1318 TRACE("%s %s 0x%04x\n",debugstr_w(lpStart),debugstr_w(lpEnd), (WCHAR)wMatch );
1319
1320 /* if the end not given, search*/
1321 if (!lpEnd)
1322 { lpEnd=lpStart;
1323 while (*lpEnd)
1324 lpEnd++;
1325 }
1326
1327 do
1328 { if (*lpStart==(WCHAR)wMatch)
1329 wptr = lpStart;
1330 lpStart++;
1331 } while ( lpStart<=lpEnd );
1332 return wptr;
1333}
1334/*************************************************************************
1335* StrFormatByteSize [SHLWAPI]
1336*/
1337LPSTR WINAPI StrFormatByteSizeA ( DWORD dw, LPSTR pszBuf, UINT cchBuf )
1338{ char buf[64];
1339 TRACE("%lx %p %i\n", dw, pszBuf, cchBuf);
1340 if ( dw<1024L )
1341 { sprintf (buf,"%3.0f bytes", (FLOAT)dw);
1342 }
1343 else if ( dw<1048576L)
1344 { sprintf (buf,"%3.2f KB", (FLOAT)dw/1024);
1345 }
1346 else if ( dw < 1073741824L)
1347 { sprintf (buf,"%3.2f MB", (FLOAT)dw/1048576L);
1348 }
1349 else
1350 { sprintf (buf,"%3.2f GB", (FLOAT)dw/1073741824L);
1351 }
1352 lstrcpynA (pszBuf, buf, cchBuf);
1353 return pszBuf;
1354}
1355LPWSTR WINAPI StrFormatByteSizeW ( DWORD dw, LPWSTR pszBuf, UINT cchBuf )
1356{ char buf[64];
1357 TRACE("%lx %p %i\n", dw, pszBuf, cchBuf);
1358 if ( dw<1024L )
1359 { sprintf (buf,"%3.0f bytes", (FLOAT)dw);
1360 }
1361 else if ( dw<1048576L)
1362 { sprintf (buf,"%3.2f KB", (FLOAT)dw/1024);
1363 }
1364 else if ( dw < 1073741824L)
1365 { sprintf (buf,"%3.2f MB", (FLOAT)dw/1048576L);
1366 }
1367 else
1368 { sprintf (buf,"%3.2f GB", (FLOAT)dw/1073741824L);
1369 }
1370 lstrcpynAtoW (pszBuf, buf, cchBuf);
1371 return pszBuf;
1372}
1373/*************************************************************************
1374 * SHWaitForFileToOpen [SHELL32.97]
1375 *
1376 */
1377HRESULT WINAPI SHWaitForFileToOpen(DWORD u, DWORD v, DWORD w)
1378{ FIXME("0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w);
1379 return 0;
1380}
1381/*************************************************************************
1382 * Control_FillCache_RunDLL [SHELL32.8]
1383 *
1384 */
1385HRESULT WINAPI Control_FillCache_RunDLL(HWND hWnd, HANDLE hModule, DWORD w, DWORD x)
1386{ FIXME("0x%04x 0x%04x 0x%04lx 0x%04lx stub\n",hWnd, hModule,w,x);
1387 return 0;
1388}
1389/*************************************************************************
1390 * RunDLL_CallEntry16 [SHELL32.122]
1391 * the name is propably wrong
1392 */
1393HRESULT WINAPI RunDLL_CallEntry16(DWORD v, DWORD w, DWORD x, DWORD y, DWORD z)
1394{ FIXME("0x%04lx 0x%04lx 0x%04lx 0x%04lx 0x%04lx stub\n",v,w,x,y,z);
1395 return 0;
1396}
1397
1398/************************************************************************
1399 * shell32_654 [SHELL32.654]
1400 *
1401 * NOTES: first parameter seems to be a pointer (same as passed to WriteCabinetState)
1402 * second one could be a size (0x0c). The size is the same as the structure saved to
1403 * HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState
1404 * I'm (js) guessing: this one is just ReadCabinetState ;-)
1405 */
1406HRESULT WINAPI shell32_654 (DWORD x, DWORD y)
1407{ FIXME("0x%08lx 0x%08lx stub\n",x,y);
1408 return 0;
1409}
1410
1411/************************************************************************
1412 * RLBuildListOfPaths [SHELL32.146]
1413 *
1414 * NOTES
1415 * builds a DPA
1416 */
1417DWORD WINAPI RLBuildListOfPaths (void)
1418{ FIXME("stub\n");
1419 return 0;
1420}
1421/************************************************************************
1422 * StrToOleStr [SHELL32.163]
1423 *
1424 */
1425int WINAPI StrToOleStrA (LPWSTR lpWideCharStr, LPCSTR lpMultiByteString)
1426{
1427 TRACE("%p %p(%s)\n",
1428 lpWideCharStr, lpMultiByteString, lpMultiByteString);
1429
1430 return MultiByteToWideChar(0, 0, lpMultiByteString, -1, lpWideCharStr, MAX_PATH);
1431
1432}
1433int WINAPI StrToOleStrW (LPWSTR lpWideCharStr, LPCWSTR lpWString)
1434{
1435 TRACE("%p %p(%s)\n",
1436 lpWideCharStr, lpWString, debugstr_w(lpWString));
1437
1438 if (lstrcpyW (lpWideCharStr, lpWString ))
1439 { return lstrlenW (lpWideCharStr);
1440 }
1441 return 0;
1442}
1443
1444BOOL WINAPI StrToOleStrAW (LPWSTR lpWideCharStr, LPCVOID lpString)
1445{
1446 if (VERSION_OsIsUnicode())
1447 return StrToOleStrW (lpWideCharStr, (LPCWSTR)lpString);
1448 return StrToOleStrA (lpWideCharStr, (LPCSTR)lpString);
1449}
1450
1451/************************************************************************
1452 * SHValidateUNC [SHELL32.173]
1453 *
1454 */
1455HRESULT WINAPI SHValidateUNC (DWORD x, DWORD y, DWORD z)
1456{
1457 FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x,y,z);
1458 return 0;
1459}
1460
1461/************************************************************************
1462 * DoEnvironmentSubstW [SHELL32.53]
1463 *
1464 */
1465HRESULT WINAPI DoEnvironmentSubstA(LPSTR x, LPSTR y)
1466{
1467 FIXME("%p(%s) %p(%s) stub\n", x, x, y, y);
1468 return 0;
1469}
1470
1471HRESULT WINAPI DoEnvironmentSubstW(LPWSTR x, LPWSTR y)
1472{
1473 FIXME("%p(%s) %p(%s) stub\n", x, debugstr_w(x), y, debugstr_w(y));
1474 return 0;
1475}
1476
1477HRESULT WINAPI DoEnvironmentSubstAW(LPVOID x, LPVOID y)
1478{
1479 if (VERSION_OsIsUnicode())
1480 return DoEnvironmentSubstW((LPWSTR)x, (LPWSTR)y);
1481 return DoEnvironmentSubstA((LPSTR)x, (LPSTR)y);
1482}
1483
1484/*************************************************************************
1485 * shell32_243 [SHELL32.243]
1486 *
1487 * Win98+ by-ordinal routine. In Win98 this routine returns zero and
1488 * does nothing else. Possibly this does something in NT or SHELL32 5.0?
1489 *
1490 */
1491
1492BOOL WINAPI shell32_243(DWORD a, DWORD b)
1493{
1494 return FALSE;
1495}
1496
1497/************************************************************************
1498 * Win32DeleteFile [SHELL32.164]
1499 *
1500 * Deletes a file. Also triggers a change notify if one exists, but
1501 * that mechanism doesn't yet exist in Wine's SHELL32.
1502 *
1503 * FIXME:
1504 * Verified on Win98 / IE 5 (SHELL32 4.72, March 1999 build) to be
1505 * ANSI. Is this Unicode on NT?
1506 *
1507 */
1508
1509BOOL WINAPI Win32DeleteFile(LPSTR fName)
1510{
1511 dprintf(("SHELL32:SHELLORD:Win32DeleteFile %p(%s): partial stub\n", fName, fName));
1512
1513 DeleteFileA(fName);
1514
1515 return TRUE;
1516}
1517
1518
1519/*****************************************************************************
1520 * Name : StrChrIA
1521 * Purpose : Searches a string for the first occurrence of a character that
1522 * matches the specified character. The comparison is not case sensitive.
1523 * Parameters: LPCSTR lpStart Address of the string to be searched.
1524 * TCHAR wMatch Character to be used for comparison.
1525 * Variables :
1526 * Result : Returns the address of the first occurrence of the character in
1527 * the string if successful, or NULL otherwise.
1528 * Remark : SHELL32.
1529 * Status : UNTESTED UNKNOWN
1530 *
1531 * Author : Patrick Haller [Wed, 1999/12/29 09:00]
1532 *****************************************************************************/
1533
1534ODINFUNCTION2(LPSTR, StrChrIA,
1535 LPCSTR, lpStart,
1536 CHAR, wMatch)
1537{
1538 LPSTR lpRes;
1539
1540 wMatch = tolower(wMatch);
1541 lpRes = strchr(lpStart, wMatch); // lower case comparsion
1542 if (NULL == lpRes)
1543 {
1544 wMatch = toupper(wMatch);
1545 lpRes = strchr(lpStart, wMatch); // upper case comparsion
1546 }
1547
1548 return lpRes;
1549}
1550
1551
1552/*****************************************************************************
1553 * Name : StrChrIW
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 : UNTESTED UNKNOWN
1563 *
1564 * Author : Patrick Haller [Wed, 1999/12/29 09:00]
1565 *****************************************************************************/
1566
1567ODINFUNCTION2(LPWSTR, StrChrIW,
1568 LPCWSTR, lpStart,
1569 WCHAR, wMatch)
1570{
1571 LPWSTR lpRes;
1572
1573 wMatch = towlower(wMatch);
1574 lpRes = (WCHAR*)wcschr((const wchar_t*)lpStart, wMatch); // lower case comparsion
1575 if (NULL == lpRes)
1576 {
1577 wMatch = towupper(wMatch);
1578 lpRes = (WCHAR*)wcschr((const wchar_t*)lpStart, wMatch); // upper case comparsion
1579 }
1580
1581 return lpRes;
1582}
1583
1584
1585/*****************************************************************************
1586 * Name : StrStrIA
1587 * Purpose : Finds the first occurrence of a substring within a string. The
1588 * comparison is not case sensitive.
1589 * Parameters: LPCSTR lpFirst
1590 * LPCSTR lpSrch
1591 * Variables :
1592 * Result : Returns the address of the first occurrence of the matching
1593 * substring if successful, or NULL otherwise.
1594 * Remark : SHELL32.
1595 * Status : UNTESTED UNKNOWN
1596 *
1597 * Author : Patrick Haller [Wed, 1999/12/29 09:00]
1598 *****************************************************************************/
1599
1600ODINFUNCTION2(LPSTR, StrStrIA,
1601 LPCSTR, lpFirst,
1602 LPCSTR, lpSrch)
1603{
1604 char ch = lpSrch[0]; // look for 1st character
1605 LONG lLen = lstrlenA(lpSrch); // length of search string
1606 int iRes; // comparsion result
1607
1608 do
1609 {
1610 lpFirst = StrChrIA(lpFirst, // find first matching character
1611 ch);
1612 if (NULL == lpFirst) // not found
1613 return NULL;
1614
1615 iRes = StrCmpNIA((LPSTR)lpFirst, // compare search string
1616 (LPSTR)lpSrch,
1617 lLen);
1618
1619 if (0 == iRes) // Found!
1620 return (LPSTR)lpFirst;
1621
1622 lpFirst = CharNextA(lpFirst); // skip to next character
1623 }
1624 while (*lpFirst != 0); // safe termination
1625
1626 return NULL; // default result
1627}
1628
1629
1630
1631/*****************************************************************************
1632 * Name : StrStrIW
1633 * Purpose : Finds the first occurrence of a substring within a string. The
1634 * comparison is not case sensitive.
1635 * Parameters: LPCWSTR lpFirst
1636 * LPCWSTR lpSrch
1637 * Variables :
1638 * Result : Returns the address of the first occurrence of the matching
1639 * substring if successful, or NULL otherwise.
1640 * Remark : SHELL32.
1641 * Status : UNTESTED UNKNOWN
1642 *
1643 * Author : Patrick Haller [Wed, 1999/12/29 09:00]
1644 *****************************************************************************/
1645
1646ODINFUNCTION2(LPWSTR, StrStrIW,
1647 LPCWSTR, lpFirst,
1648 LPCWSTR, lpSrch)
1649{
1650 WCHAR ch = lpSrch[0]; // look for 1st character
1651 LONG lLen = lstrlenW(lpSrch); // length of search string
1652 int iRes; // comparsion result
1653
1654 do
1655 {
1656 lpFirst = StrChrIW(lpFirst, // find first matching character
1657 ch);
1658 if (NULL == lpFirst) // not found
1659 return NULL;
1660
1661 iRes = StrCmpNIW((LPWSTR)lpFirst, // compare search string
1662 (LPWSTR)lpSrch,
1663 lLen);
1664
1665 if (0 == iRes) // Found!
1666 return (LPWSTR)lpFirst;
1667
1668 lpFirst = CharNextW(lpFirst); // skip to next character
1669 }
1670 while (*lpFirst != 0); // safe termination
1671
1672 return NULL; // default result
1673}
1674
1675
Note: See TracBrowser for help on using the repository browser.