0
我想將內存中的例程代碼複製到另一個位置。對於例如將例程的內容複製到內存中的另一個位置
procedure OldShowMessage;
begin
ShowMessage('Old message..');
end;
說我想複製例程到內存中的另一個位置。我宣佈類似
var
lopShowMessage : procedure; // procedural pointer.
一些僞代碼會像
// VirtualProtect(@OldShowMessage, <length of routine>, ..., ...);
// Allocate memory
// lopShowMessage := AllocMem(<length of routine>);
// Move(@OldMessage, Pointer(lopShowMessage)^, <length of routine>);
// FlushInstructioncache.....
我只是想知道是否有這樣做的可能性。我修補了一個例程來調用一個新的例程,但是由於我們使用代碼繞道來放置JMP指令,因此我可能無法使用舊例程中提供的功能。
一種我剛纔的問題引用here
爲什麼這會降低投票率?這是一個有效的答案。 – 2012-03-02 23:38:04