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