How to translate the CC ++ program into Delphi (nine)

zhaozj2021-02-17  42

Case Integer of Starts The Variant Part of The Record. Each Variant Is Identified by An ORDINAL VALUE. THIS VALUE HAS NO Meaning When The Type is Being Used, But IS Required For Declaration.

Please Note The Difference Between a Variant (Case-) Record and a record without case-declaration.

The Following Translation IS WRONG:

Type

PPROCESSHEAPENTRY = ^ TPROCESSHEAPENTRY;

TProcessHeapenTry = Record

LPDATA: POINTER;

CBDATA: DWORD;

CBOVERHEAD: BYTE;

IREGIONDEX: BYTE;

WFLAGS: WORD;

Block: Record

HMEM: Thandle

Reserved: array [0..2] of dword;

END;

Region: Record

DWCommittedsize: DWORD;

Dwuncommittedsize: DWORD;

LpfirstBlock: Pointer;

Lplastblock: Pointer

END);

END;

This Wrong Translation Would Cause Block and Region To BE CAUSECUTIVE IN MEMORY, AND NOT OVERLAID, AS FOLLOWS:

LPDATA, CBDATA, CBOVERHEAD, IREGIONDEX, WFLAGS HMEM, DWRESERVED DWCOMMIZIZE, DWUNCOMMITTEDSIZE, LPFIRSTBLOCK, LPLASTBLOCK

Back to Contents

转载请注明原文地址:https://www.9cbs.com/read-30421.html

New Post(0)