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