i'm writing a hack that looks up information in a database.  it patches
FldHandleEvent, and does a lookup on almost every keyDownEvent.

i thought i'd be clever and open the database once, and store the DmOpenRef
in a feature (FtrSet) between calls to FldHandleEvent.  this works great,
until i switch to another app.

apparently, the act of launching a new app closes all open databases.  i
tried to find where in the OS source this actually happens, and found that
SysAppExit loops thru all open databases and keeps closing them until the
open count goes to 0.  but i can't find who calls SysAppExit.  does the
compiler/linker stick in an implicit call to SysAppExit in the app's exit
code?

how can i detect that the DmOpenRef i have is no longer viable?  or i
suppose i could patch DmCloseDatabase and do a fast check to see if my
database is being closed.  or is SysAppExit always called - could i patch it
instead?  but if possible, i'd like to avoid patching any other traps
besides FldHandleEvent.  by the way, i'm being very careful to use fully
documented APIs, in fully documented ways.  (aside from the fact that i'm
patching an OS trap...  :-)

// chris

Reply via email to