- Timestamp:
- Feb 24, 2003, 6:03:00 PM (23 years ago)
- Location:
- trunk/src
- Files:
-
- 5 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", -
trunk/src/user32/USER32.DEF
r9810 r9851 1 ; $Id: USER32.DEF,v 1.7 6 2003-02-16 15:31:08sandervl Exp $1 ; $Id: USER32.DEF,v 1.77 2003-02-24 17:02:42 sandervl Exp $ 2 2 3 3 LIBRARY USER32 INITINSTANCE TERMINSTANCE … … 718 718 _OSLibWinCreateObject@32 @2031 NONAME 719 719 _ConvertIconGroup@12 @2032 NONAME 720 _ConvertIconGroupIndirect@12 @2037 NONAME 720 721 721 722 _WinSetVisibleRgnNotifyProc@12 @2033 NONAME -
trunk/src/user32/icon.cpp
r7733 r9851 1 /* $Id: icon.cpp,v 1.1 4 2002-01-07 11:17:52sandervl Exp $ */1 /* $Id: icon.cpp,v 1.15 2003-02-24 17:02:43 sandervl Exp $ */ 2 2 3 3 /* … … 371 371 //****************************************************************************** 372 372 //****************************************************************************** 373 void *WIN32API ConvertIconGroupIndirect(void *lpIconData, DWORD iconsize, 374 DWORD *ressize) 375 { 376 ICONDIR *ihdr = (ICONDIR *)lpIconData; 377 ICONDIRENTRY *rdir = (ICONDIRENTRY *)(ihdr + 1); 378 int i, groupsize = 0, os2iconsize; 379 BITMAPARRAYFILEHEADER2 *bafh, *orgbafh; 380 WINBITMAPINFOHEADER *iconhdr; 381 void *os2icon; 382 int nricons = 0; 383 void *winicon; 384 385 dprintf(("Icon Group type :%d", ihdr->idType)); 386 dprintf(("Icon Group count:%d", ihdr->idCount)); 387 for(i=0;i<ihdr->idCount;i++) { 388 dprintf2(("Icon : %x", rdir->dwImageOffset)); 389 dprintf2(("Width : %d", (int)rdir->bWidth)); 390 dprintf2(("Height : %d", (int)rdir->bHeight)); 391 dprintf2(("Colors : %d", (int)rdir->bColorCount)); 392 dprintf2(("Bits : %d", rdir->wBitCount)); 393 dprintf2(("ResBytes: %d", rdir->dwBytesInRes)); 394 395 winicon = (char *)lpIconData + rdir->dwImageOffset; 396 groupsize += QueryConvertedIconSize((WINBITMAPINFOHEADER *)winicon, 397 rdir->dwBytesInRes); 398 //add centered icon if size is 32x32 399 if(rdir->bWidth == 32 && rdir->bHeight == 32 && rdir->wBitCount >= 4) 400 { 401 groupsize += QueryConvertedIconSize((WINBITMAPINFOHEADER *)winicon, 402 rdir->dwBytesInRes, TRUE); 403 //extra pixels 404 groupsize += (40*8 + 8*32)*rdir->wBitCount/8; 405 nricons++; 406 } 407 nricons++; 408 rdir++; 409 } 410 groupsize = groupsize+nricons*(sizeof(BITMAPARRAYFILEHEADER2) - sizeof(BITMAPFILEHEADER2)); 411 bafh = (BITMAPARRAYFILEHEADER2 *)malloc(groupsize); 412 memset(bafh, 0, groupsize); 413 orgbafh = bafh; 414 415 rdir = (ICONDIRENTRY *)(ihdr + 1); 416 for(i=0;i<ihdr->idCount;i++) { 417 bafh->usType = BFT_BITMAPARRAY; 418 bafh->cbSize = sizeof(BITMAPARRAYFILEHEADER2); 419 bafh->cxDisplay = 0; 420 bafh->cyDisplay = 0; 421 422 winicon = (char *)lpIconData + rdir->dwImageOffset; 423 iconhdr = (WINBITMAPINFOHEADER *)winicon; 424 425 os2icon = ConvertIcon(iconhdr, rdir->dwBytesInRes, &os2iconsize, (ULONG)bafh - (ULONG)orgbafh + sizeof(BITMAPARRAYFILEHEADER2)-sizeof(BITMAPFILEHEADER2)); 426 if(os2icon == NULL) { 427 dprintf(("Can't convert icon!")); 428 rdir++; 429 continue; 430 } 431 432 if(rdir->bWidth == 32 && rdir->bHeight == 32 && rdir->wBitCount >= 4) 433 { 434 //add 40x40 icon by centering 32x32 icon in 40x40 grid 435 //(resize is really ugly) 436 bafh->offNext = (ULONG)&bafh->bfh2 - (ULONG)orgbafh + os2iconsize; 437 memcpy((char *)&bafh->bfh2, os2icon, os2iconsize); 438 free(os2icon); 439 440 bafh = (BITMAPARRAYFILEHEADER2 *)((ULONG)&bafh->bfh2 + os2iconsize); 441 442 os2icon = ConvertIcon(iconhdr, rdir->dwBytesInRes, &os2iconsize, (ULONG)bafh - (ULONG)orgbafh + sizeof(BITMAPARRAYFILEHEADER2)-sizeof(BITMAPFILEHEADER2), TRUE); 443 if(os2icon == NULL) { 444 dprintf(("Can't convert icon!")); 445 rdir++; 446 continue; 447 } 448 } 449 450 if(i != ihdr->idCount -1) { 451 bafh->offNext = (ULONG)&bafh->bfh2 - (ULONG)orgbafh + os2iconsize; 452 } 453 else bafh->offNext = 0; 454 455 memcpy((char *)&bafh->bfh2, os2icon, os2iconsize); 456 free(os2icon); 457 458 bafh = (BITMAPARRAYFILEHEADER2 *)((ULONG)&bafh->bfh2 + os2iconsize); 459 460 rdir++; 461 } 462 *ressize = groupsize; 463 return (void *)orgbafh; 464 } 465 //****************************************************************************** 466 //****************************************************************************** -
trunk/src/user32/oslibres.cpp
r9624 r9851 1 /* $Id: oslibres.cpp,v 1.3 4 2003-01-05 16:34:58sandervl Exp $ */1 /* $Id: oslibres.cpp,v 1.35 2003-02-24 17:02:43 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 749 749 char szWorkDir[256]; 750 750 char szPEGUILoaderPath[256]; 751 BOOL fWin32App; 751 752 752 753 if(pszName) { … … 784 785 ((pszWorkDir) ? strlen(pszWorkDir) : 0)); 785 786 786 sprintf(pszSetupString, "PROGTYPE=PM;OBJECTID=<%s>;EXENAME=%s;SET BEGINLIBPATH=%s;STARTUPDIR=%s;ICONFILE=%s;PARAMETERS=\"%s\"", pszName, szPEGUILoaderPath, szSystemDir, szWorkDir, pszIcoPath, pszPath); 787 fWin32App = ODIN_IsWin32App(pszPath); 788 if(!fWin32App) 789 {//don't use the PE loader; use the program path directly 790 sprintf(pszSetupString, "PROGTYPE=PM;OBJECTID=<%s%s>;EXENAME=%s;SET BEGINLIBPATH=%s;STARTUPDIR=%s;ICONFILE=%s;PARAMETERS=", (fDesktop) ? "DESKTOP_" : "", pszName, pszPath, szSystemDir, szWorkDir, pszIcoPath); 791 } 792 else sprintf(pszSetupString, "PROGTYPE=PM;OBJECTID=<%s%s>;EXENAME=%s;SET BEGINLIBPATH=%s;STARTUPDIR=%s;ICONFILE=%s;PARAMETERS=\"%s\"", (fDesktop) ? "DESKTOP_" : "", pszName, szPEGUILoaderPath, szSystemDir, szWorkDir, pszIcoPath, pszPath); 793 787 794 if(pszArgs && *pszArgs) { 788 795 strcat(pszSetupString, " "); … … 794 801 dprintf(("Name = %s", pszName)); 795 802 dprintf(("Setup string = %s", pszSetupString)); 803 804 //Use a different name for desktop objects 796 805 hObject = WinCreateObject("WPProgram", pszName, pszSetupString, 797 806 "<WP_DESKTOP>", CO_REPLACEIFEXISTS); … … 805 814 hObject = WinCreateObject("WPFolder", pszFolder, szWorkDir, 806 815 "<ODINFOLDER>", CO_UPDATEIFEXISTS); 807 hObject = WinCreateObject("WPProgram", pszName, pszSetupString, 808 temp, CO_REPLACEIFEXISTS); 816 if(hObject) { 817 hObject = WinCreateObject("WPProgram", pszName, pszSetupString, 818 temp, CO_REPLACEIFEXISTS); 819 } 820 else { 821 hObject = 1; //force silent failure 822 } 809 823 } 810 824 -
trunk/src/user32/user32dbg.def
r9810 r9851 1 ; $Id: user32dbg.def,v 1. 9 2003-02-16 15:31:11sandervl Exp $1 ; $Id: user32dbg.def,v 1.10 2003-02-24 17:02:43 sandervl Exp $ 2 2 3 3 LIBRARY USER32 INITINSTANCE TERMINSTANCE … … 717 717 _OSLibWinCreateObject@32 @2031 NONAME 718 718 _ConvertIconGroup@12 @2032 NONAME 719 _ConvertIconGroupIndirect@12 @2037 NONAME 719 720 720 721 _WinSetVisibleRgnNotifyProc@12 @2033 NONAME
Note:
See TracChangeset
for help on using the changeset viewer.