1 | /* $Id: shell32_main.c,v 1.6 2001-10-17 09:15:21 phaller Exp $ */
|
---|
2 | /*
|
---|
3 | * Shell basics
|
---|
4 | *
|
---|
5 | * 1998 Marcus Meissner
|
---|
6 | * 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
|
---|
7 | */
|
---|
8 | #ifdef __WIN32OS2__
|
---|
9 | #define ICOM_CINTERFACE 1
|
---|
10 | #include <odin.h>
|
---|
11 | #endif
|
---|
12 |
|
---|
13 | #include <stdlib.h>
|
---|
14 | #include <string.h>
|
---|
15 | #include <stdio.h>
|
---|
16 |
|
---|
17 | #include "windef.h"
|
---|
18 | #include "wingdi.h"
|
---|
19 | #include "wine/winuser16.h"
|
---|
20 | #include "winerror.h"
|
---|
21 | #include "heap.h"
|
---|
22 | #include "dlgs.h"
|
---|
23 | #include "ldt.h"
|
---|
24 | #include "debugtools.h"
|
---|
25 | #include "winreg.h"
|
---|
26 | #include "authors.h"
|
---|
27 |
|
---|
28 | #include "shellapi.h"
|
---|
29 | #include "pidl.h"
|
---|
30 |
|
---|
31 | #include "shell32_main.h"
|
---|
32 | #include "wine/undocshell.h"
|
---|
33 | #include "shlobj.h"
|
---|
34 | #include "shlguid.h"
|
---|
35 | #include "shlwapi.h"
|
---|
36 |
|
---|
37 | #ifdef __WIN32OS2__
|
---|
38 | #include <heapstring.h>
|
---|
39 | #include <misc.h>
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | DEFAULT_DEBUG_CHANNEL(shell);
|
---|
43 |
|
---|
44 | #define MORE_DEBUG 1
|
---|
45 | /*************************************************************************
|
---|
46 | * CommandLineToArgvW [SHELL32.7]
|
---|
47 | */
|
---|
48 | /*************************************************************************
|
---|
49 | * CommandLineToArgvW[SHELL32.@]
|
---|
50 | *
|
---|
51 | * We must interpret the quotes in the command line to rebuild the argv
|
---|
52 | * array correctly:
|
---|
53 | * - arguments are separated by spaces or tabs
|
---|
54 | * - quotes serve as optional argument delimiters
|
---|
55 | * '"a b"' -> 'a b'
|
---|
56 | * - escaped quotes must be converted back to '"'
|
---|
57 | * '\"' -> '"'
|
---|
58 | * - an odd number of '\'s followed by '"' correspond to half that number
|
---|
59 | * of '\' followed by a '"' (extension of the above)
|
---|
60 | * '\\\"' -> '\"'
|
---|
61 | * '\\\\\"' -> '\\"'
|
---|
62 | * - an even number of '\'s followed by a '"' correspond to half that number
|
---|
63 | * of '\', plus a regular quote serving as an argument delimiter (which
|
---|
64 | * means it does not appear in the result)
|
---|
65 | * 'a\\"b c"' -> 'a\b c'
|
---|
66 | * 'a\\\\"b c"' -> 'a\\b c'
|
---|
67 | * - '\' that are not followed by a '"' are copied literally
|
---|
68 | * 'a\b' -> 'a\b'
|
---|
69 | * 'a\\b' -> 'a\\b'
|
---|
70 | *
|
---|
71 | * Note:
|
---|
72 | * '\t' == 0x0009
|
---|
73 | * ' ' == 0x0020
|
---|
74 | * '"' == 0x0022
|
---|
75 | * '\\' == 0x005c
|
---|
76 | */
|
---|
77 | LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
|
---|
78 | {
|
---|
79 | DWORD argc;
|
---|
80 | HGLOBAL hargv;
|
---|
81 | LPWSTR *argv;
|
---|
82 | LPCWSTR cs;
|
---|
83 | LPWSTR arg,s,d;
|
---|
84 | LPWSTR cmdline;
|
---|
85 | int in_quotes,bcount;
|
---|
86 |
|
---|
87 | if (*lpCmdline==0) {
|
---|
88 | /* Return the path to the executable */
|
---|
89 | DWORD size;
|
---|
90 |
|
---|
91 | hargv=0;
|
---|
92 | size=16;
|
---|
93 | do {
|
---|
94 | size*=2;
|
---|
95 | hargv=GlobalReAlloc(hargv, size, 0);
|
---|
96 | argv=GlobalLock(hargv);
|
---|
97 | } while (GetModuleFileNameW((HMODULE)0, (LPWSTR)(argv+1), size-sizeof(LPWSTR)) == 0);
|
---|
98 | argv[0]=(LPWSTR)(argv+1);
|
---|
99 | if (numargs)
|
---|
100 | *numargs=2;
|
---|
101 |
|
---|
102 | return argv;
|
---|
103 | }
|
---|
104 |
|
---|
105 | /* to get a writeable copy */
|
---|
106 | argc=0;
|
---|
107 | bcount=0;
|
---|
108 | in_quotes=0;
|
---|
109 | cs=lpCmdline;
|
---|
110 | while (1) {
|
---|
111 | if (*cs==0 || ((*cs==0x0009 || *cs==0x0020) && !in_quotes)) {
|
---|
112 | /* space */
|
---|
113 | argc++;
|
---|
114 | /* skip the remaining spaces */
|
---|
115 | while (*cs==0x0009 || *cs==0x0020) {
|
---|
116 | cs++;
|
---|
117 | }
|
---|
118 | if (*cs==0)
|
---|
119 | break;
|
---|
120 | bcount=0;
|
---|
121 | continue;
|
---|
122 | } else if (*cs==0x005c) {
|
---|
123 | /* '\', count them */
|
---|
124 | bcount++;
|
---|
125 | } else if ((*cs==0x0022) && ((bcount & 1)==0)) {
|
---|
126 | /* unescaped '"' */
|
---|
127 | in_quotes=!in_quotes;
|
---|
128 | bcount=0;
|
---|
129 | } else {
|
---|
130 | /* a regular character */
|
---|
131 | bcount=0;
|
---|
132 | }
|
---|
133 | cs++;
|
---|
134 | }
|
---|
135 | /* Allocate in a single lump, the string array, and the strings that go with it.
|
---|
136 | * This way the caller can make a single GlobalFree call to free both, as per MSDN.
|
---|
137 | */
|
---|
138 | hargv=GlobalAlloc(0, argc*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR));
|
---|
139 | argv=GlobalLock(hargv);
|
---|
140 | if (!argv)
|
---|
141 | return NULL;
|
---|
142 | cmdline=(LPWSTR)(argv+argc);
|
---|
143 | strcpyW(cmdline, lpCmdline);
|
---|
144 |
|
---|
145 | argc=0;
|
---|
146 | bcount=0;
|
---|
147 | in_quotes=0;
|
---|
148 | arg=d=s=cmdline;
|
---|
149 | while (*s) {
|
---|
150 | if ((*s==0x0009 || *s==0x0020) && !in_quotes) {
|
---|
151 | /* Close the argument and copy it */
|
---|
152 | *d=0;
|
---|
153 | argv[argc++]=arg;
|
---|
154 |
|
---|
155 | /* skip the remaining spaces */
|
---|
156 | do {
|
---|
157 | s++;
|
---|
158 | } while (*s==0x0009 || *s==0x0020);
|
---|
159 |
|
---|
160 | /* Start with a new argument */
|
---|
161 | arg=d=s;
|
---|
162 | bcount=0;
|
---|
163 | } else if (*s==0x005c) {
|
---|
164 | /* '\\' */
|
---|
165 | *d++=*s++;
|
---|
166 | bcount++;
|
---|
167 | } else if (*s==0x0022) {
|
---|
168 | /* '"' */
|
---|
169 | if ((bcount & 1)==0) {
|
---|
170 | /* Preceeded by an even number of '\', this is half that
|
---|
171 | * number of '\', plus a quote which we erase.
|
---|
172 | */
|
---|
173 | d-=bcount/2;
|
---|
174 | in_quotes=!in_quotes;
|
---|
175 | s++;
|
---|
176 | } else {
|
---|
177 | /* Preceeded by an odd number of '\', this is half that
|
---|
178 | * number of '\' followed by a '"'
|
---|
179 | */
|
---|
180 | d=d-bcount/2-1;
|
---|
181 | *d++='"';
|
---|
182 | s++;
|
---|
183 | }
|
---|
184 | bcount=0;
|
---|
185 | } else {
|
---|
186 | /* a regular character */
|
---|
187 | *d++=*s++;
|
---|
188 | bcount=0;
|
---|
189 | }
|
---|
190 | }
|
---|
191 | if (*arg) {
|
---|
192 | *d='\0';
|
---|
193 | argv[argc]=arg;
|
---|
194 | }
|
---|
195 | if (numargs)
|
---|
196 | *numargs=argc;
|
---|
197 |
|
---|
198 | return argv;
|
---|
199 | }
|
---|
200 |
|
---|
201 | /*************************************************************************
|
---|
202 | * SHGetFileInfoA [SHELL32.@]
|
---|
203 | *
|
---|
204 | */
|
---|
205 |
|
---|
206 | DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
|
---|
207 | SHFILEINFOA *psfi, UINT sizeofpsfi,
|
---|
208 | UINT flags )
|
---|
209 | {
|
---|
210 | char szLoaction[MAX_PATH];
|
---|
211 | int iIndex;
|
---|
212 | DWORD ret = TRUE, dwAttributes = 0;
|
---|
213 | IShellFolder * psfParent = NULL;
|
---|
214 | IExtractIconA * pei = NULL;
|
---|
215 | LPITEMIDLIST pidlLast = NULL, pidl = NULL;
|
---|
216 | HRESULT hr = S_OK;
|
---|
217 |
|
---|
218 | TRACE("(%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x)\n",
|
---|
219 | (flags & SHGFI_PIDL)? "pidl" : path, dwFileAttributes, psfi, psfi->dwAttributes, sizeofpsfi, flags);
|
---|
220 |
|
---|
221 | if ((flags & SHGFI_USEFILEATTRIBUTES) && (flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
|
---|
222 | return FALSE;
|
---|
223 |
|
---|
224 | /* windows initializes this values regardless of the flags */
|
---|
225 | psfi->szDisplayName[0] = '\0';
|
---|
226 | psfi->szTypeName[0] = '\0';
|
---|
227 | psfi->iIcon = 0;
|
---|
228 |
|
---|
229 | if (flags & SHGFI_EXETYPE) {
|
---|
230 | BOOL status = FALSE;
|
---|
231 | HANDLE hfile;
|
---|
232 | DWORD BinaryType;
|
---|
233 | IMAGE_DOS_HEADER mz_header;
|
---|
234 | IMAGE_NT_HEADERS nt;
|
---|
235 | DWORD len;
|
---|
236 | char magic[4];
|
---|
237 |
|
---|
238 | if (flags != SHGFI_EXETYPE) return 0;
|
---|
239 |
|
---|
240 | status = GetBinaryTypeA (path, &BinaryType);
|
---|
241 | if (!status) return 0;
|
---|
242 | if ((BinaryType == SCS_DOS_BINARY)
|
---|
243 | || (BinaryType == SCS_PIF_BINARY)) return 0x4d5a;
|
---|
244 |
|
---|
245 | hfile = CreateFileA( path, GENERIC_READ, FILE_SHARE_READ,
|
---|
246 | NULL, OPEN_EXISTING, 0, 0 );
|
---|
247 | if ( hfile == INVALID_HANDLE_VALUE ) return 0;
|
---|
248 |
|
---|
249 | /* The next section is adapted from MODULE_GetBinaryType, as we need
|
---|
250 | * to examine the image header to get OS and version information. We
|
---|
251 | * know from calling GetBinaryTypeA that the image is valid and either
|
---|
252 | * an NE or PE, so much error handling can be omitted.
|
---|
253 | * Seek to the start of the file and read the header information.
|
---|
254 | */
|
---|
255 |
|
---|
256 | SetFilePointer( hfile, 0, NULL, SEEK_SET );
|
---|
257 | ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL );
|
---|
258 |
|
---|
259 | SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
|
---|
260 | ReadFile( hfile, magic, sizeof(magic), &len, NULL );
|
---|
261 | if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE )
|
---|
262 | {
|
---|
263 | SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
|
---|
264 | ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
|
---|
265 | CloseHandle( hfile );
|
---|
266 | if (nt.OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI) {
|
---|
267 | return IMAGE_NT_SIGNATURE
|
---|
268 | | (nt.OptionalHeader.MajorSubsystemVersion << 24)
|
---|
269 | | (nt.OptionalHeader.MinorSubsystemVersion << 16);
|
---|
270 | }
|
---|
271 | return IMAGE_NT_SIGNATURE;
|
---|
272 | }
|
---|
273 | else if ( *(WORD*)magic == IMAGE_OS2_SIGNATURE )
|
---|
274 | {
|
---|
275 | IMAGE_OS2_HEADER ne;
|
---|
276 | SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
|
---|
277 | ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
|
---|
278 | CloseHandle( hfile );
|
---|
279 | if (ne.ne_exetyp == 2) return IMAGE_OS2_SIGNATURE
|
---|
280 | | (ne.ne_expver << 16);
|
---|
281 | return 0;
|
---|
282 | }
|
---|
283 | CloseHandle( hfile );
|
---|
284 | return 0;
|
---|
285 | }
|
---|
286 |
|
---|
287 |
|
---|
288 | /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES in not specified
|
---|
289 | the pidl functions fail on not existing file names */
|
---|
290 | if (flags & SHGFI_PIDL)
|
---|
291 | {
|
---|
292 | pidl = (LPCITEMIDLIST) path;
|
---|
293 | if (!pidl )
|
---|
294 | {
|
---|
295 | ERR("pidl is null!\n");
|
---|
296 | return FALSE;
|
---|
297 | }
|
---|
298 | }
|
---|
299 | else if (!(flags & SHGFI_USEFILEATTRIBUTES))
|
---|
300 | {
|
---|
301 | hr = SHILCreateFromPathA ( path, &pidl, &dwAttributes);
|
---|
302 | /* note: the attributes in ISF::ParseDisplayName are not implemented */
|
---|
303 | }
|
---|
304 |
|
---|
305 | /* get the parent shellfolder */
|
---|
306 | if (pidl)
|
---|
307 | {
|
---|
308 | hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent, &pidlLast);
|
---|
309 | }
|
---|
310 |
|
---|
311 | /* get the attributes of the child */
|
---|
312 | if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES))
|
---|
313 | {
|
---|
314 | if (!(flags & SHGFI_ATTR_SPECIFIED))
|
---|
315 | {
|
---|
316 | psfi->dwAttributes = 0xffffffff;
|
---|
317 | }
|
---|
318 | IShellFolder_GetAttributesOf(psfParent, 1 , &pidlLast, &(psfi->dwAttributes));
|
---|
319 | }
|
---|
320 |
|
---|
321 | /* get the displayname */
|
---|
322 | if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME))
|
---|
323 | {
|
---|
324 | if (flags & SHGFI_USEFILEATTRIBUTES)
|
---|
325 | {
|
---|
326 | strcpy (psfi->szDisplayName, PathFindFileNameA(path));
|
---|
327 | }
|
---|
328 | else
|
---|
329 | {
|
---|
330 | STRRET str;
|
---|
331 | hr = IShellFolder_GetDisplayNameOf(psfParent, pidlLast, SHGDN_INFOLDER, &str);
|
---|
332 | StrRetToStrNA (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
|
---|
333 | }
|
---|
334 | }
|
---|
335 |
|
---|
336 | /* get the type name */
|
---|
337 | if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
|
---|
338 | {
|
---|
339 | _ILGetFileType(pidlLast, psfi->szTypeName, 80);
|
---|
340 | }
|
---|
341 |
|
---|
342 | /* ### icons ###*/
|
---|
343 | if (flags & SHGFI_LINKOVERLAY)
|
---|
344 | FIXME("set icon to link, stub\n");
|
---|
345 |
|
---|
346 | if (flags & SHGFI_SELECTED)
|
---|
347 | FIXME("set icon to selected, stub\n");
|
---|
348 |
|
---|
349 | if (flags & SHGFI_SHELLICONSIZE)
|
---|
350 | FIXME("set icon to shell size, stub\n");
|
---|
351 |
|
---|
352 | /* get the iconlocation */
|
---|
353 | if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
|
---|
354 | {
|
---|
355 | UINT uDummy,uFlags;
|
---|
356 | hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1, &pidlLast, &IID_IExtractIconA, &uDummy, (LPVOID*)&pei);
|
---|
357 |
|
---|
358 | if (SUCCEEDED(hr))
|
---|
359 | {
|
---|
360 | hr = IExtractIconA_GetIconLocation(pei, (flags & SHGFI_OPENICON)? GIL_OPENICON : 0,szLoaction, MAX_PATH, &iIndex, &uFlags);
|
---|
361 | /* fixme what to do with the index? */
|
---|
362 |
|
---|
363 | if(uFlags != GIL_NOTFILENAME)
|
---|
364 | strcpy (psfi->szDisplayName, szLoaction);
|
---|
365 | else
|
---|
366 | ret = FALSE;
|
---|
367 |
|
---|
368 | IExtractIconA_Release(pei);
|
---|
369 | }
|
---|
370 | }
|
---|
371 |
|
---|
372 | /* get icon index (or load icon)*/
|
---|
373 | if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))
|
---|
374 | {
|
---|
375 | if (flags & SHGFI_USEFILEATTRIBUTES)
|
---|
376 | {
|
---|
377 | char sTemp [MAX_PATH];
|
---|
378 | char * szExt;
|
---|
379 | DWORD dwNr=0;
|
---|
380 |
|
---|
381 | lstrcpynA(sTemp, path, MAX_PATH);
|
---|
382 | szExt = (LPSTR) PathFindExtensionA(sTemp);
|
---|
383 | if( szExt && HCR_MapTypeToValue(szExt, sTemp, MAX_PATH, TRUE)
|
---|
384 | && HCR_GetDefaultIcon(sTemp, sTemp, MAX_PATH, &dwNr))
|
---|
385 | {
|
---|
386 | if (!strcmp("%1",sTemp)) /* icon is in the file */
|
---|
387 | {
|
---|
388 | strcpy(sTemp, path);
|
---|
389 | }
|
---|
390 | /* FIXME: if sTemp contains a valid filename, get the icon
|
---|
391 | from there, index is in dwNr
|
---|
392 | */
|
---|
393 | psfi->iIcon = 2;
|
---|
394 | }
|
---|
395 | else /* default icon */
|
---|
396 | {
|
---|
397 | psfi->iIcon = 0;
|
---|
398 | }
|
---|
399 | }
|
---|
400 | else
|
---|
401 | {
|
---|
402 | if (!(PidlToSicIndex(psfParent, pidlLast, (flags & SHGFI_LARGEICON),
|
---|
403 | (flags & SHGFI_OPENICON)? GIL_OPENICON : 0, &(psfi->iIcon))))
|
---|
404 | {
|
---|
405 | ret = FALSE;
|
---|
406 | }
|
---|
407 | }
|
---|
408 | if (ret)
|
---|
409 | {
|
---|
410 | ret = (DWORD) ((flags & SHGFI_LARGEICON) ? ShellBigIconList : ShellSmallIconList);
|
---|
411 | }
|
---|
412 | }
|
---|
413 |
|
---|
414 | /* icon handle */
|
---|
415 | if (SUCCEEDED(hr) && (flags & SHGFI_ICON))
|
---|
416 | psfi->hIcon = ImageList_GetIcon((flags & SHGFI_LARGEICON) ? ShellBigIconList:ShellSmallIconList, psfi->iIcon, ILD_NORMAL);
|
---|
417 |
|
---|
418 | if (flags & (SHGFI_UNKNOWN1 | SHGFI_UNKNOWN2 | SHGFI_UNKNOWN3))
|
---|
419 | FIXME("unknown attribute!\n");
|
---|
420 |
|
---|
421 | if (psfParent)
|
---|
422 | IShellFolder_Release(psfParent);
|
---|
423 |
|
---|
424 | if (hr != S_OK)
|
---|
425 | ret = FALSE;
|
---|
426 |
|
---|
427 | if(pidlLast) SHFree(pidlLast);
|
---|
428 | #ifdef MORE_DEBUG
|
---|
429 | TRACE ("icon=0x%08x index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
|
---|
430 | psfi->hIcon, psfi->iIcon, psfi->dwAttributes, psfi->szDisplayName, psfi->szTypeName, ret);
|
---|
431 | #endif
|
---|
432 | return ret;
|
---|
433 | }
|
---|
434 | /*************************************************************************
|
---|
435 | * SHGetFileInfoW [SHELL32.@]
|
---|
436 | */
|
---|
437 |
|
---|
438 | DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
|
---|
439 | SHFILEINFOW *psfi, UINT sizeofpsfi,
|
---|
440 | UINT flags )
|
---|
441 | {
|
---|
442 | INT len;
|
---|
443 | LPSTR temppath;
|
---|
444 | DWORD ret;
|
---|
445 | SHFILEINFOA temppsfi;
|
---|
446 |
|
---|
447 | len = WideCharToMultiByte(CP_ACP, 0, path, -1, NULL, 0, NULL, NULL);
|
---|
448 | temppath = HeapAlloc(GetProcessHeap(), 0, len);
|
---|
449 | WideCharToMultiByte(CP_ACP, 0, path, -1, temppath, len, NULL, NULL);
|
---|
450 |
|
---|
451 | WideCharToMultiByte(CP_ACP, 0, psfi->szDisplayName, -1, temppsfi.szDisplayName,
|
---|
452 | sizeof(temppsfi.szDisplayName), NULL, NULL);
|
---|
453 | WideCharToMultiByte(CP_ACP, 0, psfi->szTypeName, -1, temppsfi.szTypeName,
|
---|
454 | sizeof(temppsfi.szTypeName), NULL, NULL);
|
---|
455 |
|
---|
456 | ret = SHGetFileInfoA(temppath, dwFileAttributes, &temppsfi, sizeof(temppsfi), flags);
|
---|
457 |
|
---|
458 | HeapFree(GetProcessHeap(), 0, temppath);
|
---|
459 |
|
---|
460 | return ret;
|
---|
461 | }
|
---|
462 |
|
---|
463 | /*************************************************************************
|
---|
464 | * SHGetFileInfoAW [SHELL32.@]
|
---|
465 | */
|
---|
466 | DWORD WINAPI SHGetFileInfoAW(
|
---|
467 | LPCVOID path,
|
---|
468 | DWORD dwFileAttributes,
|
---|
469 | LPVOID psfi,
|
---|
470 | UINT sizeofpsfi,
|
---|
471 | UINT flags)
|
---|
472 | {
|
---|
473 | if(SHELL_OsIsUnicode())
|
---|
474 | return SHGetFileInfoW(path, dwFileAttributes, psfi, sizeofpsfi, flags );
|
---|
475 | return SHGetFileInfoA(path, dwFileAttributes, psfi, sizeofpsfi, flags );
|
---|
476 | }
|
---|
477 |
|
---|
478 | /*************************************************************************
|
---|
479 | * DuplicateIcon [SHELL32.188]
|
---|
480 | */
|
---|
481 | HICON WINAPI DuplicateIcon( HINSTANCE hInstance, HICON hIcon)
|
---|
482 | {
|
---|
483 | ICONINFO IconInfo;
|
---|
484 | HICON hDupIcon = 0;
|
---|
485 |
|
---|
486 | TRACE("(%04x, %04x)\n", hInstance, hIcon);
|
---|
487 |
|
---|
488 | if(GetIconInfo(hIcon, &IconInfo))
|
---|
489 | {
|
---|
490 | hDupIcon = CreateIconIndirect(&IconInfo);
|
---|
491 |
|
---|
492 | /* clean up hbmMask and hbmColor */
|
---|
493 | DeleteObject(IconInfo.hbmMask);
|
---|
494 | DeleteObject(IconInfo.hbmColor);
|
---|
495 | }
|
---|
496 |
|
---|
497 | return hDupIcon;
|
---|
498 | }
|
---|
499 |
|
---|
500 |
|
---|
501 | /*************************************************************************
|
---|
502 | * ExtractIconA [SHELL32.133]
|
---|
503 | *
|
---|
504 | * fixme
|
---|
505 | * is the filename is not a file return 1
|
---|
506 | */
|
---|
507 | #ifdef __WIN32OS2__
|
---|
508 | HICON WINAPI ExtractIconA( HINSTANCE hInstance, LPCSTR lpszExeFileName,
|
---|
509 | UINT nIconIndex )
|
---|
510 | {
|
---|
511 | HGLOBAL handle = InternalExtractIcon(hInstance,lpszExeFileName,nIconIndex, 1);
|
---|
512 | TRACE_(shell)("\n");
|
---|
513 | if( handle )
|
---|
514 | {
|
---|
515 | HICON* ptr = (HICON*)GlobalLock(handle);
|
---|
516 | HICON hIcon = *ptr;
|
---|
517 |
|
---|
518 | GlobalFree(handle);
|
---|
519 | return hIcon;
|
---|
520 | }
|
---|
521 | return 0;
|
---|
522 | }
|
---|
523 | #else
|
---|
524 | HICON WINAPI ExtractIconA( HINSTANCE hInstance, LPCSTR lpszExeFileName,
|
---|
525 | UINT nIconIndex )
|
---|
526 | { HGLOBAL16 handle = InternalExtractIcon16(hInstance,lpszExeFileName,nIconIndex, 1);
|
---|
527 | TRACE("\n");
|
---|
528 | if( handle )
|
---|
529 | {
|
---|
530 | HICON16* ptr = (HICON16*)GlobalLock16(handle);
|
---|
531 | HICON16 hIcon = *ptr;
|
---|
532 |
|
---|
533 | GlobalFree16(handle);
|
---|
534 | return hIcon;
|
---|
535 | }
|
---|
536 | return 0;
|
---|
537 | }
|
---|
538 | #endif
|
---|
539 |
|
---|
540 | /*************************************************************************
|
---|
541 | * ExtractIconW [SHELL32.180]
|
---|
542 | *
|
---|
543 | * fixme
|
---|
544 | * is the filename is not a file return 1
|
---|
545 | */
|
---|
546 | HICON WINAPI ExtractIconW( HINSTANCE hInstance, LPCWSTR lpszExeFileName,
|
---|
547 | UINT nIconIndex )
|
---|
548 | { LPSTR exefn;
|
---|
549 | HICON ret;
|
---|
550 | TRACE("\n");
|
---|
551 |
|
---|
552 | exefn = HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName);
|
---|
553 | ret = ExtractIconA(hInstance,exefn,nIconIndex);
|
---|
554 |
|
---|
555 | HeapFree(GetProcessHeap(),0,exefn);
|
---|
556 | return ret;
|
---|
557 | }
|
---|
558 |
|
---|
559 | /*************************************************************************
|
---|
560 | * FindExecutableA [SHELL32.184]
|
---|
561 | */
|
---|
562 | HINSTANCE WINAPI FindExecutableA( LPCSTR lpFile, LPCSTR lpDirectory,
|
---|
563 | LPSTR lpResult )
|
---|
564 | { HINSTANCE retval=31; /* default - 'No association was found' */
|
---|
565 | char old_dir[1024];
|
---|
566 |
|
---|
567 | TRACE("File %s, Dir %s\n",
|
---|
568 | (lpFile != NULL?lpFile:"-"),
|
---|
569 | (lpDirectory != NULL?lpDirectory:"-"));
|
---|
570 |
|
---|
571 | lpResult[0]='\0'; /* Start off with an empty return string */
|
---|
572 |
|
---|
573 | /* trap NULL parameters on entry */
|
---|
574 | if (( lpFile == NULL ) || ( lpResult == NULL ))
|
---|
575 | { /* FIXME - should throw a warning, perhaps! */
|
---|
576 | return 2; /* File not found. Close enough, I guess. */
|
---|
577 | }
|
---|
578 |
|
---|
579 | if (lpDirectory)
|
---|
580 | { GetCurrentDirectoryA( sizeof(old_dir), old_dir );
|
---|
581 | SetCurrentDirectoryA( lpDirectory );
|
---|
582 | }
|
---|
583 |
|
---|
584 | retval = SHELL_FindExecutable( lpFile, "open", lpResult );
|
---|
585 |
|
---|
586 | TRACE("returning %s\n", lpResult);
|
---|
587 | if (lpDirectory)
|
---|
588 | SetCurrentDirectoryA( old_dir );
|
---|
589 | return retval;
|
---|
590 | }
|
---|
591 |
|
---|
592 | /*************************************************************************
|
---|
593 | * FindExecutableW [SHELL32.219]
|
---|
594 | */
|
---|
595 | HINSTANCE WINAPI FindExecutableW(LPCWSTR lpFile, LPCWSTR lpDirectory,
|
---|
596 | LPWSTR lpResult)
|
---|
597 | {
|
---|
598 | FIXME("(%p,%p,%p): stub\n", lpFile, lpDirectory, lpResult);
|
---|
599 | return 31; /* default - 'No association was found' */
|
---|
600 | }
|
---|
601 |
|
---|
602 | typedef struct
|
---|
603 | { LPCSTR szApp;
|
---|
604 | LPCSTR szOtherStuff;
|
---|
605 | HICON hIcon;
|
---|
606 | } ABOUT_INFO;
|
---|
607 |
|
---|
608 | #define IDC_STATIC_TEXT 100
|
---|
609 | #define IDC_LISTBOX 99
|
---|
610 | #define IDC_WINE_TEXT 98
|
---|
611 |
|
---|
612 | #define DROP_FIELD_TOP (-15)
|
---|
613 | #define DROP_FIELD_HEIGHT 15
|
---|
614 |
|
---|
615 | extern HICON hIconTitleFont;
|
---|
616 |
|
---|
617 | static BOOL __get_dropline( HWND hWnd, LPRECT lprect )
|
---|
618 | { HWND hWndCtl = GetDlgItem(hWnd, IDC_WINE_TEXT);
|
---|
619 | if( hWndCtl )
|
---|
620 | { GetWindowRect( hWndCtl, lprect );
|
---|
621 | MapWindowPoints( 0, hWnd, (LPPOINT)lprect, 2 );
|
---|
622 | lprect->bottom = (lprect->top += DROP_FIELD_TOP);
|
---|
623 | return TRUE;
|
---|
624 | }
|
---|
625 | return FALSE;
|
---|
626 | }
|
---|
627 |
|
---|
628 | /*************************************************************************
|
---|
629 | * SHAppBarMessage [SHELL32.207]
|
---|
630 | */
|
---|
631 | UINT WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
|
---|
632 | {
|
---|
633 | int width=data->rc.right - data->rc.left;
|
---|
634 | int height=data->rc.bottom - data->rc.top;
|
---|
635 | RECT rec=data->rc;
|
---|
636 | switch (msg)
|
---|
637 | { case ABM_GETSTATE:
|
---|
638 | return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
|
---|
639 | case ABM_GETTASKBARPOS:
|
---|
640 | GetWindowRect(data->hWnd, &rec);
|
---|
641 | data->rc=rec;
|
---|
642 | return TRUE;
|
---|
643 | case ABM_ACTIVATE:
|
---|
644 | SetActiveWindow(data->hWnd);
|
---|
645 | return TRUE;
|
---|
646 | case ABM_GETAUTOHIDEBAR:
|
---|
647 | data->hWnd=GetActiveWindow();
|
---|
648 | return TRUE;
|
---|
649 | case ABM_NEW:
|
---|
650 | SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
|
---|
651 | width,height,SWP_SHOWWINDOW);
|
---|
652 | return TRUE;
|
---|
653 | case ABM_QUERYPOS:
|
---|
654 | GetWindowRect(data->hWnd, &(data->rc));
|
---|
655 | return TRUE;
|
---|
656 | case ABM_REMOVE:
|
---|
657 | FIXME("ABM_REMOVE broken\n");
|
---|
658 | /* FIXME: this is wrong; should it be DestroyWindow instead? */
|
---|
659 | /*CloseHandle(data->hWnd);*/
|
---|
660 | return TRUE;
|
---|
661 | case ABM_SETAUTOHIDEBAR:
|
---|
662 | SetWindowPos(data->hWnd,HWND_TOP,rec.left+1000,rec.top,
|
---|
663 | width,height,SWP_SHOWWINDOW);
|
---|
664 | return TRUE;
|
---|
665 | case ABM_SETPOS:
|
---|
666 | data->uEdge=(ABE_RIGHT | ABE_LEFT);
|
---|
667 | SetWindowPos(data->hWnd,HWND_TOP,data->rc.left,data->rc.top,
|
---|
668 | width,height,SWP_SHOWWINDOW);
|
---|
669 | return TRUE;
|
---|
670 | case ABM_WINDOWPOSCHANGED:
|
---|
671 | SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
|
---|
672 | width,height,SWP_SHOWWINDOW);
|
---|
673 | return TRUE;
|
---|
674 | }
|
---|
675 | return FALSE;
|
---|
676 | }
|
---|
677 |
|
---|
678 | /*************************************************************************
|
---|
679 | * SHHelpShortcuts_RunDLL [SHELL32.224]
|
---|
680 | *
|
---|
681 | */
|
---|
682 | DWORD WINAPI SHHelpShortcuts_RunDLL (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
|
---|
683 | { FIXME("(%lx, %lx, %lx, %lx) empty stub!\n",
|
---|
684 | dwArg1, dwArg2, dwArg3, dwArg4);
|
---|
685 |
|
---|
686 | return 0;
|
---|
687 | }
|
---|
688 |
|
---|
689 | /*************************************************************************
|
---|
690 | * SHLoadInProc [SHELL32.225]
|
---|
691 | * Create an instance of specified object class from within
|
---|
692 | * the shell process and release it immediately
|
---|
693 | */
|
---|
694 |
|
---|
695 | DWORD WINAPI SHLoadInProc (REFCLSID rclsid)
|
---|
696 | {
|
---|
697 | IUnknown * pUnk = NULL;
|
---|
698 | TRACE("%s\n", debugstr_guid(rclsid));
|
---|
699 |
|
---|
700 | CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,(LPVOID*)pUnk);
|
---|
701 | if(pUnk)
|
---|
702 | {
|
---|
703 | IUnknown_Release(pUnk);
|
---|
704 | return NOERROR;
|
---|
705 | }
|
---|
706 | return DISP_E_MEMBERNOTFOUND;
|
---|
707 | }
|
---|
708 |
|
---|
709 | //replacement in shell32_odin.cpp
|
---|
710 | #ifndef __WIN32OS2__
|
---|
711 | /*************************************************************************
|
---|
712 | * ShellExecuteA [SHELL32.245]
|
---|
713 | */
|
---|
714 | HINSTANCE WINAPI ShellExecuteA( HWND hWnd, LPCSTR lpOperation,
|
---|
715 | LPCSTR lpFile, LPCSTR lpParameters,
|
---|
716 | LPCSTR lpDirectory, INT iShowCmd )
|
---|
717 | { TRACE("\n");
|
---|
718 | return ShellExecute16( hWnd, lpOperation, lpFile, lpParameters,
|
---|
719 | lpDirectory, iShowCmd );
|
---|
720 | }
|
---|
721 | #endif
|
---|
722 |
|
---|
723 | /*************************************************************************
|
---|
724 | * ShellExecuteW [SHELL32.294]
|
---|
725 | * from shellapi.h
|
---|
726 | * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
|
---|
727 | * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
|
---|
728 | */
|
---|
729 | HINSTANCE WINAPI
|
---|
730 | ShellExecuteW(
|
---|
731 | HWND hwnd,
|
---|
732 | LPCWSTR lpOperation,
|
---|
733 | LPCWSTR lpFile,
|
---|
734 | LPCWSTR lpParameters,
|
---|
735 | LPCWSTR lpDirectory,
|
---|
736 | INT nShowCmd) {
|
---|
737 |
|
---|
738 | FIXME(": stub\n");
|
---|
739 | return 0;
|
---|
740 | }
|
---|
741 |
|
---|
742 | //replacement in shell32_odin.cpp
|
---|
743 | #ifndef __WIN32OS2__
|
---|
744 | /*************************************************************************
|
---|
745 | * AboutDlgProc (internal)
|
---|
746 | */
|
---|
747 | BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
|
---|
748 | LPARAM lParam )
|
---|
749 | { HWND hWndCtl;
|
---|
750 | char Template[512], AppTitle[512];
|
---|
751 |
|
---|
752 | TRACE("\n");
|
---|
753 |
|
---|
754 | switch(msg)
|
---|
755 | { case WM_INITDIALOG:
|
---|
756 | { ABOUT_INFO *info = (ABOUT_INFO *)lParam;
|
---|
757 | if (info)
|
---|
758 | { const char* const *pstr = SHELL_People;
|
---|
759 | SendDlgItemMessageA(hWnd, stc1, STM_SETICON,info->hIcon, 0);
|
---|
760 | GetWindowTextA( hWnd, Template, sizeof(Template) );
|
---|
761 | sprintf( AppTitle, Template, info->szApp );
|
---|
762 | SetWindowTextA( hWnd, AppTitle );
|
---|
763 | SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT),
|
---|
764 | info->szOtherStuff );
|
---|
765 | hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
|
---|
766 | SendMessageA( hWndCtl, WM_SETREDRAW, 0, 0 );
|
---|
767 | if (!hIconTitleFont)
|
---|
768 | {
|
---|
769 | LOGFONTA logFont;
|
---|
770 | SystemParametersInfoA( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 );
|
---|
771 | hIconTitleFont = CreateFontIndirectA( &logFont );
|
---|
772 | }
|
---|
773 | SendMessageA( hWndCtl, WM_SETFONT, hIconTitleFont, 0 );
|
---|
774 | while (*pstr)
|
---|
775 | { SendMessageA( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)*pstr );
|
---|
776 | pstr++;
|
---|
777 | }
|
---|
778 | SendMessageA( hWndCtl, WM_SETREDRAW, 1, 0 );
|
---|
779 | }
|
---|
780 | }
|
---|
781 | return 1;
|
---|
782 |
|
---|
783 | case WM_PAINT:
|
---|
784 | { RECT rect;
|
---|
785 | PAINTSTRUCT ps;
|
---|
786 | HDC hDC = BeginPaint( hWnd, &ps );
|
---|
787 |
|
---|
788 | if( __get_dropline( hWnd, &rect ) ) {
|
---|
789 | SelectObject( hDC, GetStockObject( BLACK_PEN ) );
|
---|
790 | MoveToEx( hDC, rect.left, rect.top, NULL );
|
---|
791 | LineTo( hDC, rect.right, rect.bottom );
|
---|
792 | }
|
---|
793 | EndPaint( hWnd, &ps );
|
---|
794 | }
|
---|
795 | break;
|
---|
796 |
|
---|
797 | case WM_LBTRACKPOINT:
|
---|
798 | hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
|
---|
799 | if( (INT16)GetKeyState( VK_CONTROL ) < 0 )
|
---|
800 | { if( DragDetect( hWndCtl, *((LPPOINT)&lParam) ) )
|
---|
801 | { INT idx = SendMessageA( hWndCtl, LB_GETCURSEL, 0, 0 );
|
---|
802 | if( idx != -1 )
|
---|
803 | { INT length = SendMessageA( hWndCtl, LB_GETTEXTLEN, (WPARAM)idx, 0 );
|
---|
804 | HGLOBAL16 hMemObj = GlobalAlloc16( GMEM_MOVEABLE, length + 1 );
|
---|
805 | char* pstr = (char*)GlobalLock16( hMemObj );
|
---|
806 |
|
---|
807 | if( pstr )
|
---|
808 | { HCURSOR hCursor = LoadCursorA( 0, MAKEINTRESOURCEA(OCR_DRAGOBJECT) );
|
---|
809 | SendMessageA( hWndCtl, LB_GETTEXT, (WPARAM)idx, (LPARAM)pstr );
|
---|
810 | SendMessageA( hWndCtl, LB_DELETESTRING, (WPARAM)idx, 0 );
|
---|
811 | UpdateWindow( hWndCtl );
|
---|
812 | if( !DragObject16((HWND16)hWnd, (HWND16)hWnd, DRAGOBJ_DATA, 0, (WORD)hMemObj, hCursor) )
|
---|
813 | SendMessageA( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)pstr );
|
---|
814 | }
|
---|
815 | if( hMemObj )
|
---|
816 | GlobalFree16( hMemObj );
|
---|
817 | }
|
---|
818 | }
|
---|
819 | }
|
---|
820 | break;
|
---|
821 |
|
---|
822 | case WM_QUERYDROPOBJECT:
|
---|
823 | if( wParam == 0 )
|
---|
824 | { LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
|
---|
825 | if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA )
|
---|
826 | { RECT rect;
|
---|
827 | if( __get_dropline( hWnd, &rect ) )
|
---|
828 | { POINT pt;
|
---|
829 | pt.x=lpDragInfo->pt.x;
|
---|
830 | pt.x=lpDragInfo->pt.y;
|
---|
831 | rect.bottom += DROP_FIELD_HEIGHT;
|
---|
832 | if( PtInRect( &rect, pt ) )
|
---|
833 | { SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
|
---|
834 | return TRUE;
|
---|
835 | }
|
---|
836 | }
|
---|
837 | }
|
---|
838 | }
|
---|
839 | break;
|
---|
840 |
|
---|
841 | case WM_DROPOBJECT:
|
---|
842 | if( wParam == hWnd )
|
---|
843 | { LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
|
---|
844 | if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA && lpDragInfo->hList )
|
---|
845 | { char* pstr = (char*)GlobalLock16( (HGLOBAL16)(lpDragInfo->hList) );
|
---|
846 | if( pstr )
|
---|
847 | { static char __appendix_str[] = " with";
|
---|
848 |
|
---|
849 | hWndCtl = GetDlgItem( hWnd, IDC_WINE_TEXT );
|
---|
850 | SendMessageA( hWndCtl, WM_GETTEXT, 512, (LPARAM)Template );
|
---|
851 | if( !strncmp( Template, "WINE", 4 ) )
|
---|
852 | SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT), Template );
|
---|
853 | else
|
---|
854 | { char* pch = Template + strlen(Template) - strlen(__appendix_str);
|
---|
855 | *pch = '\0';
|
---|
856 | SendMessageA( GetDlgItem(hWnd, IDC_LISTBOX), LB_ADDSTRING,
|
---|
857 | (WPARAM)-1, (LPARAM)Template );
|
---|
858 | }
|
---|
859 |
|
---|
860 | strcpy( Template, pstr );
|
---|
861 | strcat( Template, __appendix_str );
|
---|
862 | SetWindowTextA( hWndCtl, Template );
|
---|
863 | SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
|
---|
864 | return TRUE;
|
---|
865 | }
|
---|
866 | }
|
---|
867 | }
|
---|
868 | break;
|
---|
869 |
|
---|
870 | case WM_COMMAND:
|
---|
871 | if (wParam == IDOK)
|
---|
872 | { EndDialog(hWnd, TRUE);
|
---|
873 | return TRUE;
|
---|
874 | }
|
---|
875 | break;
|
---|
876 | case WM_CLOSE:
|
---|
877 | EndDialog(hWnd, TRUE);
|
---|
878 | break;
|
---|
879 | }
|
---|
880 |
|
---|
881 | return 0;
|
---|
882 | }
|
---|
883 |
|
---|
884 |
|
---|
885 | /*************************************************************************
|
---|
886 | * ShellAboutA [SHELL32.243]
|
---|
887 | */
|
---|
888 | BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
|
---|
889 | HICON hIcon )
|
---|
890 | { ABOUT_INFO info;
|
---|
891 | HRSRC hRes;
|
---|
892 | LPVOID template;
|
---|
893 | TRACE("\n");
|
---|
894 |
|
---|
895 | if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", RT_DIALOGA)))
|
---|
896 | return FALSE;
|
---|
897 | if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
|
---|
898 | return FALSE;
|
---|
899 |
|
---|
900 | info.szApp = szApp;
|
---|
901 | info.szOtherStuff = szOtherStuff;
|
---|
902 | info.hIcon = hIcon;
|
---|
903 | if (!hIcon) info.hIcon = LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON) );
|
---|
904 | return DialogBoxIndirectParamA( GetWindowLongA( hWnd, GWL_HINSTANCE ),
|
---|
905 | template, hWnd, AboutDlgProc, (LPARAM)&info );
|
---|
906 | }
|
---|
907 |
|
---|
908 |
|
---|
909 | /*************************************************************************
|
---|
910 | * ShellAboutW [SHELL32.244]
|
---|
911 | */
|
---|
912 | BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
|
---|
913 | HICON hIcon )
|
---|
914 | { BOOL ret;
|
---|
915 | ABOUT_INFO info;
|
---|
916 | HRSRC hRes;
|
---|
917 | LPVOID template;
|
---|
918 |
|
---|
919 | TRACE("\n");
|
---|
920 |
|
---|
921 | if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", RT_DIALOGA)))
|
---|
922 | return FALSE;
|
---|
923 | if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
|
---|
924 | return FALSE;
|
---|
925 |
|
---|
926 | info.szApp = HEAP_strdupWtoA( GetProcessHeap(), 0, szApp );
|
---|
927 | info.szOtherStuff = HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff );
|
---|
928 | info.hIcon = hIcon;
|
---|
929 | if (!hIcon) info.hIcon = LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON) );
|
---|
930 | ret = DialogBoxIndirectParamA( GetWindowLongA( hWnd, GWL_HINSTANCE ),
|
---|
931 | template, hWnd, AboutDlgProc, (LPARAM)&info );
|
---|
932 | HeapFree( GetProcessHeap(), 0, (LPSTR)info.szApp );
|
---|
933 | HeapFree( GetProcessHeap(), 0, (LPSTR)info.szOtherStuff );
|
---|
934 | return ret;
|
---|
935 | }
|
---|
936 | #endif //#ifndef __WIN32OS2__
|
---|
937 |
|
---|
938 | /*************************************************************************
|
---|
939 | * FreeIconList
|
---|
940 | */
|
---|
941 | void WINAPI FreeIconList( DWORD dw )
|
---|
942 | { FIXME("(%lx): stub\n",dw);
|
---|
943 | }
|
---|
944 |
|
---|
945 | /***********************************************************************
|
---|
946 | * DllGetVersion [SHELL32]
|
---|
947 | *
|
---|
948 | * Retrieves version information of the 'SHELL32.DLL'
|
---|
949 | *
|
---|
950 | * PARAMS
|
---|
951 | * pdvi [O] pointer to version information structure.
|
---|
952 | *
|
---|
953 | * RETURNS
|
---|
954 | * Success: S_OK
|
---|
955 | * Failure: E_INVALIDARG
|
---|
956 | *
|
---|
957 | * NOTES
|
---|
958 | * Returns version of a shell32.dll from IE4.01 SP1.
|
---|
959 | */
|
---|
960 |
|
---|
961 | HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi)
|
---|
962 | {
|
---|
963 | if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
|
---|
964 | {
|
---|
965 | WARN("wrong DLLVERSIONINFO size from app");
|
---|
966 | return E_INVALIDARG;
|
---|
967 | }
|
---|
968 |
|
---|
969 | pdvi->dwMajorVersion = 4;
|
---|
970 | pdvi->dwMinorVersion = 72;
|
---|
971 | pdvi->dwBuildNumber = 3110;
|
---|
972 | pdvi->dwPlatformID = 1;
|
---|
973 |
|
---|
974 | TRACE("%lu.%lu.%lu.%lu\n",
|
---|
975 | pdvi->dwMajorVersion, pdvi->dwMinorVersion,
|
---|
976 | pdvi->dwBuildNumber, pdvi->dwPlatformID);
|
---|
977 |
|
---|
978 | return S_OK;
|
---|
979 | }
|
---|
980 | /*************************************************************************
|
---|
981 | * global variables of the shell32.dll
|
---|
982 | * all are once per process
|
---|
983 | *
|
---|
984 | */
|
---|
985 | void (* WINAPI pDLLInitComctl)(LPVOID);
|
---|
986 | LPVOID (* WINAPI pCOMCTL32_Alloc) (INT);
|
---|
987 | BOOL (* WINAPI pCOMCTL32_Free) (LPVOID);
|
---|
988 |
|
---|
989 | /* 2001-10-17 @@@PH
|
---|
990 | either me or VAC308 seems to be confused here:
|
---|
991 | if complains about redeclaration of the corresponding functions
|
---|
992 | in commctrl.h
|
---|
993 |
|
---|
994 | Even more strangely, all variables "pFunction" are automatically
|
---|
995 | percieved as "Function".
|
---|
996 | */
|
---|
997 | #if 0
|
---|
998 | HDPA (* WINAPI lpDPA_Create) (INT);
|
---|
999 | INT (* WINAPI lpDPA_InsertPtr) (const HDPA, INT, LPVOID);
|
---|
1000 | BOOL (* WINAPI lpDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM);
|
---|
1001 | LPVOID (* WINAPI lpDPA_GetPtr) (const HDPA, INT);
|
---|
1002 | BOOL (* WINAPI lpDPA_Destroy) (const HDPA);
|
---|
1003 | INT (* WINAPI lpDPA_Search) (const HDPA, LPVOID, INT, PFNDPACOMPARE, LPARAM, UINT);
|
---|
1004 | LPVOID (* WINAPI lpDPA_DeletePtr) (const HDPA hdpa, INT i);
|
---|
1005 | HANDLE (* WINAPI lpCreateMRUListA) (LPVOID lpcml);
|
---|
1006 | DWORD (* WINAPI lpFreeMRUListA) (HANDLE hMRUList);
|
---|
1007 | INT (* WINAPI lpAddMRUData) (HANDLE hList, LPCVOID lpData, DWORD cbData);
|
---|
1008 | INT (* WINAPI lpFindMRUData) (HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum);
|
---|
1009 | INT (* WINAPI lpEnumMRUListA) (HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize);
|
---|
1010 | #endif
|
---|
1011 |
|
---|
1012 | static HINSTANCE hComctl32;
|
---|
1013 | static INT shell32_RefCount = 0;
|
---|
1014 |
|
---|
1015 | LONG shell32_ObjCount = 0;
|
---|
1016 | HINSTANCE shell32_hInstance = 0;
|
---|
1017 | HIMAGELIST ShellSmallIconList = 0;
|
---|
1018 | HIMAGELIST ShellBigIconList = 0;
|
---|
1019 |
|
---|
1020 |
|
---|
1021 | /*************************************************************************
|
---|
1022 | * SHELL32 LibMain
|
---|
1023 | *
|
---|
1024 | * NOTES
|
---|
1025 | * calling oleinitialize here breaks sone apps.
|
---|
1026 | */
|
---|
1027 |
|
---|
1028 | BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
---|
1029 | {
|
---|
1030 | TRACE("0x%x 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
|
---|
1031 |
|
---|
1032 | switch (fdwReason)
|
---|
1033 | {
|
---|
1034 | case DLL_PROCESS_ATTACH:
|
---|
1035 | shell32_RefCount++;
|
---|
1036 | if (shell32_hInstance) return TRUE;
|
---|
1037 |
|
---|
1038 | shell32_hInstance = hinstDLL;
|
---|
1039 | hComctl32 = GetModuleHandleA("COMCTL32.DLL");
|
---|
1040 | DisableThreadLibraryCalls(shell32_hInstance);
|
---|
1041 |
|
---|
1042 | if (!hComctl32)
|
---|
1043 | {
|
---|
1044 | ERR("P A N I C SHELL32 loading failed\n");
|
---|
1045 | return FALSE;
|
---|
1046 | }
|
---|
1047 |
|
---|
1048 | /* comctl32 */
|
---|
1049 | pDLLInitComctl=(void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
|
---|
1050 | pCOMCTL32_Alloc=(void*)GetProcAddress(hComctl32, (LPCSTR)71L);
|
---|
1051 | pCOMCTL32_Free=(void*)GetProcAddress(hComctl32, (LPCSTR)73L);
|
---|
1052 | #if 0
|
---|
1053 | lpDPA_Create=(void*)GetProcAddress(hComctl32, (LPCSTR)328L);
|
---|
1054 | lpDPA_Destroy=(void*)GetProcAddress(hComctl32, (LPCSTR)329L);
|
---|
1055 | lpDPA_GetPtr=(void*)GetProcAddress(hComctl32, (LPCSTR)332L);
|
---|
1056 | lpDPA_InsertPtr=(void*)GetProcAddress(hComctl32, (LPCSTR)334L);
|
---|
1057 | lpDPA_DeletePtr=(void*)GetProcAddress(hComctl32, (LPCSTR)336L);
|
---|
1058 | lpDPA_Sort=(void*)GetProcAddress(hComctl32, (LPCSTR)338L);
|
---|
1059 | lpDPA_Search=(void*)GetProcAddress(hComctl32, (LPCSTR)339L);
|
---|
1060 | lpCreateMRUListA=(void*)GetProcAddress(hComctl32, (LPCSTR)151L /*"CreateMRUListA"*/);
|
---|
1061 | lpFreeMRUListA=(void*)GetProcAddress(hComctl32, (LPCSTR)152L /*"FreeMRUList"*/);
|
---|
1062 | lpAddMRUData=(void*)GetProcAddress(hComctl32, (LPCSTR)167L /*"AddMRUData"*/);
|
---|
1063 | lpFindMRUData=(void*)GetProcAddress(hComctl32, (LPCSTR)169L /*"FindMRUData"*/);
|
---|
1064 | lpEnumMRUListA=(void*)GetProcAddress(hComctl32, (LPCSTR)154L /*"EnumMRUListA"*/);
|
---|
1065 | #endif
|
---|
1066 | /* initialize the common controls */
|
---|
1067 | if (pDLLInitComctl)
|
---|
1068 | {
|
---|
1069 | pDLLInitComctl(NULL);
|
---|
1070 | }
|
---|
1071 | InitCommonControlsEx(NULL);
|
---|
1072 |
|
---|
1073 | SIC_Initialize();
|
---|
1074 | SYSTRAY_Init();
|
---|
1075 | InitChangeNotifications();
|
---|
1076 | SHInitRestricted(NULL, NULL);
|
---|
1077 | break;
|
---|
1078 |
|
---|
1079 | case DLL_THREAD_ATTACH:
|
---|
1080 | shell32_RefCount++;
|
---|
1081 | break;
|
---|
1082 |
|
---|
1083 | case DLL_THREAD_DETACH:
|
---|
1084 | shell32_RefCount--;
|
---|
1085 | break;
|
---|
1086 |
|
---|
1087 | case DLL_PROCESS_DETACH:
|
---|
1088 | shell32_RefCount--;
|
---|
1089 |
|
---|
1090 | if ( !shell32_RefCount )
|
---|
1091 | {
|
---|
1092 | shell32_hInstance = 0;
|
---|
1093 |
|
---|
1094 | if (pdesktopfolder)
|
---|
1095 | {
|
---|
1096 | IShellFolder_Release(pdesktopfolder);
|
---|
1097 | pdesktopfolder = NULL;
|
---|
1098 | }
|
---|
1099 |
|
---|
1100 | SIC_Destroy();
|
---|
1101 | FreeChangeNotifications();
|
---|
1102 |
|
---|
1103 | /* this one is here to check if AddRef/Release is balanced */
|
---|
1104 | if (shell32_ObjCount)
|
---|
1105 | {
|
---|
1106 | WARN("leaving with %lu objects left (memory leak)\n", shell32_ObjCount);
|
---|
1107 | }
|
---|
1108 | }
|
---|
1109 |
|
---|
1110 | TRACE("refcount=%u objcount=%lu \n", shell32_RefCount, shell32_ObjCount);
|
---|
1111 | break;
|
---|
1112 | }
|
---|
1113 | return TRUE;
|
---|
1114 | }
|
---|
1115 |
|
---|
1116 | /*************************************************************************
|
---|
1117 | * DllInstall [SHELL32.202]
|
---|
1118 | *
|
---|
1119 | * PARAMETERS
|
---|
1120 | *
|
---|
1121 | * BOOL bInstall - TRUE for install, FALSE for uninstall
|
---|
1122 | * LPCWSTR pszCmdLine - command line (unused by shell32?)
|
---|
1123 | */
|
---|
1124 |
|
---|
1125 | HRESULT WINAPI SHELL32_DllInstall(BOOL bInstall, LPCWSTR cmdline)
|
---|
1126 | {
|
---|
1127 | FIXME("(%s, %s): stub!\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
|
---|
1128 |
|
---|
1129 | return S_OK; /* indicate success */
|
---|
1130 | }
|
---|
1131 |
|
---|
1132 | /***********************************************************************
|
---|
1133 | * DllCanUnloadNow (SHELL32.@)
|
---|
1134 | */
|
---|
1135 | HRESULT WINAPI SHELL32_DllCanUnloadNow(void)
|
---|
1136 | {
|
---|
1137 | FIXME("(void): stub\n");
|
---|
1138 |
|
---|
1139 | return S_FALSE;
|
---|
1140 | }
|
---|