exception handling for another program, is it possible in c#?
-
For example, if i VirtualProtectEx portion of memory of another program, with page guard or no access, how can i handle the exception when it will be raised, and get exception informations like registers value ect...? I think to handle the exception my program would require enabled debug privileges which i know how to code but then i don't know how to set a top level exception filter. I am still learning so any help would be great. :)
-
For example, if i VirtualProtectEx portion of memory of another program, with page guard or no access, how can i handle the exception when it will be raised, and get exception informations like registers value ect...? I think to handle the exception my program would require enabled debug privileges which i know how to code but then i don't know how to set a top level exception filter. I am still learning so any help would be great. :)
Cptkli wrote:
For example, if i VirtualProtectEx portion of memory of another program, with page guard or no access, how can i handle the exception when it will be raised, and get exception informations like registers value ect...?
You can't. Your code will never see the exception. This would require a technique called ".DLL Injection", which is something that C# alone cannot do because of the .DLL library requirements of the technique. This is a very advanced technique. Not something for beginners to try and pull off.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Cptkli wrote:
For example, if i VirtualProtectEx portion of memory of another program, with page guard or no access, how can i handle the exception when it will be raised, and get exception informations like registers value ect...?
You can't. Your code will never see the exception. This would require a technique called ".DLL Injection", which is something that C# alone cannot do because of the .DLL library requirements of the technique. This is a very advanced technique. Not something for beginners to try and pull off.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008