pinvoke icon indicating copy to clipboard operation
pinvoke copied to clipboard

Change NTSTATUS/HResult FACILITY_CODE to match CsWin32 definitions

Open BinToss opened this issue 3 years ago • 3 comments

  • [ ] Move shift operation by FacilityShift to Get property accessor
  • [ ] (Optional) Add bit mask of 0xC0000000

e.g. property generated by CsWin32:

public Severity SeverityCode => (Severity)(((uint)this.Value & 0xc0000000) >> 30);

Why?

I was having trouble determining the "true" values of the Facility Codes and nearly opened a separate issue after seeing FACILITY_DEBUGGER was not assigned 1.

BinToss avatar Jul 10 '22 02:07 BinToss

Can you send a PR with the proposed change?

AArnott avatar Jul 21 '22 19:07 AArnott

Sure! I should have time to work on it in the next few days.

BinToss avatar Jul 21 '22 21:07 BinToss

While working on it, I noticed a minor compatibility issue. If a downstream library explicitly depends on the existing, bit-shifted enum values, the library/app will no longer behave as expected when they update their package references.

In light of this, I'll submit a followup PR for ~~SeverityCode~~ FacilityCode so these two compatibility changes can be published together.

I'll leave fields such as CustomerCode as-is for now. "*Shifted" properties can be added later if needed e.g. "CustomerCodeShifted".

P.S. I've been spending a lot of today figuring out a GPG issue that's preventing me from committing.

P.P.S. Finally re-learned that Git needs gpg4win registered as its gpg application. Haven't done that in a few years.

BinToss avatar Jul 24 '22 21:07 BinToss