Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CParser doesn't recognize Microsoft-specific pointer modifier __uptr #6173

Open
xiaoyinl opened this issue Feb 1, 2024 · 0 comments
Open
Assignees
Labels
Feature: C-Parser Status: Triage Information is being gathered

Comments

@xiaoyinl
Copy link
Contributor

xiaoyinl commented Feb 1, 2024

Describe the bug
The Ghidra's CParser can't parse the following C source code:

void MyFunction(char * __uptr __ptr32 myValue);

__uptr and __sptr are Visual Studio specific. They are documented here: https://learn.microsoft.com/en-us/cpp/cpp/sptr-uptr.

Error Message

C Parser:  Encountered errors during parse.
         in C:\...\uptr.h near line 2
Error: Encountered " "__ptr32" "__ptr32 "" at line 3, column 31.
Was expecting one of:
    [... omitted ...]
    
         near token: __uptr
Possibly Undefined : (
         Last Valid Datatype: char *
         Check around uptr2 around line: 3

Environment (please complete the following information):

  • OS: Windows 11
  • Java Version: 17.0.7
  • Ghidra Version: 11.1 DEV 59972bb
  • Ghidra Origin: locally built

Additional context
This error appears when parsing GET_CONFIGURATION_IOCTL_INPUT32 struct in ntddmmc.h in Windows WDK, using x86-64 profile. After macro expansion, its definition is:

typedef struct _GET_CONFIGURATION_IOCTL_INPUT32 {
    FEATURE_NUMBER   Feature;
    ULONG            RequestType; 
    void* __uptr __ptr32 Reserved[2];
} GET_CONFIGURATION_IOCTL_INPUT32, *PGET_CONFIGURATION_IOCTL_INPUT32;
@ryanmkurtz ryanmkurtz added Feature: C-Parser Status: Triage Information is being gathered labels Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: C-Parser Status: Triage Information is being gathered
Projects
None yet
Development

No branches or pull requests

3 participants