BBS: Inland Empire Archive Date: 03-01-93 (00:38) Number: 357 From: ROB MCKEE Refer#: NONE To: BOB SEWELL Recvd: NO Subj: Detecting Windows Conf: (2) Quik_Bas
Hello Bob! You wrote to Scott Drysdale: BS> Quoting Scott Drysdale in a speech to Bob Sewell: SD> This may sound lame, but it would probably be possible to MEM /C > afile Better than that... You can do the MEM /c in QB using Call Interrupt. See below! --8<--|Using good sewing sissors, cut here |--8<--- 'This file created by PostIt! v4.04. '>>> Start of page 1. 'Memory Control Block Lister by Rob McKee ' Released to the Public Domain 1 March 1993 ' QBS: YES!! ' Written for: PDS/QB45 ' If you can Make a Buck with it GO FOR IT! ' $INCLUDE: 'qbx.bi' ' ^^^^^^ Change to 'qb.bi' for QB45 CONST False = 0, True = NOT False DEFINT A-Z DIM R AS RegTypeX R.Ax = &H3000 ' Get Dos Version, ' this only works on MS-Dos 4 or higher InterruptX &H21, R, R IF R.Ax < 0 THEN RegAx& = 65536 + R.Ax ELSE RegAx& = R.Ax IF (RegAx& AND &HFF) < 4 THEN PRINT "Dos Version to Low": PRINT_ "Requires MS-Dos 4.00 or higher": END R.Ax = &H5200 ' Get ListofLists ' Pointer to First MCB Segment is at ES:BX-2 InterruptX &H21, R, R IF R.bx < 0 THEN RegBx& = 65536 + R.bx ELSE RegBx& = R.bx IF R.es < 0 THEN RegEs& = 65536 + R.es ELSE RegEs& = R.es DIM MCB(1 TO 50) AS LONG, MCBSize(1 TO 50) AS LONG DIM MCBOwner(1 TO 50) AS LONG, MCBSizeProg(1 TO 25) AS LONG DIM MCBOwnerName$(1 TO 50), MCBOwnerNameProg$(1 TO 25) DIM MCBProg(1 TO 25) AS LONG, MCBOwnerProg(1 TO 25) AS LONG DEF SEG = RegEs& - 1 ' Subract 1 from Seg and add 14 to Offset ' Which is the same thing as ES:BX-2 MCBSeg& = PEEK(R.bx + 15&) * 256& + PEEK(R.bx + 14&) DO DEF SEG = MCBSeg& TypeOfMCB = PEEK(0) ' Make sure it's a Valid MCB IF (TypeOfMCB <> &H5A) and (TypeOfMCB <> &H4D) THEN EXIT DO CountOfMCB = CountOfMCB + 1 MCB(CountOfMCB) = MCBSeg& MCBOwner(CountOfMCB) = PEEK(2) * 256& + PEEK(1) MCBSize(CountOfMCB) = PEEK(4) * 256& + PEEK(3) MCBSeg& = MCBSeg& + MCBSize(CountOfMCB) + 1 LastBlock = False IF (PEEK(16) * 256& + PEEK(17)) = &HCD20& THEN ' If it's a Program instead Enviroment Then Count the Program ' This Code can be modified to change the Primary Enviroment CountOfProg = CountOfProg + 1 MCBProg(CountOfProg) = MCBSeg& MCBOwnerProg(CountOfProg) = PEEK(2) * 256& + PEEK(1) MCBSizeProg(CountOfProg) = PEEK(4) * 256& + PEEK(3) FOR t = 8 TO 15'7 + PEEK(7) IF PEEK(t) = 0 THEN EXIT FOR MCBOwnerNameProg$(CountOfProg) =_ MCBOwnerNameProg$(CountOfProg) + CHR$(PEEK(t)) NEXT IF t = 16 THEN PRINT 0; IF MCBOwnerNameProg$(CountOfProg) = "WIN" THEN_ WindowsLoaded = True ' Heart of the Matter.. Going through the MCB's we are ' actually looking for the String "WIN" The code can be modified ' to look for different programs which don't hook interrupts END IF LOOP PRINT CountOfMCB IF WindowsLoaded THEN PRINT "Windows is Loaded" FOR t = 1 TO CountOfProg PRINT MCBOwnerNameProg$(t) ' Show the Loaded Programs NEXT PRINT CountOfProg ----8<----| The Difference between Memorex and Real |---->8---- SysOp 1:125/411 PVT - Rob --- timEd/B6 * Origin: Flyer_Proof_Computer_Svs,Richmond_CA,MO,V32B (1:125/411)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET