microsoft / microsoft/win32metadata

Should the Msi* methods be returning a WIN32_ERROR?

Open
#2,181 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
1.5k
Forks
149
Avg merge
5d 16h
Merged PRs (30d)
4

Description

Actual behavior

This might be one for win32metadata, but reporting here in case it isn't. Most Msi* currently return a uint, however the return value is typically a WIN32_ERROR value. Using MsiExtractPatchXMLData() as an example, you can see it states several WIN32_ERROR values it may return.

Comparing this with something like SetNamedSecurityInfo(), this returns a DWORD (ultimately a uint), however CsWin32 returns this correctly as a WIN32_ERROR value for the caller's convenience.

Expected behavior

That if a method is returning a WIN32_ERROR value, it should be cast as that without the caller having to work it out for themselves.

Repro steps

  1. NativeMethods.txt content:
MsiExtractPatchXMLData
  1. NativeMethods.json content (if present): N/A

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

Context
  • CsWin32 version: 0.3.0264
  • 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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the NativeMethods.txt repro for MsiExtractPatchXMLData and inspect how its return type is represented in Win32Metadata and exposed by CsWin32. Compare it with SetNamedSecurityInfo and verify that the generated method uses WIN32_ERROR without requiring caller-side conversion.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, csharp
Domain
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.