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