Changeset 9851 for trunk/src/shell32/shelllink.c
- Timestamp:
- Feb 24, 2003, 6:03:00 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/shell32/shelllink.c
r8699 r9851 263 263 264 264 #ifdef __WIN32OS2__ 265 static BOOL SaveIconFileAsOS2ICO(char *szFileName, char *szXPMFileName) 266 { 267 FILE *fXPMFile = NULL, *fICOFile = NULL; 268 void *lpOS2Icon = NULL, *lpWinIcon = NULL; 269 DWORD ressize, filesize; 270 BOOL ret = FALSE; 271 272 if (!(fICOFile = fopen(szFileName, "r"))) 273 goto failure; 274 fseek(fICOFile, 0, SEEK_END); 275 filesize = ftell(fICOFile); 276 fseek(fICOFile, 0, SEEK_SET); 277 278 lpWinIcon = malloc(filesize); 279 if(lpWinIcon == NULL) goto failure; 280 if (fread(lpWinIcon, filesize, 1, fICOFile) != 1) 281 goto failure; 282 283 if (!(fXPMFile = fopen(szXPMFileName, "wb"))) 284 goto failure; 285 286 lpOS2Icon = ConvertIconGroupIndirect(lpWinIcon, filesize, &ressize); 287 if(lpOS2Icon) { 288 fwrite(lpOS2Icon, 1, ressize, fXPMFile); 289 } 290 ret = TRUE; 291 292 failure: 293 if(fICOFile) fclose(fICOFile); 294 if(fXPMFile) fclose(fXPMFile); 295 if(lpWinIcon) free(lpWinIcon); 296 if(lpOS2Icon) free(lpOS2Icon); 297 return ret; 298 } 299 265 300 static BOOL SaveIconResAsOS2ICO(GRPICONDIR *pIconDir, HINSTANCE hInstance, 266 301 const char *szXPMFileName) … … 533 568 static int ExtractFromICO(const char *szFileName, const char *szXPMFileName) 534 569 { 570 #ifdef __WIN32OS2__ 571 if(!SaveIconFileAsOS2ICO(szFileName, szXPMFileName)) 572 { 573 TRACE("Failed saving icon as XPM, error %ld\n", GetLastError()); 574 return 0; 575 } 576 return 1; 577 #else 535 578 FILE *fICOFile; 536 579 ICONDIR iconDir; … … 540 583 void *pIcon; 541 584 int i; 542 #ifdef __WIN32OS2__543 int size;544 #endif545 585 546 586 if (!(fICOFile = fopen(szFileName, "r"))) 547 587 goto error1; 548 549 #ifdef __WIN32OS2__550 //TODO:551 dprintf(("TODO: Icon file conversion not yet supported!!"));552 goto error2;553 #else554 588 555 589 if (fread(&iconDir, sizeof (ICONDIR), 1, fICOFile) != 1) … … 579 613 goto error4; 580 614 581 #endif582 615 free(pIcon); 583 616 free(pIconDirEntry); … … 594 627 error1: 595 628 return 0; 629 #endif 596 630 } 597 631 … … 655 689 HKEY hkey; 656 690 #ifdef __WIN32OS2__ 657 char *tmp ;691 char *tmp, szAppName[MAX_PATH]; 658 692 #endif 659 693 … … 664 698 if (!pszFileName || !This->sPath) 665 699 return ERROR_UNKNOWN; 666 667 /* check for .exe extension */668 if (!(p = strrchr( This->sPath, '.' ))) return NOERROR;669 if (strchr( p, '\\' ) || strchr( p, '/' )) return NOERROR;670 if (strcasecmp( p, ".exe" )) return NOERROR;671 700 672 701 /* check if ShellLinker configured */ … … 723 752 icon_name, This->iIcoNdx)) goto done; 724 753 725 if(OSLibWinCreateObject(This->sPath, This->sArgs, This->sWorkDir, filename, 754 if(SearchPathA( NULL, This->sPath, ".exe", sizeof(szAppName), szAppName, NULL) == NULL) 755 { 756 ret = E_INVALIDARG; 757 goto done; 758 } 759 760 if(OSLibWinCreateObject(szAppName, This->sArgs, This->sWorkDir, filename, 726 761 This->sDescription, icon_name, 727 762 This->iIcoNdx, bDesktop) == FALSE) … … 739 774 740 775 #else 776 777 /* check for .exe extension */ 778 if (!(p = strrchr( This->sPath, '.' ))) return NOERROR; 779 if (strchr( p, '\\' ) || strchr( p, '/' )) return NOERROR; 780 if (strcasecmp( p, ".exe" )) return NOERROR; 781 741 782 buffer[0] = 0; 742 783 if (!RegOpenKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Wine",
Note:
See TracChangeset
for help on using the changeset viewer.