microsoft / microsoft/win32metadata

Constants like `MSIDBOPEN_PATCHFILE`, et al, should be PCWSTR-typed like others are.

Open
#2,179 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
1.5k
Forks
149
Avg merge
5d 16h
Merged PRs (30d)
4

Description

## Actual behavior

The raw P/Invoke for `MsiOpenDatabase()` accepts `szPersist` as a `PCWSTR` which matches the header, but the constants that need to be sent through are just integers.

## Expected behavior

That constants be typed to the value of the underlying P/Invoke. Other P/Invokes like `TaskDialog()`, which takes PCWSTR constants has the constants like `TD_INFORMATION_ICON` properly typed as PCWSTR.

## Repro steps

1. `NativeMethods.txt` content:
```
MSIDBOPEN_PATCHFILE
```

2. `NativeMethods.json` content (if present): N/A

3. Any of your own code that should be shared? N/A

### Context

- CsWin32 version: 0.3.257
- Win32Metadata version (if explicitly set by project): N/A
- Target Framework: net472
- `LangVersion` (if explicitly set by project): N/A

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with a NativeMethods.txt containing MSIDBOPEN_PATCHFILE, then compare the generated declaration for MsiOpenDatabase with the TaskDialog constants such as TD_INFORMATION_ICON. Done means the generated MSIDBOPEN_PATCHFILE constant is typed as PCWSTR to match the P/Invoke parameter.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.