Changeset 8048 for trunk/src/shell32/shelllink.c
- Timestamp:
- Mar 8, 2002, 12:01:03 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/shell32/shelllink.c
r7508 r8048 118 118 #include "poppack.h" 119 119 120 typedef struct 121 { 122 HRSRC *pResInfo; 123 int nIndex; 124 } ENUMRESSTRUCT; 120 125 121 126 static ICOM_VTABLE(IShellLinkA) slvt; … … 162 167 #define _ICOM_THIS_From_IPersistStream(class, name) class* This = (class*)(((char*)name)-_IPersistStream_Offset); 163 168 #define _IPersistStream_From_ICOM_THIS(class, name) class* StreamThis = (class*)(((char*)name)+_IPersistStream_Offset); 169 170 171 /* strdup on the process heap */ 172 inline static LPSTR heap_strdup( LPCSTR str ) 173 { 174 INT len = strlen(str) + 1; 175 LPSTR p = HeapAlloc( GetProcessHeap(), 0, len ); 176 if (p) memcpy( p, str, len ); 177 return p; 178 } 179 164 180 165 181 /************************************************************************** … … 364 380 static BOOL CALLBACK EnumResNameProc(HANDLE hModule, const char *lpszType, char *lpszName, LONG lParam) 365 381 { 366 *(HRSRC *) lParam = FindResourceA(hModule, lpszName, RT_GROUP_ICONA); 367 return FALSE; 368 } 382 ENUMRESSTRUCT *sEnumRes = (ENUMRESSTRUCT *) lParam; 383 384 if (!sEnumRes->nIndex--) 385 { 386 *sEnumRes->pResInfo = FindResourceA(hModule, lpszName, RT_GROUP_ICONA); 387 return FALSE; 388 } 389 else 390 return TRUE; 391 } 392 369 393 370 394 static int ExtractFromEXEDLL(const char *szFileName, int nIndex, const char *szXPMFileName) … … 448 472 #else 449 473 for (i = 0; i < pIconDir->idCount; i++) 450 if ((pIconDir->idEntries[i]. bHeight * pIconDir->idEntries[i].bWidth) > nMax)474 if ((pIconDir->idEntries[i].wBitCount >= nMaxBits) && (pIconDir->idEntries[i].wBitCount <= 8)) 451 475 { 452 lpName = MAKEINTRESOURCEA(pIconDir->idEntries[i].nID); 453 nMax = pIconDir->idEntries[i].bHeight * pIconDir->idEntries[i].bWidth; 476 if (pIconDir->idEntries[i].wBitCount > nMaxBits) 477 { 478 nMaxBits = pIconDir->idEntries[i].wBitCount; 479 nMax = 0; 480 } 481 if ((pIconDir->idEntries[i].bHeight * pIconDir->idEntries[i].bWidth) > nMax) 482 { 483 lpName = MAKEINTRESOURCEA(pIconDir->idEntries[i].nID); 484 nMax = pIconDir->idEntries[i].bHeight * pIconDir->idEntries[i].bWidth; 485 } 454 486 } 455 487 … … 480 512 481 513 done: 514 482 515 FreeResource(hResData); 483 516 FreeLibrary(hModule); … … 565 598 566 599 if (!wine_get_unix_file_name( dos, buffer, sizeof(buffer) )) return NULL; 567 return HEAP_strdupA( GetProcessHeap(), 0,buffer );600 return heap_strdup( buffer ); 568 601 } 569 602 … … 594 627 static char *extract_icon( const char *path, int index) 595 628 { 596 char *filename = HEAP_strdupA( GetProcessHeap(), 0,tmpnam(NULL) );629 char *filename = heap_strdup( tmpnam(NULL) ); 597 630 if (ExtractFromEXEDLL( path, index, filename )) return filename; 598 631 if (ExtractFromICO( path, filename )) return filename; … … 602 635 } 603 636 #endif 637 604 638 605 639 static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFileName, BOOL fRemember) … … 709 743 } 710 744 if (!*buffer) return NOERROR; 711 shell_link_app = HEAP_strdupA( GetProcessHeap(), 0,buffer );745 shell_link_app = heap_strdup( buffer ); 712 746 713 747 if (!WideCharToMultiByte( CP_ACP, 0, pszFileName, -1, buffer, sizeof(buffer), NULL, NULL)) 714 748 return ERROR_UNKNOWN; 715 749 GetFullPathNameA( buffer, sizeof(buff2), buff2, NULL ); 716 filename = HEAP_strdupA( GetProcessHeap(), 0,buff2 );750 filename = heap_strdup( buff2 ); 717 751 718 752 if (SHGetSpecialFolderPathA( 0, buffer, CSIDL_STARTUP, FALSE )) … … 962 996 963 997 SHGetPathFromIDListA(&lpLinkHeader->Pidl, sTemp); 964 This->sPath = HEAP_strdupA ( GetProcessHeap(), 0, sTemp);998 This->sPath = heap_strdup( sTemp ); 965 999 } 966 1000 This->wHotKey = lpLinkHeader->wHotKey; … … 1126 1160 HeapFree(GetProcessHeap(), 0, This->sArgs); 1127 1161 1128 1129 1162 if (This->sWorkDir) 1130 1163 HeapFree(GetProcessHeap(), 0, This->sWorkDir); … … 1199 1232 if (This->sDescription) 1200 1233 HeapFree(GetProcessHeap(), 0, This->sDescription); 1201 if (!(This->sDescription = HEAP_strdupA(GetProcessHeap(), 0,pszName)))1234 if (!(This->sDescription = heap_strdup(pszName))) 1202 1235 return E_OUTOFMEMORY; 1203 1236 … … 1222 1255 if (This->sWorkDir) 1223 1256 HeapFree(GetProcessHeap(), 0, This->sWorkDir); 1224 if (!(This->sWorkDir = HEAP_strdupA(GetProcessHeap(), 0,pszDir)))1257 if (!(This->sWorkDir = heap_strdup(pszDir))) 1225 1258 return E_OUTOFMEMORY; 1226 1259 … … 1245 1278 if (This->sArgs) 1246 1279 HeapFree(GetProcessHeap(), 0, This->sArgs); 1247 if (!(This->sArgs = HEAP_strdupA(GetProcessHeap(), 0,pszArgs)))1280 if (!(This->sArgs = heap_strdup(pszArgs))) 1248 1281 return E_OUTOFMEMORY; 1249 1282 … … 1304 1337 if (This->sIcoPath) 1305 1338 HeapFree(GetProcessHeap(), 0, This->sIcoPath); 1306 if (!(This->sIcoPath = HEAP_strdupA(GetProcessHeap(), 0,pszIconPath)))1339 if (!(This->sIcoPath = heap_strdup(pszIconPath))) 1307 1340 return E_OUTOFMEMORY; 1308 1341 This->iIcoNdx = iIcon; … … 1332 1365 if (This->sPath) 1333 1366 HeapFree(GetProcessHeap(), 0, This->sPath); 1334 if (!(This->sPath = HEAP_strdupA(GetProcessHeap(), 0,pszFile)))1367 if (!(This->sPath = heap_strdup(pszFile))) 1335 1368 return E_OUTOFMEMORY; 1336 1369
Note:
See TracChangeset
for help on using the changeset viewer.