dongshao1156 2018-12-13 09:28
浏览 42

在Golang中创建FILE_ID_DESCRIPTOR

I'm trying to create this structure in Golang -

typedef struct FILE_ID_DESCRIPTOR {
  DWORD        dwSize;
  FILE_ID_TYPE Type;
  union {
    LARGE_INTEGER FileId;
    GUID          ObjectId;
    FILE_ID_128   ExtendedFileId;
  } DUMMYUNIONNAME;
} FILE_ID_DESCRIPTOR, *LPFILE_ID_DESCRIPTOR;

As you can see, this depends on union of three in which unknown is FILE_ID_128 and another structure called FILE_ID_TYPE so I stumbled upon this, which is FILE_ID_128s and the _FILE_ID_TYPE structure is here and here

typedef enum _FILE_ID_TYPE {
  FileIdType,
  ObjectIdType,
  ExtendedFileIdType,
  MaximumFileIdType
} FILE_ID_TYPE, *PFILE_ID_TYPE;

And doing after doing some research, I found out that enum is const in Go but in Go, we can not have a named const so maybe a struct(?) and union are byte slices. But I could not find what MaximumFileIdType meant and how to implement that in Go. Thanks in advance.

Also, reference that I am following.

P.S. - Do let me know the question is down-voted. Do you see lack of efforts? Or is not clear? It'll help making a clearer question

  • 写回答

0条回答 默认 最新

    报告相同问题?