microsoft / microsoft/win32metadata

Friendly overload for `MsiGetSummaryInformation()` can't accept a null hDatabase value.

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

From the [docs](https://learn.microsoft.com/en-us/windows/win32/api/msiquery/nf-msiquery-msigetsummaryinformationw) as it's all I have to go on:

> If the database specified by the MsiGetSummaryInformation function is not open, you must specify 0 for hDatabase and specify the path to the database in szDatabasePath. If the database is open, you must set szDatabasePath to 0.

> If a value of uiUpdateCount greater than 0 is used to open an existing summary information stream, [MsiSummaryInfoPersist](https://learn.microsoft.com/en-us/windows/desktop/api/msiquery/nf-msiquery-msisummaryinfopersist) must be called before closing the phSummaryInfo handle. Failing to do this will lose the existing stream information.

## Expected behavior

That this SafeHandle parameter accepts null on the friendly overload and handles it interally like other SafeHandle types do.

## Repro steps

1. `NativeMethods.txt` content:
```
MsiGetSummaryInformation
```

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 tracing generation for the MsiGetSummaryInformation entry point from the NativeMethods.txt repro and inspect how the friendly overload handles SafeHandle parameters. Done means the generated overload accepts a null hDatabase value and handles it consistently with other SafeHandle types; no specific test file is named, so add or run the relevant generator coverage.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.