Que: Opening exe-file under OS/2 
Author Message
 Que: Opening exe-file under OS/2

In his book 'Advanced programming in CLipper with C', Stephen Straley
explains how you can append data to an '.exe'-file.
I have tried to use this trick in letting another program append an
encrypted registration number to an exe-file and it works great under
DOS. However if I try to use this trick under OS/2 (still the best OS
for developpers), I can't open the exe-file and as far as I can remember
the code returned by ferror() is 5.

Does anyone know how I can use this technique under OS/2?

Ben Engbers



Tue, 27 Jul 1999 03:00:00 GMT  
 Que: Opening exe-file under OS/2

Quote:

> In his book 'Advanced programming in CLipper with C', Stephen
> Straley explains how you can append data to an '.exe'-file.  I have
> tried to use this trick in letting another program append an
> encrypted registration number to an exe-file and it works great
> under DOS. However if I try to use this trick under OS/2 (still the
> best OS for developpers), I can't open the exe-file and as far as I
> can remember the code returned by ferror() is 5.

What method are you using to open the EXE file? Are you opening it
shared? Do you only want to read the index from the end? Are you
opening it read only?

And, I can't help wondering if this won't upset a number of virus
scanners.

--
Take a look in Hagbard's World: |     w3ng - The WWW Norton Guide reader.
http://www.acemake.com/hagbard  |  ng2html - The NG to HTML converter.
Also available in the UK:       |       eg - Norton Guide reader for OS/2.
http://www.hagbard.demon.co.uk  |   dgscan - DGROUP scanner for Clipper.



Tue, 27 Jul 1999 03:00:00 GMT  
 Que: Opening exe-file under OS/2



Quote:
>In his book 'Advanced programming in CLipper with C', Stephen Straley
>explains how you can append data to an '.exe'-file.
>I have tried to use this trick in letting another program append an
>encrypted registration number to an exe-file and it works great under
>DOS. However if I try to use this trick under OS/2 (still the best OS
>for developpers), I can't open the exe-file and as far as I can remember
>the code returned by ferror() is 5.

>Does anyone know how I can use this technique under OS/2?

Error 5 is Access Denied.

The only reasons for it are the file is open by another process,
doesn't have the correct attributes to allow modification (hidden,
system, read-only, etc.) , or you or your program does not have
sufficient rights to modify it.

You should note, however, that some viruses append data to the end of
EXE files, and a file modified in this manner will cause alerts with
some anti-virus software.

Terry

--------------------

Terry Carmen
Meadowbrook Software



Tue, 27 Jul 1999 03:00:00 GMT  
 Que: Opening exe-file under OS/2

Quote:

> In his book 'Advanced programming in CLipper with C', Stephen Straley
> explains how you can append data to an '.exe'-file.
> I have tried to use this trick in letting another program append an
> encrypted registration number to an exe-file and it works great under
> DOS. However if I try to use this trick under OS/2 (still the best OS
> for developpers), I can't open the exe-file and as far as I can remember
> the code returned by ferror() is 5.

> Does anyone know how I can use this technique under OS/2?

> Ben Engbers


I should have been more precise in my first message.

What Stephen explains is that you run an application, say a.exe, and
then open the a.exe file with fopen( "a.exe").
Under DOS this is allowed and with fread(), fwrite() and all the related
functions, it is possible to read/append data from the exe-file that is
being executed. (As long as you don't mess-up the executable portion of
the exe-file, this is no problem since DOS knows the size off the
executable code).

Under OS/2 however, it seems that the exe-file that is being executed,
is locked by the OS. The result is that you can't open the exe and can't
extract data that has been appended.

Does anyone know how that lock can be removed?



Wed, 28 Jul 1999 03:00:00 GMT  
 Que: Opening exe-file under OS/2

Quote:

> Under OS/2 however, it seems that the exe-file that is being executed,
> is locked by the OS. The result is that you can't open the exe and can't
> extract data that has been appended.

I'll ask the same question I asked of you before. What mode are you
opening the EXE in? What is the exact line of code you are using to
open the EXE? Are you sure that you are not attempting to open it
exclusive?

[CC: in case news isn't getting thru]

--
Take a look in Hagbard's World: |     w3ng - The WWW Norton Guide reader.
http://www.acemake.com/hagbard  |  ng2html - The NG to HTML converter.
Also available in the UK:       |       eg - Norton Guide reader for OS/2.
http://www.hagbard.demon.co.uk  |   dgscan - DGROUP scanner for Clipper.



Thu, 29 Jul 1999 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Unrecoverable error 415: cannot open overlay file myapp.exe

2. How to know if .EXE file is already opened

3. How to write .bat file to open telnet.exe to hostname

4. Opening .EXE files!!!!!!!!!!!

5. Convert OS/2 rexx to a .exe file

6. Opening file using PLAIN_TEXT_FILE or RAW_FILE and getting OS error status back

7. Using OS/2 REXX to modify file objects opening menu

8. Possible file open problem - OS/2 classic Rexx

9. Number of files open in OS/2 compilers

10. Problem opening files while using os.path.walk

11. Import plaintext file into a que

12. Que: Permissions while saving files

 

 
Powered by phpBB® Forum Software