Skip to content
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
9 changes: 4 additions & 5 deletions src/Common/src/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2007,12 +2007,11 @@ public PICTDESCemf(System.Drawing.Imaging.Metafile metafile)
}
}

[StructLayout(LayoutKind.Sequential)]
public class USEROBJECTFLAGS
public struct USEROBJECTFLAGS
{
public int fInherit = 0;
public int fReserved = 0;
public int dwFlags = 0;
public int fInherit;
public int fReserved;
public int dwFlags;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
Expand Down
2 changes: 1 addition & 1 deletion src/Common/src/UnsafeNativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ public static bool TrySystemParametersInfoForDpi(int nAction, int nParam, [In, O
public static extern IntPtr GetProcessWindowStation();
[DllImport(ExternDll.User32, SetLastError = true)]

public static extern bool GetUserObjectInformation(HandleRef hObj, int nIndex, [MarshalAs(UnmanagedType.LPStruct)] NativeMethods.USEROBJECTFLAGS pvBuffer, int nLength, ref int lpnLengthNeeded);
public static extern bool GetUserObjectInformation(HandleRef hObj, int nIndex, ref NativeMethods.USEROBJECTFLAGS pvBuffer, int nLength, ref int lpnLengthNeeded);
[DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)]

public static extern int ClientToScreen(HandleRef hWnd, [In, Out] NativeMethods.POINT pt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ public static string ComputerName
/// Gets a value indicating whether the current process is running in user
/// interactive mode.
/// </summary>
public static bool UserInteractive
public unsafe static bool UserInteractive
{
get
{
Expand All @@ -807,7 +807,7 @@ public static bool UserInteractive
int lengthNeeded = 0;
NativeMethods.USEROBJECTFLAGS flags = new NativeMethods.USEROBJECTFLAGS();

if (UnsafeNativeMethods.GetUserObjectInformation(new HandleRef(null, hwinsta), NativeMethods.UOI_FLAGS, flags, Marshal.SizeOf(flags), ref lengthNeeded))
if (UnsafeNativeMethods.GetUserObjectInformation(new HandleRef(null, hwinsta), NativeMethods.UOI_FLAGS, ref flags, sizeof(NativeMethods.USEROBJECTFLAGS), ref lengthNeeded))
{
if ((flags.dwFlags & NativeMethods.WSF_VISIBLE) == 0)
{
Expand Down