Skip to content

Commit

Permalink
Add PhIsInteractiveUserSession
Browse files Browse the repository at this point in the history
  • Loading branch information
dmex committed Jun 30, 2023
1 parent 386fcfb commit 7603574
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
24 changes: 24 additions & 0 deletions phlib/guisup.c
Original file line number Diff line number Diff line change
Expand Up @@ -4146,3 +4146,27 @@ HCURSOR PhLoadDividerCursor(

return dividerCursorHandle;
}

BOOLEAN PhIsInteractiveUserSession(
VOID
)
{
USEROBJECTFLAGS flags;

memset(&flags, 0, sizeof(USEROBJECTFLAGS));

if (GetUserObjectInformation(
GetProcessWindowStation(),
UOI_FLAGS,
&flags,
sizeof(USEROBJECTFLAGS),
NULL
))
{
if (BooleanFlagOn(flags.dwFlags, WSF_VISIBLE))
return TRUE;
}

return FALSE;
}

7 changes: 7 additions & 0 deletions phlib/include/guisup.h
Original file line number Diff line number Diff line change
Expand Up @@ -1805,6 +1805,13 @@ PhLoadDividerCursor(
VOID
);

PHLIBAPI
BOOLEAN
NTAPI
PhIsInteractiveUserSession(
VOID
);

#ifndef DBT_DEVICEARRIVAL
#define DBT_DEVICEARRIVAL 0x8000 // system detected a new device
#define DBT_DEVICEREMOVECOMPLETE 0x8004 // device is gone
Expand Down

0 comments on commit 7603574

Please sign in to comment.