Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Making a PEF that will run and return an exit code, like a shell tool?

3 views
Skip to first unread message

st_e...@hotmail.com

unread,
Sep 8, 2005, 9:19:02 AM9/8/05
to

I want to make an app, using PEF (I can't use MachO), which returns an
exit code.

I'll call it from the shell from a Cocoa app, using LaunchCFM. And my
Cocoa app will do something different depending upon the return code
got from the PEF app.

Basically it's for copy protection. The company I'm working for is some
non-Mac friendly copy protection system, which "injects" code into PEF
files only.

The only other way I can think of doing this, is to do it over TCP/IP.
But then I've never actually made a Mac app with codewarrior. I've
made a lot of stuff with CodeWarrior, just libraries, never proper
apps. (I've also made Mac apps with Cocoa, but that's irrelevant here.)

So I have no idea how I'd make a faceless background app in PEF format
with CodeWarrior, that communicates over TCP/IP.

How do I get started with this? Any help anyone?

st_e...@hotmail.com

unread,
Sep 8, 2005, 9:21:54 AM9/8/05
to
"The company I'm working for is USING some non-Mac friendly copy
protection".

They aren't this non-Mac friendly company :o) I'd never work for them!

Jonathan Hoyle

unread,
Sep 8, 2005, 10:01:15 AM9/8/05
to
>> Basically it's for copy protection.

Are there still companies doing software copy protection? Didn't that
evil go out with the '80s?

I don't recommend the use of any form of copy protection, but if you
are going to do it, use a hardware key, such as a SuperPro USB dongle.
Being too "clever" in software will likely come back to bite you.
(This brings up old bad memories of the "Bozo bit" falg. Yikes.)

>> So I have no idea how I'd make a faceless background app in
>> PEF format with CodeWarrior, that communicates over TCP/IP.

Mach-O is certainly convenient for background apps, but you could
create and run an application in PEF that simply displays no UI.
However, if you want this to run as a daemon, you need to use Mach-O.

Is what you're calling a "faceless background app" simply a console
application, in which you are ignoring any output to the console log?
Mach-O apps are the only ones that can do that; however, you can create
something almost the same in PEF using CodeWarrior's console app
stationary. It does not write to the Mac console, but it will write to
its own I/O console window (which you can equally choose to ignore).
PEF apps use their own custom console window specifically because they
have to be able to run in Mac OS 9 which has no native console.

Hope that helps.

st_e...@hotmail.com

unread,
Sep 8, 2005, 10:11:51 AM9/8/05
to
Well, it's not "copy protection" as in "you can't physically copy it",
instead it stops people from copying serial numbers.

But yes your point applies about trying to be too clever. Unfortunately
my protests fall on deaf ears. The most respectable thing to do at this
point is just to give them what they are asking for, after all they are
paying me to do it the slow and wrong way :o)

Aha, I remember the stubs.console.c file now. This is the one that
stops console apps from displaying anything, right? I've used
stubs.console.c in my library making days, when some library was
outputting stuff when I wanted it to be quiet!

Of course it's not a faceless background app yet, but I should be able
to tweak some flags to make it so! CW's Merge-to-file feature at worst
should be able to acheive this.

st_e...@hotmail.com

unread,
Sep 8, 2005, 11:13:56 AM9/8/05
to
OK, well console.stubs.c didn't work at all. CW just froze on run :( if
I returned anything that wasn't 0.

I think I'll have to use TCP/IP sockets :( bah.

glenn andreas

unread,
Sep 8, 2005, 11:59:15 AM9/8/05
to
In article <1126185542.8...@z14g2000cwz.googlegroups.com>,
st_e...@hotmail.com wrote:

> I want to make an app, using PEF (I can't use MachO), which returns an
> exit code.
>
> I'll call it from the shell from a Cocoa app, using LaunchCFM. And my
> Cocoa app will do something different depending upon the return code
> got from the PEF app.
>
> Basically it's for copy protection. The company I'm working for is some
> non-Mac friendly copy protection system, which "injects" code into PEF
> files only.


So wouldn't this make it trivial to defeat the copy protection by
replacing this PEF app by one that just says "main() { return 0; }"?

Ben Artin

unread,
Sep 8, 2005, 6:44:39 PM9/8/05
to

> I want to make an app, using PEF (I can't use MachO), which returns an
> exit code.

You can't. The best you can do it write a Mach-O app which loads some PEF code
and executes it. (Which is how PEF apps are run on Mac OS X anyway.)

The best way to do what you are trying to do is to put your code in a CFM shared
library and call it directly from Mach-O. See Apple sample code at
<http://developer.apple.com/samplecode/CFM_MachO_CFM/CFM_MachO_CFM.html>

hth

Ben

--
If this message helped you, consider buying an item
from my wish list: <http://artins.org/ben/wishlist>

I changed my name: <http://periodic-kingdom.org/People/NameChange.php>

0 new messages