microsoft / microsoft/CsWin32

Can't use PowerRegisterSuspendResumeNotification with DEVICE_NOTIFY_CALLBACK

Open
#1,631 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
2.5k
Forks
124
Avg merge
1d 3h
Merged PRs (30d)
9

Description

There's no signature to use PowerRegisterSuspendResumeNotification per the Win32 docs

https://learn.microsoft.com/en-us/windows/win32/api/powerbase/nf-powerbase-powerregistersuspendresumenotification

Actual behavior

internal static extern unsafe winmdroot.Foundation.WIN32_ERROR PowerRegisterSuspendResumeNotification(winmdroot.UI.WindowsAndMessaging.REGISTER_NOTIFICATION_FLAGS Flags, winmdroot.Foundation.HANDLE Recipient, void** RegistrationHandle);

Expected behavior

Should have an overload taking DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS

Repro steps

  1. NativeMethods.txt content:
PowerRegisterSuspendResumeNotification
  1. NativeMethods.json content (if present):
{
  "$schema": "https://aka.ms/CsWin32.schema.json",
  "wideCharOnly": true,
  "emitSingleFile": true,
  "public": false,
  "allowMarshaling": false
}
  1. Any of your own code that should be shared?
Context
  • CsWin32 version: 0.3.269
  • Target Framework: net10.0

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 PowerRegisterSuspendResumeNotification entry point generated from NativeMethods.txt and NativeMethods.json, then compare its current signature with the Win32 documentation and DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS definition. Done means generation exposes an overload that accepts the callback subscription parameters while preserving the existing form.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.