Changeset 1879
- Timestamp:
- Nov 29, 1999, 9:43:02 PM (25 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/include/winimagebase.h ¶
r1872 r1879 1 /* $Id: winimagebase.h,v 1. 6 1999-11-29 00:05:03 birdExp $ */1 /* $Id: winimagebase.h,v 1.7 1999-11-29 20:42:20 sandervl Exp $ */ 2 2 3 3 /* … … 70 70 virtual BOOL enumResourceNamesA(HMODULE hmod, LPCTSTR lpszType, ENUMRESNAMEPROCA lpEnumFunc, LONG lParam); 71 71 virtual BOOL enumResourceNamesW(HMODULE hmod, LPCWSTR lpszType, ENUMRESNAMEPROCW lpEnumFunc, LONG lParam); 72 virtual BOOL enumResourceTypesA(HMODULE hmod, ENUMRESTYPEPROCA lpEnumFunc, 73 LONG lParam); 74 virtual BOOL enumResourceTypesW(HMODULE hmod, ENUMRESTYPEPROCW lpEnumFunc, 75 LONG lParam); 72 76 73 77 virtual ULONG getVersionSize(); -
TabularUnified trunk/src/kernel32/resource.cpp ¶
r1872 r1879 1 /* $Id: resource.cpp,v 1.1 0 1999-11-29 00:04:05 birdExp $ */1 /* $Id: resource.cpp,v 1.11 1999-11-29 20:43:01 sandervl Exp $ */ 2 2 3 3 /* … … 163 163 } 164 164 165 /***************************************************************************** 166 * Name : BOOL WIN32API EnumResourceLanguagesA 167 * Purpose : The EnumResourceLanguagesA function searches a module for each 168 * resource of the specified type and name and passes the language 169 * of each resource it locates to a defined callback function 170 * Parameters: HMODULE hModule resource-module handle 171 * LPCTSTR lpType pointer to resource type 172 * LPCTSTR lpName, pointer to resource name 173 * ENUMRESLANGPROC lpEnumFunc pointer to callback function 174 * LONG lParam application-defined parameter 175 * Variables : 176 * Result : If the function succeeds, the return value is nonzero. 177 * If the function fails, the return value is zero. 178 * Remark : The EnumResourceLanguages function continues to enumerate 179 * resource languages until the callback function returns FALSE 180 * or all resource languages have been enumerated. 181 * Status : UNTESTED STUB 182 * 183 * Author : Markus Montkowski [Tha, 1998/05/21 17:46] 184 *****************************************************************************/ 185 186 BOOL WIN32API EnumResourceLanguagesA(HMODULE hModule, LPCSTR lpType, 187 LPCSTR lpName, 188 ENUMRESLANGPROCA lpEnumFunc, 189 LONG lParam) 190 { 191 192 dprintf(("KERNEL32:EnumResourceLanguagesA(%08x,%08x,%08x,%08x,%08x)\n not implemented", 193 hModule, lpType, lpName, lpEnumFunc, lParam 194 )); 195 196 return (FALSE); 197 } 198 199 /***************************************************************************** 200 * Name : BOOL WIN32API EnumResourceLanguagesW 201 * Purpose : The EnumResourceLanguagesW function searches a module for each 202 * resource of the specified type and name and passes the language 203 * of each resource it locates to a defined callback function 204 * Parameters: HMODULE hModule resource-module handle 205 * LPCTSTR lpType pointer to resource type 206 * LPCTSTR lpName, pointer to resource name 207 * ENUMRESLANGPROC lpEnumFunc pointer to callback function 208 * LONG lParam application-defined parameter 209 * Variables : 210 * Result : If the function succeeds, the return value is nonzero. 211 * If the function fails, the return value is zero. 212 * Remark : The EnumResourceLanguages function continues to enumerate 213 * resource languages until the callback function returns FALSE 214 * or all resource languages have been enumerated. 215 * Status : UNTESTED STUB 216 * 217 * Author : Markus Montkowski [Tha, 1998/05/21 17:46] 218 *****************************************************************************/ 219 220 BOOL WIN32API EnumResourceLanguagesW(HMODULE hModule, LPCWSTR lpType, 221 LPCWSTR lpName, 222 ENUMRESLANGPROCW lpEnumFunc, 223 LONG lParam) 224 { 225 226 dprintf(("KERNEL32:EnumResourceLanguagesW(%08x,%08x,%08x,%08x,%08x)\n not implemented", 227 hModule, lpType, lpName, lpEnumFunc, lParam 228 )); 229 230 return (FALSE); 231 } 232 233 234 235 /***************************************************************************** 236 * Name : BOOL WIN32API EnumResourceTypesA 237 * Purpose : The EnumResourceTypesA function searches a module for resources 238 * and passes each resource type it finds to an application-defined 239 * callback function 240 * Parameters: HMODULE hModule, resource-module handle 241 * ENUMRESTYPEPROC lpEnumFunc pointer to callback function 242 * LONG lParam application-defined parameter 243 * Variables : 244 * Result : If the function succeeds, the return value is nonzero. 245 * If the function fails, the return value is zero 246 * Remark : 247 * Status : UNTESTED STUB 248 * 249 * Author : Markus Montkowski [Tha, 1998/05/21 17:46] 250 *****************************************************************************/ 251 252 BOOL WIN32API EnumResourceTypesA(HMODULE hModule, 253 ENUMRESTYPEPROCA lpEnumFunc, LONG lParam) 254 { 255 Win32ImageBase *pModule; 256 257 dprintf(("KERNEL32:EnumResourceTypesA(%08x,%08x,%08x)\n", 258 hModule, lpEnumFunc, lParam)); 259 260 pModule = Win32ImageBase::findModule(hModule); 261 if (pModule == NULL) 262 { 263 SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND); 264 return FALSE; 265 } 266 267 return pModule->enumResourceTypesA(hModule, lpEnumFunc, lParam); 268 } 269 270 /***************************************************************************** 271 * Name : BOOL WIN32API EnumResourceTypesW 272 * Purpose : The EnumResourceTypesW function searches a module for resources 273 * and passes each resource type it finds to an application-defined 274 * callback function 275 * Parameters: HMODULE hModule, resource-module handle 276 * ENUMRESTYPEPROC lpEnumFunc pointer to callback function 277 * LONG lParam application-defined parameter 278 * Variables : 279 * Result : If the function succeeds, the return value is nonzero. 280 * If the function fails, the return value is zero 281 * Remark : 282 * Status : UNTESTED STUB 283 * 284 * Author : Markus Montkowski [Tha, 1998/05/21 17:46] 285 *****************************************************************************/ 286 287 BOOL WIN32API EnumResourceTypesW(HMODULE hModule, 288 ENUMRESTYPEPROCW lpEnumFunc, LONG lParam) 289 { 290 Win32ImageBase *pModule; 291 292 dprintf(("KERNEL32:EnumResourceTypesW(%08x,%08x,%08x)\n", 293 hModule, lpEnumFunc, lParam)); 294 295 pModule = Win32ImageBase::findModule(hModule); 296 if (pModule == NULL) 297 { 298 SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND); 299 return FALSE; 300 } 301 302 return pModule->enumResourceTypesW(hModule, lpEnumFunc, lParam); 303 } -
TabularUnified trunk/src/kernel32/stubs.cpp ¶
r1872 r1879 1 /* $Id: stubs.cpp,v 1. 8 1999-11-29 00:04:05 birdExp $ */1 /* $Id: stubs.cpp,v 1.9 1999-11-29 20:43:01 sandervl Exp $ */ 2 2 3 3 /* … … 1450 1450 1451 1451 /***************************************************************************** 1452 * Name : BOOL WIN32API EnumResourceLanguagesA1453 * Purpose : The EnumResourceLanguagesA function searches a module for each1454 * resource of the specified type and name and passes the language1455 * of each resource it locates to a defined callback function1456 * Parameters: HMODULE hModule resource-module handle1457 * LPCTSTR lpType pointer to resource type1458 * LPCTSTR lpName, pointer to resource name1459 * ENUMRESLANGPROC lpEnumFunc pointer to callback function1460 * LONG lParam application-defined parameter1461 * Variables :1462 * Result : If the function succeeds, the return value is nonzero.1463 * If the function fails, the return value is zero.1464 * Remark : The EnumResourceLanguages function continues to enumerate1465 * resource languages until the callback function returns FALSE1466 * or all resource languages have been enumerated.1467 * Status : UNTESTED STUB1468 *1469 * Author : Markus Montkowski [Tha, 1998/05/21 17:46]1470 *****************************************************************************/1471 1472 BOOL WIN32API EnumResourceLanguagesA(HMODULE hModule, LPCSTR lpType,1473 LPCSTR lpName,1474 ENUMRESLANGPROCA lpEnumFunc,1475 LONG lParam)1476 {1477 1478 dprintf(("KERNEL32:EnumResourceLanguagesA(%08x,%08x,%08x,%08x,%08x)\n not implemented",1479 hModule, lpType, lpName, lpEnumFunc, lParam1480 ));1481 1482 return (FALSE);1483 }1484 1485 /*****************************************************************************1486 * Name : BOOL WIN32API EnumResourceLanguagesW1487 * Purpose : The EnumResourceLanguagesW function searches a module for each1488 * resource of the specified type and name and passes the language1489 * of each resource it locates to a defined callback function1490 * Parameters: HMODULE hModule resource-module handle1491 * LPCTSTR lpType pointer to resource type1492 * LPCTSTR lpName, pointer to resource name1493 * ENUMRESLANGPROC lpEnumFunc pointer to callback function1494 * LONG lParam application-defined parameter1495 * Variables :1496 * Result : If the function succeeds, the return value is nonzero.1497 * If the function fails, the return value is zero.1498 * Remark : The EnumResourceLanguages function continues to enumerate1499 * resource languages until the callback function returns FALSE1500 * or all resource languages have been enumerated.1501 * Status : UNTESTED STUB1502 *1503 * Author : Markus Montkowski [Tha, 1998/05/21 17:46]1504 *****************************************************************************/1505 1506 BOOL WIN32API EnumResourceLanguagesW(HMODULE hModule, LPCWSTR lpType,1507 LPCWSTR lpName,1508 ENUMRESLANGPROCW lpEnumFunc,1509 LONG lParam)1510 {1511 1512 dprintf(("KERNEL32:EnumResourceLanguagesW(%08x,%08x,%08x,%08x,%08x)\n not implemented",1513 hModule, lpType, lpName, lpEnumFunc, lParam1514 ));1515 1516 return (FALSE);1517 }1518 1519 1520 1521 /*****************************************************************************1522 * Name : BOOL WIN32API EnumResourceTypesA1523 * Purpose : The EnumResourceTypesA function searches a module for resources1524 * and passes each resource type it finds to an application-defined1525 * callback function1526 * Parameters: HMODULE hModule, resource-module handle1527 * ENUMRESTYPEPROC lpEnumFunc pointer to callback function1528 * LONG lParam application-defined parameter1529 * Variables :1530 * Result : If the function succeeds, the return value is nonzero.1531 * If the function fails, the return value is zero1532 * Remark :1533 * Status : UNTESTED STUB1534 *1535 * Author : Markus Montkowski [Tha, 1998/05/21 17:46]1536 *****************************************************************************/1537 1538 BOOL WIN32API EnumResourceTypesA(HMODULE hModule,1539 ENUMRESTYPEPROCA lpEnumFunc, LONG lParam)1540 {1541 1542 dprintf(("KERNEL32: EnumResourceTypesA(%08x,%08x,%08x) not implemented\n",1543 hModule, lpEnumFunc, lParam1544 ));1545 1546 return (FALSE);1547 }1548 1549 /*****************************************************************************1550 * Name : BOOL WIN32API EnumResourceTypesW1551 * Purpose : The EnumResourceTypesW function searches a module for resources1552 * and passes each resource type it finds to an application-defined1553 * callback function1554 * Parameters: HMODULE hModule, resource-module handle1555 * ENUMRESTYPEPROC lpEnumFunc pointer to callback function1556 * LONG lParam application-defined parameter1557 * Variables :1558 * Result : If the function succeeds, the return value is nonzero.1559 * If the function fails, the return value is zero1560 * Remark :1561 * Status : UNTESTED STUB1562 *1563 * Author : Markus Montkowski [Tha, 1998/05/21 17:46]1564 *****************************************************************************/1565 1566 BOOL WIN32API EnumResourceTypesW(HMODULE hModule,1567 ENUMRESTYPEPROCW lpEnumFunc, LONG lParam)1568 {1569 1570 dprintf(("KERNEL32: EnumResourceTypesW(%08x,%08x,%08x) not implemented\n",1571 hModule, lpEnumFunc, lParam1572 ));1573 1574 return (FALSE);1575 }1576 1577 /*****************************************************************************1578 1452 * Name : BOOL WIN32API EnumSystemCodePagesA 1579 1453 * Purpose : The EnumSystemCodePagesA function enumerates the code pages that -
TabularUnified trunk/src/kernel32/winimgres.cpp ¶
r1872 r1879 1 /* $Id: winimgres.cpp,v 1.2 7 1999-11-29 00:04:07 birdExp $ */1 /* $Id: winimgres.cpp,v 1.28 1999-11-29 20:43:02 sandervl Exp $ */ 2 2 3 3 /* … … 270 270 //for the resource section (images loaded by the pe.exe and pe2lx/win32k) 271 271 //For LX images, this is 0 as OffsetToData contains a relative offset 272 char *resdata = (char *)((char *)pResDir + pData->OffsetToData - ulRVAResourceSection);272 char *resdata = (char *)((char *)pResDir + (pData->OffsetToData - ulRVAResourceSection)); 273 273 res = new Win32Resource(this, id, type, pData->Size, resdata); 274 274 … … 299 299 return(hres); 300 300 } 301 //******************************************************************************302 //TODO:303 //******************************************************************************304 #if 0305 ULONG Win32Pe2LxImage::getResourceSizeA(LPCSTR lpszName, LPSTR lpszType, ULONG lang)306 {307 DebugInt3();308 return 0;309 }310 #endif311 301 //****************************************************************************** 312 302 //****************************************************************************** … … 356 346 if(getVersionId() == -1) { 357 347 dprintf(("GetVersionStruct: %s has no version resource!\n", szModule)); 348 SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND); 358 349 return(FALSE); 359 350 } … … 380 371 if(pData == NULL) { 381 372 dprintf(("Win32PeLdrImage::getVersionStruct: couldn't find version resource!")); 373 SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND); 382 374 return 0; 383 375 } … … 432 424 if (pResDir == NULL) 433 425 { 434 /* SetLastError(?);? */426 SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND); 435 427 return FALSE; 436 428 } … … 702 694 return pResDirRet; 703 695 } 704 696 //****************************************************************************** 697 //****************************************************************************** 698 BOOL Win32ImageBase::enumResourceTypesA(HMODULE hmod, ENUMRESTYPEPROCA lpEnumFunc, 699 LONG lParam) 700 { 701 PIMAGE_RESOURCE_DIRECTORY prdType; 702 PIMAGE_RESOURCE_DIRECTORY_ENTRY prde; 703 PIMAGE_RESOURCE_DIR_STRING_U pstring; 704 ULONG i, nameOffset; 705 BOOL fRet; 706 707 if (pResDir == NULL) 708 { 709 SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND); 710 return FALSE; 711 } 712 713 if ((unsigned)lpEnumFunc < 0x10000 || (unsigned)lpEnumFunc >= 0xc0000000) 714 { 715 SetLastError(ERROR_NOACCESS); 716 return FALSE; 717 } 718 719 //reminder: 720 //1st level -> types 721 //2nd level -> names 722 //3rd level -> language 723 724 /* set pointer to first resource type entry */ 725 prde = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)((ULONG)pResDir + sizeof(IMAGE_RESOURCE_DIRECTORY)); 726 727 for (i=0; i<pResDir->NumberOfNamedEntries+pResDir->NumberOfIdEntries && fRet; i++) 728 { 729 /* locate directory or each resource type */ 730 prdType = (PIMAGE_RESOURCE_DIRECTORY)((int)pResDir + (int)prde->u2.OffsetToData); 731 732 if (prde->u1.s.NameIsString) 733 {//name or id entry? 734 //SvL: 30-10-'97, high bit is set, so clear to get real offset 735 nameOffset = prde->u1.Name & ~0x80000000; 736 737 pstring = (PIMAGE_RESOURCE_DIR_STRING_U)((ULONG)pResDir + nameOffset); 738 char *typename = (char *)malloc(pstring->Length+1); 739 lstrcpynWtoA(typename, pstring->NameString, pstring->Length+1); 740 typename[pstring->Length] = 0; 741 742 fRet = lpEnumFunc(hmod, typename, lParam); 743 free(typename); 744 } 745 else { 746 fRet = lpEnumFunc(hmod, (LPSTR)prde->u1.Id, lParam); 747 } 748 749 /* increment to next entry */ 750 prde++; 751 } 752 return fRet > 0 ? TRUE : FALSE; 753 } 754 //****************************************************************************** 755 //****************************************************************************** 756 BOOL Win32ImageBase::enumResourceTypesW(HMODULE hmod, ENUMRESTYPEPROCW lpEnumFunc, 757 LONG lParam) 758 { 759 PIMAGE_RESOURCE_DIRECTORY prdType; 760 PIMAGE_RESOURCE_DIRECTORY_ENTRY prde; 761 PIMAGE_RESOURCE_DIR_STRING_U pstring; 762 ULONG i, nameOffset; 763 BOOL fRet; 764 765 if (pResDir == NULL) 766 { 767 SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND); 768 return FALSE; 769 } 770 771 if ((unsigned)lpEnumFunc < 0x10000 || (unsigned)lpEnumFunc >= 0xc0000000) 772 { 773 SetLastError(ERROR_NOACCESS); 774 return FALSE; 775 } 776 777 //reminder: 778 //1st level -> types 779 //2nd level -> names 780 //3rd level -> language 781 782 /* set pointer to first resource type entry */ 783 prde = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)((ULONG)pResDir + sizeof(IMAGE_RESOURCE_DIRECTORY)); 784 785 for (i=0; i<pResDir->NumberOfNamedEntries+pResDir->NumberOfIdEntries && fRet; i++) 786 { 787 /* locate directory or each resource type */ 788 prdType = (PIMAGE_RESOURCE_DIRECTORY)((int)pResDir + (int)prde->u2.OffsetToData); 789 790 if (prde->u1.s.NameIsString) 791 {//name or id entry? 792 //SvL: 30-10-'97, high bit is set, so clear to get real offset 793 nameOffset = prde->u1.Name & ~0x80000000; 794 795 pstring = (PIMAGE_RESOURCE_DIR_STRING_U)((ULONG)pResDir + nameOffset); 796 fRet = lpEnumFunc(hmod, pstring->NameString, lParam); 797 } 798 else fRet = lpEnumFunc(hmod, (LPWSTR)prde->u1.Id, lParam); 799 800 /* increment to next entry */ 801 prde++; 802 } 803 return fRet > 0 ? TRUE : FALSE; 804 } 805 //****************************************************************************** 806 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.