Hacker News new | ask | show | jobs
by NtGuy25 1632 days ago
You want to use C anyhow as you want to make sure you have control over the code that is output.

For example the following code you know what the assembly is going to be.

strcmp(char* a, char* b);

strcmp(str1,str2);

If you do the above as a template you can run into some weird issues that you may not be expecting. So while tedious, you would need to make your own wscmp. You also have to be very careful so that you don't pull in ANY libraries. Since your code needs to be 100 % independent and do the loading itself.

C++ exceptions are implemented at the OS level in windows. C++ exceptions using SEH, while there's also VEH and unhandled exceptions. You can easily use SEH for your shell code, it's just not documented well. But sadly you have to manually set this up by having something like

SetExceptionHandler(curAddr,Handler) // Where curaddr can be found by doing something like call $+5 so you remain position independent.