Hello everyone!
There are times when you want to save the data after completion of the program, but did not want to have external dependencies, registry entries, etc. However you can store the data in your EXE. Unfortunately, Windows doesn't allow to write into the running EXE (i don't consider NTFS streams), and any attempt of the writing will be rejected with the ERROR_ACCESS_DENIED error. Although if the process is complete it can be performed by another process. Here is the way I decided to choose.
Firstly, you'd run cmd.exe with the suspended state. Further you'd create code that will be injected to it and will change the resources of our EXE. Then you'd run this code. This code waits for termination of our process and then rewrites the needed data (you've passed them to there). Eventually it is terminated.
In order to simplify the code (it only needs single form) i decide to make it in assembler. It is simpler and requires less code (source is included). Because the code is published especially for the review and test, it doesn't perform any synchronizations.
is this tested on all windows like as xp 32bit or win 7 64 bit or win 10?
i want use this code but how can protect that resource created itself or hide it inside exe,can i do that?or maybe another way to can save my data and edit data inside exe without need resource?
is this tested on all windows like as xp 32bit or win 7 64 bit or win 10?
i want use this code but how can protect that resource created itself or hide it inside exe,can i do that?or maybe another way to can save my data and edit data inside exe without need resource?
The protection isn't related to storing here. You can encrypt your data and store it to resource in the simpliest case.
Hi The Trck
Very interesting.
A module or a class would be welcome
my means of protect is how protect this resource added in exe "RCDATA" part,i dont want somebody can see it in resource editors i want protect that "RCDATA" part or hide that "RCDATA" tab
.
because everybody easy can find it or replace it with another resource in res editors.
any way to can hide it ?
and i cant use any packer or etc to protect this exe file because after protect by other softwares it cant work for save data intself.
any way to can fix this problem?
i see that github too but i have 2 questsion about it
1- can i add or modify string data too because maybe i dont need add files jst i want add or edit string data?
for example i want jst save a counter data to can make my exe limited for 5 times jst with saved that counter variable itself.
2- how size support , can i add a 100 mb file inside it or more than 10 files with each 100 mb or longer? and how can play theme for example i want add 4 mp4 videos but i want play theme inside exe too.
Last edited by Black_Storm; Feb 15th, 2022 at 11:22 PM.
Anyone can replace the data anywhere. Just encrypt it and make checking by a checksum. There is no difference if you place the data in resources or inside an executable.
1- can i add or modify string data too because maybe i dont need add files jst i want add or edit string data?
for example i want jst save a counter data to can make my exe limited for 5 times jst with saved that counter variable itself.
There is no difference a file or a string.
how size support , can i add a 100 mb file inside it or more than 10 files with each 100 mb or longer? and how can play theme for example i want add 4 mp4 videos but i want play theme inside exe too.
The size doesn't matter. If you plan to store big files inside an EXE it's better to use the second approach (append to tail) because no VM is used for this when the executable is loaded.
so its not safe for protect that rcdata and the only way for protect is checksum?!!! if yes which check sum vb project is better and worked on win xp till win 10?can send a best source code for check sum to can run in xp till win 10?
if i dont want use like as this thread and using resource but if i want save inside exe so CEmbeddedFiles class is better?!! i seen before but CEmbeddedFiles saved files in .text section? because i did not find resource part in final exe when i use CEmbeddedFiles project.
my english is weak but ur means of append to tail is same append to the file or appened to resource?
can i use jst CEmbeddedFiles for what i want is that support (append to tail)?
i ask this question in my other thread too how can save string and edit or delete it inside exe when i want use CEmbeddedFiles without need add files on disk
Last edited by Black_Storm; Feb 17th, 2022 at 10:23 PM.
I think you can't use resources and EOF in the same exe. If you need to change some data in exe (like a counter or a small string) you just need to update it directly in the file (using a shellcode or an external executable). I think you can't write a shellcode so you can create a small executable which patches the main exe. Put it to main exe resources/section. Before finish your application extract this small executable to a file and run it with specified command line. This executable waits for the main executable has ended and patches the data.
I think you can't use resources and EOF in the same exe. If you need to change some data in exe (like a counter or a small string) you just need to update it directly in the file (using a shellcode or an external executable). I think you can't write a shellcode so you can create a small executable which patches the main exe. Put it to main exe resources/section. Before finish your application extract this small executable to a file and run it with specified command line. This executable waits for the main executable has ended and patches the data.
i said this too here in linked thread so am i on correct way ?
maybe need another modifer exe but created with vb and can access to resources in opened exe and edited and saved with replace to opened exe?
if yes any sample code to can modify another exe vb and access to resource part and edit it?!!