#### Archived

This topic is now archived and is closed to further replies.

This topic is 4947 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

i want to know how to bind two or more files together. like a exe attached to a jpg and it will also run the exe thats what binding is. how do i do this? thanks in advanced.

##### Share on other sites
You''re being a little vague. Are you developing an application you want to attach resources to? Are you developing a pak file format? What language? What platform? More info is needed.

##### Share on other sites
me thinks you are up to something a bit evil...

check out this pic -> not_a_trojan.jpg

##### Share on other sites
i just want to make my own.

nothing evil!

##### Share on other sites
This isn''t getting anywhere. Please refer to my other post.

##### Share on other sites
You can''t just attach an EXE to a JPG. You can include the data for JPGs in EXEs due to their design, but not the other way around.

##### Share on other sites
http://www.catb.org/~esr/faqs/smart-questions.html#bespecific

##### Share on other sites
If you just need to distribute your exe with the file its easy

dim ifl() as bytedim ffl() as bytedim ofl() as byteopen exefile for binary as #1redim ifl(lof(1))get #1, , iflclose #1open fileadded for binary as #1redim ffl(lof(1)) as byteget #1, , fflclose #1for x = 0 to ubound(ifl)ofl(x) = ifl(x)next xfor x = 0 to ubound(ffl)ofl(x + ubound(ifl) + 1) = ffl(x)next xopen outfile for binary as #1put #1, , oflput #1, , ccur(ubound(ifl))close #1

That just 1. gets the two files, 2. puts the exe before the jpg and 3. puts the length of the exe on the end of it.

To get it out, just use
dim bn() as bytedim lf as currencydim of() as byteopen file for binary as #1redim bn(lof(1) - 4)get #1, bnget #1, lfclose #1open file for binary as #1redim of(ubound(bn) - lf)get #1, lf, ofclose #1open fout for binary as #1put #1, ofclose #1

Thats how i do it... if you want something different, just ask.

##### Share on other sites
Do you mean file associations? Where you have SomeFile.yourFileExtension and you want your own application to start whenever the file is double clicked? IIRC, your app will receive the filename as an argument to your main method, then you need the registry to associate the .something with your actual exe.

try here

##### Share on other sites
can you give me a c++ example.

##### Share on other sites
and OrangyTang no not files extensions.
nicecoder knows what i mean.

##### Share on other sites
Here''s a tip, go learn it yourself instead of begging for the entire thing here.

##### Share on other sites
JPG data is just binary. I''ll let you figure the rest out.

##### Share on other sites
He wants to know how to attach his trojan executable to a jpeg image, such that when his victim opens the image, the executable will install itself and steal passwords, perform keylogs and the like.

Well I have news for you clown - it''s not possible, and thank jimmy it isn''t.

##### Share on other sites
Maybe its the optimist in me, but I don't think he wants to make a trojan.

Look up FindResource()/LoadResource() in MSDN. You may need to use a JPEG decompression library if you are using that format.

Example code - ResourceManager.cpp

[edited by - antareus on May 30, 2004 7:53:45 PM]

##### Share on other sites
quote:
Original post by antareus
Maybe its the optimist in me, but I don''t think he wants to make a trojan.

Look up FindResource()/LoadResource() in MSDN. You may need to use a JPEG decompression library if you are using that format.

Example code - ResourceManager.cpp

[edited by - antareus on May 30, 2004 7:53:45 PM]

Always assume the worst case scenario...

That''s how you make lots of friends.

##### Share on other sites
Nah, it is clear he wants to make something bad. Why on earth would you, by his example, want to run an exe when a jpeg is opened? And he even said that he doesn''t mean file-type associations.

##### Share on other sites
Yeah, if it were in the opposite order (run exe, do something with jpg attached to exe), it would be a simple and fairly benign question.

But asking how to tack an executable onto an image and make it run when the image is opened is a little shifty at best.

The only way to ever make this happen would be to make a special loader go along with the image so it can open the jpg as normal, unattach the exe behind it and run it. And frankly that''s an awful way to distribute anything, be it a virus or not...

Then again, some people are so stupid that if they got an e-mail that said, "Here''s a picture of someone naked/cute kittens, but you have to use this program to open it!" they would do it regardless of how many warnings they''ve been given not to.

BTW, I mean no offense to internet newbies (not that there are many of those here) who wouldn''t know better. In those cases it''s an honest mistake.

-Auron