Re: Detecting a C translated bound program

new topic     » goto parent     » topic index » view thread      » older message » newer message

OtterDad wrote:
> 
> I have a couple of programs that refuse to behave when bound into C, but 
> behave just fine when simply bound with the interpreter.
> Is there a way I can tell from within the bound program itself if it was 
> translated into C so I can catch my own mistake prior to deployment?

> BTW I'm still using Euphoria Version 2.4.
If that last point is unlikely to change, you could use the entry point:
cl=command_line()
 if equal(cl[1],cl[2]) then  -- prog is bound or translated
   fn=open(cl[1],"rb")
   void = seek(fn,#A8)
   ep={getc(fn),getc(fn),getc(fn),getc(fn)}
   close(fn)
   if equal(ep,{#10,#0F,#03,#00}) then  -- Eu 2.4 exw entry point, I think
   else                    -- assume eu2c'd

The above is completely untested, btw.
Alternatively you could try patching a 1 at offset #7F into any .exe you create
via eu2c and assume that all versions of eu (/bound files) will have a 0 there,
or examine the PE headers (I use OllyDebug) and see if there is anything else
that sticks out, maybe an EC.LIB section, (I'm guessing now).

Regards,
Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu