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