Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8869789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:33:57+00:00 2026-06-14T17:33:57+00:00

typedef struct _FILE_OBJECTID_INFORMATION { LONGLONG FileReference; UCHAR ObjectId[16]; union { struct { UCHAR BirthVolumeId[16];

  • 0
typedef struct _FILE_OBJECTID_INFORMATION {
    LONGLONG FileReference;
    UCHAR ObjectId[16];
    union {
        struct {
            UCHAR BirthVolumeId[16];
            UCHAR BirthObjectId[16];
            UCHAR DomainId[16];
        } DUMMYSTRUCTNAME;
        UCHAR ExtendedInfo[48];
    } DUMMYUNIONNAME;
} FILE_OBJECTID_INFORMATION, *PFILE_OBJECTID_INFORMATION;

How to translate such a union to Delphi?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:34:01+00:00Added an answer on June 14, 2026 at 5:34 pm

    The Pascal equivalent of a C union is known as a variant record.

    A record type can have a variant part, which looks like a case
    statement. The variant part must follow the other fields in the record
    declaration.

    To declare a record type with a variant part, use the following
    syntax:

    type recordTypeName = record
      fieldList1: type1;
       ...
      fieldListn: typen;
    case tag: ordinalType of
      constantList1: (variant1);
       ...
      constantListn: (variantn);
    end;
    

    The first part of the declaration – up to the reserved word case – is
    the same as that of a standard record type. The remainder of the
    declaration – from case to the optional final semicolon – is called
    the variant part. In the variant part,

    • tag is optional and can be any valid identifier. If you omit tag, omit the colon (:) after it as well.
    • ordinalType denotes an ordinal type.
    • Each constantList is a constant denoting a value of type ordinalType, or a comma-delimited list of such constants. No value can
      be represented more than once in the combined constantLists.
    • Each variant is a semicolon-delimited list of declarations resembling the fieldList: type constructions in the main part of the
      record type. That is, a variant has the form:

      fieldList1: type1;
      …
      fieldListn: typen;

    where each fieldList is a valid identifier or comma-delimited list of
    identifiers, each type denotes a type, and the final semicolon is
    optional. The types must not be long strings, dynamic arrays, variants
    (that is, Variant types), or interfaces, nor can they be structured
    types that contain long strings, dynamic arrays, variants, or
    interfaces; but they can be pointers to these types.

    Records with variant parts are complicated syntactically but
    deceptively simple semantically. The variant part of a record contains
    several variants which share the same space in memory. You can read or
    write to any field of any variant at any time; but if you write to a
    field in one variant and then to a field in another variant, you may
    be overwriting your own data. The tag, if there is one, functions as
    an extra field (of type ordinalType) in the non-variant part of the
    record.


    As for the rest, it’s pretty routine: LONGLONG is a 64 bit integer, and UCHAR is unsigned char, or AnsiChar in Delphi.

    type
      TFileObjectIDInformation = record
        FileReference: Int64;
        ObjectID: array[0..15] of AnsiChar;
        case Integer of
        0:
          (
            BirthVolumeId: array[0..15] of AnsiChar;
            BirthObjectId: array[0..15] of AnsiChar;
            DomainId: array[0..15] of AnsiChar;
          );
        1:
          (ExtendedInfo: array[0..47] of AnsiChar);
      end;
    

    It’s possible that Byte may be more appropriate than AnsiChar. It’s a bit hard to tell of course because C, unlike Pascal, doesn’t have separate types for Byte and AnsiChar. But these arrays look to me as though they would be read as text so my guess is that AnsiChar would be more appropriate.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have such a C++ structure: typedef struct _FILE_OP_BLOCK { unsigned short fid; //
I've declared a struct in my header file like this: typedef struct { NSString
I have C header file containing the following type definition: // example.h typedef struct
I'm having some trouble with some struct typedef declarations in a header file not
//file list.h #include stdafx.h namespace st { struct My_List; typedef My_List list; list* create(const
typedef struct _ut_slot { ucontext_t uc; .... }*ut_slot; static ut_slot* table; //array of the
55 typedef struct pidmap { 56 atomic_t nr_free; 57 void *page; 58 } pidmap_t;
I have a structure: typedef struct stock { const char* key1p2; // stock code
From objc.h: typedef struct objc_class *Class; but in runtime.h: struct objc_class { Class isa;
Consider the following: typedef struct { int a; int b; int c; int d;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.