resnick@cogsci.uiuc.edu (Pete Resnick) (03/19/91)
I have been pouring through Inside Mac looking for an easy way to do this but can find nothing: I am writing an INIT which installs a ShutDownProc. At shutdown time, I will want to re-open my resource file to play with some resources. At INIT time, I know the refNum of my resource file (CurResFile) and can easily retrieve it's DirID, etc with File Manager calls. But what is the best way to tell my shutdown proc which resource file it is to re-open? I can store the filename and vRefNum or DirID into the code itself, but this seems like a pain, let alone the fact that some bozo might change my file name or something like that. Does anyone have any recommendations of a better way? pr -- Pete Resnick (...so what is a mojo, and why would one be rising?) Graduate assistant - Philosophy Department, Gregory Hall, UIUC System manager - Cognitive Science Group, Beckman Institute, UIUC Internet/ARPAnet/EDUnet : resnick@cogsci.uiuc.edu BITNET (if no other way) : FREE0285@UIUCVMD
dorner@pequod.cso.uiuc.edu (Steve Dorner) (03/19/91)
In article <1991Mar19.002406.23347@ux1.cso.uiuc.edu> resnick@cogsci.uiuc.edu (Pete Resnick) writes: >re-open? I can store the filename and vRefNum or DirID into the code >itself, but this seems like a pain, let alone the fact that some bozo >might change my file name or something like that. Does anyone have any >recommendations of a better way? MacTCP searches for its creator and type in the blessed folder. This is broken under 7.0, but a variant (searching for your creator and type in the blessed folder and (all?) subfolders) might be reasonable. -- Steve Dorner, U of Illinois Computing Services Office Internet: s-dorner@uiuc.edu UUCP: uunet!uiucuxc!uiuc.edu!s-dorner
francis@arthur.zaphod.uchicago.edu (Francis Stracke) (03/20/91)
In article <1991Mar19.002406.23347@ux1.cso.uiuc.edu> resnick@cogsci.uiuc.edu (Pete Resnick) writes: re-open? I can store the filename and vRefNum or DirID into the code itself, but this seems like a pain, let alone the fact that some bozo Let alone the fact that it'll break if Apple ever gets around to protecting code segments. :-) (Are they doing that with Sys7's VM?) -- /============================================================================\ | Francis Stracke | My opinions are my own. I don't steal them.| | Department of Mathematics |=============================================| | University of Chicago | Until you stalk and overrun, | | francis@zaphod.uchicago.edu | you can't devour anyone. -- Hobbes | \============================================================================/
kaufman@neon.Stanford.EDU (Marc T. Kaufman) (03/20/91)
In article <FRANCIS.91Mar19172528@arthur.zaphod.uchicago.edu> francis@arthur.zaphod.uchicago.edu (Francis Stracke) writes: >In article <1991Mar19.002406.23347@ux1.cso.uiuc.edu> resnick@cogsci.uiuc.edu (Pete Resnick) writes: > re-open? I can store the filename and vRefNum or DirID into the code > itself, but this seems like a pain, let alone the fact that some bozo >Let alone the fact that it'll break if Apple ever gets around to >protecting code segments. :-) Not likely, unless and until Apple gets around to providing a second heap for code. The memory manager can't tell code from other resources, after all. Even code resources have to be loaded, moved high, locked, and possibly have addresses adjusted (what? write to a code resource?). I think the best we can ever expect is that applications can be protected from one another with VM, not that code segments within an app can be protected. Marc Kaufman (kaufman@Neon.stanford.edu)