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