Changeset 59
- Timestamp:
- Apr 16, 2001, 9:29:52 PM (24 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/helpers/dosh.h
r56 r59 13 13 */ 14 14 15 /* This file Copyright (C) 1997-200 0Ulrich Mller,15 /* This file Copyright (C) 1997-2001 Ulrich Mller, 16 16 * Dmitry A. Steklenev. 17 17 * This file is part of the "XWorkplace helpers" source package. … … 417 417 * 418 418 *@@changed V0.9.7 (2000-12-20) [umoeller]: fixed NE offset 419 *@@changed V0.9.9 (2001-04-06) [lafaix]: additional fields defined 419 420 */ 420 421 … … 436 437 USHORT usRelocTableOfs; // 18: reloc table ofs.header (Win: >= 0x40) 437 438 USHORT usOverlayNo; // 1a: overlay no. 438 ULONG ulLinkerVersion; // 1c: linker version (if 0x18 > 0x28) 439 ULONG ulUnused1; // 20: unused 440 ULONG ulUnused2; // 24: exe.h says the following fields are 441 ULONG ulUnused3; // 28: 'behavior bits' 442 ULONG ulUnused4; // 3c: 439 USHORT usLinkerVersion; // 1c: linker version (if 0x18 > 0x28) 440 USHORT usUnused1; // 1e: unused 441 USHORT usBehaviorBits; // 20: exe.h says this field contains 442 // 'behavior bits' 443 USHORT usUnused2; // 22: unused 444 USHORT usOEMIdentifier; // 24: OEM identifier 445 USHORT usOEMInformation; // 26: OEM information 446 ULONG ulUnused3; // 28: 447 ULONG ulUnused4; // 2c: 443 448 ULONG ulUnused5; // 30: 444 449 ULONG ulUnused6; // 34: 445 450 ULONG ulUnused7; // 38: 446 ULONG ulNewHeaderOfs; // new header ofs (if 0x18 > 0x40)451 ULONG ulNewHeaderOfs; // 3c: new header ofs (if 0x18 > 0x40) 447 452 // fixed this from USHORT, thanks Martin Lafaix 448 453 // V0.9.7 (2000-12-20) [umoeller] … … 461 466 * which comes after the DOS header in the 462 467 * EXE file (at DOSEXEHEADER.ulNewHeaderOfs). 468 * 469 *@@changed V0.9.9 (2001-04-06) [lafaix]: fixed typo in usMoveableEntries 463 470 */ 464 471 … … 486 493 USHORT usImportTblOfs; // 2a: import tbl ofs 487 494 ULONG ulNonResdTblOfs; // 2c: non-resd. name tbl ofs 488 USHORT usMoveableEnt ires; // 30: moveable entry pts. count495 USHORT usMoveableEntries; // 30: moveable entry pts. count 489 496 USHORT usLogicalSectShift; // 32: logcl. sector shift 490 497 USHORT usResSegmCount; // 34: resource segm. count … … 502 509 * which comes after the DOS header in the 503 510 * EXE file (at DOSEXEHEADER.ulNewHeaderOfs). 511 * 512 *@@changed V0.9.9 (2001-04-06) [lafaix]: fixed auto data object and ulinstanceDemdCnt 504 513 */ 505 514 … … 549 558 ULONG ulNonResdNameTblLen; // 8c: non-resdnt name tbl length 550 559 ULONG ulNonResdNameTblCS; // 90: non-res name tbl checksum 551 ULONG ulAutoDataSegObj Cnt; // 94: auto dataseg object count560 ULONG ulAutoDataSegObj; // 94: auto dataseg object 552 561 ULONG ulDebugOfs; // 98: debug info ofs 553 562 ULONG ulDebugLen; // 9c: debug info length 554 563 ULONG ulInstancePrelCnt; // a0: instance preload count 555 ULONG ul instanceDemdCnt; // a0: instance demand count564 ULONG ulInstanceDemdCnt; // a0: instance demand count 556 565 ULONG ulHeapSize16; // a8: heap size (16-bit) 557 566 ULONG ulStackSize; // ac: stack size 558 567 } LXHEADER, *PLXHEADER; 568 569 /* 570 *@@ PEHEADER: 571 * portable executable (PE) header format, 572 * which comes after the DOS header in the 573 * EXE file (at DOSEXEHEADER.ulNewHeaderOfs). 574 * 575 *@@added V0.9.10 (2001-04-08) [lafaix] 576 */ 577 578 typedef struct _PEHEADER 579 { 580 // standard header 581 ULONG ulSignature; // 00: 'P', 'E', 0, 0 582 USHORT usCPU; // 04: CPU type 583 USHORT usObjCount; // 06: number of object entries 584 ULONG ulTimeDateStamp; // 08: store the time and date the 585 // file was created or modified 586 // by the linker 587 ULONG ulReserved1; // 0c: reserved 588 ULONG ulReserved2; // 10: reserved 589 USHORT usHeaderSize; // 14: number of remaining bytes after 590 // usImageFlags 591 USHORT usImageFlags; // 16: flags bits for the image 592 593 // optional header (always present in valid Win32 files) 594 USHORT usReserved3; // 18: reserved 595 USHORT usLinkerMajor; // 1a: linker major version number 596 USHORT usLinkerMinor; // 1c: linker minor version number 597 USHORT usReserved4; // 1e: reserved 598 ULONG ulReserved5; // 20: reserved 599 ULONG ulReserved6; // 24: reserved 600 ULONG ulEntryPointRVA; // 28: entry point relative virtual address 601 ULONG ulReserved7; // 2c: reserved 602 ULONG ulReserved8; // 30: reserved 603 ULONG ulImageBase; // 34: 604 ULONG ulObjectAlign; // 38: 605 ULONG ulFileAlign; // 3c: 606 USHORT usOSMajor; // 40: 607 USHORT usOSMinor; // 42: 608 USHORT usUserMajor; // 44: 609 USHORT usUserMinor; // 46: 610 USHORT usSubSystemMajor; // 48: 611 USHORT usSubSystemMinor; // 4a: 612 ULONG ulReserved9; // 4c: reserved 613 ULONG ulImageSize; // 50: 614 ULONG ulHeaderSize; // 54: 615 ULONG ulFileChecksum; // 58: 616 USHORT usSubSystem; // 5c: 617 USHORT usDLLFlags; // 5e: 618 ULONG ulStackReserveSize; // 60: 619 ULONG ulStackCommitSize; // 64: 620 ULONG ulHeapReserveSize; // 68: 621 ULONG ulHeapCommitSize; // 6c: 622 ULONG ulReserved10; // 70: reserved 623 ULONG ulInterestingRVACount;// 74: 624 ULONG aulRVASize[1]; // 78: array of RVA/Size entries 625 } PEHEADER, *PPEHEADER; 559 626 560 627 #pragma pack() … … 651 718 PLXHEADER pLXHeader; 652 719 ULONG cbLXHeader; 720 721 // Portable Executable (PE) header, if ulExeFormat == EXEFORMAT_PE 722 PPEHEADER pPEHeader; 723 ULONG cbPEHeader; 653 724 654 725 // module analysis (always set): -
trunk/include/helpers/syssound.h
r41 r59 71 71 PULONG pulVolume); 72 72 73 VOID sndQueryMmpmIniPath(PSZ pszMMPM); 74 73 75 HINI sndOpenMmpmIni(HAB hab); 74 76 -
trunk/src/helpers/dosh2.c
r57 r59 810 810 *@@changed V0.9.1 (2000-02-13) [umoeller]: fixed 32-bits flag 811 811 *@@changed V0.9.7 (2000-12-20) [lafaix]: fixed ulNewHeaderOfs 812 *@@changed V0.9.10 (2001-04-08) [lafaix]: added PE support 812 813 *@@changed V0.9.10 (2001-04-08) [umoeller]: now setting ppExec only if NO_ERROR is returned 813 814 */ … … 945 946 else if (memcmp(achNewHeaderType, "PE", 2) == 0) 946 947 { 948 PEHEADER PEHeader = {0}; 949 947 950 pExec->ulExeFormat = EXEFORMAT_PE; 948 951 pExec->ulOS = EXEOS_WIN32; 949 952 pExec->f32Bits = TRUE; 950 953 951 // can't parse this yet 954 // V0.9.10 (2001-04-08) [lafaix] 955 // read in standard PE header 956 if (!(arc = DosRead(hFile, 957 &PEHeader, 958 24, 959 &ulBytesRead))) 960 { 961 // allocate PE header 962 pExec->pPEHeader = (PPEHEADER)malloc(24 + PEHeader.usHeaderSize); 963 if (!(pExec->pPEHeader)) 964 arc = ERROR_NOT_ENOUGH_MEMORY; 965 else 966 { 967 // copy standard PE header 968 memcpy(pExec->pPEHeader, 969 &PEHeader, 970 24); 971 972 // read in optional PE header 973 if (!(arc = DosRead(hFile, 974 &(pExec->pPEHeader->usReserved3), 975 PEHeader.usHeaderSize, 976 &(pExec->cbPEHeader)))) 977 pExec->cbPEHeader += 24; 978 } 979 } 952 980 } 953 981 else … … 1243 1271 *@@changed V0.9.9 (2001-04-03) [umoeller]: added tons of error checking, changed prototype to return APIRET 1244 1272 *@@changed V0.9.9 (2001-04-05) [lafaix]: rewritten error checking code 1273 *@@changed V0.9.10 (2001-04-10) [lafaix]: added Win16 and Win386 support 1274 *@@changed V0.9.10 (2001-04-13) [lafaix]: removed 127 characters limit 1245 1275 */ 1246 1276 … … 1250 1280 { 1251 1281 if ( (pExec) 1252 && (pExec->ulOS == EXEOS_OS2) 1282 && ( (pExec->ulOS == EXEOS_OS2) 1283 || (pExec->ulOS == EXEOS_WIN16) 1284 || (pExec->ulOS == EXEOS_WIN386) 1285 ) 1253 1286 ) 1254 1287 { … … 1286 1319 // reading the length of the module name 1287 1320 ENSURE_SAFE(DosRead(pExec->hfExe, &bLen, 1, &ulDummy)); 1288 1289 // At most 127 bytes1290 bLen &= 0x7F;1291 1321 1292 1322 // reading the module name … … 1304 1334 else if (pExec->ulExeFormat == EXEFORMAT_NE) 1305 1335 { 1306 // 16-bit OS/2executable:1336 // 16-bit executable: 1307 1337 cModules = pExec->pNEHeader->usModuleTblEntries; 1308 1338 … … 1345 1375 1346 1376 ENSURE_SAFE(DosRead(pExec->hfExe, &bLen, 1, &ulDummy)); 1347 1348 bLen &= 0x7F;1349 1377 1350 1378 ENSURE_SAFE(DosRead(pExec->hfExe, … … 1662 1690 ENSURE(DosRead(pExec->hfExe, &bType, 1, &ulDummy)); 1663 1691 1664 for (i = 0; i < bCnt; i++)1692 if (bType) 1665 1693 { 1666 ENSURE(DosRead(pExec->hfExe, 1667 &bFlag, 1668 1, 1669 &ulDummy)); 1670 1671 if (bFlag & 0x01) 1694 for (i = 0; i < bCnt; i++) 1672 1695 { 1673 if (paFunctions) 1696 ENSURE(DosRead(pExec->hfExe, 1697 &bFlag, 1698 1, 1699 &ulDummy)); 1700 1701 if (bFlag & 0x01) 1674 1702 { 1675 paFunctions[usCurrent].ulOrdinal = usOrdinal; 1676 paFunctions[usCurrent].ulType = 1; // 16-bit entry 1677 paFunctions[usCurrent].achFunctionName[0] = 0; 1703 if (paFunctions) 1704 { 1705 paFunctions[usCurrent].ulOrdinal = usOrdinal; 1706 paFunctions[usCurrent].ulType = 1; // 16-bit entry 1707 paFunctions[usCurrent].achFunctionName[0] = 0; 1708 } 1709 usCurrent++; 1678 1710 } 1679 usCurrent++; 1680 } 1681 1682 usOrdinal++; 1683 1684 if (bType == 0xFF) 1685 { 1686 // moveable segment 1687 ENSURE(DosSetFilePtr(pExec->hfExe, 1688 5, 1689 FILE_CURRENT, 1690 &ulDummy)); 1691 } 1692 else 1693 { 1694 // fixed segment 1695 ENSURE(DosSetFilePtr(pExec->hfExe, 1696 2, 1697 FILE_CURRENT, 1698 &ulDummy)); 1699 } 1700 1701 } // end for 1711 1712 usOrdinal++; 1713 1714 if (bType == 0xFF) 1715 { 1716 // moveable segment 1717 ENSURE(DosSetFilePtr(pExec->hfExe, 1718 5, 1719 FILE_CURRENT, 1720 &ulDummy)); 1721 } 1722 else 1723 { 1724 // fixed segment or constant (0xFE) 1725 ENSURE(DosSetFilePtr(pExec->hfExe, 1726 2, 1727 FILE_CURRENT, 1728 &ulDummy)); 1729 } 1730 1731 } // end for 1732 } 1733 else 1734 usOrdinal += bCnt; 1702 1735 } // end while (TRUE) 1703 1736 … … 1815 1848 *@@changed V0.9.9 (2001-04-03) [umoeller]: added tons of error checking, changed prototype to return APIRET 1816 1849 *@@changed V0.9.9 (2001-04-05) [lafaix]: rewritten error checking code 1850 *@@changed V0.9.10 (2001-04-10) [lafaix]: added Win16 and Win386 support 1817 1851 */ 1818 1852 … … 1822 1856 { 1823 1857 if ( (pExec) 1824 && (pExec->ulOS == EXEOS_OS2) 1858 && ( (pExec->ulOS == EXEOS_OS2) 1859 || (pExec->ulOS == EXEOS_WIN16) 1860 || (pExec->ulOS == EXEOS_WIN386) 1861 ) 1825 1862 ) 1826 1863 { … … 1880 1917 else if (pExec->ulExeFormat == EXEFORMAT_NE) 1881 1918 { 1882 // It's a 16bit OS/2executable1919 // it's a "new" segmented 16bit executable 1883 1920 1884 1921 // here too the number of exported entry points … … 1980 2017 *@@added V0.9.7 (2000-12-18) [lafaix] 1981 2018 *@@changed V0.9.9 (2001-04-03) [umoeller]: added tons of error checking, changed prototype to return APIRET 2019 *@@changed V0.9.10 (2001-04-10) [lafaix]: added Win16 and Win386 support 1982 2020 */ 1983 2021 … … 1987 2025 { 1988 2026 if ( (pExec) 1989 && (pExec->ulOS == EXEOS_OS2) 2027 && ( (pExec->ulOS == EXEOS_OS2) 2028 || (pExec->ulOS == EXEOS_WIN16) 2029 || (pExec->ulOS == EXEOS_WIN386) 2030 ) 1990 2031 ) 1991 2032 { … … 2082 2123 else if (pExec->ulExeFormat == EXEFORMAT_NE) 2083 2124 { 2084 // 16-bit OS/2 executable: 2085 cResources = pExec->pNEHeader->usResSegmCount; 2086 2087 if (cResources) 2125 if (pExec->ulOS == EXEOS_OS2) 2088 2126 { 2089 #pragma pack(1) // V0.9.9 (2001-04-02) [umoeller] 2090 struct {unsigned short type; unsigned short name;} rti; 2091 struct new_seg /* New .EXE segment table entry */ 2127 // 16-bit OS/2 executable: 2128 cResources = pExec->pNEHeader->usResSegmCount; 2129 2130 if (cResources) 2092 2131 { 2093 unsigned short ns_sector; /* File sector of start of segment */ 2094 unsigned short ns_cbseg; /* Number of bytes in file */ 2095 unsigned short ns_flags; /* Attribute flags */ 2096 unsigned short ns_minalloc; /* Minimum allocation in bytes */ 2097 } ns; 2098 #pragma pack() 2099 2100 ULONG cb = sizeof(FSYSRESOURCE) * cResources; 2101 ULONG ulDummy; 2102 int i; 2103 2104 paResources = (PFSYSRESOURCE)malloc(cb); 2105 if (!paResources) 2106 ENSURE_FAIL(ERROR_NOT_ENOUGH_MEMORY); 2107 2108 memset(paResources, 0, cb); // V0.9.9 (2001-04-03) [umoeller] 2109 2110 // we first read the resources IDs and types 2111 2112 ENSURE_SAFE(DosSetFilePtr(pExec->hfExe, 2113 pExec->pNEHeader->usResTblOfs 2114 + pExec->pDosExeHeader->ulNewHeaderOfs, 2115 FILE_BEGIN, 2116 &ulDummy)); 2117 2118 for (i = 0; i < cResources; i++) 2132 #pragma pack(1) // V0.9.9 (2001-04-02) [umoeller] 2133 struct {unsigned short type; unsigned short name;} rti; 2134 struct new_seg /* New .EXE segment table entry */ 2135 { 2136 unsigned short ns_sector; /* File sector of start of segment */ 2137 unsigned short ns_cbseg; /* Number of bytes in file */ 2138 unsigned short ns_flags; /* Attribute flags */ 2139 unsigned short ns_minalloc; /* Minimum allocation in bytes */ 2140 } ns; 2141 #pragma pack() 2142 2143 ULONG cb = sizeof(FSYSRESOURCE) * cResources; 2144 ULONG ulDummy; 2145 int i; 2146 2147 paResources = (PFSYSRESOURCE)malloc(cb); 2148 if (!paResources) 2149 ENSURE_FAIL(ERROR_NOT_ENOUGH_MEMORY); 2150 2151 memset(paResources, 0, cb); // V0.9.9 (2001-04-03) [umoeller] 2152 2153 // we first read the resources IDs and types 2154 2155 ENSURE_SAFE(DosSetFilePtr(pExec->hfExe, 2156 pExec->pNEHeader->usResTblOfs 2157 + pExec->pDosExeHeader->ulNewHeaderOfs, 2158 FILE_BEGIN, 2159 &ulDummy)); 2160 2161 for (i = 0; i < cResources; i++) 2162 { 2163 ENSURE_SAFE(DosRead(pExec->hfExe, &rti, sizeof(rti), &ulDummy)); 2164 2165 paResources[i].ulID = rti.name; 2166 paResources[i].ulType = rti.type; 2167 } 2168 2169 // we then read their sizes and flags 2170 2171 for (i = 0; i < cResources; i++) 2172 { 2173 ENSURE_SAFE(DosSetFilePtr(pExec->hfExe, 2174 pExec->pDosExeHeader->ulNewHeaderOfs 2175 + pExec->pNEHeader->usSegTblOfs 2176 + (sizeof(ns) 2177 * ( pExec->pNEHeader->usSegTblEntries 2178 - pExec->pNEHeader->usResSegmCount 2179 + i)), 2180 FILE_BEGIN, 2181 &ulDummy)); 2182 2183 ENSURE_SAFE(DosRead(pExec->hfExe, &ns, sizeof(ns), &ulDummy)); 2184 2185 paResources[i].ulSize = ns.ns_cbseg; 2186 2187 paResources[i].ulFlag = (ns.ns_flags & OBJPRELOAD) ? RNPRELOAD : 0; 2188 paResources[i].ulFlag |= (ns.ns_flags & OBJSHARED) ? RNPURE : 0; 2189 paResources[i].ulFlag |= (ns.ns_flags & OBJDISCARD) ? RNMOVE : 0; 2190 paResources[i].ulFlag |= (ns.ns_flags & OBJDISCARD) ? 4096 : 0; 2191 } 2192 } // end if (cResources) 2193 } 2194 else 2195 { 2196 // 16-bit Windows executable 2197 USHORT usAlignShift; 2198 ULONG ulDummy; 2199 2200 ENSURE(DosSetFilePtr(pExec->hfExe, 2201 pExec->pNEHeader->usResTblOfs 2202 + pExec->pDosExeHeader->ulNewHeaderOfs, 2203 FILE_BEGIN, 2204 &ulDummy)); 2205 2206 ENSURE(DosRead(pExec->hfExe, 2207 &usAlignShift, 2208 sizeof(usAlignShift), 2209 &ulDummy)); 2210 2211 while (TRUE) 2119 2212 { 2120 ENSURE_SAFE(DosRead(pExec->hfExe, &rti, sizeof(rti), &ulDummy)); 2121 2122 paResources[i].ulID = rti.name; 2123 paResources[i].ulType = rti.type; 2213 USHORT usTypeID; 2214 USHORT usCount; 2215 2216 ENSURE(DosRead(pExec->hfExe, 2217 &usTypeID, 2218 sizeof(usTypeID), 2219 &ulDummy)); 2220 2221 if (usTypeID == 0) 2222 break; 2223 2224 ENSURE(DosRead(pExec->hfExe, 2225 &usCount, 2226 sizeof(usCount), 2227 &ulDummy)); 2228 2229 ENSURE(DosSetFilePtr(pExec->hfExe, 2230 sizeof(ULONG), 2231 FILE_CURRENT, 2232 &ulDummy)); 2233 2234 cResources += usCount; 2235 2236 // first pass, skip NAMEINFO table 2237 ENSURE(DosSetFilePtr(pExec->hfExe, 2238 usCount*6*sizeof(USHORT), 2239 FILE_CURRENT, 2240 &ulDummy)); 2124 2241 } 2125 2242 2126 // we then read their sizes and flags 2127 2128 for (i = 0; i < cResources; i++) 2243 if (cResources) 2129 2244 { 2245 USHORT usCurrent = 0; 2246 ULONG cb = sizeof(FSYSRESOURCE) * cResources; 2247 2248 paResources = (PFSYSRESOURCE)malloc(cb); 2249 if (!paResources) 2250 ENSURE_FAIL(ERROR_NOT_ENOUGH_MEMORY); 2251 2252 memset(paResources, 0, cb); 2253 2130 2254 ENSURE_SAFE(DosSetFilePtr(pExec->hfExe, 2131 pExec->pDosExeHeader->ulNewHeaderOfs 2132 + pExec->pNEHeader->usSegTblOfs 2133 + (sizeof(ns) 2134 * ( pExec->pNEHeader->usSegTblEntries 2135 - pExec->pNEHeader->usResSegmCount 2136 + i)), 2137 FILE_BEGIN, 2255 pExec->pNEHeader->usResTblOfs 2256 + pExec->pDosExeHeader->ulNewHeaderOfs, 2257 FILE_BEGIN, 2258 &ulDummy)); 2259 2260 ENSURE_SAFE(DosRead(pExec->hfExe, 2261 &usAlignShift, 2262 sizeof(usAlignShift), 2263 &ulDummy)); 2264 2265 while (TRUE) 2266 { 2267 USHORT usTypeID; 2268 USHORT usCount; 2269 int i; 2270 2271 ENSURE_SAFE(DosRead(pExec->hfExe, 2272 &usTypeID, 2273 sizeof(usTypeID), 2274 &ulDummy)); 2275 2276 if (usTypeID == 0) 2277 break; 2278 2279 ENSURE_SAFE(DosRead(pExec->hfExe, 2280 &usCount, 2281 sizeof(usCount), 2282 &ulDummy)); 2283 2284 ENSURE_SAFE(DosSetFilePtr(pExec->hfExe, 2285 sizeof(ULONG), 2286 FILE_CURRENT, 2287 &ulDummy)); 2288 2289 // second pass, read NAMEINFO table 2290 for (i = 0; i < usCount; i++) 2291 { 2292 USHORT usLength, 2293 usFlags, 2294 usID; 2295 2296 ENSURE_SAFE(DosSetFilePtr(pExec->hfExe, 2297 sizeof(USHORT), 2298 FILE_CURRENT, 2299 &ulDummy)); 2300 2301 ENSURE_SAFE(DosRead(pExec->hfExe, 2302 &usLength, 2303 sizeof(USHORT), 2138 2304 &ulDummy)); 2139 2140 ENSURE_SAFE(DosRead(pExec->hfExe, &ns, sizeof(ns), &ulDummy)); 2141 2142 paResources[i].ulSize = ns.ns_cbseg; 2143 2144 paResources[i].ulFlag = (ns.ns_flags & OBJPRELOAD) ? RNPRELOAD : 0; 2145 paResources[i].ulFlag |= (ns.ns_flags & OBJSHARED) ? RNPURE : 0; 2146 paResources[i].ulFlag |= (ns.ns_flags & OBJDISCARD) ? RNMOVE : 0; 2147 paResources[i].ulFlag |= (ns.ns_flags & OBJDISCARD) ? 4096 : 0; 2305 ENSURE_SAFE(DosRead(pExec->hfExe, 2306 &usFlags, 2307 sizeof(USHORT), 2308 &ulDummy)); 2309 ENSURE_SAFE(DosRead(pExec->hfExe, 2310 &usID, 2311 sizeof(USHORT), 2312 &ulDummy)); 2313 2314 ENSURE_SAFE(DosSetFilePtr(pExec->hfExe, 2315 2*sizeof(USHORT), 2316 FILE_CURRENT, 2317 &ulDummy)); 2318 2319 // !!! strings ids and types not handled yet 2320 // !!! 15th bit is used to denotes strings 2321 // !!! offsets [lafaix] 2322 paResources[usCurrent].ulType = usTypeID ^ 0x8000; 2323 paResources[usCurrent].ulID = usID ^ 0x8000; 2324 paResources[usCurrent].ulSize = usLength << usAlignShift; 2325 paResources[usCurrent].ulFlag = usFlags & 0x70; 2326 2327 usCurrent++; 2328 } 2329 } 2148 2330 } 2149 } // end if (cResources)2331 } 2150 2332 } // end else if (pExec->ulExeFormat == EXEFORMAT_NE) 2151 2333 else -
trunk/src/helpers/procstat.c
r57 r59 321 321 * system. If pfnwpCallback is NULL, only this number will be 322 322 * returned, so you can use this as a process counter too. 323 * 324 *@@changed V0.9.10 (2001-04-16) [pr]: now using DosAllocMem 323 325 */ 324 326 … … 326 328 { 327 329 ULONG ulrc = 0; 330 PQPROCSTAT16 pps; 328 331 PQPROCESS16 pProcess; 329 332 PRCPROCESS prcp; 330 PQPROCSTAT16 pps = (PQPROCSTAT16)malloc(0x8000); 331 DosQProcStatus(pps, 0x8000); 332 333 for ( pProcess = (PQPROCESS16)PTR(pps->ulProcesses, 0); 334 pProcess->ulType != 3; 335 pProcess = (PQPROCESS16)PTR(pProcess->ulThreadList, 336 pProcess->usThreads * sizeof(QTHREAD16)) 337 ) 338 { 339 if (pfnwpCallback) 340 { 341 prcReport16(pProcess, &prcp); 342 (*pfnwpCallback)(hwnd, ulMsg, mp1, &prcp); 343 } 344 ulrc++; 345 } 346 347 free(pps); 333 334 if (!DosAllocMem((PVOID*)&pps, 335 BUF_SIZE, 336 PAG_READ | PAG_WRITE | PAG_COMMIT | OBJ_TILE)) 337 { 338 if (!DosQProcStatus(pps, BUF_SIZE)) 339 for ( pProcess = (PQPROCESS16)PTR(pps->ulProcesses, 0); 340 pProcess->ulType != 3; 341 pProcess = (PQPROCESS16)PTR(pProcess->ulThreadList, 342 pProcess->usThreads * sizeof(QTHREAD16)) 343 ) 344 { 345 if (pfnwpCallback) 346 { 347 prcReport16(pProcess, &prcp); 348 (*pfnwpCallback)(hwnd, ulMsg, mp1, &prcp); 349 } 350 ulrc++; 351 } 352 353 DosFreeMem(pps); 354 } 355 348 356 return (ulrc); 349 357 } … … 542 550 * 543 551 *@@added V0.9.1 (2000-02-12) [umoeller] 544 *@@changed V0.9.3 (2000-05-01) [umoeller]: now using Dos AllocMem552 *@@changed V0.9.3 (2000-05-01) [umoeller]: now using DosFreeMem 545 553 */ 546 554 547 555 VOID prc32FreeInfo(PQTOPLEVEL32 pInfo) 548 556 { 549 DosFreeMem(pInfo); ;557 DosFreeMem(pInfo); 550 558 } 551 559 -
trunk/src/helpers/syssound.c
r21 r59 164 164 165 165 /* 166 *@@ sndQueryMmpmIniPath: 167 * writes the full path of MMPM.INI into 168 * the specified buffer (e.g. C:\MMOS2\MMPM.INI). 169 * 170 *@@added V0.9.10 (2001-04-16) [umoeller] 171 */ 172 173 VOID sndQueryMmpmIniPath(PSZ pszMMPM) // out: fully q'fied MMPM.INI 174 { 175 PSZ pszMMPMPath = getenv("MMBASE"); // V0.9.6 (2000-10-16) [umoeller] 176 if (pszMMPMPath) 177 { 178 // variable set: 179 PSZ p; 180 181 strcpy(pszMMPM, pszMMPMPath); // V0.9.7 (2000-12-17) [umoeller] 182 183 // kill semicolon if present 184 p = strchr(pszMMPM, ';'); 185 if (p) 186 *p = 0; 187 188 strcat(pszMMPM, "\\MMPM.INI"); 189 } 190 else 191 // variable not set (shouldn't happen): try boot drive 192 sprintf(pszMMPM, "%c:\\MMOS2\\MMPM.INI", doshQueryBootDrive()); 193 } 194 195 /* 166 196 *@@ sndOpenMmpmIni: 167 197 * this opens \MMOS2\MMPM.INI on the … … 183 213 HINI hini = NULLHANDLE; 184 214 185 PSZ pszMMPMPath = getenv("MMBASE"); // V0.9.6 (2000-10-16) [umoeller] 186 if (pszMMPMPath) 187 { 188 // variable set: 189 PSZ p; 190 191 strcpy(szMMPM, pszMMPMPath); // V0.9.7 (2000-12-17) [umoeller] 192 193 // kill semicolon if present 194 p = strchr(szMMPM, ';'); 195 if (p) 196 *p = 0; 197 198 strcat(szMMPM, "\\MMPM.INI"); 199 } 200 else 201 // variable not set (shouldn't happen): try boot drive 202 sprintf(szMMPM, "%c:\\MMOS2\\MMPM.INI", doshQueryBootDrive()); 215 sndQueryMmpmIniPath(szMMPM); 216 203 217 hini = PrfOpenProfile(habDesktop, szMMPM); 204 218 return (hini); -
trunk/src/helpers/winh.c
r48 r59 3891 3891 * user that all windows have been closed (which in fact might 3892 3892 * not be the case). 3893 * 3893 3894 * This window's background color is set to the Desktop's 3894 3895 * (PM's one, not the WPS's one). 3896 * 3895 3897 * Returns the HWND of this window. 3896 3898 */
Note:
See TracChangeset
for help on using the changeset viewer.