Coding STEM

Editing Registry using C/C++

WARNING: This is a real easy one, but can be dangerous! Do NOT use this for any malicious or system purposes unless you have been instructed to do so from a verified support professional! This is NOT intended to be anything other than for a test and education.

I’ve written millions of lines of code for Windows, but this blog isn’t about demonstrating the complexity of such code, but meant to open the door to curiosity who will ease into STEM/coding with an approachable stance. Simple, fun, easy-to-code stuff that will hopefully get you excited or interested in STEM. So, no showing off 🙂 but fun stuff only here.


Use system() function is C with an expression as below (example only):

 system("reg add HKLM\\SOFTWARE\\myTestNode /v myTitle /t reg_sz /d Test-Application");

NOTE: To run this, the exe must be executed as an Administrator (right-click on the EXE file). I’m NOT going to share the exe here. Sorry, but it’s for your own good.

After execution, open REGEDIT via cmd console or Windows-Run dialog, and drill down to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\ node and look for “myTestNode” node (created in this program),
and when it’s selected on the right pane, there should be an item called “myTitle” and its value should be “Test-Application”.
After testing, the “myTestNode” node can be safely deleted.


So, a simple code block is as follows:

int main()
system("reg add HKLM\\SOFTWARE\\myTestNode /v myTitle /t reg_sz /d Test-Application");
// system("reg add HKLM\\system\\currentcontrolset\\Services\\SharedAccess\\parameters\\firewallpolicy\\publicprofile /v EnableFirewall /t reg_dword /d 0 /f");
return 0;

There you have it. You must do your diligence on reading up on the “flags”, parameters, and values because I believe that just running it without knowing what you’re doing is dangerous and unproductive. Cheers.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top