Forum » Programiranje » [Delphi] Koda za pisanje v executable file
[Delphi] Koda za pisanje v executable file
pr25012 ::
Razumem kako naj bi koda iz članka:
(http://edn.embarcadero.com/article/2797...
delala ampak je ne zmorem kompletirati.
In povezava za download code ne dela.
Tu so error-ji...
Next are the errors..
Pomagajte mi jih prosim razrešiti in potem bi predpostavljal bil sposoben nadaljevati sam.
[Error] licenseexe.pas(63): Undeclared identifier: 'TExeBuf'
[Error] licenseexe.pas(77): Incompatible types
[Error] licenseexe.pas(112): Undeclared identifier: 'EExeBuf'
[Error] licenseexe.pas(116): Incompatible types
[Error] licenseexe.pas(131): Incompatible types
[Error] licenseexe.pas(137): Incompatible types
[Error] licenseexe.pas(138): Incompatible types
[Fatal Error] PRlicenseexe.dpr(5): Could not compile used unit 'licenseexe.pas'
(http://edn.embarcadero.com/article/2797...
delala ampak je ne zmorem kompletirati.
In povezava za download code ne dela.
Tu so error-ji...
Next are the errors..
Pomagajte mi jih prosim razrešiti in potem bi predpostavljal bil sposoben nadaljevati sam.
[Error] licenseexe.pas(63): Undeclared identifier: 'TExeBuf'
[Error] licenseexe.pas(77): Incompatible types
[Error] licenseexe.pas(112): Undeclared identifier: 'EExeBuf'
[Error] licenseexe.pas(116): Incompatible types
[Error] licenseexe.pas(131): Incompatible types
[Error] licenseexe.pas(137): Incompatible types
[Error] licenseexe.pas(138): Incompatible types
[Fatal Error] PRlicenseexe.dpr(5): Could not compile used unit 'licenseexe.pas'
unit licenseexe; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) private { Private declarations } (* procedure SetExeData (ExeName : String; ExeBuf : TExeBuf); procedure GetExeData (ExeName : String; var ExeBuf : TExeBuf); procedure StringToExeBuf (const S : String; var ExeBuf : TExeBuf); function ExeBufToString (const ExeBuf : TExeBuf) : String; *) public { Public declarations } end; const //our ExeBuffer signature ExeBufSig = 'EB1.0'; type //the Footer for our executable format TExeBufFooter = record OriginalSize : Integer; Sig : Array[0..4] of char; end; var Form1: TForm1; //exebuf:TExeBufFooter ; implementation {$R *.dfm} //////////////////////////////////////////////////////////////////////////////////////////////////// procedure SetExeData (ExeName : String; ExeBuf : TExeBuf); var F : File; BufSz,OrigSz : Integer; Footer : TExeBufFooter; begin AssignFile (F,ExeName); Reset (F,1); try //obtaining the original file size OrigSz := FileSize(F); //go to the EOF of the file Seek (F,OrigSz); //Writing our custom data beyond the EOF BufSz := Length(ExeBuf); BlockWrite (F,Pointer(ExeBuf)^,BufSz); //Writing our footer FillChar (Footer,SizeOf(Footer),0); Footer.OriginalSize := OrigSz; Footer.Sig := ExeBufSig; BlockWrite (F,Footer,Sizeof(Footer)); finally CloseFile (F); end; end; procedure GetExeData (ExeName : String; var ExeBuf : TExeBuf); var F : File; CurrSz, BufSize : Integer; OldFileMode : Integer; Footer : TExeBufFooter; begin AssignFile (F,ExeName); //Saving the old FileMode OldFileMode := FileMode; //Setting the FileMode to ReadOnly FileMode := 0; try Reset (F,1); try //Getting the current file size CurrSz := FileSize (F); //Seeking to the footer position //and reading it Seek (F,CurrSz-SizeOf (Footer)); BlockRead (F,Footer,Sizeof(Footer)); //if there's no signature, boom! //no data in this executable! if Footer.Sig <> ExeBufSig then raise EExeBuf.Create ('No Data in EXE!'); //calculating the buffer size that was written //to this executable file BufSize :=CurrSz-Footer.OriginalSize-SizeOf(Footer); SetLength (ExeBuf,BufSize); //seek and read! Seek (F,Footer.OriginalSize); BlockRead(F,Pointer(ExeBuf)^, BufSize); finally CloseFile (F); end; finally //returning to the previous saved //FileMode FileMode := OldFileMode; end; end; procedure StringToExeBuf (const S : String; var ExeBuf : TExeBuf); begin SetLength(ExeBuf,Length(S)); Move (Pointer(S)^,Pointer(ExeBuf)^,Length(S)); end; function ExeBufToString (const ExeBuf : TExeBuf) : String; begin SetLength (Result,Length(ExeBuf)); Move (Pointer(ExeBuf)^,Pointer(Result)^,Length(ExeBuf)); end; end.
sas084 ::
Sicer nimam pojma o Delphi-ju, sklepam pa da nimas nikjer deklariranega TExeBuf. V linku je definiran kot:
TExeBuf = array of char;
pr25012 ::
Ok, se bom lotil.
Hvala.
Rešeno, še enkrat hvala.
Hvala.
Rešeno, še enkrat hvala.
Zgodovina sprememb…
- spremenil: pr25012 ()
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | [NALOGA][Java] Branje vsebine datoteke vzvratnoOddelek: Programiranje | 1608 (1550) | SkIDiver |
» | [C] MySQLOddelek: Programiranje | 2812 (1834) | Tutankhamun |
» | [C++] Portabilna funkcija za kopiranje datotekOddelek: Programiranje | 2251 (1907) | Gundolf |
» | [Delphi] Unit za EXIF metadata (jpg)Oddelek: Programiranje | 1137 (1066) | b0B3k |
» | Pointer-ji v C-juOddelek: Programiranje | 1774 (1472) | rokpok |