microsoft / win32metadata

Tooling to generate metadata for Win32 APIs in the Windows SDK.
Other
1.32k stars 113 forks source link

OpenInputDesktop no found GENERIC_ALL #1949

Open Junffzz opened 1 month ago

Junffzz commented 1 month ago

Suggestion

The OpenInputDesktop function does not have a GENERIC_ALL parameter, or a parameter for complete replacement.

kennykerr commented 1 month ago

Sounds like a question for the Win32 metadata repo.

0x5bfa commented 1 month ago

Does this related to #1948?

riverar commented 1 month ago

So to clarify the original issue, the OpenInputDesktop method accepts an ACCESS_MASK. Currently, that's mapped to a synthetic enum DESKTOP_ACCESS_FLAGS, which is missing GENERIC_ALL (or similar) constant. As a workaround, you can use Windows.Win32.Foundation.GENERIC_ACCESS_RIGHTS.GENERIC_ALL.

This enum appears to duplicate a lot of existing standard rights, which is something we're discussing in #1948 as well.

public enum DESKTOP_ACCESS_FLAGS : uint
{
    DESKTOP_DELETE = 65536u,
    DESKTOP_READ_CONTROL = 131072u,
    DESKTOP_WRITE_DAC = 262144u,
    DESKTOP_WRITE_OWNER = 524288u,
    DESKTOP_SYNCHRONIZE = 1048576u,
    DESKTOP_READOBJECTS = 1u,
    DESKTOP_CREATEWINDOW = 2u,
    DESKTOP_CREATEMENU = 4u,
    DESKTOP_HOOKCONTROL = 8u,
    DESKTOP_JOURNALRECORD = 16u,
    DESKTOP_JOURNALPLAYBACK = 32u,
    DESKTOP_ENUMERATE = 64u,
    DESKTOP_WRITEOBJECTS = 128u,
    DESKTOP_SWITCHDESKTOP = 256u
}
Junffzz commented 1 month ago

So to clarify the original issue, the OpenInputDesktop method accepts an ACCESS_MASK. Currently, that's mapped to a synthetic enum DESKTOP_ACCESS_FLAGS, which is missing GENERIC_ALL (or similar) constant. As a workaround, you can use Windows.Win32.Foundation.GENERIC_ACCESS_RIGHTS.GENERIC_ALL.

This enum appears to duplicate a lot of existing standard rights, which is something we're discussing in #1948 as well.

public enum DESKTOP_ACCESS_FLAGS : uint
{
  DESKTOP_DELETE = 65536u,
  DESKTOP_READ_CONTROL = 131072u,
  DESKTOP_WRITE_DAC = 262144u,
  DESKTOP_WRITE_OWNER = 524288u,
  DESKTOP_SYNCHRONIZE = 1048576u,
  DESKTOP_READOBJECTS = 1u,
  DESKTOP_CREATEWINDOW = 2u,
  DESKTOP_CREATEMENU = 4u,
  DESKTOP_HOOKCONTROL = 8u,
  DESKTOP_JOURNALRECORD = 16u,
  DESKTOP_JOURNALPLAYBACK = 32u,
  DESKTOP_ENUMERATE = 64u,
  DESKTOP_WRITEOBJECTS = 128u,
  DESKTOP_SWITCHDESKTOP = 256u
}

I can't use Windows.Win32.Foundation.GENERIC_ACCESS_RIGHTS.GENERIC_ALL because OpenInputDesktop's parameter is DESKTOP_ACCESS_FLAGS, but it's of type GENERICACCESS RIGHTS

riverar commented 1 month ago

You would need to cast it, yes. (DESKTOP_ACCESS_FLAGS)GENERIC_ALL or similar.