Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
AhmadTayseerDajani wrote:ok,
the function: _saveTCRegs();
save all registers even DS,CS,IP(code offset),...
i think exec(char*,void*,char*);
need some fix,
anyway, if you have another method to run .EXE better than my method,please let my know
ThankX
Saves the registers where? If it uses globals, it probably has reentrancy issues. And execution of image files (be it EXE or another format) is supposed to start at the entry point designated by its header, isn't it? Sorry, but I don't understand what the problem is, really.
Saves the registers where? If it uses globals, it probably has reentrancy issues. And execution of image files (be it EXE or another format) is supposed to start at the entry point designated by its header, isn't it? Sorry, but I don't understand what the problem is, really.
There is two problem with storing the processor context in global variables. First, if two threads concurrently try to save the context, either thead A overwrites thread B's context, or they write at the exact same time, resulting in a context X that is neither A nor B. I assume you use threads from this code:
Second, if you load an executable A that in turn loads another executable B, then the context that was saved before A was executed is overwritten by the context saved before B is executed.
AhmadTayseerDajani wrote:execution image is 16 bit MZ executable
ru2aqare wrote:
There is two problem with storing the processor context in global variables. First, if two threads concurrently try to save the context, either thead A overwrites thread B's context, or they write at the exact same time, resulting in a context X that is neither A nor B.
Second, if you load an executable A that in turn loads another executable B, then the context that was saved before A was executed is overwritten by the context saved before B is executed.
Oh my guess, i forgot that,...,thank you ru2aqare for your help,& I am gona fix up my code by adding struct to save each EXE registers individually
ThAnKX AgAiN
Distance doesn't make you any smaller,
but it does make you part of a larger picture.