Skip to content

Invalid typecast? (Pointer(Cardinal(LInd) * 65536) #65

Description

@GabrielOnDelphi

Hi there!
Is this code valid on 64 bit?
procedure UpdateVMGraph(var AMemoryMap: TMemoryMapEx);
var
LInd, LIndTop, I1: Cardinal;
LChunkState: TChunkStatusEx;
LMBI: TMemoryBasicInformation;
LA_Char: array[0..MAX_PATH] of Char;
begin
LInd := 0;
repeat
{If the chunk is not allocated by this MM, what is its status?}
if AMemoryMap[LInd] = csExSysAllocated then
begin
{Get all the reserved memory blocks and Windows allocated memory blocks, etc.}
VirtualQuery(Pointer(Cardinal(LInd) * 65536), LMBI, SizeOf(LMBI));
if LMBI.State = MEM_COMMIT then
begin
if (GetModuleFileName(DWord(LMBI.AllocationBase), LA_Char, MAX_PATH) <> 0) then
begin
if DWord(LMBI.AllocationBase) = SysInit.HInstance then
LChunkState := csExSysExe
else
LChunkState := csExSysDLL;
end
Gabriel
:)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions