Adding word to EXE-file 
Author Message
 Adding word to EXE-file

Hello,

Has anyone a SIMPLE procedure for me that can add a ordinal value of the
type word (2 bytes) to an EXE file (and COM)?

Thank you!



Sun, 25 Jul 1999 03:00:00 GMT  
 Adding word to EXE-file

Quote:

>Hello,

>Has anyone a SIMPLE procedure for me that can add a ordinal value of the
>type word (2 bytes) to an EXE file (and COM)?

>Thank you!

   Could you be more specific?

   (Perhaps we can helps you if we can understand your question :=))

--
 AVONTURE Christophe                   0 0     The Crazy Programmer

 Uses Standard_Disclaimer;             \_/           Happy New Year
 French Pascal programming site     http://www.mygale.org/07/jmy51/



Mon, 26 Jul 1999 03:00:00 GMT  
 Adding word to EXE-file

Quote:

> Hello,

> Has anyone a SIMPLE procedure for me that can add a ordinal value of the
> type word (2 bytes) to an EXE file (and COM)?

> Thank you!

What I mean is that I need a need to add 2 bytes to a binary file, so if
the original file is 1000 bytes I need to add 2 bytes at the positions
1001 and 1002. I can of course put it all in an array and create a new
file, copying the buffer using BlockWrite, but if the file size is more
than 64k I get in to trouble becourse I don't know how to create array's
larger than 64k.
I hope I've made myself as little bit less vague! :)

Thanks again...
Harro.



Tue, 27 Jul 1999 03:00:00 GMT  
 Adding word to EXE-file


Quote:
>What I mean is that I need a need to add 2 bytes to a binary file, so if
>the original file is 1000 bytes I need to add 2 bytes at the positions
>1001 and 1002. I can of course put it all in an array and create a new
>file, copying the buffer using BlockWrite, but if the file size is more
>than 64k I get in to trouble becourse I don't know how to create array's
>larger than 64k.
>I hope I've made myself as little bit less vague! :)

Still not sure of platform or compiler...
Here's a Turbo Pascal solution:

VAR F: FILE;
    i: Integer;

BEGIN
    Assign(F, ...
    Reset(F, 1);
    Seek(F, FileSize(F));
    BlockWrite(F, i, s);
    Close(F);
END;

    ...red

--
Roger E. Donais
Jacksonville, FL

http://users.southeast.net/~rdonais/index.html



Tue, 27 Jul 1999 03:00:00 GMT  
 Adding word to EXE-file

Quote:


> >What I mean is that I need a need to add 2 bytes to a binary file, so if
> >the original file is 1000 bytes I need to add 2 bytes at the positions
> >1001 and 1002. I can of course put it all in an array and create a new
> >file, copying the buffer using BlockWrite, but if the file size is more
> >than 64k I get in to trouble becourse I don't know how to create array's
> >larger than 64k.
> >I hope I've made myself as little bit less vague! :)

> Still not sure of platform or compiler...
> Here's a Turbo Pascal solution:

> VAR F: FILE;
>     i: Integer;

> BEGIN
>     Assign(F, ...
>     Reset(F, 1);
>     Seek(F, FileSize(F));
>     BlockWrite(F, i, s);
>     Close(F);
> END;

Here's a slightly simpler TurboPascal solution:
var
  F : File;
  W : Word;
begin
  Assign(F, FileName);
  Append (F);
  BlockWrite (F, W, 2);
  Close(F);
end;


Tue, 27 Jul 1999 03:00:00 GMT  
 Adding word to EXE-file

Check ou this way...

Const Dummy : Word = 1234;
Var     F       : File;

Begin
  Assign(F,'???');
  Reset(F,1);
  Seek(F,FileSize(F));
  Blockwrite(F,Dummy,2);
  Close(F);
End;

You just can't write something into a open file,
if it's a textfile (..APPEND).

--
          \|/
[--------|o o|--------------------------------------------------]
|  You   | 7 |   Patrick Gleichmann aka Ravemax of Himbeereis |
|  Got   |\_/|                                                          |
|   A    (_ _)  * Hey wanna mail me?:                             |

| eMail /     \ * Visit these place:                              |
| from: |     |   http://people.wiesbaden.netsurf.de/~ravemax   |
[---------------------------------------------------------------]          



Tue, 27 Jul 1999 03:00:00 GMT  
 Adding word to EXE-file



Quote:



>> >What I mean is that I need a need to add 2 bytes to a binary file, so if

>> Still not sure of platform or compiler...
>> Here's a Turbo Pascal solution:

>Here's a slightly simpler TurboPascal solution:
>var
>  F : File;
>  W : Word;
>begin
>  Assign(F, FileName);
>  Append (F);
>  BlockWrite (F, W, 2);
>  Close(F);
>end;                           <-- end.

Ah, but did you test it?  Append is for text files, Blockwrite is for
untyped files.

I get   Error 63: Invalid file type    on compiling the Append.

And the on-line Help for Append says

 If a Ctrl+Z (ASCII 26) is present in the last 128-byte block
 of the file, the current file position is set to overwrite
 the first Ctrl+Z in the block. In this way, text can be
 appended to a file that terminates with a Ctrl+Z.

which could do your binary a dose of no good ...

--

  Web URL: http://www.merlyn.demon.co.uk/
  Standard signature separator is as above, a line containing "-- " (SoRFC1036)
  Standard quoter : ">" / "> " , recognised by good news readers



Wed, 28 Jul 1999 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Adding data files to EXE file - HELP!

2. adding of icon in to exe file

3. add programm to beginning of a exe file.

4. Adding data files to EXE's

5. Borland EXE as an insertable object in Word

6. Appending exe to exe file

7. adding to EXE

8. Help adding self-checksum data to an EXE/COM

9. Help adding self-checksum data to an EXE/COM

10. file.exe not file.pas

11. file.exe not file.pas

12. which files do I include with exe file?

 

 
Powered by phpBB® Forum Software