Skip to content

Parse C Source doesn't support enumeration with explicit underlying type supported by MSVC C++ #8495

@bthiae2934

Description

@bthiae2934

Is your feature request related to a problem? Please describe.
I found a nice feature called "Parse C Source" and tried it with my MSVC 2022 headers. I copied VisualStudio22_64.prf to a new profile, modified the profile's included paths to the paths on my machine and ran it. It failed with an error indicating that it can't parse an enumeration in C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\ProofOfPossessionCookieInfo.h:

typedef enum _PROOF_OF_POSSESSION_FLAGS : DWORD
{
    PROOF_OF_POSSESSION_DEFAULT                      = 0x0000000000000000,
    PROOF_OF_POSSESSION_ALLOW_SILENT_REQUESTS        = 0x0000000000000001,
} PROOF_OF_POSSESSION_FLAGS;

After troubleshooting I found that the : DWORD is a feature called "Explicit Underlying Type" supported by MSVC C++ compiler:
https://learn.microsoft.com/en-us/cpp/dotnet/how-to-define-and-consume-enums-in-cpp-cli?view=msvc-170

I tried to create a C source file with the syntax above, compiled it and MSVC C compiler complained that it doesn't support this syntax.

Describe the solution you'd like
I have read the document and found that Ghidra doesn't support C++ header files. I think there're two ways to improve the user experience:

  1. Comment out ProofOfPossessionCookieInfo.h.
  2. Add support of this syntax.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions