Solved

How can i store exe file in my delphi Program

Posted on 1998-12-26
20
388 Views
Last Modified: 2010-04-04
How can i store exe file in my delphi Program?
0
Comment
Question by:rmloh
  • 8
  • 8
  • 3
  • +1
20 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1353129
Here is an article from UNDU...
=========================
Put Anything In Your Delphi EXE!

by William A. Portillo - hallcom@wantree.com.au

I don't know if this is useful stuff but after a couple of weeks of playing with the
resources side of Delphi, I ended up writing a routine that will &quotextract" other
files out of a Delphi EXE. I found this useful for distributing little picture or sound files
with the application or as a setup program with internal files. No doubt many of you
will find other uses for this technique.

First, I create an RC project with NOTEPAD.EXE and ARJ.EXE in it as follows (we'll
call it RESJUNK.RC):

 NOTEPAD EXEFILE C:\WINDOWS\NOTEPAD.EXE
 ARJ EXEFILE C:\UTILS\ARJ.EXE

then I compile it with BRCC32 into a RES file. After this I include it in my Delphi
project by using the $R compiler directive like this:

{$R RESJUNK.RES}

and extract this files by using the TResourceStream class.

        procedure ExtractRes(ResType, ResName, ResNewName : String);
         var
           Res : TResourceStream;
         begin
           Res := TResourceStream.Create(Hinstance, Resname, Pchar(ResType));
           Res.SavetoFile(ResNewName);
           Res.Free;
         end;

I hope this proves to be relevant to someone at least. If you want to share ideas on
this, please email me. If you mail me back, please put &quotWP:" on the subject line.
This lets my boss know that the mail is for me.
=========================
Hope this helps...

Happy New Year!

-Viktor
--Ivanov
0
 

Author Comment

by:rmloh
ID: 1353130
I DONT KNOW WOT TO WRITE HERE

TResourceStream.Create(Hinstance,*** Resname ***, Pchar(ResType));



procedure ExtractRes(ResType, ResName, ResNewName : String);
         var
           Res : TResourceStream;
         begin
           Res := TResourceStream.Create(Hinstance, Resname, Pchar(ResType));
           Res.SavetoFile(ResNewName);
           Res.Free;
         end;

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1353131
In our example where we declare this in our resource file
NOTEPAD EXEFILE C:\WINDOWS\NOTEPAD.EXE
ARJ EXEFILE C:\UTILS\ARJ.EXE
you should include NOTEPAD or ARJ in the place where it says RESNAME...e.g.

ExtractRes(RC_DATA, 'ARJ', 'Whatever');

-Viktor
--Ivanov

0
 

Author Comment

by:rmloh
ID: 1353132
There are message "ARJ not found".
0
 
LVL 1

Expert Comment

by:slautin
ID: 1353133
I recommend to use BLOBs with LZARC-components. I did it not once (not only EXE, but PAS, DCU, BMP, XLS, DOC ant others).

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1353134
What the (Edited by Computer101) is that?

slautin, that's not (Edited by Computer101)ing true.. The best and easiest way is as I mentioned.

rmloh, Are you a newbie or what?? That's just an example. I know you don''t have ARJ, that was just an eaxmle.. YOu should substitute it with the EXE file that you want and the path to the file....  Man and oyu have been rejecting my answers just because you do the mistakes. My answer is completly correct. I'd really like to receive the credit for which I helped you with. I hate when I help someone and someone else like slautin gets in and answers without thinking if it's the easiest and best answer....

-Viktor
--Ivanov
0
 
LVL 17

Expert Comment

by:inthe
ID: 1353135
"ARG NOT FOUND" LoL ,
 rmloh have you read viktor's answer and comments ??
This is easiest way to do it for any type of file including exe
obviously if you dont have arg you replace it with a file you do have like as viktor said notepad .if you are new at this try reading the sources more and if you dont understand try looking at the delphi help or asking what specific functions mean.
 
 my 2 cents
Regards Barry
 
 

0
 

Author Comment

by:rmloh
ID: 1353136
slautin wher can i find the components??
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1353137
rmloh, don't you understand?? Those components are for compressing data and that's not of your use. The way to do it is as I told you. That's the easiest way to use and the one that you don't have to do lots of coding...

-Viktor
--Ivanov
0
 

Author Comment

by:rmloh
ID: 1353138
OK viktornet but i did wot you tolld my to do
and it is"t work can you pleas send my yors fles
for a EXE to ian@gezernet.co.il
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 10

Expert Comment

by:viktornet
ID: 1353139
Ok, I'll make you an example...
0
 

Author Comment

by:rmloh
ID: 1353140
ok
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1353141
rmloh, I sent you a demo... YOu just need to compile it and press the button. Notepad would be extracted and saved to your desktop. The resource file is ResFile.rc which is actually a text file and you can see its contents. Then I compiled it with brcc32.exe and it gave me the ResFile.res... I included resfile.res in delphi by doing the following...

{$R RESFILE.RED}

Then I use the code I showed you above and it worked....

I hope now you can reject that person's answer and let me answer it and get the credit I deserve... 10q

-Viktor
--Ivanov
0
 

Author Comment

by:rmloh
ID: 1353142
I go the Email and it works but
you tolld my to write in *.rc
NOTEPAD EXEFILE C:\WINDOWS\NOTEPAD.EXE
and you write
NOTEPAD RCDATA C:\windows\notepad.exe
now how to you wont to get yours Points
0
 

Author Comment

by:rmloh
ID: 1353143
answer viktornet
0
 
LVL 10

Accepted Solution

by:
viktornet earned 50 total points
ID: 1353144
Ok, Here is my answer :)

btw- I told you to write EXEFILE because I just copied the article and pasted it.... When I try to make a demo project, it didn't work out so I had to change it to RCDATA... That's all... Happy Coding....

-Viktor
--Ivanov
0
 
LVL 1

Expert Comment

by:slautin
ID: 1353145
Specially for VICTORNET!!!
What is '(Edited by Computer101)'? I didn't understand.
Are you want to write "flame out" or %#$%#$%#$%#$?
My be you know what's "(Edited by Computer101)ing true"? It's new language?
Type me, I know only "false" or "true" in coding.
In different conferences you'll get "(Edited by Computer101)" yourself.

Are you a professional or not?
Then talk as professionals, but not as ^$%^66456456$%^...

With best regards,
Slautin.
0
 
LVL 1

Expert Comment

by:slautin
ID: 1353146
rmloh
are you need lz-component?
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1353147
slautin.... Keep ur professional mouth shut, 'cuz I'm sick of u aready... and u've been here for only 2 days... As a matter of fact I don't need no &%&^$@#&^!@%#*^$#!@$ script to express my self...
0
 

Author Comment

by:rmloh
ID: 1353148
Good by viktornet :-)
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now