Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ internal partial class Interop
internal partial class User32
{
[DllImport(Libraries.User32, SetLastError=true, CharSet = CharSet.Unicode, ExactSpelling = true)]
public static extern bool GetUserObjectInformationW(IntPtr hObj, int nIndex, [MarshalAs(UnmanagedType.LPStruct)] USEROBJECTFLAGS pvBuffer, int nLength, ref int lpnLengthNeeded);
public static extern bool GetUserObjectInformationW(IntPtr hObj, int nIndex, ref USEROBJECTFLAGS pvBuffer, int nLength, ref int lpnLengthNeeded);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ internal partial class Interop
{
internal partial class User32
{
[StructLayout(LayoutKind.Sequential)]
internal class USEROBJECTFLAGS {
public int fInherit = 0;
public int fReserved = 0;
public int dwFlags = 0;
internal struct USEROBJECTFLAGS {
public int fInherit;
public int fReserved;
public int dwFlags;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private SystemEvents()
[SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")]
private static volatile IntPtr s_processWinStation = IntPtr.Zero;
private static volatile bool s_isUserInteractive = false;
private static bool UserInteractive
private unsafe static bool UserInteractive
{
get
{
Expand All @@ -106,7 +106,7 @@ private static bool UserInteractive
int lengthNeeded = 0;
Interop.User32.USEROBJECTFLAGS flags = new Interop.User32.USEROBJECTFLAGS();

if (Interop.User32.GetUserObjectInformationW(hwinsta, Interop.User32.UOI_FLAGS, flags, Marshal.SizeOf(flags), ref lengthNeeded))
if (Interop.User32.GetUserObjectInformationW(hwinsta, Interop.User32.UOI_FLAGS, ref flags, sizeof(Interop.User32.USEROBJECTFLAGS), ref lengthNeeded))
{
if ((flags.dwFlags & Interop.User32.WSF_VISIBLE) == 0)
{
Expand Down