rob@cs.mu.oz.au (Robert Wallen) (03/31/91)
I can tell whether a source file is being compiled with MPW or Think-C by checking the defined(MPW) vs defined(THINK_C) pre-processor directives. If I am using Think-C, is there some way I can tell which mode of object is being produced? i.e. is there some sort of #if defined(APPL) || defined(DESKACC) || defined(DRIVER) || defined(RSRC) #endif that lets me know whats selected in the Project Type window? Page 442 of the Think manual would lead me to believe not but I can always hope???
bradk@van-bc.wimsey.bc.ca (Brad Kollmyer) (04/01/91)
In article <3142@murtoa.cs.mu.oz.au> rob@cs.mu.oz.au (Robert Wallen) writes: >#if defined(APPL) || defined(DESKACC) || defined(DRIVER) || defined(RSRC) >#endif This would be a great feature, but is not available. I've had to resort to defining a constant in one of my header files. For example I have two projects TestApp.p, and TestDA.p. I also have folders called (TestApp.p) and (TestDA.p) in the project tree. In each of these folders I have a Config.h, one defines DeskAcc, and the other definces Application. This is the best way I've been able to come up with. Brad Kollmyer bradk@wimsey.bc.ca
Jim.Spencer@p510.f22.n282.z1.fidonet.org (Jim Spencer) (04/02/91)
Robert Wallen writes in a message to All RW> I can tell whether a source file is being compiled with MPW or RW> Think-C by checking the defined(MPW) vs defined(THINK_C) pre-processor RW> directives. RW> If I am using Think-C, is there some way I can tell which mode RW> of object is being produced? i.e. is there some sort of RW> #if defined(APPL) defined(DESKACC) defined(DRIVER) defined(RSRC) RW> #endif RW> that lets me know whats selected in the Project Type window? RW> Page 442 of the Think manual would lead me to believe not but RW> I can always hope??? No big deal, just manually define the type of code you are producing.
gurgle@well.sf.ca.us (Pete Gontier) (04/02/91)
In article <3142@murtoa.cs.mu.oz.au> rob@cs.mu.oz.au (Robert Wallen) writes: >If I am using Think-C, is there some way I can tell which mode of object is >being produced? i.e. is there some sort of > >#if defined(APPL) || defined(DESKACC) || defined(DRIVER) || defined(RSRC) >#endif > >that lets me know whats selected in the Project Type window? Page 442 of the >Think manual would lead me to believe not but I can always hope??? As far as I know, the answer is no. However, there is hope. You can use the pre-processor to force yourself to define a symbol for the project type. Here's what I use: #define __STAND_ALONE__ /* project type */ #if defined __APPLICATION__ # define __GRR__ A5 #elif defined __DRIVER__ # define __GRR__ A4 #elif defined __STAND_ALONE__ # define __GRR__ A4 #else You need to define *ONE* of the above project types. #endif The last line there forces a compiler error. If you ever get it, the message explains why. -- Pete Gontier, gurgle@well.sf.ca.us Software Imagineer, Kiwi Software, Inc.
lim@iris.ucdavis.edu (Lloyd Lim) (04/04/91)
In article <3142@murtoa.cs.mu.oz.au> rob@cs.mu.oz.au (Robert Wallen) writes: >If I am using Think-C, is there some way I can tell which mode of object is >being produced? i.e. is there some sort of > >#if defined(APPL) || defined(DESKACC) || defined(DRIVER) || defined(RSRC) >#endif This doesn't answer your question but it's related and may come in useful some day. Sometimes it's useful to know when you are running from a project or a built application. If Count1Resources('CODE') is 0, then you're running from a project. I need to know this because my apps checksum themselves after they are first built and then check themselves at subsequent startups for viruses. Obviously, I don't want this to happen when it's a project. +++ Lloyd Lim Internet: lim@iris.eecs.ucdavis.edu America Online: LimUnltd Compuserve: 72647,660 US Mail: 215 Lysle Leach Hall, U.C. Davis, Davis, CA 95616
d88-jwa@byse.nada.kth.se (Jon W{tte) (04/04/91)
In article <8695@ucdavis.ucdavis.edu> lim@iris.ucdavis.edu (Lloyd Lim) writes:
day. Sometimes it's useful to know when you are running from a project
or a built application. If Count1Resources('CODE') is 0, then you're
running from a project. I need to know this because my apps checksum
themselves after they are first built and then check themselves at
subsequent startups for viruses. Obviously, I don't want this to happen
when it's a project.
So, of course, the virus just patches _Count1Resources to return 0 for
CODE (and no, you can't check if it's patched, since there may be
legitimate patches to it too...)
h+@nada.kth.se
Jon W{tte
--
"The IM-IV file manager chapter documents zillions of calls, all of which
seem to do almost the same thing and none of which seem to do what I want
them to do." -- Juri Munkki in comp.sys.mac.programmer
Lawson.English@p88.f15.n300.z1.fidonet.org (Lawson English) (04/08/91)
Jon W{tte writes in a message to All JW> So, of course, the virus just patches _Count1Resources to return JW> 0 for CODE (and no, you can't check if it's patched, since there JW> may be legitimate patches to it too...) JW> h+@nada.kth.se Jon W{tte That's a mighty intellegent virus: it allows for the existance of viral checking code in individual programs as well as virus checkers and whatever alchemy Apple does with memory address #4, etc. Lawson -- Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!300!15.88!Lawson.English Internet: Lawson.English@p88.f15.n300.z1.fidonet.org
lim@iris.ucdavis.edu (Lloyd Lim) (04/09/91)
In article <D88-JWA.91Apr4102003@byse.nada.kth.se> d88-jwa@byse.nada.kth.se (Jon W{tte) writes: >In article <8695@ucdavis.ucdavis.edu> lim@iris.ucdavis.edu (Lloyd Lim) writes: > > day. Sometimes it's useful to know when you are running from a project > or a built application. If Count1Resources('CODE') is 0, then you're > running from a project. I need to know this because my apps checksum > themselves after they are first built and then check themselves at > subsequent startups for viruses. Obviously, I don't want this to happen > when it's a project. > >So, of course, the virus just patches _Count1Resources to return 0 for >CODE (and no, you can't check if it's patched, since there may be >legitimate patches to it too...) True, there are other easier ways too - but only if you know MY virus checking scheme. The strength of such schemes lies not in some standard but in all of different ways programmers implement their own virus checking schemes. There are a couple very simple ways I could make the above mentioned patch useless (and no I won't even check if it's patched or patch anything else), but... I won't tell you what they are. :-) I was not proposing that you adopt my method - it was only an example of checking whether you are running from a project. Since we're on the subject, I do suggest that each programmer implement their own minimal detection scheme even if it is simple. +++ Lloyd Lim Internet: lim@iris.eecs.ucdavis.edu America Online: LimUnltd Compuserve: 72647,660 US Mail: 215 Lysle Leach Hall, U.C. Davis, Davis, CA 95616