1 | /* $Id: shell32_main.cpp,v 1.7 2000-01-09 19:23:09 phaller Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Win32 SHELL32 for OS/2
|
---|
5 | *
|
---|
6 | * Copyright 1999 Patrick Haller (haller@zebra.fh-weingarten.de)
|
---|
7 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
8 | *
|
---|
9 | * Shell basics
|
---|
10 | *
|
---|
11 | * 1998 Marcus Meissner
|
---|
12 | * 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
|
---|
13 | */
|
---|
14 |
|
---|
15 | /*****************************************************************************
|
---|
16 | * Includes *
|
---|
17 | *****************************************************************************/
|
---|
18 |
|
---|
19 | #include <odin.h>
|
---|
20 | #include <odinwrap.h>
|
---|
21 | #include <os2sel.h>
|
---|
22 |
|
---|
23 | #include <stdlib.h>
|
---|
24 | #include <string.h>
|
---|
25 |
|
---|
26 | #define ICOM_CINTERFACE 1
|
---|
27 | #define CINTERFACE 1
|
---|
28 |
|
---|
29 | #include "wine/winuser16.h"
|
---|
30 | #include "winerror.h"
|
---|
31 | #include "heap.h"
|
---|
32 | #include "resource.h"
|
---|
33 | #include "dlgs.h"
|
---|
34 | //#include "ldt.h"
|
---|
35 | #include "sysmetrics.h"
|
---|
36 | #include "debugtools.h"
|
---|
37 | #include "winreg.h"
|
---|
38 | #include "authors.h"
|
---|
39 | #include "winversion.h"
|
---|
40 |
|
---|
41 | #include "shellapi.h"
|
---|
42 | #include "pidl.h"
|
---|
43 |
|
---|
44 | #include "shlobj.h"
|
---|
45 | #include "shell32_main.h"
|
---|
46 | #include "shlguid.h"
|
---|
47 | #include "wine/undocshell.h"
|
---|
48 | #include "shpolicy.h"
|
---|
49 |
|
---|
50 | #include <heapstring.h>
|
---|
51 | #include <misc.h>
|
---|
52 |
|
---|
53 |
|
---|
54 | /*****************************************************************************
|
---|
55 | * Local Variables *
|
---|
56 | *****************************************************************************/
|
---|
57 |
|
---|
58 | ODINDEBUGCHANNEL(SHELL32-MAIN)
|
---|
59 |
|
---|
60 |
|
---|
61 | #define MORE_DEBUG 1
|
---|
62 |
|
---|
63 |
|
---|
64 | /*************************************************************************
|
---|
65 | * CommandLineToArgvW [SHELL32.7]
|
---|
66 | */
|
---|
67 |
|
---|
68 | ODINFUNCTION2(LPWSTR*, CommandLineToArgvW, LPWSTR, cmdline,
|
---|
69 | LPDWORD, numargs)
|
---|
70 | { LPWSTR *argv,s,t;
|
---|
71 | int i;
|
---|
72 |
|
---|
73 | /* to get writeable copy */
|
---|
74 | cmdline = HEAP_strdupW( GetProcessHeap(), 0, cmdline);
|
---|
75 | s=cmdline;i=0;
|
---|
76 | while (*s)
|
---|
77 | { /* space */
|
---|
78 | if (*s==0x0020)
|
---|
79 | { i++;
|
---|
80 | s++;
|
---|
81 | while (*s && *s==0x0020)
|
---|
82 | s++;
|
---|
83 | continue;
|
---|
84 | }
|
---|
85 | s++;
|
---|
86 | }
|
---|
87 | argv=(LPWSTR*)HeapAlloc( GetProcessHeap(), 0, sizeof(LPWSTR)*(i+1) );
|
---|
88 | s=t=cmdline;
|
---|
89 | i=0;
|
---|
90 | while (*s)
|
---|
91 | { if (*s==0x0020)
|
---|
92 | { *s=0;
|
---|
93 | argv[i++]=HEAP_strdupW( GetProcessHeap(), 0, t );
|
---|
94 | *s=0x0020;
|
---|
95 | while (*s && *s==0x0020)
|
---|
96 | s++;
|
---|
97 | if (*s)
|
---|
98 | t=s+1;
|
---|
99 | else
|
---|
100 | t=s;
|
---|
101 | continue;
|
---|
102 | }
|
---|
103 | s++;
|
---|
104 | }
|
---|
105 | if (*t)
|
---|
106 | argv[i++]=(LPWSTR)HEAP_strdupW( GetProcessHeap(), 0, t );
|
---|
107 |
|
---|
108 | HeapFree( GetProcessHeap(), 0, cmdline );
|
---|
109 | argv[i]=NULL;
|
---|
110 | *numargs=i;
|
---|
111 | return argv;
|
---|
112 | }
|
---|
113 |
|
---|
114 | /*************************************************************************
|
---|
115 | * Control_RunDLL [SHELL32.12]
|
---|
116 | *
|
---|
117 | * Wild speculation in the following!
|
---|
118 | *
|
---|
119 | * http://premium.microsoft.com/msdn/library/techart/msdn193.htm
|
---|
120 | */
|
---|
121 |
|
---|
122 | ODINPROCEDURE4(Control_RunDLL,HWND, hwnd,
|
---|
123 | LPCVOID,code,
|
---|
124 | LPCSTR, cmd,
|
---|
125 | DWORD, arg4)
|
---|
126 | {
|
---|
127 | dprintf(("SHELL32:Shell32_Main:Control_RunDLL not implemented.\n"));
|
---|
128 | }
|
---|
129 |
|
---|
130 | /*************************************************************************
|
---|
131 | * SHGetFileInfoA [SHELL32.254]
|
---|
132 | */
|
---|
133 |
|
---|
134 | ODINFUNCTION5(DWORD, SHGetFileInfoA, LPCSTR, path,
|
---|
135 | DWORD, dwFileAttributes,
|
---|
136 | SHFILEINFOA*, psfi,
|
---|
137 | UINT, sizeofpsfi,
|
---|
138 | UINT, flags )
|
---|
139 | {
|
---|
140 | char szLoaction[MAX_PATH];
|
---|
141 | int iIndex;
|
---|
142 | DWORD ret = TRUE, dwAttributes = 0;
|
---|
143 | IShellFolder * psfParent = NULL;
|
---|
144 | IExtractIcon * pei = NULL;
|
---|
145 | LPITEMIDLIST pidlLast = NULL, pidl = NULL;
|
---|
146 | HRESULT hr = S_OK;
|
---|
147 |
|
---|
148 | dprintf(("SHELL32:Shell32_main:SHGetFileInfoA (%s,0x%lx,%p,0x%x,0x%x)\n",
|
---|
149 | (flags & SHGFI_PIDL)? "pidl" : path, dwFileAttributes, psfi, sizeofpsfi, flags));
|
---|
150 |
|
---|
151 | #ifdef MORE_DEBUG
|
---|
152 | ZeroMemory(psfi, sizeof(SHFILEINFOA));
|
---|
153 | #endif
|
---|
154 | if ((flags & SHGFI_USEFILEATTRIBUTES) && (flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
|
---|
155 | return FALSE;
|
---|
156 |
|
---|
157 | /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES in not specified
|
---|
158 | the pidl functions fail on not existing file names */
|
---|
159 | if (flags & SHGFI_PIDL)
|
---|
160 | {
|
---|
161 | pidl = (LPCITEMIDLIST) path;
|
---|
162 | if (!pidl )
|
---|
163 | {
|
---|
164 | dprintf(("pidl is null!\n"));
|
---|
165 | return FALSE;
|
---|
166 | }
|
---|
167 | }
|
---|
168 | else if (!(flags & SHGFI_USEFILEATTRIBUTES))
|
---|
169 | {
|
---|
170 | hr = SHILCreateFromPathA ( path, &pidl, &dwAttributes);
|
---|
171 | /* note: the attributes in ISF::ParseDisplayName are not implemented */
|
---|
172 | }
|
---|
173 |
|
---|
174 | /* get the parent shellfolder */
|
---|
175 | if (pidl)
|
---|
176 | {
|
---|
177 | hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent, &pidlLast);
|
---|
178 | }
|
---|
179 |
|
---|
180 | /* get the attributes of the child */
|
---|
181 | if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES))
|
---|
182 | {
|
---|
183 | if (!(flags & SHGFI_ATTR_SPECIFIED))
|
---|
184 | {
|
---|
185 | psfi->dwAttributes = 0xffffffff;
|
---|
186 | }
|
---|
187 | IShellFolder_GetAttributesOf(psfParent, 1 , &pidlLast, &(psfi->dwAttributes));
|
---|
188 | }
|
---|
189 |
|
---|
190 | /* get the displayname */
|
---|
191 | if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME))
|
---|
192 | {
|
---|
193 | if (flags & SHGFI_USEFILEATTRIBUTES)
|
---|
194 | {
|
---|
195 | strcpy (psfi->szDisplayName, PathFindFilenameA(path));
|
---|
196 | }
|
---|
197 | else
|
---|
198 | {
|
---|
199 | STRRET str;
|
---|
200 | hr = IShellFolder_GetDisplayNameOf(psfParent, pidlLast, SHGDN_INFOLDER, &str);
|
---|
201 | StrRetToStrNA (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
|
---|
202 | }
|
---|
203 | }
|
---|
204 |
|
---|
205 | /* get the type name */
|
---|
206 | if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
|
---|
207 | {
|
---|
208 | _ILGetFileType(pidlLast, psfi->szTypeName, 80);
|
---|
209 | }
|
---|
210 |
|
---|
211 | /* ### icons ###*/
|
---|
212 | if (flags & SHGFI_LINKOVERLAY)
|
---|
213 | dprintf(("SHELL32:Shell32_main:SHGetFileInfoA set icon to link, stub\n"));
|
---|
214 |
|
---|
215 | if (flags & SHGFI_OPENICON)
|
---|
216 | dprintf(("SHELL32:Shell32_main:SHGetFileInfoA set to open icon, stub\n"));
|
---|
217 |
|
---|
218 | if (flags & SHGFI_SELECTED)
|
---|
219 | dprintf(("SHELL32:Shell32_main:SHGetFileInfoA set icon to selected, stub\n"));
|
---|
220 |
|
---|
221 | if (flags & SHGFI_SHELLICONSIZE)
|
---|
222 | dprintf(("SHELL32:Shell32_main:SHGetFileInfoA set icon to shell size, stub\n"));
|
---|
223 |
|
---|
224 | /* get the iconlocation */
|
---|
225 | if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
|
---|
226 | {
|
---|
227 | UINT uDummy,uFlags;
|
---|
228 | hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1, &pidlLast, &IID_IExtractIconA, &uDummy, (LPVOID*)&pei);
|
---|
229 |
|
---|
230 | if (SUCCEEDED(hr))
|
---|
231 | {
|
---|
232 | hr = IExtractIconA_GetIconLocation(pei, 0, szLoaction, MAX_PATH, &iIndex, &uFlags);
|
---|
233 | /* fixme what to do with the index? */
|
---|
234 |
|
---|
235 | if(uFlags != GIL_NOTFILENAME)
|
---|
236 | strcpy (psfi->szDisplayName, szLoaction);
|
---|
237 | else
|
---|
238 | ret = FALSE;
|
---|
239 |
|
---|
240 | IExtractIconA_Release(pei);
|
---|
241 | }
|
---|
242 | }
|
---|
243 |
|
---|
244 | /* get icon index (or load icon)*/
|
---|
245 | if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))
|
---|
246 | {
|
---|
247 | if (flags & SHGFI_USEFILEATTRIBUTES)
|
---|
248 | {
|
---|
249 | char sTemp [MAX_PATH];
|
---|
250 | char * szExt;
|
---|
251 | DWORD dwNr=0;
|
---|
252 |
|
---|
253 | lstrcpynA(sTemp, path, MAX_PATH);
|
---|
254 | szExt = (LPSTR) PathFindExtensionA(sTemp);
|
---|
255 | if( szExt && HCR_MapTypeToValue(szExt, sTemp, MAX_PATH, TRUE)
|
---|
256 | && HCR_GetDefaultIcon(sTemp, sTemp, MAX_PATH, &dwNr))
|
---|
257 | {
|
---|
258 | if (!strcmp("%1",sTemp)) /* icon is in the file */
|
---|
259 | {
|
---|
260 | strcpy(sTemp, path);
|
---|
261 | }
|
---|
262 | /* FIXME: if sTemp contains a valid filename, get the icon
|
---|
263 | from there, index is in dwNr
|
---|
264 | */
|
---|
265 | psfi->iIcon = 2;
|
---|
266 | }
|
---|
267 | else /* default icon */
|
---|
268 | {
|
---|
269 | psfi->iIcon = 0;
|
---|
270 | }
|
---|
271 | }
|
---|
272 | else
|
---|
273 | {
|
---|
274 | if (!(PidlToSicIndex(psfParent, pidlLast, (flags && SHGFI_LARGEICON), (PUINT)&(psfi->iIcon))))
|
---|
275 | {
|
---|
276 | ret = FALSE;
|
---|
277 | }
|
---|
278 | }
|
---|
279 | if (ret)
|
---|
280 | {
|
---|
281 | ret = (DWORD) ((flags && SHGFI_LARGEICON) ? ShellBigIconList : ShellSmallIconList);
|
---|
282 | }
|
---|
283 | }
|
---|
284 |
|
---|
285 | /* icon handle */
|
---|
286 | if (SUCCEEDED(hr) && (flags & SHGFI_ICON))
|
---|
287 | psfi->hIcon = pImageList_GetIcon((flags && SHGFI_LARGEICON) ? ShellBigIconList:ShellSmallIconList, psfi->iIcon, ILD_NORMAL);
|
---|
288 |
|
---|
289 |
|
---|
290 | if (flags & SHGFI_EXETYPE)
|
---|
291 | dprintf(("SHELL32:Shell32_main:SHGetFileInfoA type of executable, stub\n"));
|
---|
292 |
|
---|
293 | if (flags & (SHGFI_UNKNOWN1 | SHGFI_UNKNOWN2 | SHGFI_UNKNOWN3))
|
---|
294 | dprintf(("SHELL32:Shell32_main:SHGetFileInfoA unknown attribute!\n"));
|
---|
295 |
|
---|
296 | if (psfParent)
|
---|
297 | IShellFolder_Release(psfParent);
|
---|
298 |
|
---|
299 | if (hr != S_OK)
|
---|
300 | ret = FALSE;
|
---|
301 |
|
---|
302 | #ifdef MORE_DEBUG
|
---|
303 | TRACE_(shell) ("icon=0x%08x index=0x%08x attr=0x%08lx name=%s type=%s\n",
|
---|
304 | psfi->hIcon, psfi->iIcon, psfi->dwAttributes, psfi->szDisplayName, psfi->szTypeName);
|
---|
305 | #endif
|
---|
306 | return ret;
|
---|
307 | }
|
---|
308 |
|
---|
309 | /*************************************************************************
|
---|
310 | * SHGetFileInfoW [SHELL32.255]
|
---|
311 | */
|
---|
312 |
|
---|
313 | ODINFUNCTION5(DWORD, SHGetFileInfoW, LPCWSTR, path,
|
---|
314 | DWORD, dwFileAttributes,
|
---|
315 | SHFILEINFOW*, psfi,
|
---|
316 | UINT, sizeofpsfi,
|
---|
317 | UINT, flags)
|
---|
318 | {
|
---|
319 | dprintf(("SHELL32:Shell32_main:SHGetFileInfoW not implemented\n"));
|
---|
320 | return 0;
|
---|
321 | }
|
---|
322 |
|
---|
323 |
|
---|
324 | /*************************************************************************
|
---|
325 | * ExtractIconA [SHELL32.133]
|
---|
326 | */
|
---|
327 |
|
---|
328 | ODINFUNCTION3(HICON, ExtractIconA, HINSTANCE, hInstance,
|
---|
329 | LPCSTR, lpszExeFileName,
|
---|
330 | UINT, nIconIndex )
|
---|
331 | {
|
---|
332 | dprintf(("SHELL32:Shell32_Main:ExtractIconA not implemented.\n"));
|
---|
333 |
|
---|
334 | #if 0
|
---|
335 | //@@@PH
|
---|
336 | HGLOBAL handle = InternalExtractIconA(hInstance,lpszExeFileName,nIconIndex, 1);
|
---|
337 | TRACE_(shell)("\n");
|
---|
338 | if( handle )
|
---|
339 | {
|
---|
340 | HICON* ptr = (HICON*)GlobalLock(handle);
|
---|
341 | HICON hIcon = *ptr;
|
---|
342 |
|
---|
343 | GlobalFree(handle);
|
---|
344 | return hIcon;
|
---|
345 | }
|
---|
346 | #endif
|
---|
347 | return 0;
|
---|
348 | }
|
---|
349 |
|
---|
350 | /*************************************************************************
|
---|
351 | * ExtractIconW [SHELL32.180]
|
---|
352 | */
|
---|
353 |
|
---|
354 | ODINFUNCTION3(HICON, ExtractIconW, HINSTANCE, hInstance,
|
---|
355 | LPCWSTR, lpszExeFileName,
|
---|
356 | UINT, nIconIndex )
|
---|
357 | { LPSTR exefn;
|
---|
358 | HICON ret;
|
---|
359 |
|
---|
360 | exefn = HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName);
|
---|
361 | ret = ExtractIconA(hInstance,exefn,nIconIndex);
|
---|
362 |
|
---|
363 | HeapFree(GetProcessHeap(),0,exefn);
|
---|
364 | return ret;
|
---|
365 | }
|
---|
366 |
|
---|
367 | /*************************************************************************
|
---|
368 | * FindExecutableA [SHELL32.184]
|
---|
369 | */
|
---|
370 |
|
---|
371 | ODINFUNCTION3(HINSTANCE, FindExecutableA, LPCSTR, lpFile,
|
---|
372 | LPCSTR, lpDirectory,
|
---|
373 | LPSTR, lpResult )
|
---|
374 | { HINSTANCE retval=31; /* default - 'No association was found' */
|
---|
375 | char old_dir[1024];
|
---|
376 |
|
---|
377 | dprintf(("File %s, Dir %s\n",
|
---|
378 | (lpFile != NULL?lpFile:"-"),
|
---|
379 | (lpDirectory != NULL?lpDirectory:"-")));
|
---|
380 |
|
---|
381 | lpResult[0]='\0'; /* Start off with an empty return string */
|
---|
382 |
|
---|
383 | /* trap NULL parameters on entry */
|
---|
384 | if (( lpFile == NULL ) || ( lpResult == NULL ))
|
---|
385 | { /* FIXME - should throw a warning, perhaps! */
|
---|
386 | return 2; /* File not found. Close enough, I guess. */
|
---|
387 | }
|
---|
388 |
|
---|
389 | if (lpDirectory)
|
---|
390 | { GetCurrentDirectoryA( sizeof(old_dir), old_dir );
|
---|
391 | SetCurrentDirectoryA( lpDirectory );
|
---|
392 | }
|
---|
393 |
|
---|
394 | retval = SHELL_FindExecutable( lpFile, "open", lpResult );
|
---|
395 |
|
---|
396 | dprintf(("returning %s\n", lpResult));
|
---|
397 | if (lpDirectory)
|
---|
398 | SetCurrentDirectoryA( old_dir );
|
---|
399 | return retval;
|
---|
400 | }
|
---|
401 |
|
---|
402 | /*************************************************************************
|
---|
403 | * FindExecutableW [SHELL32.219]
|
---|
404 | */
|
---|
405 | ODINFUNCTION3(HINSTANCE, FindExecutableW, LPCWSTR, lpFile,
|
---|
406 | LPCWSTR, lpDirectory,
|
---|
407 | LPWSTR, lpResult )
|
---|
408 | {
|
---|
409 | dprintf(("FindExecutableW not implemented.\n"));
|
---|
410 | return 31; /* default - 'No association was found' */
|
---|
411 | }
|
---|
412 |
|
---|
413 | typedef struct
|
---|
414 | { LPCSTR szApp;
|
---|
415 | LPCSTR szOtherStuff;
|
---|
416 | HICON hIcon;
|
---|
417 | } ABOUT_INFO;
|
---|
418 |
|
---|
419 | #define IDC_STATIC_TEXT 100
|
---|
420 | #define IDC_LISTBOX 99
|
---|
421 | #define IDC_WINE_TEXT 98
|
---|
422 |
|
---|
423 | #define DROP_FIELD_TOP (-15)
|
---|
424 | #define DROP_FIELD_HEIGHT 15
|
---|
425 |
|
---|
426 | static BOOL __get_dropline( HWND hWnd, LPRECT lprect )
|
---|
427 | { HWND hWndCtl = GetDlgItem(hWnd, IDC_WINE_TEXT);
|
---|
428 | if( hWndCtl )
|
---|
429 | { GetWindowRect( hWndCtl, lprect );
|
---|
430 | MapWindowPoints( 0, hWnd, (LPPOINT)lprect, 2 );
|
---|
431 | lprect->bottom = (lprect->top += DROP_FIELD_TOP);
|
---|
432 | return TRUE;
|
---|
433 | }
|
---|
434 | return FALSE;
|
---|
435 | }
|
---|
436 |
|
---|
437 | /*************************************************************************
|
---|
438 | * SHAppBarMessage32 [SHELL32.207]
|
---|
439 | */
|
---|
440 |
|
---|
441 | ODINFUNCTION2(UINT, SHAppBarMessage, DWORD, msg,
|
---|
442 | PAPPBARDATA, data)
|
---|
443 | {
|
---|
444 | dprintf(("SHELL32:Shell32_Main:SHAppBarMessage not implemented.\n"));
|
---|
445 |
|
---|
446 | switch (msg)
|
---|
447 | { case ABM_GETSTATE:
|
---|
448 | return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
|
---|
449 | case ABM_GETTASKBARPOS:
|
---|
450 | /* fake a taskbar on the bottom of the desktop */
|
---|
451 | { RECT rec;
|
---|
452 | GetWindowRect(GetDesktopWindow(), &rec);
|
---|
453 | rec.left = 0;
|
---|
454 | rec.top = rec.bottom - 2;
|
---|
455 | }
|
---|
456 | return TRUE;
|
---|
457 | case ABM_ACTIVATE:
|
---|
458 | case ABM_GETAUTOHIDEBAR:
|
---|
459 | case ABM_NEW:
|
---|
460 | case ABM_QUERYPOS:
|
---|
461 | case ABM_REMOVE:
|
---|
462 | case ABM_SETAUTOHIDEBAR:
|
---|
463 | case ABM_SETPOS:
|
---|
464 | case ABM_WINDOWPOSCHANGED:
|
---|
465 | return FALSE;
|
---|
466 | }
|
---|
467 | return 0;
|
---|
468 | }
|
---|
469 |
|
---|
470 | /*************************************************************************
|
---|
471 | * SHHelpShortcuts_RunDLL [SHELL32.224]
|
---|
472 | *
|
---|
473 | */
|
---|
474 |
|
---|
475 | ODINFUNCTION4(DWORD, SHHelpShortcuts_RunDLL, DWORD, dwArg1,
|
---|
476 | DWORD, dwArg2,
|
---|
477 | DWORD, dwArg3,
|
---|
478 | DWORD, dwArg4)
|
---|
479 | {
|
---|
480 | dprintf(("SHELL32:Shell32_Main:SHHelpShortcuts_RunDLL not implemented.\n"));
|
---|
481 | return 0;
|
---|
482 | }
|
---|
483 |
|
---|
484 | /*************************************************************************
|
---|
485 | * SHLoadInProc [SHELL32.225]
|
---|
486 | *
|
---|
487 | */
|
---|
488 |
|
---|
489 | ODINFUNCTION1(DWORD, SHLoadInProc, DWORD, dwArg1)
|
---|
490 | {
|
---|
491 | dprintf(("SHELL32:Shell32_Main:SHLoadInProc not implemented.\n"));
|
---|
492 | return 0;
|
---|
493 | }
|
---|
494 |
|
---|
495 |
|
---|
496 |
|
---|
497 | /*************************************************************************
|
---|
498 | * ShellExecuteA [SHELL32.245]
|
---|
499 | */
|
---|
500 |
|
---|
501 | ODINFUNCTION6(HINSTANCE, ShellExecuteA, HWND, hWnd,
|
---|
502 | LPCSTR, lpOperation,
|
---|
503 | LPCSTR, lpFile,
|
---|
504 | LPCSTR, lpParameters,
|
---|
505 | LPCSTR, lpDirectory,
|
---|
506 | INT, iShowCmd )
|
---|
507 | { HINSTANCE retval=31;
|
---|
508 | char old_dir[1024];
|
---|
509 | char cmd[256];
|
---|
510 |
|
---|
511 | if (lpFile==NULL) return 0; /* should not happen */
|
---|
512 | if (lpOperation==NULL) /* default is open */
|
---|
513 | lpOperation="open";
|
---|
514 |
|
---|
515 | if (lpDirectory)
|
---|
516 | { GetCurrentDirectoryA( sizeof(old_dir), old_dir );
|
---|
517 | SetCurrentDirectoryA( lpDirectory );
|
---|
518 | }
|
---|
519 |
|
---|
520 | retval = SHELL_FindExecutable( lpFile, lpOperation, cmd );
|
---|
521 |
|
---|
522 | if (retval > 32) /* Found */
|
---|
523 | {
|
---|
524 | if (lpParameters)
|
---|
525 | {
|
---|
526 | strcat(cmd," ");
|
---|
527 | strcat(cmd,lpParameters);
|
---|
528 | }
|
---|
529 |
|
---|
530 | dprintf(("starting %s\n",cmd));
|
---|
531 | retval = WinExec( cmd, iShowCmd );
|
---|
532 | }
|
---|
533 | if (lpDirectory)
|
---|
534 | SetCurrentDirectoryA( old_dir );
|
---|
535 | return retval;
|
---|
536 | }
|
---|
537 |
|
---|
538 |
|
---|
539 | /*************************************************************************
|
---|
540 | * ShellExecuteW [SHELL32.294]
|
---|
541 | * from shellapi.h
|
---|
542 | * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
|
---|
543 | * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
|
---|
544 | */
|
---|
545 |
|
---|
546 | ODINFUNCTION6(HINSTANCE, ShellExecuteW, HWND, hWnd,
|
---|
547 | LPCWSTR, lpOperation,
|
---|
548 | LPCWSTR, lpFile,
|
---|
549 | LPCWSTR, lpParameters,
|
---|
550 | LPCWSTR, lpDirectory,
|
---|
551 | INT, iShowCmd )
|
---|
552 | {
|
---|
553 | dprintf(("SHELL32:Shell32_Main:ShellExecuteW not implemented\n"));
|
---|
554 | return 0;
|
---|
555 | }
|
---|
556 |
|
---|
557 |
|
---|
558 | /*************************************************************************
|
---|
559 | * AboutDlgProc32 (internal)
|
---|
560 | */
|
---|
561 | BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
|
---|
562 | LPARAM lParam )
|
---|
563 | { HWND hWndCtl;
|
---|
564 | char Template[512], AppTitle[512];
|
---|
565 |
|
---|
566 | TRACE_(shell)("\n");
|
---|
567 |
|
---|
568 | switch(msg)
|
---|
569 | { case WM_INITDIALOG:
|
---|
570 | { ABOUT_INFO *info = (ABOUT_INFO *)lParam;
|
---|
571 | if (info)
|
---|
572 | { const char* const *pstr = SHELL_People;
|
---|
573 | SendDlgItemMessageA(hWnd, stc1, STM_SETICON,info->hIcon, 0);
|
---|
574 | GetWindowTextA( hWnd, Template, sizeof(Template) );
|
---|
575 | sprintf( AppTitle, Template, info->szApp );
|
---|
576 | SetWindowTextA( hWnd, AppTitle );
|
---|
577 | SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT),
|
---|
578 | info->szOtherStuff );
|
---|
579 | hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
|
---|
580 | SendMessageA( hWndCtl, WM_SETREDRAW, 0, 0 );
|
---|
581 | while (*pstr)
|
---|
582 | { SendMessageA( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)*pstr );
|
---|
583 | pstr++;
|
---|
584 | }
|
---|
585 | SendMessageA( hWndCtl, WM_SETREDRAW, 1, 0 );
|
---|
586 | }
|
---|
587 | }
|
---|
588 | return 1;
|
---|
589 |
|
---|
590 | case WM_PAINT:
|
---|
591 | { RECT rect;
|
---|
592 | PAINTSTRUCT ps;
|
---|
593 | HDC hDC = BeginPaint( hWnd, &ps );
|
---|
594 |
|
---|
595 | if( __get_dropline( hWnd, &rect ) ) {
|
---|
596 | SelectObject( hDC, GetStockObject( BLACK_PEN ) );
|
---|
597 | MoveToEx( hDC, rect.left, rect.top, NULL );
|
---|
598 | LineTo( hDC, rect.right, rect.bottom );
|
---|
599 | }
|
---|
600 | EndPaint( hWnd, &ps );
|
---|
601 | }
|
---|
602 | break;
|
---|
603 |
|
---|
604 | #if 0
|
---|
605 | // @@@PH turned off
|
---|
606 | case WM_LBTRACKPOINT:
|
---|
607 | hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
|
---|
608 | if( (INT)GetKeyState( VK_CONTROL ) < 0 )
|
---|
609 | { if( DragDetect( hWndCtl, *((LPPOINT)&lParam) ) )
|
---|
610 | { INT idx = SendMessageA( hWndCtl, LB_GETCURSEL, 0, 0 );
|
---|
611 | if( idx != -1 )
|
---|
612 | { INT length = SendMessageA( hWndCtl, LB_GETTEXTLEN, (WPARAM)idx, 0 );
|
---|
613 | HGLOBAL hMemObj = GlobalAlloc( GMEM_MOVEABLE, length + 1 );
|
---|
614 | char* pstr = (char*)GlobalLock( hMemObj );
|
---|
615 |
|
---|
616 | if( pstr )
|
---|
617 | { HCURSOR hCursor = LoadCursorA( 0, (LPCSTR)OCR_DRAGOBJECT );
|
---|
618 | SendMessageA( hWndCtl, LB_GETTEXT, (WPARAM)idx, (LPARAM)pstr );
|
---|
619 | SendMessageA( hWndCtl, LB_DELETESTRING, (WPARAM)idx, 0 );
|
---|
620 | UpdateWindow( hWndCtl );
|
---|
621 | //@@@PH DragObject16 experimentally replaced by DragObject
|
---|
622 | if( !DragObject(hWnd, hWnd, DRAGOBJ_DATA, hMemObj, hCursor) )
|
---|
623 | SendMessageA( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)pstr );
|
---|
624 | }
|
---|
625 | if( hMemObj )
|
---|
626 | GlobalFree( hMemObj );
|
---|
627 | }
|
---|
628 | }
|
---|
629 | }
|
---|
630 | break;
|
---|
631 |
|
---|
632 | case WM_QUERYDROPOBJECT:
|
---|
633 | if( wParam == 0 )
|
---|
634 | { LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
|
---|
635 | if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA )
|
---|
636 | { RECT rect;
|
---|
637 | if( __get_dropline( hWnd, &rect ) )
|
---|
638 | { POINT pt;
|
---|
639 | pt.x=lpDragInfo->pt.x;
|
---|
640 | pt.x=lpDragInfo->pt.y;
|
---|
641 | rect.bottom += DROP_FIELD_HEIGHT;
|
---|
642 | if( PtInRect( &rect, pt ) )
|
---|
643 | { SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
|
---|
644 | return TRUE;
|
---|
645 | }
|
---|
646 | }
|
---|
647 | }
|
---|
648 | }
|
---|
649 | break;
|
---|
650 |
|
---|
651 | case WM_DROPOBJECT:
|
---|
652 | if( wParam == hWnd )
|
---|
653 | { LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
|
---|
654 | if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA && lpDragInfo->hList )
|
---|
655 | { char* pstr = (char*)GlobalLock( (HGLOBAL)(lpDragInfo->hList) );
|
---|
656 | if( pstr )
|
---|
657 | { static char __appendix_str[] = " with";
|
---|
658 |
|
---|
659 | hWndCtl = GetDlgItem( hWnd, IDC_WINE_TEXT );
|
---|
660 | SendMessageA( hWndCtl, WM_GETTEXT, 512, (LPARAM)Template );
|
---|
661 | if( !strncmp( Template, "WINE", 4 ) )
|
---|
662 | SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT), Template );
|
---|
663 | else
|
---|
664 | { char* pch = Template + strlen(Template) - strlen(__appendix_str);
|
---|
665 | *pch = '\0';
|
---|
666 | SendMessageA( GetDlgItem(hWnd, IDC_LISTBOX), LB_ADDSTRING,
|
---|
667 | (WPARAM)-1, (LPARAM)Template );
|
---|
668 | }
|
---|
669 |
|
---|
670 | strcpy( Template, pstr );
|
---|
671 | strcat( Template, __appendix_str );
|
---|
672 | SetWindowTextA( hWndCtl, Template );
|
---|
673 | SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
|
---|
674 | return TRUE;
|
---|
675 | }
|
---|
676 | }
|
---|
677 | }
|
---|
678 | break;
|
---|
679 | #endif
|
---|
680 |
|
---|
681 |
|
---|
682 | case WM_COMMAND:
|
---|
683 | if (wParam == IDOK)
|
---|
684 | { EndDialog(hWnd, TRUE);
|
---|
685 | return TRUE;
|
---|
686 | }
|
---|
687 | break;
|
---|
688 | case WM_CLOSE:
|
---|
689 | EndDialog(hWnd, TRUE);
|
---|
690 | break;
|
---|
691 | }
|
---|
692 | return 0;
|
---|
693 | }
|
---|
694 |
|
---|
695 |
|
---|
696 | /*************************************************************************
|
---|
697 | * ShellAboutA [SHELL32.243]
|
---|
698 | */
|
---|
699 |
|
---|
700 | ODINFUNCTION4(INT,ShellAboutA, HWND, hWnd,
|
---|
701 | LPCSTR, szApp,
|
---|
702 | LPCSTR, szOtherStuff,
|
---|
703 | HICON, hIcon )
|
---|
704 | { ABOUT_INFO info;
|
---|
705 | HRSRC hRes;
|
---|
706 | LPVOID dlgTemplate;
|
---|
707 |
|
---|
708 | if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", RT_DIALOGA)))
|
---|
709 | return FALSE;
|
---|
710 | if(!(dlgTemplate = (LPVOID)LoadResource(shell32_hInstance, hRes)))
|
---|
711 | return FALSE;
|
---|
712 |
|
---|
713 | info.szApp = szApp;
|
---|
714 | info.szOtherStuff = szOtherStuff;
|
---|
715 | info.hIcon = hIcon;
|
---|
716 | if (!hIcon) info.hIcon = LoadIconA( 0, (LPCSTR)OIC_ODINICON );
|
---|
717 | return DialogBoxIndirectParamA( GetWindowLongA( hWnd, GWL_HINSTANCE ),
|
---|
718 | (DLGTEMPLATE*)dlgTemplate , hWnd, AboutDlgProc, (LPARAM)&info );
|
---|
719 | }
|
---|
720 |
|
---|
721 |
|
---|
722 | /*************************************************************************
|
---|
723 | * ShellAboutW [SHELL32.244]
|
---|
724 | */
|
---|
725 | ODINFUNCTION4(INT,ShellAboutW, HWND, hWnd,
|
---|
726 | LPCWSTR, szApp,
|
---|
727 | LPCWSTR, szOtherStuff,
|
---|
728 | HICON, hIcon )
|
---|
729 | { INT ret;
|
---|
730 | ABOUT_INFO info;
|
---|
731 | HRSRC hRes;
|
---|
732 | LPVOID dlgTemplate;
|
---|
733 |
|
---|
734 | if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", RT_DIALOGA)))
|
---|
735 | return FALSE;
|
---|
736 | if(!(dlgTemplate = (LPVOID)LoadResource(shell32_hInstance, hRes)))
|
---|
737 | return FALSE;
|
---|
738 |
|
---|
739 | info.szApp = HEAP_strdupWtoA( GetProcessHeap(), 0, szApp );
|
---|
740 | info.szOtherStuff = HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff );
|
---|
741 | info.hIcon = hIcon;
|
---|
742 | if (!hIcon) info.hIcon = LoadIconA( 0, (LPCSTR)OIC_ODINICON );
|
---|
743 | ret = DialogBoxIndirectParamA( GetWindowLongA( hWnd, GWL_HINSTANCE ),
|
---|
744 | (DLGTEMPLATE*)dlgTemplate, hWnd, AboutDlgProc, (LPARAM)&info );
|
---|
745 | HeapFree( GetProcessHeap(), 0, (LPSTR)info.szApp );
|
---|
746 | HeapFree( GetProcessHeap(), 0, (LPSTR)info.szOtherStuff );
|
---|
747 | return ret;
|
---|
748 | }
|
---|
749 |
|
---|
750 | /*************************************************************************
|
---|
751 | * Shell_NotifyIcon [SHELL32.297]
|
---|
752 | * FIXME
|
---|
753 | * This function is supposed to deal with the systray.
|
---|
754 | * Any ideas on how this is to be implimented?
|
---|
755 | */
|
---|
756 |
|
---|
757 | ODINFUNCTION2(BOOL, Shell_NotifyIconA, DWORD, dwMessage,
|
---|
758 | PNOTIFYICONDATAA, pnid )
|
---|
759 | {
|
---|
760 | dprintf(("SHELL32:Shell32_Main:Shell_NotifyIconA not implemented\n"));
|
---|
761 | return FALSE;
|
---|
762 | }
|
---|
763 |
|
---|
764 | /*************************************************************************
|
---|
765 | * Shell_NotifyIcon [SHELL32.?]
|
---|
766 | * FIXME
|
---|
767 | * This function is supposed to deal with the systray.
|
---|
768 | * Any ideas on how this is to be implimented?
|
---|
769 | */
|
---|
770 |
|
---|
771 | ODINFUNCTION2(BOOL, Shell_NotifyIconW, DWORD, dwMessage,
|
---|
772 | PNOTIFYICONDATAW, pnid )
|
---|
773 | {
|
---|
774 | dprintf(("SHELL32:Shell32_Main:Shell_NotifyIconA not implemented\n"));
|
---|
775 | return FALSE;
|
---|
776 | }
|
---|
777 |
|
---|
778 |
|
---|
779 | /*************************************************************************
|
---|
780 | * Shell_NotifyIcon [SHELL32.296]
|
---|
781 | * FIXME
|
---|
782 | * This function is supposed to deal with the systray.
|
---|
783 | * Any ideas on how this is to be implimented?
|
---|
784 | */
|
---|
785 |
|
---|
786 | BOOL WINAPI Shell_NotifyIcon(DWORD dwMessage, PNOTIFYICONDATAA pnid )
|
---|
787 | {
|
---|
788 | if (VERSION_OsIsUnicode())
|
---|
789 | return(Shell_NotifyIconW(dwMessage,(PNOTIFYICONDATAW)pnid));
|
---|
790 | else
|
---|
791 | return(Shell_NotifyIconA(dwMessage,pnid));
|
---|
792 | }
|
---|
793 |
|
---|
794 | /*************************************************************************
|
---|
795 | * FreeIconList
|
---|
796 | */
|
---|
797 |
|
---|
798 | ODINPROCEDURE1(FreeIconList,DWORD,dw)
|
---|
799 | {
|
---|
800 | dprintf(("SHELL32:Shell32_Main:FreeIconList not implemented.\n"));
|
---|
801 | }
|
---|
802 |
|
---|
803 | /***********************************************************************
|
---|
804 | * DllGetVersion [COMCTL32.25]
|
---|
805 | *
|
---|
806 | * Retrieves version information of the 'SHELL32.DLL'
|
---|
807 | *
|
---|
808 | * PARAMS
|
---|
809 | * pdvi [O] pointer to version information structure.
|
---|
810 | *
|
---|
811 | * RETURNS
|
---|
812 | * Success: S_OK
|
---|
813 | * Failure: E_INVALIDARG
|
---|
814 | *
|
---|
815 | * NOTES
|
---|
816 | * Returns version of a shell32.dll from IE4.01 SP1.
|
---|
817 | */
|
---|
818 |
|
---|
819 | ODINFUNCTION1(HRESULT, SHELL32_DllGetVersion, DLLVERSIONINFO*, pdvi)
|
---|
820 | {
|
---|
821 | if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
|
---|
822 | { dprintf(("wrong DLLVERSIONINFO size from app\n"));
|
---|
823 | return E_INVALIDARG;
|
---|
824 | }
|
---|
825 |
|
---|
826 | pdvi->dwMajorVersion = 4;
|
---|
827 | pdvi->dwMinorVersion = 72;
|
---|
828 | pdvi->dwBuildNumber = 3110;
|
---|
829 | pdvi->dwPlatformID = 1;
|
---|
830 |
|
---|
831 | dprintf(("%lu.%lu.%lu.%lu\n",
|
---|
832 | pdvi->dwMajorVersion, pdvi->dwMinorVersion,
|
---|
833 | pdvi->dwBuildNumber, pdvi->dwPlatformID));
|
---|
834 |
|
---|
835 | return S_OK;
|
---|
836 | }
|
---|
837 | /*************************************************************************
|
---|
838 | * global variables of the shell32.dll
|
---|
839 | * all are once per process
|
---|
840 | *
|
---|
841 | */
|
---|
842 | void (WINAPI* pDLLInitComctl)(LPVOID);
|
---|
843 | INT (WINAPI* pImageList_AddIcon) (HIMAGELIST himl, HICON hIcon);
|
---|
844 | INT (WINAPI* pImageList_ReplaceIcon) (HIMAGELIST, INT, HICON);
|
---|
845 | HIMAGELIST (WINAPI * pImageList_Create) (INT,INT,UINT,INT,INT);
|
---|
846 | BOOL (WINAPI* pImageList_Draw) (HIMAGELIST himl, int i, HDC hdcDest, int x, int y, UINT fStyle);
|
---|
847 | HICON (WINAPI * pImageList_GetIcon) (HIMAGELIST, INT, UINT);
|
---|
848 | INT (WINAPI* pImageList_GetImageCount)(HIMAGELIST);
|
---|
849 | COLORREF (WINAPI *pImageList_SetBkColor)(HIMAGELIST, COLORREF);
|
---|
850 |
|
---|
851 | LPVOID (WINAPI* pCOMCTL32_Alloc) (INT);
|
---|
852 | BOOL (WINAPI* pCOMCTL32_Free) (LPVOID);
|
---|
853 |
|
---|
854 | HDPA (WINAPI* pDPA_Create) (INT);
|
---|
855 | INT (WINAPI* pDPA_InsertPtr) (const HDPA, INT, LPVOID);
|
---|
856 | BOOL (WINAPI* pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM);
|
---|
857 | LPVOID (WINAPI* pDPA_GetPtr) (const HDPA, INT);
|
---|
858 | BOOL (WINAPI* pDPA_Destroy) (const HDPA);
|
---|
859 | INT (WINAPI *pDPA_Search) (const HDPA, LPVOID, INT, PFNDPACOMPARE, LPARAM, UINT);
|
---|
860 | LPVOID (WINAPI *pDPA_DeletePtr) (const HDPA hdpa, INT i);
|
---|
861 |
|
---|
862 | /* user32 */
|
---|
863 | HICON (WINAPI *pLookupIconIdFromDirectoryEx)(LPBYTE dir, BOOL bIcon, INT width, INT height, UINT cFlag);
|
---|
864 | HICON (WINAPI *pCreateIconFromResourceEx)(LPBYTE bits,UINT cbSize, BOOL bIcon, DWORD dwVersion, INT width, INT height,UINT cFlag);
|
---|
865 |
|
---|
866 | /* ole2 */
|
---|
867 | HRESULT (WINAPI* pOleInitialize)(LPVOID reserved);
|
---|
868 | void (WINAPI* pOleUninitialize)(void);
|
---|
869 | HRESULT (WINAPI* pDoDragDrop)(IDataObject* pDataObject, IDropSource * pDropSource, DWORD dwOKEffect, DWORD *pdwEffect);
|
---|
870 | HRESULT (WINAPI* pRegisterDragDrop)(HWND hwnd, IDropTarget* pDropTarget);
|
---|
871 | HRESULT (WINAPI* pRevokeDragDrop)(HWND hwnd);
|
---|
872 |
|
---|
873 | static HINSTANCE hComctl32;
|
---|
874 | static HINSTANCE hOle32;
|
---|
875 | static INT shell32_RefCount = 0;
|
---|
876 |
|
---|
877 | INT shell32_ObjCount = 0;
|
---|
878 | HINSTANCE shell32_hInstance = 0;
|
---|
879 | HIMAGELIST ShellSmallIconList = 0;
|
---|
880 | HIMAGELIST ShellBigIconList = 0;
|
---|
881 |
|
---|
882 | /*************************************************************************
|
---|
883 | * SHELL32 LibMain
|
---|
884 | *
|
---|
885 | * NOTES
|
---|
886 | * calling oleinitialize here breaks sone apps.
|
---|
887 | */
|
---|
888 |
|
---|
889 | static void Shell32ProcLoadHelper(LPVOID* pAddr,
|
---|
890 | HANDLE hModule,
|
---|
891 | LPCSTR lpstrName)
|
---|
892 | {
|
---|
893 | *pAddr = (void*)GetProcAddress(hModule,lpstrName);
|
---|
894 |
|
---|
895 | if (!pAddr)
|
---|
896 | dprintf(("Shell32: Shell32ProcLoadHelper(%08xh,%08xh,%s) failed!\n",
|
---|
897 | pAddr,
|
---|
898 | hModule,
|
---|
899 | lpstrName));
|
---|
900 | }
|
---|
901 |
|
---|
902 |
|
---|
903 | ODINFUNCTION3(BOOL, Shell32LibMain, HINSTANCE, hinstDLL,
|
---|
904 | DWORD, fdwReason,
|
---|
905 | LPVOID, fImpLoad)
|
---|
906 | {
|
---|
907 | HMODULE hUser32;
|
---|
908 |
|
---|
909 | switch (fdwReason)
|
---|
910 | {
|
---|
911 | case DLL_PROCESS_ATTACH:
|
---|
912 | shell32_RefCount++;
|
---|
913 | if (shell32_hInstance)
|
---|
914 | {
|
---|
915 | dprintf(("shell32.dll instantiated twice in one address space!\n"));
|
---|
916 | }
|
---|
917 | else
|
---|
918 | {
|
---|
919 | /* we only want to call this the first time shell32 is instantiated */
|
---|
920 | SHInitRestricted(NULL, NULL);
|
---|
921 | }
|
---|
922 |
|
---|
923 | shell32_hInstance = hinstDLL;
|
---|
924 |
|
---|
925 | hComctl32 = LoadLibraryA("COMCTL32.DLL");
|
---|
926 | hOle32 = LoadLibraryA("OLE32.DLL");
|
---|
927 | hUser32 = GetModuleHandleA("USER32");
|
---|
928 |
|
---|
929 | if (!hComctl32 || !hUser32 || !hOle32)
|
---|
930 | {
|
---|
931 | dprintf(("P A N I C SHELL32 loading failed\n"));
|
---|
932 | return FALSE;
|
---|
933 | }
|
---|
934 |
|
---|
935 | /* comctl32 */
|
---|
936 | Shell32ProcLoadHelper((LPVOID*)&pDLLInitComctl,hComctl32,"InitCommonControlsEx");
|
---|
937 | Shell32ProcLoadHelper((LPVOID*)&pImageList_Create,hComctl32,"ImageList_Create");
|
---|
938 | Shell32ProcLoadHelper((LPVOID*)&pImageList_AddIcon,hComctl32,"ImageList_AddIcon");
|
---|
939 | Shell32ProcLoadHelper((LPVOID*)&pImageList_ReplaceIcon,hComctl32,"ImageList_ReplaceIcon");
|
---|
940 | Shell32ProcLoadHelper((LPVOID*)&pImageList_GetIcon,hComctl32,"ImageList_GetIcon");
|
---|
941 | Shell32ProcLoadHelper((LPVOID*)&pImageList_GetImageCount,hComctl32,"ImageList_GetImageCount");
|
---|
942 | Shell32ProcLoadHelper((LPVOID*)&pImageList_Draw,hComctl32,"ImageList_Draw");
|
---|
943 | Shell32ProcLoadHelper((LPVOID*)&pImageList_SetBkColor,hComctl32,"ImageList_SetBkColor");
|
---|
944 | Shell32ProcLoadHelper((LPVOID*)&pCOMCTL32_Alloc,hComctl32, (LPCSTR)71L);
|
---|
945 | Shell32ProcLoadHelper((LPVOID*)&pCOMCTL32_Free,hComctl32, (LPCSTR)73L);
|
---|
946 | Shell32ProcLoadHelper((LPVOID*)&pDPA_Create,hComctl32, (LPCSTR)328L);
|
---|
947 | Shell32ProcLoadHelper((LPVOID*)&pDPA_Destroy,hComctl32, (LPCSTR)329L);
|
---|
948 | Shell32ProcLoadHelper((LPVOID*)&pDPA_GetPtr,hComctl32, (LPCSTR)332L);
|
---|
949 | Shell32ProcLoadHelper((LPVOID*)&pDPA_InsertPtr,hComctl32, (LPCSTR)334L);
|
---|
950 | Shell32ProcLoadHelper((LPVOID*)&pDPA_DeletePtr,hComctl32, (LPCSTR)336L);
|
---|
951 | Shell32ProcLoadHelper((LPVOID*)&pDPA_Sort,hComctl32, (LPCSTR)338L);
|
---|
952 | Shell32ProcLoadHelper((LPVOID*)&pDPA_Search,hComctl32, (LPCSTR)339L);
|
---|
953 | /* user32 */
|
---|
954 | Shell32ProcLoadHelper((LPVOID*)&pLookupIconIdFromDirectoryEx,hUser32,"LookupIconIdFromDirectoryEx");
|
---|
955 | Shell32ProcLoadHelper((LPVOID*)&pCreateIconFromResourceEx,hUser32,"CreateIconFromResourceEx");
|
---|
956 | /* ole2 */
|
---|
957 | Shell32ProcLoadHelper((LPVOID*)&pOleInitialize,hOle32,"OleInitialize");
|
---|
958 | Shell32ProcLoadHelper((LPVOID*)&pOleUninitialize,hOle32,"OleUninitialize");
|
---|
959 | Shell32ProcLoadHelper((LPVOID*)&pDoDragDrop,hOle32,"DoDragDrop");
|
---|
960 | Shell32ProcLoadHelper((LPVOID*)&pRegisterDragDrop,hOle32,"RegisterDragDrop");
|
---|
961 | Shell32ProcLoadHelper((LPVOID*)&pRevokeDragDrop,hOle32,"RevokeDragDrop");
|
---|
962 |
|
---|
963 | /* initialize the common controls */
|
---|
964 | if (pDLLInitComctl)
|
---|
965 | {
|
---|
966 | pDLLInitComctl(NULL);
|
---|
967 | }
|
---|
968 |
|
---|
969 | SIC_Initialize();
|
---|
970 |
|
---|
971 | break;
|
---|
972 |
|
---|
973 | case DLL_THREAD_ATTACH:
|
---|
974 | shell32_RefCount++;
|
---|
975 | break;
|
---|
976 |
|
---|
977 | case DLL_THREAD_DETACH:
|
---|
978 | shell32_RefCount--;
|
---|
979 | break;
|
---|
980 |
|
---|
981 | case DLL_PROCESS_DETACH:
|
---|
982 | shell32_RefCount--;
|
---|
983 |
|
---|
984 | if ( !shell32_RefCount )
|
---|
985 | {
|
---|
986 | shell32_hInstance = 0;
|
---|
987 |
|
---|
988 | if (pdesktopfolder)
|
---|
989 | {
|
---|
990 | IShellFolder_Release(pdesktopfolder);
|
---|
991 | pdesktopfolder = NULL;
|
---|
992 | }
|
---|
993 |
|
---|
994 | SIC_Destroy();
|
---|
995 |
|
---|
996 | /* this one is here to check if AddRef/Release is balanced */
|
---|
997 | if (shell32_ObjCount)
|
---|
998 | {
|
---|
999 | dprintf(("leaving with %u objects left (memory leak)\n", shell32_ObjCount));
|
---|
1000 | }
|
---|
1001 | }
|
---|
1002 |
|
---|
1003 | FreeLibrary(hOle32);
|
---|
1004 | FreeLibrary(hComctl32);
|
---|
1005 |
|
---|
1006 | dprintf(("refcount=%u objcount=%u \n", shell32_RefCount, shell32_ObjCount));
|
---|
1007 | break;
|
---|
1008 | }
|
---|
1009 | return TRUE;
|
---|
1010 | }
|
---|