Path: utzoo!attcan!uunet!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!apple!stevec From: stevec@Apple.COM (Steve Christensen) Newsgroups: comp.sys.mac.programmer Subject: Re: my driver stalls! Message-ID: <46510@apple.Apple.COM> Date: 12 Nov 90 21:08:11 GMT References: <1990Nov11.232728.35684@eagle.wesleyan.edu> Organization: Apple Computer Inc., Cupertino, CA Lines: 33 rcook@eagle.wesleyan.edu writes: >I am currently working on a driver that gets installed by an init and plays >a sound every Friday at 6pm (don't ask why--it's for a friend :-). The init >apparently works, and receives noErr from the OpenDriver call. The problem is >that the system crashes when the Finder is launched. The usual problem is a >line 1111 error. When I install the driver from within an application, there >is no problem as long as the application is running, but, again, when the >application quits and the finder starts up (or even when control is returned to >LSP 3.0) the system crashes. More than likely what's happening is that you didn't detach the driver. When resource files are closed (like your INIT's file), all resources belonging to that file are purged from the heap (even if they're in the system heap). So in your case, the system goes to call your driver, but the pointers are invalid, so it jumps off into the weeds and goes boom. To fix it, try adding the following (you did say Pascal, didn't you?): driverHandle := GetResource('DRVR', itsID); IF driverHandle<>NIL THEN BEGIN HLock(driverHandle); {if it's already locked you don't need this} DetachResource(driverHandle); {it's no longer a resource} END; steve -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ whoami? Steve Christensen snail: Apple Computer, 20525 Mariani Ave, MS-81CS, Cupertino, CA 95035 internet: stevec@apple.com AppleLink: stevec CompuServe: 76174,1712