delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/07/30/04:47:05

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Gundolf" <news1 AT vonbachhaus DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Generating a CRC over a DJGPP programs binary code in memory?
Date: 30 Jul 2005 01:31:38 -0700
Organization: http://groups.google.com
Lines: 49
Message-ID: <1122712298.280880.247880@o13g2000cwo.googlegroups.com>
References: <71078E41DDE3E541B024832F34BC3D0D4BC2E4 AT cowexc03 DOT corp DOT mxtr DOT net>
NNTP-Posting-Host: 213.198.84.198
Mime-Version: 1.0
X-Trace: posting.google.com 1122712303 19295 127.0.0.1 (30 Jul 2005 08:31:43 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Sat, 30 Jul 2005 08:31:43 +0000 (UTC)
User-Agent: G2/0.2
Complaints-To: groups-abuse AT google DOT com
Injection-Info: o13g2000cwo.googlegroups.com; posting-host=213.198.84.198;
posting-account=rY35YA0AAAAyeF5kjpy8hQOSdJiziKje
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi guys,

just checked back in, and two useful answers. Wow! This
'group' stuff really works ;)

News Reader wrote:
> But that's all what I can slice off my weekend.

And thanks for that slice of last weekend, that is a pretty elegant
solution you came up with.
It never occurred to me (duh) to access the functions via &func; was
thinking was too low-levelish.

>  asm(".ascii \"ABC\"");

Aah! I'd been looking all over for that and had almost feared there
wasn't any such command.



Schumacher, Gordon wrote:

> extern char*  _text  asm(".text");
> extern char*  _etext asm("etext");
> static char*  __dbg_progstart = (char*) &_text;
> static size_t __dbg_progsize  = (&_etext - &_text) - sizeof(uint32);

And this is exactly what I was looking for!

In my case I'm better off using these DJ-pointers to do a byte-for-byte
marker-scan, as I have several places all spread out through different
libraries that I need to CRC.

> I have some functions to take CRC "snapshots" of a block of
> memory to ensure they haven't changed

That sounds like a good idea, I might borrow that one as well. ;)

I basically need the check to get a piece of software approved for
'legal trade'. The requirements are that the binary code is virtually
impossible to manipulate. Which is what as a customer you really
expect, i.e. from a gas/petrol pump, grocery scale, etc.
Up to now, I had been CRCing the whole .EXE file on disk, the drawback
of course being that any insignificant change voids the whole approval.
This way I can split the approval-critical stuff from the non-relevant.

Thanks again guys, big help!!
Gundolf

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019