I write a hack for a program so that it can detect itself to be
deleted and reset some some system config. I hack the
DmDeleteDatabase(UInt, LocalID), and add few lines before the go to do
DmDeleteDatabase(UInt, LocalID).

Err myDmDeleteDatabase(UInt cardNoToDelete, LocalID dbIDToDelete) {
        UInt cardNo;
        LocalID dbID;
        DmSearchStateType searchInfo;

        DmGetNextDatabaseByTypeCreator (true, &searchInfo, 
                appFileType, appFileCreator, true, &cardNo, &dbID);

//      Reset the system Trap Address
        if (cardNo==cardNoToDelete && dbID==dbIDToDelete) {
                SysSetTrapAddress(0xA2E2, oldKeyboardPtr);      
                SysSetTrapAddress(0xa042,oldDmDeletePtr );
        }
        return DmDeleteDatabase(cardNoToDelete,dbIDToDelete);
}

the problem is taht when it do (dbID==dbIDToDelete), it cause a bus error.
when I just compare the cardNo, it works. 
can anybody help me ?

E r i c                                                 
                                                           
             Electrical and Electronic Engineering
       The  Hong Kong University of Science and Technology
                URL: http://home.ust.hk/~ee_slm 

Reply via email to