FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

DISK I/O

Get the resFileID of a running process


I'm using the following code snippet to try to open the resource file of a running process.
CLEAR LOCAL MODE

DIM processName$;32
DIM procSpec;0,vRefNum%,parID&,filename$;64
DIM osErr%, resFileID%
DIM processInfo.procInfoRecSize

LOCAL FN GetProcess(pName$, @psnPtr&)
   processInfo.pInfoLen& = _procInfoRecSize
   processInfo.pNamePtr& = @processName$
   processInfo.pAppSpec& = @procSpec

   psnPtr&.psnHigh& = 0
   psnPtr&.psnLow&  = 0

   WHILE (processName$ <> pName$) AND (osErr% = _noErr)
     osErr% = FN GetNextProcess(=psnPtr&)
     LONG IF osErr% = _noErr
       osErr% = FN GetProcessInformation(=psnPtr&, processInfo)
     END IF
   WEND

resFileID% = FN FSPOPENRESFILE(procSpec, _fsRdPerm).
Jeff & Rick

Try this...
'
'      Function:FSpOpenRF
'
'=================
LOCAL MODE
LOCAL FN FSpOpenRF(@spec&,permission%,@refNum&)
   '---------------------------------------
   `     CLR.W     -(SP)
   `     MOVE.L    ^spec&,-(SP)                    ;Var: FSSpec
   `     MOVE.B    ^permission%,-(SP)              ;ByteParameter
   `     MOVE.L    ^refNum&,-(SP)                  ;Var: INTEGER
   `     DC.W      $7003,$AA52
   `     MOVE.W    (SP)+,D0
   `     EXT.L     D0
END FN
STAZ