typedef unsigned char UCHAR;          // 8 unsigned bits
typedef unsigned short USHORT;        // 16 unsigned bits
typedef unsigned long ULONG;          // 32 unsigned bitstypedef struct {
    ULONG LowPart;
    LONG HighPart;
} LARGE_INTEGER;                      // 64 bits of datatypedef struct  {
    UCHAR Protocol[4];                // Contains 0xFF,'SMB'
    UCHAR Command;                    // Command code
    union {
        struct {
            UCHAR ErrorClass;         // Error class
            UCHAR Reserved;           // Reserved for future use
            USHORT Error;             // Error code
        } DosError;
        ULONG Status;                 // 32-bit error code
    } Status;
    UCHAR Flags;                      // Flags
    USHORT Flags2;                    // More flags
    union {
        USHORT Pad[6];                // Ensure section is 12 bytes long
        struct {
            USHORT PidHigh;           // High part of PID
            UCHAR SecuritySignature[8];    // reserved for security
      } Extra;
    };
    USHORT Tid;                       // Tree identifier
    USHORT Pid;                       // Caller's process id
    USHORT Uid;                       // Unauthenticated user id
    USHORT Mid;                       // multiplex id
    UCHAR  WordCount;                 // Count of parameter words
    USHORT ParameterWords[ WordCount ];    // The parameter words
    USHORT ByteCount;                 // Count of bytes
    UCHAR  Buffer[ ByteCount ];       // The bytes
} SMB_HEADER;

解决方案 »

  1.   

    结构体:
    type [structname] = record
      [var1]: Datatype;
      [var2]: Datatype;
      ...
    end;共用体:
    type [unionname] = record
      case Integer of
      0:
        [var1]: Datatype; 
        [var2]: Datatype;
        ...
      1;
        [var1]: Datatype;
        [var2]: Datatype;
        [var3]: Datatype;
        ...
      2:
      ...
    end;//说明:[]的内容可自已定,Datatype表示数据类型,可为用户自定义类型,比如结构体!!
    //注意,共用体中每种Case所占用的字节总数是一样的!!
      

  2.   

    大概如此,注意编译中的字节对其选项,delphi的和c的要一样type
     UCHAR = byte;          // 8 unsigned bits
     USHORT = Word;        // 16 unsigned bits
     ULONG = DWord;          // 32 unsigned bitsLARGE_INTEGER = record
        LowPart: ULONG;
        HighPart : LONGInt;
    end;                       // 64 bits of dataSMB_HEADER = record
        Protocol: array [0..3] of UCHAR;                // Contains 0xFF,'SMB'
        Command: UCHAR;                    // Command code
        case Integer of
         0: (DosError : record
         ErrorClass, // Error class
         Reserved: UCHAR;  // Reserved for future use
         Error: USHORT;      // Error code
         end);
         1: (Status: ULONG); // 32-bit error code
        Flags: UCHAR;                      // Flags
        Flags2: USHORT;                    // More flags
        case Integer of
         0: ( Pad : Array of [0..5] of USHORT;); // Ensure section is 12 bytes long
         1: ( Extra : Record 
         PidHigh: USHORT;  // High part of PID
         SecuritySignature: array [0..7] of UCHAR; // reserved for security
         end);
        Tid,                       // Tree identifier
        Pid : USHORT;                       // Caller's process id
        Uid,                       // Unauthenticated user id
        Mid : USHORT;                       // multiplex id
        WordCount : UCHAR;                 // Count of parameter words
        USHORT ParameterWords[ WordCount ];    // The parameter words
        ByteCount : USHORT;                 // Count of bytes
        UCHAR  Buffer[ ByteCount ];       // The bytes
    end;