0

This is the code for running a .reg file from c#. Is it possible to encrypt the .reg files so that C# can decrypt before executing from memory"

Process regeditProcess = Process.Start("regedit.exe", "/s " + @"D:\Projects\efe\efe\bin\Debug\test.reg");

regeditProcess.WaitForExit()

how does the above lines change in this case?

Edit: My question is, I can decrypt the file and write it temporarily in a location and pass it to my code as e.g) test.reg. But Can I execute the reg file in memory using the Process.Start command without passing an actual file location?

The reason was not to allow any one to mess up with the .reg files. An exe does some tasks and runs .reg files along the way. I dont mind them viewing it later, though they wont identify which entries changed if encrypted.

Dexters
  • 2,419
  • 6
  • 37
  • 57

1 Answers1

0

No.

To my knowledge RegEdit can't read input from console (which is generally the only way to pass information to an existing app directly) - so no, you can't pass information to RegEdit from memory without saving to disk.

Note that it is strange requirement in case of RegEdit as all changes made by it are already visible to current user - so you are not hiding anything with not writing file to disk.

The only option I can think of is to read file yourself and make registry changes via .Net APIs (see modifying the registry key value).

Community
  • 1
  • 1
Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179