[SOLVED] Method patch example request...ideas?
Posted: Mon May 27, 2013 9:31 am
I need help with the following "patch" in
http://code.google.com/p/polymorph/sour ... y/filter.c
I need "LoadSegVMM" to actually perform a call to "LoadSegDOS" which is the original dos.library/LoadSeg() LVO call
and to do so with the following restrictions...
No GCC optimization or call modification (static definition of the entrypoint)...
Arguments given when called *must* be used unchanged in calling the original vector,
any return value except NULL is to be handed back to the caller,
the "EnablePolymorphX" needs to be checked when "LoadSegDOS()" returns NULL,
I currently have a "naked" Assembly function presented as "LoadSegVMM()" specifically to try and call the original LoadSegDOS()
without the SysV argument setup in registers being modified (currently I am seeing deadlocks and recoverable alerts)
there is also a commented C version at the bottom... if there is some means of fixing a function to that Polymorph can patch and wrapper
LoadSeg() calls without crashing the system in the process...
LoadSegVMM() is provided by Polymorph
LoadSegDOS() is proveded by dos.library
dos.library / LoadSeg() is patched to call LoadSegVMM() as transparent replacement
LoadSegVMM() first calls the LoadSegDOS() function which is obtained when the patch is applied
----
IF (rc = LoadSegDOS(name))==NULL THEN
IF EnablePolymorphX THEN
dtid = ObtainDataTypeIdent(name)
plugin = ObtainPolymorphPlugin(dtid)
rc = PluginLoadSeg(plugin,name)
ENDIF
ENDIF
----
What am I missing in declaring the function in C?
Have I incorrectly tried to call the LoadSegDOS() function using a direct branch?
Help... please?
The above link is directly into the repository fopr the whole project... so feel freeto check it out and comment if you have a constructive suggestion
http://code.google.com/p/polymorph/sour ... y/filter.c
I need "LoadSegVMM" to actually perform a call to "LoadSegDOS" which is the original dos.library/LoadSeg() LVO call
and to do so with the following restrictions...
No GCC optimization or call modification (static definition of the entrypoint)...
Arguments given when called *must* be used unchanged in calling the original vector,
any return value except NULL is to be handed back to the caller,
the "EnablePolymorphX" needs to be checked when "LoadSegDOS()" returns NULL,
I currently have a "naked" Assembly function presented as "LoadSegVMM()" specifically to try and call the original LoadSegDOS()
without the SysV argument setup in registers being modified (currently I am seeing deadlocks and recoverable alerts)
there is also a commented C version at the bottom... if there is some means of fixing a function to that Polymorph can patch and wrapper
LoadSeg() calls without crashing the system in the process...
LoadSegVMM() is provided by Polymorph
LoadSegDOS() is proveded by dos.library
dos.library / LoadSeg() is patched to call LoadSegVMM() as transparent replacement
LoadSegVMM() first calls the LoadSegDOS() function which is obtained when the patch is applied
----
IF (rc = LoadSegDOS(name))==NULL THEN
IF EnablePolymorphX THEN
dtid = ObtainDataTypeIdent(name)
plugin = ObtainPolymorphPlugin(dtid)
rc = PluginLoadSeg(plugin,name)
ENDIF
ENDIF
----
What am I missing in declaring the function in C?
Have I incorrectly tried to call the LoadSegDOS() function using a direct branch?
Help... please?
The above link is directly into the repository fopr the whole project... so feel freeto check it out and comment if you have a constructive suggestion