After this period of time, I found a solution to this problem by using code injection on file.
Below is my solution on steps:
- Since both exe files (app1.exe and app2.exe) are created by same person, you can create the app2.exe with some predefined variable values (like
string setting1 = "${MYVAR}"
), then compile and save the exe (app2.exe). - Include app2.exe as an embeded resource on app1.exe (the app2.exe generator), and get input (usually from user) that will be used to replace
setting1
variables value of app2.exe - Read byte array of app2.exe on app1.exe (since it is embedded on it's resources) and convert it to HEX string
- From the string (that is converted from byte array) find value of
setting1
variable (by firstly converting it also in byte array then in HEX string), and then replace it with the input you got in step 2 (by also converting in byte array then in HEX string). - Convert the whole string (after replacing the values) back to byte array and save it as a file (app2.exe).
If someone want to see an example, I can put some code as proof of concept.