Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
Solved

# check if my process's code was changed in memory.

Posted on 2003-03-09
Medium Priority
121 Views
hey, lets say i have a function and i would like to check if it was changed inside the memory, how can i do this ?
0
Question by:wsock32_
• 4
• 3

Author Comment

ID: 8101434
increased points.. please, some help here..
0

LVL 9

Expert Comment

ID: 8101479
seems you have to calc checksum of function code on programm startup and then compare it with stored value.

0

Author Comment

ID: 8101496
i know that, but how can i calc the checksum of the function, how can i fetch that data into a buffer? :/
0

LVL 9

Expert Comment

ID: 8101572
I saw sample about how to acces executable code in this topic area. Let me know if you didn't found it.
0

Author Comment

ID: 8101789
nope tried the google search, but its not here
0

LVL 9

Expert Comment

ID: 8101818
ok, just a moment....
0

LVL 9

Accepted Solution

ITugay earned 1200 total points
ID: 8101871
here is a sample.
Proc1 - procedure that must be checked.
DummyProc - place it just after Proc1 to calculate Proc1 size.

procedure Proc1(var M: Integer);
begin
M := 1000;
end;

procedure DummyProc;
begin

end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
var
A: Pointer;
L: Integer;
CS: Integer;
begin
A := @Proc1;

// size of procedure
L := Integer(@DummyProc) - Integer(@Proc1);

// check summ
CS := 0;
while L > 0 do
begin
CS := CS + Byte(A^);
dec(L);
A := Pointer(Integer(A) + 1);
end;

// show result
ShowMessage(IntToStr(CS));
end;

-----
Igor

PS: if you need to copy code of proc1 to buffer, then use  A as pointer of area and L as length in bytes
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small printâ€¦
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have toâ€¦
Loops Section Overview
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calculâ€¦
###### Suggested Courses
Course of the Month12 days, 8 hours left to enroll