For example,
For I:=1 to 4 do
The begin
PDZ:=pointer ($25366445);
PDZ:=pointer (PDZ ^ + I * 4);
Bb:=longint (pointer (PDZ ^));
end;
Or
Asm
PUSHAD
MOV ECX, $25366445
MOV ECX, [ECX]
MOV EAX, I
MOV ECX, [ECX + EAX * 4)
MOV bb, ECX
POPAD
end;
PDZ point to address was invalid, then may make a mistake, how to judge the pointer to the address of the first is invalid
The invalid is will pop up the access violation address
CodePudding user response:
If PDWORD ($25366445) ^=0 thenCodePudding user response:
Can't know. Maybe the address (1 byte byte; 2 bytes word; Cardinal 4 bytes) is a data, and data is 0Or the address is 3 bytes (PAnsiChar), store the data is # 0 # 0 # 0
0 is not said it is not a real data,
CodePudding user response:
Elegant point is using the Windows APIIsBadReadPtr
Violence, can use the try... Except, catch exceptions,
CodePudding user response:
For memory, it is a memory chip,Memory address, it is the memory chip, a piece of place marked position,
Memory value, it is the memory chip area, save the data,
Strict sense, the value of the memory always on some, its value:
(1) the original value;
(2) valid values;
(3) invalid values,
For example, your memory address is unused area, it is a memory of the original state, whole is zero, or is all 1 (binary values),
If you define a variable var I: integer; , that is I corresponds to the address specified is integer type, it is an initial value of 0 (decimal values), if I:=10; Operation, the value of the corresponding address is 10 I (decimal values),
If you define a variable var ADO: TADOQuery; ADO, then, the corresponding address is nil (initial value), you can use the if ADC=nil then statements for judgment; When performing ADO:=TADOQuery. Create (application); , it is a valid value, ADC<> Nil, as it points to the TADOQuery object address,
In short, the comparison of the memory depth of knowledge, it is related to the depth development of knowledge,
CodePudding user response:
Try directly determine whether NILCodePudding user response:
If not asigned (PDZ) then