- Timestamp:
- Nov 24, 2000, 2:19:12 PM (25 years ago)
- Location:
- trunk/src/shell32
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/shell32/folders.c
r4202 r4691 1 /* $Id: folders.c,v 1. 2 2000-09-07 18:13:50sandervl Exp $ */1 /* $Id: folders.c,v 1.3 2000-11-24 13:19:11 sandervl Exp $ */ 2 2 /* 3 * Copyright 1997Marcus Meissner4 * Copyright 1998Juergen Schmied3 * Copyright 1997 Marcus Meissner 4 * Copyright 1998 Juergen Schmied 5 5 * 6 6 */ … … 8 8 #define ICOM_CINTERFACE 1 9 9 #include <odin.h> 10 #include "shellicon.h" 10 11 #endif 11 12 … … 32 33 */ 33 34 34 typedef struct 35 { 36 DWORDref;37 ICOM_VTABLE(IPersistFile)*lpvtblPersistFile;38 LPITEMIDLISTpidl;35 typedef struct 36 { ICOM_VFIELD(IExtractIconA); 37 DWORD ref; 38 ICOM_VTABLE(IPersistFile)* lpvtblPersistFile; 39 LPITEMIDLIST pidl; 39 40 } IExtractIconAImpl; 40 41 … … 50 51 IExtractIconA* IExtractIconA_Constructor(LPCITEMIDLIST pidl) 51 52 { 52 53 54 55 56 57 58 59 60 61 62 63 64 53 IExtractIconAImpl* ei; 54 55 ei=(IExtractIconAImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IExtractIconAImpl)); 56 ei->ref=1; 57 ICOM_VTBL(ei) = &eivt; 58 ei->lpvtblPersistFile = &pfvt; 59 ei->pidl=ILClone(pidl); 60 61 pdump(pidl); 62 63 TRACE("(%p)\n",ei); 64 shell32_ObjCount++; 65 return (IExtractIconA *)ei; 65 66 } 66 67 /************************************************************************** … … 69 70 static HRESULT WINAPI IExtractIconA_fnQueryInterface( IExtractIconA * iface, REFIID riid, LPVOID *ppvObj) 70 71 { 71 72 73 74 75 76 77 if(IsEqualIID(riid, &IID_IUnknown))/*IUnknown*/78 { *ppvObj = This; 79 80 else if(IsEqualIID(riid, &IID_IPersistFile))/*IExtractIcon*/81 82 83 else if(IsEqualIID(riid, &IID_IExtractIconA))/*IExtractIcon*/84 85 86 87 88 { IExtractIconA_AddRef((IExtractIconA*) *ppvObj); 89 90 91 92 93 72 ICOM_THIS(IExtractIconAImpl,iface); 73 74 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 75 76 *ppvObj = NULL; 77 78 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 79 { *ppvObj = This; 80 } 81 else if(IsEqualIID(riid, &IID_IPersistFile)) /*IExtractIcon*/ 82 { *ppvObj = (IPersistFile*)&(This->lpvtblPersistFile); 83 } 84 else if(IsEqualIID(riid, &IID_IExtractIconA)) /*IExtractIcon*/ 85 { *ppvObj = (IExtractIconA*)This; 86 } 87 88 if(*ppvObj) 89 { IExtractIconA_AddRef((IExtractIconA*) *ppvObj); 90 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 91 return S_OK; 92 } 93 TRACE("-- Interface: E_NOINTERFACE\n"); 94 return E_NOINTERFACE; 94 95 } 95 96 … … 99 100 static ULONG WINAPI IExtractIconA_fnAddRef(IExtractIconA * iface) 100 101 { 101 102 103 104 105 106 107 102 ICOM_THIS(IExtractIconAImpl,iface); 103 104 TRACE("(%p)->(count=%lu)\n",This, This->ref ); 105 106 shell32_ObjCount++; 107 108 return ++(This->ref); 108 109 } 109 110 /************************************************************************** … … 112 113 static ULONG WINAPI IExtractIconA_fnRelease(IExtractIconA * iface) 113 114 { 114 115 116 117 118 119 120 if (!--(This->ref)) 121 122 123 124 125 126 115 ICOM_THIS(IExtractIconAImpl,iface); 116 117 TRACE("(%p)->()\n",This); 118 119 shell32_ObjCount--; 120 121 if (!--(This->ref)) 122 { TRACE(" destroying IExtractIcon(%p)\n",This); 123 SHFree(This->pidl); 124 HeapFree(GetProcessHeap(),0,This); 125 return 0; 126 } 127 return This->ref; 127 128 } 128 129 /************************************************************************** … … 132 133 */ 133 134 static HRESULT WINAPI IExtractIconA_fnGetIconLocation( 134 IExtractIconA * iface, 135 UINT uFlags, 136 LPSTR szIconFile, 137 UINT cchMax, 138 int * piIndex, 139 UINT * pwFlags) 140 { 141 ICOM_THIS(IExtractIconAImpl,iface); 142 143 char sTemp[MAX_PATH]; 144 DWORD dwNr; 145 GUID const * riid; 146 LPITEMIDLIST pSimplePidl = ILFindLastID(This->pidl); 147 148 TRACE("(%p) (flags=%u %p %u %p %p)\n", This, uFlags, szIconFile, cchMax, piIndex, pwFlags); 149 150 if (pwFlags) 151 *pwFlags = 0; 152 153 if (_ILIsDesktop(pSimplePidl)) 154 { 155 lstrcpynA(szIconFile, "shell32.dll", cchMax); 156 *piIndex = 34; 157 } 158 159 /* my computer and other shell extensions */ 160 else if ( (riid = _ILGetGUIDPointer(pSimplePidl)) ) 161 { 162 char xriid[50]; 135 IExtractIconA * iface, 136 UINT uFlags, 137 LPSTR szIconFile, 138 UINT cchMax, 139 int * piIndex, 140 UINT * pwFlags) 141 { 142 ICOM_THIS(IExtractIconAImpl,iface); 143 144 char sTemp[MAX_PATH]; 145 DWORD dwNr; 146 GUID const * riid; 147 LPITEMIDLIST pSimplePidl = ILFindLastID(This->pidl); 148 149 TRACE("(%p) (flags=%u %p %u %p %p)\n", This, uFlags, szIconFile, cchMax, piIndex, pwFlags); 150 151 if (pwFlags) 152 *pwFlags = 0; 153 154 if (_ILIsDesktop(pSimplePidl)) 155 { 156 lstrcpynA(szIconFile, "shell32.dll", cchMax); 157 #ifdef __WIN32OS2__ 158 *piIndex = SHLICON_DESKTOP; 159 #else 160 *piIndex = 34; 161 #endif 162 } 163 164 /* my computer and other shell extensions */ 165 else if ( (riid = _ILGetGUIDPointer(pSimplePidl)) ) 166 { 167 char xriid[50]; 163 168 sprintf( xriid, "CLSID\\{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", 164 169 riid->Data1, riid->Data2, riid->Data3, … … 166 171 riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7] ); 167 172 168 if (HCR_GetDefaultIcon(xriid, sTemp, MAX_PATH, &dwNr)) 169 { 170 lstrcpynA(szIconFile, sTemp, cchMax); 171 *piIndex = dwNr; 172 } 173 else 174 { 175 lstrcpynA(szIconFile, "shell32.dll", cchMax); 176 *piIndex = 15; 177 } 178 } 179 180 else if (_ILIsDrive (pSimplePidl)) 181 { 182 if (HCR_GetDefaultIcon("Drive", sTemp, MAX_PATH, &dwNr)) 183 { 184 lstrcpynA(szIconFile, sTemp, cchMax); 185 *piIndex = dwNr; 186 } 187 else 188 { 189 lstrcpynA(szIconFile, "shell32.dll", cchMax); 190 *piIndex = 8; 191 } 192 } 193 else if (_ILIsFolder (pSimplePidl)) 194 { 195 if (HCR_GetDefaultIcon("Folder", sTemp, MAX_PATH, &dwNr)) 196 { 197 lstrcpynA(szIconFile, sTemp, cchMax); 198 *piIndex = dwNr; 199 } 200 else 201 { 202 lstrcpynA(szIconFile, "shell32.dll", cchMax); 203 *piIndex = (uFlags & GIL_OPENICON)? 4 : 3; 204 } 205 } 206 else /* object is file */ 207 { 173 if (HCR_GetDefaultIcon(xriid, sTemp, MAX_PATH, &dwNr)) 174 { 175 lstrcpynA(szIconFile, sTemp, cchMax); 176 *piIndex = dwNr; 177 } 178 else 179 { 180 #ifdef __WIN32OS2__ 181 /* Not correct. Originally location is explorer.exe, index 1 */ 182 lstrcpynA(szIconFile, "shell32.dll", cchMax); 183 *piIndex = -SHLICON_MYCOMPUTER; 184 185 /* 15 is absolutely wrong! ( Another computer in the network ) */ 186 #else 187 lstrcpynA(szIconFile, "shell32.dll", cchMax); 188 *piIndex = 15; 189 #endif 190 } 191 } 192 else if (_ILIsDrive (pSimplePidl)) 193 { 194 #ifdef __WIN32OS2__ 195 lstrcpynA(szIconFile, "shell32.dll", cchMax); 196 *piIndex = 8; /* hard disk */ 197 198 if ( _ILGetDrive( pSimplePidl, sTemp, cchMax ) ) 199 { 200 if ( ( sTemp[ 0 ] == 'A' ) || ( sTemp[ 0 ] == 'a' ) || 201 ( sTemp[ 0 ] == 'B' ) || ( sTemp[ 0 ] == 'b' ) ) 202 { 203 /* FIXME determine 5.25 Floppy */ 204 *piIndex = SHLICON_FLOPPY35; 205 } 206 else 207 { 208 UINT nType = GetDriveTypeA( sTemp ); 209 switch ( nType ) 210 { 211 case DRIVE_REMOVABLE: 212 *piIndex = SHLICON_REMOVABLE_DISK; 213 break; 214 215 case DRIVE_FIXED: 216 *piIndex = SHLICON_HARDDISK; 217 break; 218 219 case DRIVE_REMOTE: 220 { 221 /* FIXME: connected (9) / disconnected (10)state */ 222 BOOL connected = TRUE; 223 if ( connected ) 224 *piIndex = SHLICON_NETDRIVE_CONN; 225 else 226 *piIndex = SHLICON_NETDRIVE_DISCON; 227 break; 228 } 229 case DRIVE_CDROM: 230 *piIndex = SHLICON_CDROM_DRIVE; 231 break; 232 233 case DRIVE_RAMDISK: 234 *piIndex = SHLICON_RAMDRIVE; 235 break; 236 237 case DRIVE_UNKNOWN: 238 case DRIVE_NO_ROOT_DIR: 239 default: 240 *piIndex = SHLICON_HARDDISK; 241 break; 242 } 243 } 244 } 245 246 if ( ( *piIndex == 8 ) && 247 HCR_GetDefaultIcon( "Drive", sTemp, MAX_PATH, &dwNr ) ) 248 { 249 /* kso: Are there special registry keys for particular drives? */ 250 lstrcpynA(szIconFile, sTemp, cchMax); 251 *piIndex = dwNr; 252 } 253 #else 254 if (HCR_GetDefaultIcon("Drive", sTemp, MAX_PATH, &dwNr)) 255 { 256 lstrcpynA(szIconFile, sTemp, cchMax); 257 *piIndex = dwNr; 258 } 259 else 260 { 261 lstrcpynA(szIconFile, "shell32.dll", cchMax); 262 *piIndex = 8; 263 } 264 #endif 265 } 266 else if (_ILIsFolder (pSimplePidl)) 267 { 268 if (HCR_GetDefaultIcon("Folder", sTemp, MAX_PATH, &dwNr)) 269 { 270 lstrcpynA(szIconFile, sTemp, cchMax); 271 *piIndex = dwNr; 272 } 273 else 274 { 275 lstrcpynA(szIconFile, "shell32.dll", cchMax); 276 *piIndex = (uFlags & GIL_OPENICON)? 4 : 3; 277 } 278 } 279 else /* object is file */ 280 { 208 281 #ifdef __WIN32OS2__ 209 282 if (_ILGetExtension (pSimplePidl, sTemp, MAX_PATH)) … … 222 295 { 223 296 //icon is in the file/file is icon 224 if ( stricmp(sTemp,"EXE") == 0) //CB: add more225 {226 SHGetPathFromIDListA(This->pidl, sTemp);227 dwNr = 0;297 if ((stricmp(sTemp,"EXE") == 0) || 298 (stricmp(sTemp,"ICO") == 0)) 299 { 300 SHGetPathFromIDListA(This->pidl, sTemp); 228 301 lstrcpynA(szIconFile, sTemp, cchMax); 229 *piIndex = dwNr; 230 } else //default icon 302 *piIndex = 0; 303 } 304 else if (stricmp(sTemp,"FND") == 0) 305 { 306 SHGetPathFromIDListA(This->pidl, sTemp); 307 lstrcpynA(szIconFile, "shell32.dll", cchMax); 308 #ifdef __WIN32OS2__ 309 *piIndex = SHLICON_TREE; //??? 310 #else 311 *piIndex = 42; 312 #endif 313 } 314 else if (stricmp(sTemp,"COM") == 0) 315 { 316 SHGetPathFromIDListA(This->pidl, sTemp); 317 lstrcpynA(szIconFile, "shell32.dll", cchMax); 318 #ifdef __WIN32OS2__ 319 *piIndex = SHLICON_APPLICATION; 320 #else 321 *piIndex = 2; 322 #endif 323 } 324 #if 0 325 // icons not yet in resources 326 327 else if ((stricmp(sTemp,"INI") == 0) || 328 (stricmp(sTemp,"INF") == 0)) 329 { 330 SHGetPathFromIDListA(This->pidl, sTemp); 331 lstrcpynA(szIconFile, "shell32.dll", cchMax); 332 *piIndex = -151; 333 } 334 else if (stricmp(sTemp,"TXT") == 0) 335 { 336 SHGetPathFromIDListA(This->pidl, sTemp); 337 lstrcpynA(szIconFile, "shell32.dll", cchMax); 338 *piIndex = -152; 339 } 340 else if ((stricmp(sTemp,"BAT") == 0) || 341 (stricmp(sTemp,"CMD") == 0)) 342 { 343 SHGetPathFromIDListA(This->pidl, sTemp); 344 lstrcpynA(szIconFile, "shell32.dll", cchMax); 345 *piIndex = -153; 346 } 347 else if ((stricmp(sTemp,"DLL") == 0) || 348 (stricmp(sTemp,"SYS") == 0) || 349 (stricmp(sTemp,"VXD") == 0) || 350 (stricmp(sTemp,"DRV") == 0) || 351 (stricmp(sTemp,"CPL") == 0)) 352 { 353 SHGetPathFromIDListA(This->pidl, sTemp); 354 lstrcpynA(szIconFile, "shell32.dll", cchMax); 355 *piIndex = -154; 356 } 357 else if (stricmp(sTemp,"FON") == 0) 358 { 359 SHGetPathFromIDListA(This->pidl, sTemp); 360 lstrcpynA(szIconFile, "shell32.dll", cchMax); 361 *piIndex = -155; 362 } 363 else if (stricmp(sTemp,"TTF") == 0) 364 { 365 SHGetPathFromIDListA(This->pidl, sTemp); 366 lstrcpynA(szIconFile,"shell32.dll", cchMax); 367 *piIndex = -156; 368 } 369 #endif 370 else //default icon 231 371 { 232 372 lstrcpynA(szIconFile, "shell32.dll", cchMax); … … 241 381 } 242 382 #else 243 244 245 246 247 if (!strcmp("%1",sTemp))/* icon is in the file */248 249 250 251 252 253 254 255 else/* default icon */256 257 258 259 260 261 #endif 262 263 383 if (_ILGetExtension (pSimplePidl, sTemp, MAX_PATH) 384 && HCR_MapTypeToValue(sTemp, sTemp, MAX_PATH, TRUE) 385 && HCR_GetDefaultIcon(sTemp, sTemp, MAX_PATH, &dwNr)) 386 { 387 if (!strcmp("%1",sTemp)) /* icon is in the file */ 388 { 389 SHGetPathFromIDListA(This->pidl, sTemp); 390 dwNr = 0; 391 } 392 lstrcpynA(szIconFile, sTemp, cchMax); 393 *piIndex = dwNr; 394 } 395 else /* default icon */ 396 { 397 lstrcpynA(szIconFile, "shell32.dll", cchMax); 398 *piIndex = 0; 399 } 400 } 401 #endif 402 TRACE("-- %s %x\n", szIconFile, *piIndex); 403 return NOERROR; 264 404 } 265 405 /************************************************************************** … … 268 408 static HRESULT WINAPI IExtractIconA_fnExtract(IExtractIconA * iface, LPCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize) 269 409 { 270 271 272 273 274 275 276 277 278 279 280 281 } 282 283 static struct ICOM_VTABLE(IExtractIconA) eivt = 284 { 285 286 287 288 289 290 410 ICOM_THIS(IExtractIconAImpl,iface); 411 412 FIXME("(%p) (file=%p index=%u %p %p size=%u) semi-stub\n", This, pszFile, nIconIndex, phiconLarge, phiconSmall, nIconSize); 413 414 if (phiconLarge) 415 *phiconLarge = pImageList_GetIcon(ShellBigIconList, nIconIndex, ILD_TRANSPARENT); 416 417 if (phiconSmall) 418 *phiconSmall = pImageList_GetIcon(ShellSmallIconList, nIconIndex, ILD_TRANSPARENT); 419 420 return S_OK; 421 } 422 423 static struct ICOM_VTABLE(IExtractIconA) eivt = 424 { 425 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 426 IExtractIconA_fnQueryInterface, 427 IExtractIconA_fnAddRef, 428 IExtractIconA_fnRelease, 429 IExtractIconA_fnGetIconLocation, 430 IExtractIconA_fnExtract 291 431 }; 292 432 … … 295 435 */ 296 436 static HRESULT WINAPI IEIPersistFile_fnQueryInterface( 297 IPersistFile*iface,298 REFIIDiid,299 LPVOID*ppvObj)300 { 301 302 303 437 IPersistFile *iface, 438 REFIID iid, 439 LPVOID *ppvObj) 440 { 441 _ICOM_THIS_From_IPersistFile(IExtractIconA, iface); 442 443 return IShellFolder_QueryInterface((IExtractIconA*)This, iid, ppvObj); 304 444 } 305 445 … … 308 448 */ 309 449 static ULONG WINAPI IEIPersistFile_fnAddRef( 310 IPersistFile*iface)311 { 312 313 314 450 IPersistFile *iface) 451 { 452 _ICOM_THIS_From_IPersistFile(IExtractIconA, iface); 453 454 return IExtractIconA_AddRef((IExtractIconA*)This); 315 455 } 316 456 … … 319 459 */ 320 460 static ULONG WINAPI IEIPersistFile_fnRelease( 321 IPersistFile*iface)322 { 323 324 325 461 IPersistFile *iface) 462 { 463 _ICOM_THIS_From_IPersistFile(IExtractIconA, iface); 464 465 return IExtractIconA_Release((IExtractIconA*)This); 326 466 } 327 467 … … 330 470 */ 331 471 static HRESULT WINAPI IEIPersistFile_fnGetClassID( 332 IPersistFile*iface,333 LPCLSIDlpClassId)334 { 335 336 337 338 339 340 341 342 472 IPersistFile *iface, 473 LPCLSID lpClassId) 474 { 475 CLSID StdFolderID = { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }; 476 477 if (lpClassId==NULL) 478 return E_POINTER; 479 480 memcpy(lpClassId, &StdFolderID, sizeof(StdFolderID)); 481 482 return S_OK; 343 483 } 344 484 … … 348 488 static HRESULT WINAPI IEIPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFileName, DWORD dwMode) 349 489 { 350 351 352 490 _ICOM_THIS_From_IPersistFile(IExtractIconA, iface); 491 FIXME("%p\n", This); 492 return E_NOTIMPL; 353 493 354 494 } … … 396 536 static struct ICOM_VTABLE(IPersistFile) pfvt = 397 537 { 398 399 400 401 402 538 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 539 IEIPersistFile_fnQueryInterface, 540 IEIPersistFile_fnAddRef, 541 IEIPersistFile_fnRelease, 542 IEIPersistFile_fnGetClassID, 403 543 #ifdef __WIN32OS2__ 404 544 IEIPersistFile_fnIsDirty, /* IEIPersistFile_fnIsDirty */ 405 545 #else 406 407 #endif 408 546 (void *) 0xdeadbeef /* IEIPersistFile_fnIsDirty */, 547 #endif 548 IEIPersistFile_fnLoad, 409 549 #ifdef __WIN32OS2__ 410 550 IEIPersistFile_fnSave, /* IEIPersistFile_fnSave */ … … 412 552 IEIPersistFile_fnGetCurFile /* IEIPersistFile_fnGetCurFile */ 413 553 #else 414 415 416 554 (void *) 0xdeadbeef /* IEIPersistFile_fnSave */, 555 (void *) 0xdeadbeef /* IEIPersistFile_fnSaveCompleted */, 556 (void *) 0xdeadbeef /* IEIPersistFile_fnGetCurFile */ 417 557 #endif 418 558 }; -
trunk/src/shell32/iconcache.c
r4607 r4691 1 /* $Id: iconcache.c,v 1. 2 2000-11-17 09:57:35sandervl Exp $ */1 /* $Id: iconcache.c,v 1.3 2000-11-24 13:19:12 sandervl Exp $ */ 2 2 /* 3 3 * shell icon cache (SIC) … … 219 219 } 220 220 221 #ifdef __WIN32OS2__ 222 223 /*************************************************************************/ 224 225 typedef struct 226 { 227 INT nStartIndex; 228 UINT nIcons; 229 UINT cx; 230 UINT cy; 231 UINT nCurrIndex; 232 HICON * phIcons; 233 UINT nRetrieved; 234 235 } GETICONSPROCPARAM; 236 237 static BOOL CALLBACK GetIconsProc( HANDLE hModule, 238 LPCTSTR lpszType, 239 LPTSTR lpszName, 240 LONG lParam ) 241 { 242 GETICONSPROCPARAM* pIcons = (GETICONSPROCPARAM *)lParam; 243 244 if ( ( pIcons->nStartIndex == -1 ) && !pIcons->phIcons && !pIcons->nIcons ) 245 { 246 /* number of icons ( RT_GROUP_ICON resources ) requested. */ 247 pIcons->nRetrieved++; 248 } 249 else if ( pIcons->nStartIndex < 0 ) 250 { 251 /* begins by extracting the icon whose resource identifier 252 is equal to the absolute value of nStartIndex. */ 253 254 INT iResId = abs( pIcons->nStartIndex ); 255 if ( lpszName < 0x10000 ) 256 { 257 if ( (INT)lpszName == iResId ) 258 { 259 /* Found icondir with resid iResId. */ 260 /* This is the starting index. */ 261 pIcons->nStartIndex = pIcons->nCurrIndex; 262 } 263 } 264 else 265 { 266 char buffer[ 8 ]; 267 sprintf( buffer, "#%u", iResId ); 268 if ( strcmp( lpszName, buffer ) == 0 ) 269 { 270 /* Found icondir with resid iResId. */ 271 /* This is the starting index. */ 272 pIcons->nStartIndex = pIcons->nCurrIndex; 273 } 274 } 275 } 276 277 if ( pIcons->nStartIndex >= 0 ) 278 { 279 /* extract icons by index */ 280 281 if ( pIcons->nCurrIndex >= pIcons->nStartIndex ) 282 { 283 HICON hIcon = LoadImageA( hModule, 284 lpszName, 285 IMAGE_ICON, 286 pIcons->cx, 287 pIcons->cy, 288 LR_DEFAULTCOLOR ); 289 *pIcons->phIcons = hIcon; 290 if ( hIcon ) 291 pIcons->nRetrieved++; 292 293 pIcons->phIcons++; 294 } 295 296 if ( pIcons->nCurrIndex 297 == ( pIcons->nStartIndex + pIcons->nIcons - 1 ) ) 298 { 299 /* done, stop enumeration */ 300 return FALSE; 301 } 302 } 303 304 /* continue enumeration */ 305 pIcons->nCurrIndex++; 306 return TRUE; 307 } 308 309 /************************************************************************* 310 * 311 * returns 312 * failure: 0 313 * success: nr of icons in file, if nIconIndex is -1, 314 * nr of icons successfully extracted, otherwise. 315 */ 316 UINT WINAPI ICO_ExtractIconEx( LPCSTR lpszExeFileName, 317 HICON * RetPtr, 318 INT nIconIndex, 319 UINT n, 320 UINT cxDesired, 321 UINT cyDesired ) 322 { 323 UINT nIconCount = 0; 324 HINSTANCE hInst = 0; 325 326 TRACE( "file=%s, index=%d, n=%u\n", lpszExeFileName, nIconIndex, n ); 327 328 #if 0 329 if ( stricmp( lpszExeFileName, "shell32.dll" ) == 0 ) 330 { 331 /* Use original renamed dll, if present. It contains all icons. ;-) */ 332 hInst = LoadLibraryExA( "shell32_pe.dll", 0, LOAD_LIBRARY_AS_DATAFILE ); 333 } 334 335 if ( !hInst ) 336 #endif 337 hInst = LoadLibraryExA( lpszExeFileName, 0, LOAD_LIBRARY_AS_DATAFILE ); 338 339 if ( hInst ) 340 { 341 GETICONSPROCPARAM icons = { 342 nIconIndex, n, cxDesired, cyDesired, 0, RetPtr, 0 }; 343 344 EnumResourceNamesA( 345 hInst, RT_GROUP_ICONA, &GetIconsProc, (LONG)&icons ); 346 347 nIconCount = icons.nRetrieved; 348 349 FreeLibrary( hInst ); 350 } 351 else 352 { 353 HFILE hFile; 354 OFSTRUCT ofs; 355 DWORD sig; 356 LPBYTE pData; 357 UINT16 iconDirCount = 0,iconCount = 0; 358 ULONG uSize; 359 360 if( nIconIndex!=-1 && !n ) 361 return 0; 362 363 hFile = OpenFile( lpszExeFileName, &ofs, OF_READ ); 364 365 if( hFile == HFILE_ERROR ) 366 return 0; 367 368 sig = SHELL_GetResourceTable(hFile,&pData); 369 370 if( sig==IMAGE_OS2_SIGNATURE || sig==1 ) /* .ICO file */ 371 { 372 /* NE image ( OS/2 1.x / Win 3.x ) / ico file */ 373 374 BYTE *pCIDir = 0; 375 NE_TYPEINFO *pTInfo = (NE_TYPEINFO*)(pData + 2); 376 NE_NAMEINFO *pIconStorage = NULL; 377 NE_NAMEINFO *pIconDir = NULL; 378 LPicoICONDIR lpiID = NULL; 379 380 TRACE("-- OS2/icon Signature (0x%08lx)\n", sig); 381 382 if( pData == (BYTE*)-1 ) 383 { 384 pCIDir = ICO_GetIconDirectory(hFile, &lpiID, &uSize); /* check for .ICO file */ 385 if( pCIDir ) 386 { 387 iconDirCount = 1; iconCount = lpiID->idCount; 388 TRACE("-- icon found %p 0x%08lx 0x%08x 0x%08x\n", pCIDir, uSize, iconDirCount, iconCount); 389 } 390 } 391 else while( pTInfo->type_id && !(pIconStorage && pIconDir) ) 392 { 393 if( pTInfo->type_id == NE_RSCTYPE_GROUP_ICON ) /* find icon directory and icon repository */ 394 { 395 iconDirCount = pTInfo->count; 396 pIconDir = ((NE_NAMEINFO*)(pTInfo + 1)); 397 TRACE("\tfound directory - %i icon families\n", iconDirCount); 398 } 399 if( pTInfo->type_id == NE_RSCTYPE_ICON ) 400 { 401 iconCount = pTInfo->count; 402 pIconStorage = ((NE_NAMEINFO*)(pTInfo + 1)); 403 TRACE("\ttotal icons - %i\n", iconCount); 404 } 405 pTInfo = (NE_TYPEINFO *)((char*)(pTInfo+1)+pTInfo->count*sizeof(NE_NAMEINFO)); 406 } 407 408 if( (pIconStorage && pIconDir) || lpiID ) /* load resources and create icons */ 409 { 410 if( nIconIndex == (UINT16)-1 ) 411 { 412 /* icon count requested */ 413 nIconCount = iconDirCount; 414 } 415 else if( nIconIndex < iconDirCount ) 416 { 417 UINT16 i, icon; 418 if( n > iconDirCount - nIconIndex ) 419 n = iconDirCount - nIconIndex; 420 421 for( i = nIconIndex; i < nIconIndex + n; i++ ) 422 { 423 /* .ICO files have only one icon directory */ 424 425 if( lpiID == NULL ) /* *.ico */ 426 pCIDir = SHELL_LoadResource( hFile, pIconDir + i, *(WORD*)pData, &uSize ); 427 428 RetPtr[i-nIconIndex] = pLookupIconIdFromDirectoryEx( pCIDir, TRUE, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0); 429 430 if ( RetPtr[i-nIconIndex] ) 431 nIconCount++; 432 433 HeapFree(GetProcessHeap(), 0, pCIDir); 434 } 435 436 for( icon = nIconIndex; icon < nIconIndex + n; icon++ ) 437 { 438 pCIDir = NULL; 439 if( lpiID ) 440 pCIDir = ICO_LoadIcon( hFile, lpiID->idEntries + RetPtr[icon-nIconIndex], &uSize); 441 else 442 { 443 for( i = 0; i < iconCount; i++ ) 444 { 445 if( pIconStorage[i].id == (RetPtr[icon-nIconIndex] | 0x8000) ) 446 pCIDir = SHELL_LoadResource( hFile, pIconStorage + i,*(WORD*)pData, &uSize ); 447 } 448 } 449 if( pCIDir ) 450 { 451 RetPtr[icon-nIconIndex] = (HICON) pCreateIconFromResourceEx(pCIDir,uSize,TRUE,0x00030000, cxDesired, cyDesired, LR_DEFAULTCOLOR); 452 if ( RetPtr[icon-nIconIndex] ) 453 nIconCount++; 454 } 455 else 456 RetPtr[icon-nIconIndex] = 0; 457 } 458 } 459 } 460 if( lpiID ) 461 HeapFree( GetProcessHeap(), 0, lpiID); 462 else 463 HeapFree( GetProcessHeap(), 0, pData); 464 } 465 _lclose( hFile); 466 } 467 return nIconCount; 468 } 469 470 #else /* ! __WIN32OS2__ */ 471 221 472 /************************************************************************* 222 473 * … … 469 720 goto end_3; /* sucess */ 470 721 } 471 #ifdef __WIN32OS2__472 else473 {474 if( nIconIndex == -1 )475 {476 TRACE( "ICO_ExtractIconEx : iconcount not implemented!\n" );477 }478 else479 {480 /* Try to get icon(s) using LoadImageA. This works for481 LX images, like Odin's shell32.dll! */482 HINSTANCE hInst = LoadLibraryA( lpszExeFileName );483 if ( hInst )484 {485 INT icon;486 for( icon = nIconIndex; icon < nIconIndex + n; icon++ )487 {488 RetPtr[ icon - nIconIndex ]489 = LoadImageA( hInst,490 MAKEINTRESOURCEA( icon ),491 IMAGE_ICON,492 cxDesired,493 cyDesired,494 LR_DEFAULTCOLOR );495 }496 hRet = RetPtr[ 0 ];497 FreeLibrary( hInst );498 }499 }500 }501 #endif502 722 goto end_1; /* unknown filetype */ 503 723 … … 508 728 return hRet; 509 729 } 730 731 #endif /* ! __WIN32OS2__ */ 510 732 511 733 /********************** THE ICON CACHE ********************************/ … … 696 918 pImageList_SetBkColor(ShellBigIconList, GetSysColor(COLOR_WINDOW)); 697 919 698 for (index=1; index< 39; index++)920 for (index=1; index<46; index++) 699 921 { 700 922 hSm = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(index), IMAGE_ICON, 16, 16,LR_SHARED); … … 855 1077 } 856 1078 1079 #ifdef __WIN32OS2__ 1080 1081 /************************************************************************* 1082 * ExtractIconEx [shell32.189] 1083 */ 1084 UINT WINAPI ExtractIconExAW ( LPCVOID lpszFile, INT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIcons ) 1085 { if (SHELL_OsIsUnicode()) 1086 return ExtractIconExW ( lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons); 1087 return ExtractIconExA ( lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons); 1088 } 1089 /************************************************************************* 1090 * ExtractIconExA [shell32.190] 1091 * 1092 * PARAMETERS 1093 * lpszFile [in] Pointer to a null-terminated string specifying the name 1094 * of an executable file, DLL, or icon file from which 1095 * icons will be extracted. 1096 * 1097 * nIconIndex [in] Specifies the zero-based index of the first icon to 1098 * extract. For example, if this value is zero, the 1099 * function extracts the first icon in the specified file. 1100 * 1101 * If this value is -1 and phIconLarge and phiconSmall are 1102 * both NULL, the function returns the total number of 1103 * icons in the specified file. If the file is an 1104 * executable file or DLL, the return value is the number 1105 * of RT_GROUP_ICON resources. If the file is an .ico file, 1106 * the return value is 1. 1107 * 1108 * Windows 95/98, Windows NT 4.0, and Windows 2000: 1109 * If this value is a negative number and either 1110 * phIconLarge or phiconSmall is not NULL, the function 1111 * begins by extracting the icon whose resource identifier 1112 * is equal to the absolute value of nIconIndex. For 1113 * example, use -3 to extract the icon whose resource 1114 * identifier is 3. 1115 * 1116 * phiconLarge [out] Pointer to an array of icon handles that receives 1117 * handles to the large icons extracted from the file. 1118 * If this parameter is NULL, no large icons are extracted 1119 * from the file. 1120 * 1121 * phiconSmall [out] Pointer to an array of icon handles that receives 1122 * handles to the small icons extracted from the file. 1123 * If this parameter is NULL, no small icons are extracted 1124 * from the file. 1125 * 1126 * nIcons [in] Specifies the number of icons to extract from the file. 1127 * 1128 * RETURNS 1129 * If the nIconIndex parameter is -1, the phiconLarge parameter is NULL, and 1130 * the phiconSmall parameter is NULL, then the return value is the number of 1131 * icons contained in the specified file. Otherwise, the return value is the 1132 * number of icons successfully extracted from the file. 1133 */ 1134 UINT WINAPI ExtractIconExA ( LPCSTR lpszFile, INT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIcons ) 1135 { UINT ret=0; 1136 1137 TRACE("file=%s idx=%i %p %p num=%i\n", lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons ); 1138 1139 if ( ( nIconIndex == -1 ) && !phiconLarge && !phiconSmall ) /* Number of icons requested */ 1140 return ICO_ExtractIconEx(lpszFile, NULL, -1, 0, 0, 0 ); 1141 1142 /* KSO: What, if phiconLarge and phiconSmall are given, and first call 1143 to ICO_ExtractIconEx returns a value other than the second one? 1144 */ 1145 if (phiconLarge) 1146 ret = ICO_ExtractIconEx(lpszFile, phiconLarge, nIconIndex, nIcons, 32, 32 ); 1147 1148 if (phiconSmall) 1149 ret = ICO_ExtractIconEx(lpszFile, phiconSmall, nIconIndex, nIcons, 16, 16 ); 1150 1151 return ret; 1152 } 1153 /************************************************************************* 1154 * ExtractIconExW [shell32.191] 1155 */ 1156 UINT WINAPI ExtractIconExW ( LPCWSTR lpszFile, INT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIcons ) 1157 { LPSTR sFile; 1158 UINT ret; 1159 1160 TRACE("file=%s idx=%i %p %p num=%i\n", debugstr_w(lpszFile), nIconIndex, phiconLarge, phiconSmall, nIcons ); 1161 1162 sFile = HEAP_strdupWtoA (GetProcessHeap(),0,lpszFile); 1163 ret = ExtractIconExA ( sFile, nIconIndex, phiconLarge, phiconSmall, nIcons); 1164 HeapFree(GetProcessHeap(),0,sFile); 1165 return ret; 1166 } 1167 1168 #else /* ! __WIN32OS2__ */ 1169 857 1170 /************************************************************************* 858 1171 * ExtractIconEx [shell32.189] … … 913 1226 return ret; 914 1227 } 1228 1229 #endif /* ! __WIN32OS2__ */ 1230 -
trunk/src/shell32/makefile
r4624 r4691 1 # $Id: makefile,v 1.3 0 2000-11-19 08:50:16 birdExp $1 # $Id: makefile,v 1.31 2000-11-24 13:19:12 sandervl Exp $ 2 2 3 3 # … … 12 12 # 13 13 !include ../../include/pdwin32.mk 14 15 16 # 17 # Overrides 18 # 19 RCFLAGS = $(RCFLAGS) -D__WIN32OS2__ 14 20 15 21 -
trunk/src/shell32/shres.orc
r4121 r4691 1 /* $Id: shres.orc,v 1. 6 2000-08-30 13:51:09sandervl Exp $ */1 /* $Id: shres.orc,v 1.7 2000-11-24 13:19:12 sandervl Exp $ */ 2 2 /* 3 3 * Top level resource file for Common Dialogs … … 108 108 CONTROL "Tree1",IDD_TREEVIEW,"SysTreeView32", 109 109 TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | 110 WS_BORDER | WS_TABSTOP, 110 WS_BORDER | WS_TABSTOP, 111 111 4, 40, 180, 120 112 112 } … … 182 182 END 183 183 END 184 185 #ifdef __WIN32OS2__ 186 187 /* These are the first 45 icons from shell32.dll */ 188 /* See ico/readme.txt for copyright info */ 189 #include "shellicon.h" 190 191 SHLICON_FILE ICON LOADONCALL DISCARDABLE "ico/file.ico" 192 SHLICON_TEXTFILE ICON LOADONCALL DISCARDABLE "ico/textfile.ico" 193 SHLICON_APPLICATION ICON LOADONCALL DISCARDABLE "ico/application.ico" 194 SHLICON_FOLDER_OPEN ICON LOADONCALL DISCARDABLE "ico/folder-c.ico" 195 SHLICON_FOLDER_CLOSED ICON LOADONCALL DISCARDABLE "ico/folder-o.ico" 196 SHLICON_FLOPPY525 ICON LOADONCALL DISCARDABLE "ico/floppy5.ico" 197 SHLICON_FLOPPY35 ICON LOADONCALL DISCARDABLE "ico/floppy3.ico" 198 SHLICON_REMOVABLE_DISK ICON LOADONCALL DISCARDABLE "ico/removable.ico" 199 SHLICON_HARDDISK ICON LOADONCALL DISCARDABLE "ico/harddrive.ico" 200 SHLICON_NETDRIVE_CONN ICON LOADONCALL DISCARDABLE "ico/netdrive-c.ico" 201 SHLICON_NETDRIVE_DISCON ICON LOADONCALL DISCARDABLE "ico/netdrive-d.ico" 202 SHLICON_CDROM_DRIVE ICON LOADONCALL DISCARDABLE "ico/cdromdrive.ico" 203 SHLICON_RAMDRIVE ICON LOADONCALL DISCARDABLE "ico/ramdrive.ico" 204 SHLICON_ENTIRENETWORK ICON LOADONCALL DISCARDABLE "ico/entirenetwork.ico" 205 SHLICON_NETWORK ICON LOADONCALL DISCARDABLE "ico/network.ico" 206 SHLICON_NETWORK_COMP ICON LOADONCALL DISCARDABLE "ico/networkcomputer.ico" 207 SHLICON_PRINTER ICON LOADONCALL DISCARDABLE "ico/printer.ico" 208 SHLICON_NETWORK_PLACE ICON LOADONCALL DISCARDABLE "ico/networkplaces.ico" 209 SHLICON_NETWORK_GROUP ICON LOADONCALL DISCARDABLE "ico/networkgroup.ico" 210 SHLICON_PROGRAMS ICON LOADONCALL DISCARDABLE "ico/programs.ico" 211 SHLICON_RECENTDOCS ICON LOADONCALL DISCARDABLE "ico/recentdocs.ico" 212 SHLICON_SETTINGS ICON LOADONCALL DISCARDABLE "ico/settings.ico" 213 SHLICON_SEARCH ICON LOADONCALL DISCARDABLE "ico/search.ico" 214 SHLICON_HELP ICON LOADONCALL DISCARDABLE "ico/help.ico" 215 SHLICON_RUN ICON LOADONCALL DISCARDABLE "ico/run.ico" 216 SHLICON_SUSPEND ICON LOADONCALL DISCARDABLE "ico/suspend.ico" 217 SHLICON_UNDOCK ICON LOADONCALL DISCARDABLE "ico/undock.ico" 218 SHLICON_SHUTDOWN ICON LOADONCALL DISCARDABLE "ico/shutdown.ico" 219 SHLICON_SHAREDRES ICON LOADONCALL DISCARDABLE "ico/sharedres.ico" 220 SHLICON_SHORTCUT ICON LOADONCALL DISCARDABLE "ico/shortcut.ico" 221 SHLICON_ARROW ICON LOADONCALL DISCARDABLE "ico/arrow.ico" 222 SHLICON_TRASHCAN ICON LOADONCALL DISCARDABLE "ico/trash-e.ico" 223 SHLICON_TRASHCAN_FULL ICON LOADONCALL DISCARDABLE "ico/trash-f.ico" 224 SHLICON_DIALUP_FOLDER ICON LOADONCALL DISCARDABLE "ico/dialup.ico" 225 SHLICON_DESKTOP ICON LOADONCALL DISCARDABLE "ico/desktop.ico" 226 SHLICON_CONTROLPANEL ICON LOADONCALL DISCARDABLE "ico/controlpanel.ico" 227 SHLICON_PROGRAMGROUP ICON LOADONCALL DISCARDABLE "ico/programgroup.ico" 228 SHLICON_PRINTER_FOLDER ICON LOADONCALL DISCARDABLE "ico/printers.ico" 229 SHLICON_FONT_FOLDER ICON LOADONCALL DISCARDABLE "ico/fonts.ico" 230 SHLICON_LOGO ICON LOADONCALL DISCARDABLE "ico/logo.ico" 231 SHLICON_AUDIO_CD ICON LOADONCALL DISCARDABLE "ico/audiocd.ico" 232 SHLICON_TREE ICON LOADONCALL DISCARDABLE "ico/tree.ico" 233 SHLICON_COMPUTERS ICON LOADONCALL DISCARDABLE "ico/computers.ico" 234 SHLICON_FAVORITES ICON LOADONCALL DISCARDABLE "ico/favorites.ico" 235 SHLICON_LOGOFF ICON LOADONCALL DISCARDABLE "ico/logoff.ico" 236 237 /* Here are still missing lots of icons from shell32! */ 238 239 /* This one is originally in explorer.exe, index 1 */ 240 SHLICON_MYCOMPUTER ICON LOADONCALL DISCARDABLE "ico/mycomputer.ico" 241 242 #else /* !__WIN32OS2__ */ 184 243 185 244 /* document */ … … 1348 1407 '} 1349 1408 1409 #endif /* !__WIN32OS2__ */ 1410 1350 1411 /*--------------------- END FIXME ------------------------*/ 1351 1412 … … 1367 1428 #include "shell32_En.orc" 1368 1429 1369 /* 1430 /* 1370 1431 CB: the new about dialog isn't implemented for these languages 1371 1432 other resources aren't translated so far
Note:
See TracChangeset
for help on using the changeset viewer.