Changeset 54 for trunk/src/helpers/dosh.c
- Timestamp:
- Apr 4, 2001, 4:39:06 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/dosh.c
r53 r54 519 519 520 520 return (arc); 521 522 /* FSALLOCATE fsa;523 APIRET arc = NO_ERROR;524 525 if (fSuppress)526 {527 DosError(FERR_DISABLEHARDERR | FERR_DISABLEEXCEPTION);528 DosEnterCritSec();529 }530 531 arc = DosQueryFSInfo(ulLogicalDrive, FSIL_ALLOC, &fsa, sizeof(fsa));532 533 if (fSuppress)534 {535 DosError(FERR_ENABLEHARDERR | FERR_ENABLEEXCEPTION);536 DosExitCritSec();537 }538 539 return (arc); */540 521 } 541 522 … … 1931 1912 ********************************************************************/ 1932 1913 1914 static PVOID G_pvGlobalInfoSeg = NULL, 1915 G_pvLocalInfoSeg = NULL; 1916 1917 USHORT _Far16 _Pascal Dos16GetInfoSeg(PSEL pselGlobal, 1918 PSEL pselLocal); 1919 1920 /* 1921 * GetInfoSegs: 1922 * 1923 */ 1924 1925 VOID GetInfoSegs(VOID) 1926 { 1927 SEL GlobalInfoSegSelector, 1928 LocalInfoSegSelector; 1929 1930 // get selectors (old 16-bit API; this gets called only once) 1931 Dos16GetInfoSeg(&GlobalInfoSegSelector, 1932 &LocalInfoSegSelector); 1933 // thunk 1934 G_pvGlobalInfoSeg = (PVOID)( (GlobalInfoSegSelector << 0x000D) 1935 & 0x01fff0000); 1936 G_pvLocalInfoSeg = (PVOID)( (LocalInfoSegSelector << 0x000D) 1937 & 0x01fff0000); 1938 } 1939 1940 /* 1941 *@@ doshMyPID: 1942 * returns the PID of the current process. 1943 * 1944 * This uses an interesting hack which is way 1945 * faster than DosGetInfoBlocks. 1946 * 1947 *@@added V0.9.9 (2001-04-04) [umoeller] 1948 */ 1949 1950 ULONG doshMyPID(VOID) 1951 { 1952 if (!G_pvLocalInfoSeg) 1953 // first call: 1954 GetInfoSegs(); 1955 1956 // PID is at offset 0 in the local info seg 1957 return (*(PUSHORT)G_pvLocalInfoSeg); 1958 } 1959 1960 /* 1961 *@@ doshMyTID: 1962 * returns the TID of the current thread. 1963 * 1964 * This uses an interesting hack which is way 1965 * faster than DosGetInfoBlocks. 1966 * 1967 *@@added V0.9.9 (2001-04-04) [umoeller] 1968 */ 1969 1970 ULONG doshMyTID(VOID) 1971 { 1972 if (!G_pvLocalInfoSeg) 1973 // first call: 1974 GetInfoSegs(); 1975 1976 // TID is at offset 6 in the local info seg 1977 return (*(PUSHORT)((PBYTE)G_pvLocalInfoSeg + 6)); 1978 } 1979 1933 1980 /* 1934 1981 *@@ doshFindExecutable:
Note:
See TracChangeset
for help on using the changeset viewer.