microsoft / microsoft/win32metadata

Friendly overloads for Msi* methods don't seem to be as good as they could be.

Open
#2,173 3 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

## Behavior

I'm starting to develop some MSI code using the Msi* methods like `MsiOpenDatabase()`, etc. The two main issue are:

1. The [documentation](https://learn.microsoft.com/en-us/windows/win32/api/msiquery/nf-msiquery-msiopendatabasew) says that the `MSIHANDLE` is an out parameter, yet the friendly overload takes an `MSIHANDLE` by ref.
2. Because the `MSIHANDLE` needs releasing with `MsiCloseHandle()`, the friendly overload should be outing a SafeHandle of some kind for this type.

## Repro steps

1. `NativeMethods.txt` content:
```
MsiOpenDatabase
```

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 with the MsiOpenDatabase entry in NativeMethods.txt and inspect the generated friendly overload for its MSIHANDLE parameter. Compare the overload with the Microsoft MsiOpenDatabase and MsiCloseHandle documentation, then review how other Msi* methods handle output handles. Done means the overload reflects the documented out parameter and provides an appropriate safe-handle pattern.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.