The user enters some text into a TEdit, then they click a button, when the button is clicked it creates a file (EXE) that when ran displays the text the user entered (Console App). Basically, like a small compiler that can only do the 1 thing.
I've heard about TImageFileHeader, but i've no idea how to use that to create a console app.
procedure TForm1.WritePEHeader(ProgName: string; MsgText: string); const PESig: DWORD = $00004550; DOSStub: array[0..111] of Byte = ( $4D, $5A, $6C, $00, $01, $00, $00, $00, $04, $00, $11, $00, $FF, $FF, $03, $00, $00, $01, $00, $00, $00, $00, $00, $00, $40, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $70, $00, $00, $00, $0E, $1F, $BA, $0E, $00, $B4, $09, $CD, $21, $B8, $00, $4C, $CD, $21, $54, $68, $69, $73, $20, $70, $72, $6F, $67, $72, $61, $6D, $20, $72, $65, $71, $75, $69, $72, $65, $73, $20, $57, $69, $6E, $33, $32, $0D, $0A, $24, $24, $41, $50, $24); IDataRVA = $1000; CodeRVA = $2000; BSSRVA = $3000; var PEData: TImageFileHeader; F: File; begin AssignFile(F, GetCurrentDir + '\output.exe'); ReWrite(F); BlockWrite (F, DOSStub, SizeOf(DOSStub)); BlockWrite (F, PESig, SizeOf(PESig)); PEHeader.Machine:= $120; PEHeader.NumberOfSections:= $3; PEHeader.TimeDateStamp:= $340; PEHeader.Characteristics:= $3000; BlockWrite(F, PEData, SizeOf(PEData)); end;
But, I don't really know how to make it load as a console app and display the text, then pause.
Hope you can help!
SirStorm25.


Sign In
Create Account

Back to top









