Connecting Tech Pros Worldwide Forums | Help | Site Map

C# Load File directly to memmory with it's binary code

Newbie
 
Join Date: Aug 2008
Posts: 4
#1: Sep 8 '08
Hi, I've got a program that decrypts a fille and i don't want to write the decrypted binary code to an exe so that i can run it. Is there anyway that i can load the inexisting file just having it's binary code?

joedeene's Avatar
Site Addict
 
Join Date: Jul 2008
Location: US of A
Posts: 587
#2: Sep 8 '08

re: C# Load File directly to memmory with it's binary code


Quote:

Originally Posted by lipeacorsi

Hi, I've got a program that decrypts a fille and i don't want to write the decrypted binary code to an exe so that i can run it. Is there anyway that i can load the inexisting file just having it's binary code?

uhm, how about making a decrypted file or encrypted whichever one you need, because i cant quite understand, and then put all of the decrypted contents of the encrypted file into the decrypted file and then run a process, and if u want it to run as an .exe use the process class, and then the process.useshellexecute, and set it to true

joedeene
Newbie
 
Join Date: Aug 2008
Posts: 4
#3: Sep 8 '08

re: C# Load File directly to memmory with it's binary code


Quote:

Originally Posted by joedeene

uhm, how about making a decrypted file or encrypted whichever one you need, because i cant quite understand, and then put all of the decrypted contents of the encrypted file into the decrypted file and then run a process, and if u want it to run as an .exe use the process class, and then the process.useshellexecute, and set it to true

joedeene

txs for the reply, here is the deal, i want to run the program directly from ram, so i don't need to store it in a non volatile memory. got it? I've got the decrypted file and im writing in my hard drive and then opening. I don't want to store the decrypted file in my hard drive, just want to run it without creating an .exe.
joedeene's Avatar
Site Addict
 
Join Date: Jul 2008
Location: US of A
Posts: 587
#4: Sep 8 '08

re: C# Load File directly to memmory with it's binary code


Quote:

Originally Posted by lipeacorsi

txs for the reply, here is the deal, i want to run the program directly from ram, so i don't need to store it in a non volatile memory. got it? I've got the decrypted file and im writing in my hard drive and then opening. I don't want to store the decrypted file in my hard drive, just want to run it without creating an .exe.

well i've read that you could use the System.IO.Path.GetTempFileName() which will make a temporary file in the temp folder, and set a string for the directory and delete it once the process is done, but im not sure, u might be able to use the MemoryStream, and decrypt the file within that, idk, its i would make a temporary file, and then delete it, its pretty simple, and in the temp directory with a random name/characters, so not many people, or programs will know where/what its called...did i help?

joedeene
Newbie
 
Join Date: Aug 2008
Posts: 4
#5: Sep 8 '08

re: C# Load File directly to memmory with it's binary code


Quote:

Originally Posted by joedeene

well i've read that you could use the System.IO.Path.GetTempFileName() which will make a temporary file in the temp folder, and set a string for the directory and delete it once the process is done, but im not sure, u might be able to use the MemoryStream, and decrypt the file within that, idk, its i would make a temporary file, and then delete it, its pretty simple, and in the temp directory with a random name/characters, so not many people, or programs will know where/what its called...did i help?

joedeene

Oh good Idea, i'll see it tomorrow that MemoryStream, temporary file it's certainly an alternative thank you, yes you did help, let's see tomorrow how much. thanks..
Reply