ReactOS  0.4.15-dev-2721-g5912c11
msgina.h File Reference
#include <stdarg.h>
#include <stdlib.h>
#include <tchar.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <winuser.h>
#include <winwlx.h>
#include <ndk/rtlfuncs.h>
#include <ntsecapi.h>
#include <strsafe.h>
#include <wine/debug.h>
#include "resource.h"
Include dependency graph for msgina.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  GINA_CONTEXT
 
struct  _GINA_UI
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 

Typedefs

typedef struct GINA_CONTEXTPGINA_CONTEXT
 
typedef BOOL(* PFGINA_INITIALIZE) (PGINA_CONTEXT)
 
typedef BOOL(* PFGINA_DISPLAYSTATUSMESSAGE) (PGINA_CONTEXT, HDESK, DWORD, PWSTR, PWSTR)
 
typedef BOOL(* PFGINA_REMOVESTATUSMESSAGE) (PGINA_CONTEXT)
 
typedef VOID(* PFGINA_DISPLAYSASNOTICE) (PGINA_CONTEXT)
 
typedef INT(* PFGINA_LOGGEDONSAS) (PGINA_CONTEXT, DWORD)
 
typedef INT(* PFGINA_LOGGEDOUTSAS) (PGINA_CONTEXT)
 
typedef INT(* PFGINA_LOCKEDSAS) (PGINA_CONTEXT)
 
typedef VOID(* PFGINA_DISPLAYLOCKEDNOTICE) (PGINA_CONTEXT)
 
typedef struct _GINA_UI GINA_UI
 
typedef struct _GINA_UIPGINA_UI
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msgina)
 
NTSTATUS ConnectToLsa (PGINA_CONTEXT pgContext)
 
NTSTATUS MyLogonUser (HANDLE LsaHandle, ULONG AuthenticationPackage, LPWSTR lpszUsername, LPWSTR lpszDomain, LPWSTR lpszPassword, PHANDLE phToken, PNTSTATUS SubStatus)
 
LONG ReadRegSzValue (IN HKEY hKey, IN LPCWSTR pszValue, OUT LPWSTR *pValue)
 
BOOL DoAdminUnlock (IN PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, IN PWSTR Password)
 
NTSTATUS DoLoginTasks (IN OUT PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, IN PWSTR Password, OUT PNTSTATUS SubStatus)
 
BOOL CreateProfile (IN OUT PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, IN PWSTR Password)
 
DWORD GetDefaultShutdownSelState (VOID)
 
DWORD LoadShutdownSelState (VOID)
 
VOID SaveShutdownSelState (DWORD ShutdownCode)
 
DWORD GetDefaultShutdownOptions (VOID)
 
DWORD GetAllowedShutdownOptions (VOID)
 
INT_PTR ShutdownDialog (IN HWND hwndDlg, IN DWORD ShutdownOptions, IN PGINA_CONTEXT pgContext)
 

Variables

HINSTANCE hDllInstance
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 13 of file msgina.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 14 of file msgina.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 12 of file msgina.h.

Typedef Documentation

◆ GINA_UI

◆ PFGINA_DISPLAYLOCKEDNOTICE

typedef VOID(* PFGINA_DISPLAYLOCKEDNOTICE) (PGINA_CONTEXT)

Definition at line 70 of file msgina.h.

◆ PFGINA_DISPLAYSASNOTICE

typedef VOID(* PFGINA_DISPLAYSASNOTICE) (PGINA_CONTEXT)

Definition at line 66 of file msgina.h.

◆ PFGINA_DISPLAYSTATUSMESSAGE

typedef BOOL(* PFGINA_DISPLAYSTATUSMESSAGE) (PGINA_CONTEXT, HDESK, DWORD, PWSTR, PWSTR)

Definition at line 64 of file msgina.h.

◆ PFGINA_INITIALIZE

typedef BOOL(* PFGINA_INITIALIZE) (PGINA_CONTEXT)

Definition at line 63 of file msgina.h.

◆ PFGINA_LOCKEDSAS

typedef INT(* PFGINA_LOCKEDSAS) (PGINA_CONTEXT)

Definition at line 69 of file msgina.h.

◆ PFGINA_LOGGEDONSAS

typedef INT(* PFGINA_LOGGEDONSAS) (PGINA_CONTEXT, DWORD)

Definition at line 67 of file msgina.h.

◆ PFGINA_LOGGEDOUTSAS

typedef INT(* PFGINA_LOGGEDOUTSAS) (PGINA_CONTEXT)

Definition at line 68 of file msgina.h.

◆ PFGINA_REMOVESTATUSMESSAGE

typedef BOOL(* PFGINA_REMOVESTATUSMESSAGE) (PGINA_CONTEXT)

Definition at line 65 of file msgina.h.

◆ PGINA_CONTEXT

◆ PGINA_UI

Function Documentation

◆ ConnectToLsa()

NTSTATUS ConnectToLsa ( PGINA_CONTEXT  pgContext)

Definition at line 11 of file lsa.c.

13 {
14  LSA_STRING LogonProcessName;
15  LSA_STRING PackageName;
18 
19  /* We are already connected to the LSA */
20  if (pgContext->LsaHandle != NULL)
21  return STATUS_SUCCESS;
22 
23  /* Connect to the LSA server */
24  RtlInitAnsiString((PANSI_STRING)&LogonProcessName,
25  "MSGINA");
26 
27  Status = LsaRegisterLogonProcess(&LogonProcessName,
28  &pgContext->LsaHandle,
29  &SecurityMode);
30  if (!NT_SUCCESS(Status))
31  {
32  ERR("LsaRegisterLogonProcess failed (Status 0x%08lx)\n", Status);
33  return Status;
34  }
35 
36  /* Get the authentication package */
37  RtlInitAnsiString((PANSI_STRING)&PackageName,
39 
41  &PackageName,
42  &pgContext->AuthenticationPackage);
43  if (!NT_SUCCESS(Status))
44  {
45  ERR("LsaLookupAuthenticationPackage failed (Status 0x%08lx)\n", Status);
46  }
47 
48  return Status;
49 }
#define MSV1_0_PACKAGE_NAME
Definition: ntsecapi.h:42
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
NTSTATUS NTAPI LsaLookupAuthenticationPackage(IN HANDLE LsaHandle, IN PLSA_STRING PackageName, OUT PULONG AuthenticationPackage)
Definition: lsa.c:136
_IRQL_requires_same_ _Out_ PHANDLE _Out_ PLSA_OPERATIONAL_MODE SecurityMode
HANDLE LsaHandle
Definition: msgina.h:39
ULONG LSA_OPERATIONAL_MODE
Definition: ntsecapi.h:367
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG AuthenticationPackage
Definition: msgina.h:40
#define ERR(fmt,...)
Definition: debug.h:110
NTSTATUS NTAPI LsaRegisterLogonProcess(IN PLSA_STRING LogonProcessName, OUT PHANDLE LsaHandle, OUT PLSA_OPERATIONAL_MODE OperationalMode)
Definition: lsa.c:249
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by DoAdminUnlock(), DoChangePassword(), DoLoginTasks(), and TUILockedSAS().

◆ CreateProfile()

BOOL CreateProfile ( IN OUT PGINA_CONTEXT  pgContext,
IN PWSTR  UserName,
IN PWSTR  Domain,
IN PWSTR  Password 
)

Definition at line 785 of file msgina.c.

790 {
791  LPWSTR ProfilePath = NULL;
792  LPWSTR lpEnvironment = NULL;
793  TOKEN_STATISTICS Stats;
794  PWLX_PROFILE_V2_0 pProfile = NULL;
795  DWORD cbStats, cbSize;
796  DWORD dwLength;
797  BOOL bResult;
798 
799  /* Store the logon time in the context */
800  GetLocalTime(&pgContext->LogonTime);
801 
802  /* Store user and domain in the context */
803  wcscpy(pgContext->UserName, UserName);
804  if (Domain == NULL || wcslen(Domain) == 0)
805  {
806  dwLength = _countof(pgContext->DomainName);
807  GetComputerNameW(pgContext->DomainName, &dwLength);
808  }
809  else
810  {
811  wcscpy(pgContext->DomainName, Domain);
812  }
813 
814  /* Get profile path */
815  cbSize = 0;
816  bResult = GetProfilesDirectoryW(NULL, &cbSize);
817  if (!bResult && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
818  {
819  ProfilePath = HeapAlloc(GetProcessHeap(), 0, cbSize * sizeof(WCHAR));
820  if (!ProfilePath)
821  {
822  WARN("HeapAlloc() failed\n");
823  goto cleanup;
824  }
825  bResult = GetProfilesDirectoryW(ProfilePath, &cbSize);
826  }
827  if (!bResult)
828  {
829  WARN("GetUserProfileDirectoryW() failed\n");
830  goto cleanup;
831  }
832 
833  /* Allocate memory for profile */
835  if (!pProfile)
836  {
837  WARN("HeapAlloc() failed\n");
838  goto cleanup;
839  }
840  pProfile->dwType = WLX_PROFILE_TYPE_V2_0;
841  pProfile->pszProfile = ProfilePath;
842 
843  cbSize = sizeof(L"LOGONSERVER=\\\\") +
844  wcslen(pgContext->DomainName) * sizeof(WCHAR) +
845  sizeof(UNICODE_NULL);
846  lpEnvironment = HeapAlloc(GetProcessHeap(), 0, cbSize);
847  if (!lpEnvironment)
848  {
849  WARN("HeapAlloc() failed\n");
850  goto cleanup;
851  }
852 
853  StringCbPrintfW(lpEnvironment, cbSize, L"LOGONSERVER=\\\\%ls", pgContext->DomainName);
854  ASSERT(wcslen(lpEnvironment) == cbSize / sizeof(WCHAR) - 2);
855  lpEnvironment[cbSize / sizeof(WCHAR) - 1] = UNICODE_NULL;
856 
857  pProfile->pszEnvironment = lpEnvironment;
858 
859  if (!GetTokenInformation(pgContext->UserToken,
861  &Stats,
862  sizeof(Stats),
863  &cbStats))
864  {
865  WARN("Couldn't get Authentication id from user token!\n");
866  goto cleanup;
867  }
868 
869  *pgContext->pAuthenticationId = Stats.AuthenticationId;
870  pgContext->pMprNotifyInfo->pszUserName = DuplicationString(UserName);
871  pgContext->pMprNotifyInfo->pszDomain = DuplicationString(Domain);
872  pgContext->pMprNotifyInfo->pszPassword = DuplicationString(Password);
873  pgContext->pMprNotifyInfo->pszOldPassword = NULL;
874  *pgContext->pdwOptions = 0;
875  *pgContext->pProfile = pProfile;
876  return TRUE;
877 
878 cleanup:
879  if (pProfile)
880  {
881  HeapFree(GetProcessHeap(), 0, pProfile->pszEnvironment);
882  }
883  HeapFree(GetProcessHeap(), 0, pProfile);
884  HeapFree(GetProcessHeap(), 0, ProfilePath);
885  return FALSE;
886 }
LUID AuthenticationId
Definition: setypes.h:1033
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:112
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:446
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
unsigned int BOOL
Definition: ntddk_ex.h:94
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
BOOL WINAPI GetProfilesDirectoryW(_Out_ LPWSTR lpProfilesDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1576
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define ASSERT(a)
Definition: mode.c:44
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD DWORD * dwLength
Definition: fusion.c:85
#define _countof(array)
Definition: sndvol32.h:68
unsigned long DWORD
Definition: ntddk_ex.h:95
PWSTR pszProfile
Definition: winwlx.h:149
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
static PWSTR DuplicationString(PWSTR Str)
Definition: msgina.c:650
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:413
char * cleanup(char *str)
Definition: wpickclick.c:99
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define WLX_PROFILE_TYPE_V2_0
Definition: winwlx.h:51
PWSTR pszEnvironment
Definition: winwlx.h:153
#define HeapFree(x, y, z)
Definition: compat.h:594
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by DoLogon(), and TUILoggedOutSAS().

◆ DoAdminUnlock()

BOOL DoAdminUnlock ( IN PGINA_CONTEXT  pgContext,
IN PWSTR  UserName,
IN PWSTR  Domain,
IN PWSTR  Password 
)

Definition at line 665 of file msgina.c.

670 {
671  HANDLE hToken = NULL;
673  BOOL bIsAdmin = FALSE;
674  ULONG Size;
675  ULONG i;
678 
679  TRACE("(%S %S %S)\n", UserName, Domain, Password);
680 
681  Status = ConnectToLsa(pgContext);
682  if (!NT_SUCCESS(Status))
683  {
684  WARN("ConnectToLsa() failed\n");
685  return FALSE;
686  }
687 
688  Status = MyLogonUser(pgContext->LsaHandle,
689  pgContext->AuthenticationPackage,
690  UserName,
691  Domain,
692  Password,
693  &pgContext->UserToken,
694  &SubStatus);
695  if (!NT_SUCCESS(Status))
696  {
697  WARN("MyLogonUser() failed\n");
698  return FALSE;
699  }
700 
702  TokenGroups,
703  NULL,
704  0,
705  &Size);
707  {
708  TRACE("NtQueryInformationToken() failed (Status 0x%08lx)\n", Status);
709  goto done;
710  }
711 
713  if (Groups == NULL)
714  {
715  TRACE("HeapAlloc() failed\n");
716  goto done;
717  }
718 
720  TokenGroups,
721  Groups,
722  Size,
723  &Size);
724  if (!NT_SUCCESS(Status))
725  {
726  TRACE("NtQueryInformationToken() failed (Status 0x%08lx)\n", Status);
727  goto done;
728  }
729 
730  for (i = 0; i < Groups->GroupCount; i++)
731  {
732  if (RtlEqualSid(Groups->Groups[i].Sid, AdminSid))
733  {
734  TRACE("Member of Admins group\n");
735  bIsAdmin = TRUE;
736  break;
737  }
738  }
739 
740 done:
741  if (Groups != NULL)
743 
744  if (hToken != NULL)
745  CloseHandle(hToken);
746 
747  return bIsAdmin;
748 }
#define CloseHandle
Definition: compat.h:598
NTSTATUS MyLogonUser(HANDLE LsaHandle, ULONG AuthenticationPackage, LPWSTR lpszUsername, LPWSTR lpszDomain, LPWSTR lpszPassword, PHANDLE phToken, PNTSTATUS SubStatus)
Definition: lsa.c:55
static PSID AdminSid
Definition: msgina.c:39
#define TRUE
Definition: types.h:120
NTSTATUS ConnectToLsa(PGINA_CONTEXT pgContext)
Definition: lsa.c:11
#define WARN(fmt,...)
Definition: debug.h:112
LONG NTSTATUS
Definition: precomp.h:26
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
TOpcodeData Groups[17][8]
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define FALSE
Definition: types.h:117
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID _Out_ PULONG _Inout_ PLUID _Out_ PHANDLE _Out_ PQUOTA_LIMITS _Out_ PNTSTATUS SubStatus
unsigned int BOOL
Definition: ntddk_ex.h:94
_Must_inspect_result_ __kernel_entry NTSTATUS NTAPI NtQueryInformationToken(_In_ HANDLE TokenHandle, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Out_writes_bytes_to_opt_(TokenInformationLength, *ReturnLength) PVOID TokenInformation, _In_ ULONG TokenInformationLength, _Out_ PULONG ReturnLength)
Definition: token.c:2373
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
#define HeapFree(x, y, z)
Definition: compat.h:594
NTSYSAPI BOOLEAN NTAPI RtlEqualSid(_In_ PSID Sid1, _In_ PSID Sid2)

Referenced by DoUnlock().

◆ DoLoginTasks()

NTSTATUS DoLoginTasks ( IN OUT PGINA_CONTEXT  pgContext,
IN PWSTR  UserName,
IN PWSTR  Domain,
IN PWSTR  Password,
OUT PNTSTATUS  SubStatus 
)

Definition at line 752 of file msgina.c.

758 {
760 
761  Status = ConnectToLsa(pgContext);
762  if (!NT_SUCCESS(Status))
763  {
764  WARN("ConnectToLsa() failed (Status 0x%08lx)\n", Status);
765  return Status;
766  }
767 
768  Status = MyLogonUser(pgContext->LsaHandle,
769  pgContext->AuthenticationPackage,
770  UserName,
771  Domain,
772  Password,
773  &pgContext->UserToken,
774  SubStatus);
775  if (!NT_SUCCESS(Status))
776  {
777  WARN("MyLogonUser() failed (Status 0x%08lx)\n", Status);
778  }
779 
780  return Status;
781 }
NTSTATUS MyLogonUser(HANDLE LsaHandle, ULONG AuthenticationPackage, LPWSTR lpszUsername, LPWSTR lpszDomain, LPWSTR lpszPassword, PHANDLE phToken, PNTSTATUS SubStatus)
Definition: lsa.c:55
NTSTATUS ConnectToLsa(PGINA_CONTEXT pgContext)
Definition: lsa.c:11
#define WARN(fmt,...)
Definition: debug.h:112
LONG NTSTATUS
Definition: precomp.h:26
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID _Out_ PULONG _Inout_ PLUID _Out_ PHANDLE _Out_ PQUOTA_LIMITS _Out_ PNTSTATUS SubStatus
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32

Referenced by DoLogon(), and TUILoggedOutSAS().

◆ GetAllowedShutdownOptions()

DWORD GetAllowedShutdownOptions ( VOID  )

Definition at line 770 of file shutdown.c.

771 {
772  DWORD Options = 0;
773 
774  // FIXME: Compute those options accordings to current user's rights!
776 
777  if (IsPwrSuspendAllowed())
779 
780  if (IsPwrHibernateAllowed())
782 
783  return Options;
784 }
#define WLX_SHUTDOWN_STATE_SLEEP
Definition: shutdown.c:22
BOOLEAN WINAPI IsPwrSuspendAllowed(VOID)
Definition: powrprof.c:488
#define WLX_SHUTDOWN_STATE_HIBERNATE
Definition: shutdown.c:24
#define WLX_SHUTDOWN_STATE_POWER_OFF
Definition: shutdown.c:19
#define WLX_SHUTDOWN_STATE_LOGOFF
Definition: shutdown.c:18
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
Definition: wdfdevice.h:3531
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WLX_SHUTDOWN_STATE_REBOOT
Definition: shutdown.c:20
BOOLEAN WINAPI IsPwrHibernateAllowed(VOID)
Definition: powrprof.c:450

Referenced by OnShutDown(), ShellShutdownDialog(), and ShutdownDialog().

◆ GetDefaultShutdownOptions()

DWORD GetDefaultShutdownOptions ( VOID  )

Definition at line 764 of file shutdown.c.

765 {
767 }
#define WLX_SHUTDOWN_STATE_POWER_OFF
Definition: shutdown.c:19
#define WLX_SHUTDOWN_STATE_REBOOT
Definition: shutdown.c:20

Referenced by OnShutDown().

◆ GetDefaultShutdownSelState()

DWORD GetDefaultShutdownSelState ( VOID  )

Definition at line 427 of file shutdown.c.

428 {
430 }
#define WLX_SAS_ACTION_SHUTDOWN_POWER_OFF
Definition: winwlx.h:62

Referenced by OnShutDown().

◆ LoadShutdownSelState()

DWORD LoadShutdownSelState ( VOID  )

Definition at line 433 of file shutdown.c.

434 {
435  LONG lRet;
436  HKEY hKeyCurrentUser, hKey;
437  DWORD dwValue, dwTemp, dwSize;
438 
439  /* Default to shutdown */
441 
442  /* Open the current user HKCU key */
443  lRet = RegOpenCurrentUser(MAXIMUM_ALLOWED, &hKeyCurrentUser);
444  if (lRet == ERROR_SUCCESS)
445  {
446  /* Open the subkey */
447  lRet = RegOpenKeyExW(hKeyCurrentUser,
448  L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
449  0, KEY_QUERY_VALUE, &hKey);
450  RegCloseKey(hKeyCurrentUser);
451  }
452  if (lRet != ERROR_SUCCESS)
453  return dwValue;
454 
455  /* Read the value */
456  dwSize = sizeof(dwTemp);
457  lRet = RegQueryValueExW(hKey,
458  L"Shutdown Setting",
459  NULL, NULL,
460  (LPBYTE)&dwTemp, &dwSize);
461  RegCloseKey(hKey);
462 
463  if (lRet == ERROR_SUCCESS)
464  {
465  switch (dwTemp)
466  {
468  dwValue = WLX_SAS_ACTION_LOGOFF;
469  break;
470 
473  break;
474 
477  break;
478 
479  // 0x08
480 
483  break;
484 
485  // 0x20
486 
489  break;
490 
491  // 0x80
492  }
493  }
494 
495  return dwValue;
496 }
#define WLX_SAS_ACTION_SHUTDOWN_HIBERNATE
Definition: winwlx.h:66
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#define WLX_SHUTDOWN_STATE_SLEEP
Definition: shutdown.c:22
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WLX_SHUTDOWN_STATE_HIBERNATE
Definition: shutdown.c:24
#define WLX_SHUTDOWN_STATE_POWER_OFF
Definition: shutdown.c:19
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
long LONG
Definition: pedump.c:60
#define WLX_SAS_ACTION_LOGOFF
Definition: winwlx.h:56
#define WLX_SHUTDOWN_STATE_LOGOFF
Definition: shutdown.c:18
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define WLX_SAS_ACTION_SHUTDOWN_POWER_OFF
Definition: winwlx.h:62
FxAutoRegKey hKey
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define WLX_SAS_ACTION_SHUTDOWN_SLEEP
Definition: winwlx.h:64
#define WLX_SHUTDOWN_STATE_REBOOT
Definition: shutdown.c:20
#define NULL
Definition: types.h:112
LONG WINAPI RegOpenCurrentUser(IN REGSAM samDesired, OUT PHKEY phkResult)
Definition: reg.c:3232
#define WLX_SAS_ACTION_SHUTDOWN_REBOOT
Definition: winwlx.h:63
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56

Referenced by OnShutDown(), ShellShutdownDialog(), and ShutdownDialog().

◆ MyLogonUser()

NTSTATUS MyLogonUser ( HANDLE  LsaHandle,
ULONG  AuthenticationPackage,
LPWSTR  lpszUsername,
LPWSTR  lpszDomain,
LPWSTR  lpszPassword,
PHANDLE  phToken,
PNTSTATUS  SubStatus 
)

Definition at line 55 of file lsa.c.

63 {
66  PSID LogonSid = NULL;
67  PSID LocalSid = NULL;
69  UNICODE_STRING DomainName;
70  UNICODE_STRING UserName;
73  ULONG AuthInfoLength;
74  ULONG_PTR Ptr;
79  LUID Luid = {0, 0};
80  LUID LogonId = {0, 0};
82  QUOTA_LIMITS QuotaLimits;
84 
85  *phToken = NULL;
86 
88  "MSGINA Logon");
89 
90  RtlInitUnicodeString(&DomainName,
91  lpszDomain);
92 
93  RtlInitUnicodeString(&UserName,
94  lpszUsername);
95 
97  lpszPassword);
98 
99  AuthInfoLength = sizeof(MSV1_0_INTERACTIVE_LOGON)+
100  DomainName.MaximumLength +
101  UserName.MaximumLength +
102  Password.MaximumLength;
103 
104  AuthInfo = RtlAllocateHeap(RtlGetProcessHeap(),
106  AuthInfoLength);
107  if (AuthInfo == NULL)
108  {
110  goto done;
111  }
112 
114 
115  Ptr = (ULONG_PTR)AuthInfo + sizeof(MSV1_0_INTERACTIVE_LOGON);
116 
117  AuthInfo->LogonDomainName.Length = DomainName.Length;
118  AuthInfo->LogonDomainName.MaximumLength = DomainName.MaximumLength;
119  AuthInfo->LogonDomainName.Buffer = (DomainName.Buffer == NULL) ? NULL : (PWCHAR)Ptr;
120  if (DomainName.MaximumLength > 0)
121  {
123  DomainName.Buffer,
124  DomainName.MaximumLength);
125 
126  Ptr += DomainName.MaximumLength;
127  }
128 
129  AuthInfo->UserName.Length = UserName.Length;
130  AuthInfo->UserName.MaximumLength = UserName.MaximumLength;
131  AuthInfo->UserName.Buffer = (PWCHAR)Ptr;
132  if (UserName.MaximumLength > 0)
133  RtlCopyMemory(AuthInfo->UserName.Buffer,
134  UserName.Buffer,
135  UserName.MaximumLength);
136 
137  Ptr += UserName.MaximumLength;
138 
139  AuthInfo->Password.Length = Password.Length;
140  AuthInfo->Password.MaximumLength = Password.MaximumLength;
141  AuthInfo->Password.Buffer = (PWCHAR)Ptr;
142  if (Password.MaximumLength > 0)
143  RtlCopyMemory(AuthInfo->Password.Buffer,
144  Password.Buffer,
145  Password.MaximumLength);
146 
147  /* Create the Logon SID*/
152  LogonId.HighPart,
153  LogonId.LowPart,
159  &LogonSid);
160  if (!NT_SUCCESS(Status))
161  goto done;
162 
163  /* Create the Local SID*/
164  Status = RtlAllocateAndInitializeSid(&LocalAuthority,
165  1,
174  &LocalSid);
175  if (!NT_SUCCESS(Status))
176  goto done;
177 
178  /* Allocate and set the token groups */
179  TokenGroups = RtlAllocateHeap(RtlGetProcessHeap(),
181  sizeof(TOKEN_GROUPS) + ((2 - ANYSIZE_ARRAY) * sizeof(SID_AND_ATTRIBUTES)));
182  if (TokenGroups == NULL)
183  {
185  goto done;
186  }
187 
188  TokenGroups->GroupCount = 2;
189  TokenGroups->Groups[0].Sid = LogonSid;
190  TokenGroups->Groups[0].Attributes = SE_GROUP_MANDATORY | SE_GROUP_ENABLED |
192  TokenGroups->Groups[1].Sid = LocalSid;
193  TokenGroups->Groups[1].Attributes = SE_GROUP_MANDATORY | SE_GROUP_ENABLED |
195 
196  /* Set the token source */
197  RtlCopyMemory(TokenSource.SourceName, User32TokenSourceName, sizeof(TokenSource.SourceName));
198  AllocateLocallyUniqueId(&TokenSource.SourceIdentifier);
199 
201  &OriginName,
202  Interactive,
204  (PVOID)AuthInfo,
205  AuthInfoLength,
206  TokenGroups,
207  &TokenSource,
208  (PVOID*)&ProfileBuffer,
210  &Luid,
211  &TokenHandle,
212  &QuotaLimits,
213  SubStatus);
214  if (!NT_SUCCESS(Status))
215  {
216  ERR("LsaLogonUser failed (Status 0x%08lx)\n", Status);
217  goto done;
218  }
219 
220  if (ProfileBuffer != NULL)
221  {
222  TRACE("ProfileBuffer: %p\n", ProfileBuffer);
223  TRACE("MessageType: %u\n", ProfileBuffer->MessageType);
224 
225  TRACE("FullName: %p\n", ProfileBuffer->FullName.Buffer);
226  TRACE("FullName: %S\n", ProfileBuffer->FullName.Buffer);
227 
228  TRACE("LogonServer: %p\n", ProfileBuffer->LogonServer.Buffer);
229  TRACE("LogonServer: %S\n", ProfileBuffer->LogonServer.Buffer);
230  }
231 
232  TRACE("Luid: 0x%08lx%08lx\n", Luid.HighPart, Luid.LowPart);
233 
234  if (TokenHandle != NULL)
235  {
236  TRACE("TokenHandle: %p\n", TokenHandle);
237  }
238 
239  *phToken = TokenHandle;
240 
241 done:
242  if (ProfileBuffer != NULL)
244 
245  if (!NT_SUCCESS(Status))
246  {
247  if (TokenHandle != NULL)
249  }
250 
251  if (TokenGroups != NULL)
252  RtlFreeHeap(RtlGetProcessHeap(), 0, TokenGroups);
253 
254  if (LocalSid != NULL)
256 
257  if (LogonSid != NULL)
258  RtlFreeSid(LogonSid);
259 
260  if (AuthInfo != NULL)
261  RtlFreeHeap(RtlGetProcessHeap(), 0, AuthInfo);
262 
263  return Status;
264 }
#define CloseHandle
Definition: compat.h:598
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
MSV1_0_LOGON_SUBMIT_TYPE MessageType
Definition: ntsecapi.h:434
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define ANYSIZE_ARRAY
Definition: typedefs.h:46
NTSYSAPI PVOID NTAPI RtlFreeSid(_In_ _Post_invalid_ PSID Sid)
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
_In_opt_ LPSTR _In_opt_ LPSTR lpszPassword
Definition: winbase.h:2690
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID _Out_ PULONG ProfileBufferLength
uint16_t * PWCHAR
Definition: typedefs.h:56
PSID LocalSid
Definition: globals.c:15
NTSYSAPI NTSTATUS NTAPI RtlAllocateAndInitializeSid(IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority, IN UCHAR SubAuthorityCount, IN ULONG SubAuthority0, IN ULONG SubAuthority1, IN ULONG SubAuthority2, IN ULONG SubAuthority3, IN ULONG SubAuthority4, IN ULONG SubAuthority5, IN ULONG SubAuthority6, IN ULONG SubAuthority7, OUT PSID *Sid)
Definition: sid.c:290
_IRQL_requires_same_ _In_ PLSA_STRING OriginName
UNICODE_STRING Password
Definition: ntsecapi.h:437
NTSTATUS NTAPI LsaLogonUser(IN HANDLE LsaHandle, IN PLSA_STRING OriginName, IN SECURITY_LOGON_TYPE LogonType, IN ULONG AuthenticationPackage, IN PVOID AuthenticationInformation, IN ULONG AuthenticationInformationLength, IN PTOKEN_GROUPS LocalGroups OPTIONAL, IN PTOKEN_SOURCE SourceContext, OUT PVOID *ProfileBuffer, OUT PULONG ProfileBufferLength, OUT PLUID LogonId, OUT PHANDLE Token, OUT PQUOTA_LIMITS Quotas, OUT PNTSTATUS SubStatus)
Definition: lsa.c:184
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define SECURITY_LOGON_IDS_RID_COUNT
Definition: setypes.h:533
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID _Out_ PULONG _Inout_ PLUID _Out_ PHANDLE _Out_ PQUOTA_LIMITS _Out_ PNTSTATUS SubStatus
#define SECURITY_LOCAL_SID_AUTHORITY
Definition: setypes.h:502
#define SE_GROUP_ENABLED_BY_DEFAULT
Definition: setypes.h:91
_In_ ACCESS_MASK _In_ ULONG _Out_ PHANDLE TokenHandle
Definition: psfuncs.h:715
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:526
HANDLE LsaHandle
Definition: wkssvc.c:41
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
Status
Definition: gdiplustypes.h:24
struct _MSV1_0_INTERACTIVE_LOGON MSV1_0_INTERACTIVE_LOGON
UNICODE_STRING UserName
Definition: ntsecapi.h:436
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SE_GROUP_ENABLED
Definition: setypes.h:92
DWORD LowPart
static const CHAR User32TokenSourceName[]
Definition: lsa.c:51
#define SECURITY_LOCAL_RID
Definition: setypes.h:514
_In_opt_ LPSTR _In_opt_ LPSTR _In_ DWORD _In_ DWORD _Out_opt_ PHANDLE phToken
Definition: winbase.h:2690
PCHAR Buffer
Definition: ntsecapi.h:174
#define SE_GROUP_MANDATORY
Definition: setypes.h:90
#define SECURITY_NULL_RID
Definition: setypes.h:512
LONG HighPart
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID * ProfileBuffer
ULONG AuthenticationPackage
Definition: logon.c:18
#define SE_GROUP_LOGON_ID
Definition: setypes.h:98
NTSTATUS NTAPI LsaFreeReturnBuffer(IN PVOID Buffer)
Definition: lsa.c:120
#define ERR(fmt,...)
Definition: debug.h:110
BOOL WINAPI AllocateLocallyUniqueId(PLUID Luid)
Definition: security.c:1097
_In_opt_ LPSTR lpszDomain
Definition: winbase.h:2690
#define NULL
Definition: types.h:112
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID _Out_ PULONG _Inout_ PLUID LogonId
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define SECURITY_LOGON_IDS_RID
Definition: setypes.h:532
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define ULONG_PTR
Definition: config.h:101
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
UNICODE_STRING LogonDomainName
Definition: ntsecapi.h:435
static SID_IDENTIFIER_AUTHORITY SystemAuthority
Definition: msgina.c:38

Referenced by DoAdminUnlock(), DoLoginTasks(), and TUILockedSAS().

◆ ReadRegSzValue()

LONG ReadRegSzValue ( IN HKEY  hKey,
IN LPCWSTR  pszValue,
OUT LPWSTR pValue 
)

Definition at line 60 of file msgina.c.

64 {
65  LONG rc;
66  DWORD dwType;
67  DWORD cbData = 0;
68  LPWSTR Value;
69 
70  if (!pValue)
72 
73  *pValue = NULL;
74  rc = RegQueryValueExW(hKey, pszValue, NULL, &dwType, NULL, &cbData);
75  if (rc != ERROR_SUCCESS)
76  return rc;
77  if (dwType != REG_SZ)
78  return ERROR_FILE_NOT_FOUND;
79  Value = HeapAlloc(GetProcessHeap(), 0, cbData + sizeof(WCHAR));
80  if (!Value)
82  rc = RegQueryValueExW(hKey, pszValue, NULL, NULL, (LPBYTE)Value, &cbData);
83  if (rc != ERROR_SUCCESS)
84  {
86  return rc;
87  }
88  /* NULL-terminate the string */
89  Value[cbData / sizeof(WCHAR)] = '\0';
90 
91  *pValue = Value;
92  return ERROR_SUCCESS;
93 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define ERROR_SUCCESS
Definition: deptool.c:10
PWCHAR pValue
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
unsigned char * LPBYTE
Definition: typedefs.h:53
long LONG
Definition: pedump.c:60
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594
#define REG_SZ
Definition: layer.c:22

Referenced by ChooseGinaUI(), GetRegistrySettings(), and GUILoggedOutSAS().

◆ SaveShutdownSelState()

VOID SaveShutdownSelState ( DWORD  ShutdownCode)

Referenced by OnShutDown().

◆ ShutdownDialog()

INT_PTR ShutdownDialog ( IN HWND  hwndDlg,
IN DWORD  ShutdownOptions,
IN PGINA_CONTEXT  pgContext 
)

Definition at line 1189 of file shutdown.c.

1193 {
1194  INT_PTR ret;
1196  BOOL bIsAltKeyPressed = FALSE;
1197  DWORD ShutdownDialogId = IDD_SHUTDOWN;
1198  MSG Msg;
1199  HWND hDlg;
1200 
1201 #if 0
1202  DWORD ShutdownOptions;
1203 
1204  // FIXME: User impersonation!!
1205  pgContext->nShutdownAction = LoadShutdownSelState();
1206  ShutdownOptions = GetAllowedShutdownOptions();
1207 #endif
1208 
1209  Context.pgContext = pgContext;
1210  Context.ShutdownOptions = ShutdownOptions;
1211  Context.bCloseDlg = FALSE;
1212  Context.bReasonUI = GetShutdownReasonUI();
1213  Context.bFriendlyUI = ShellIsFriendlyUIActive();
1214 
1215  if (pgContext->hWlx && pgContext->pWlxFuncs && !Context.bFriendlyUI)
1216  {
1217  Context.bIsDialogModal = TRUE;
1218  ret = pgContext->pWlxFuncs->WlxDialogBoxParam(pgContext->hWlx,
1219  pgContext->hDllInstance,
1221  hwndDlg,
1223  (LPARAM)&Context);
1224  }
1225  else
1226  {
1227  if (Context.bFriendlyUI)
1228  {
1230  {
1231  ShutdownDialogId = IDD_SHUTDOWN_FANCY_LONG;
1232  }
1233  else
1234  {
1235  ShutdownDialogId = IDD_SHUTDOWN_FANCY;
1236  }
1237  }
1238 
1239  Context.bIsDialogModal = FALSE;
1240  hDlg = CreateDialogParamW(pgContext->hDllInstance,
1241  MAKEINTRESOURCEW(Context.bReasonUI ? IDD_SHUTDOWN_REASON : ShutdownDialogId),
1242  hwndDlg,
1244  (LPARAM)&Context);
1245 
1246  ShowWindow(hDlg, SW_SHOW);
1247 
1248  /* Detect either Alt or Shift key have been pressed or released */
1249  while (GetMessageW(&Msg, NULL, 0, 0))
1250  {
1251  if (!IsDialogMessageW(hDlg, &Msg))
1252  {
1255  }
1256 
1257  switch (Msg.message)
1258  {
1259  case WM_SYSKEYDOWN:
1260  {
1261  /* If the Alt key has been pressed once, add prefix to static controls */
1262  if (Msg.wParam == VK_MENU && !bIsAltKeyPressed)
1263  {
1264  AddPrefixToStaticTexts(hDlg, Context.bIsSleepButtonReplaced);
1265  bIsAltKeyPressed = TRUE;
1266  }
1267  }
1268  break;
1269 
1270  case WM_KEYDOWN:
1271  {
1272  /*
1273  * If the Shift key has been pressed once, and both hibernate button and sleep button are enabled
1274  * replace the sleep button with hibernate button
1275  */
1276  if (Msg.wParam == VK_SHIFT)
1277  {
1278  if (ShutdownDialogId == IDD_SHUTDOWN_FANCY && !Context.bIsSleepButtonReplaced)
1279  {
1281  {
1282  ReplaceRequiredButton(hDlg,
1283  pgContext->hDllInstance,
1284  bIsAltKeyPressed,
1285  Context.bIsSleepButtonReplaced);
1286  Context.bIsSleepButtonReplaced = TRUE;
1287  }
1288  }
1289  }
1290  }
1291  break;
1292 
1293  case WM_KEYUP:
1294  {
1295  /* If the Shift key has been released after being pressed, replace the hibernate button with sleep button again */
1296  if (Msg.wParam == VK_SHIFT)
1297  {
1298  if (ShutdownDialogId == IDD_SHUTDOWN_FANCY && Context.bIsSleepButtonReplaced)
1299  {
1301  {
1302  ReplaceRequiredButton(hDlg,
1303  pgContext->hDllInstance,
1304  bIsAltKeyPressed,
1305  Context.bIsSleepButtonReplaced);
1306  Context.bIsSleepButtonReplaced = FALSE;
1307  }
1308  }
1309  }
1310  }
1311  break;
1312  }
1313  }
1314  ret = Msg.wParam;
1315  }
1316 
1317 #if 0
1318  // FIXME: User impersonation!!
1319  if (ret == IDOK)
1320  SaveShutdownSelState(pgContext->nShutdownAction);
1321 #endif
1322 
1323  return ret;
1324 }
#define IDD_SHUTDOWN
Definition: resource.h:43
static BOOL IsShowHibernateButtonActive(VOID)
Definition: shutdown.c:222
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define IDOK
Definition: winuser.h:824
BOOLEAN WINAPI IsPwrSuspendAllowed(VOID)
Definition: powrprof.c:488
DWORD LoadShutdownSelState(VOID)
Definition: shutdown.c:433
static INT_PTR CALLBACK ShutdownDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: shutdown.c:1012
VOID AddPrefixToStaticTexts(HWND hDlg, BOOL bIsSleepButtonReplaced)
Definition: shutdown.c:585
#define TRUE
Definition: types.h:120
VOID ReplaceRequiredButton(HWND hDlg, HINSTANCE hInstance, BOOL bIsAltKeyPressed, BOOL bIsSleepButtonReplaced)
Definition: shutdown.c:640
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define VK_MENU
Definition: winuser.h:2179
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int32_t INT_PTR
Definition: typedefs.h:64
#define FALSE
Definition: types.h:117
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD GetAllowedShutdownOptions(VOID)
Definition: shutdown.c:770
#define VK_SHIFT
Definition: winuser.h:2177
#define WM_KEYDOWN
Definition: winuser.h:1697
LONG_PTR LPARAM
Definition: windef.h:208
#define SW_SHOW
Definition: winuser.h:769
#define IDD_SHUTDOWN_FANCY_LONG
Definition: resource.h:45
#define WM_KEYUP
Definition: winuser.h:1698
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static BOOL GetShutdownReasonUI(VOID)
Definition: shutdown.c:70
#define NULL
Definition: types.h:112
#define IDD_SHUTDOWN_REASON
Definition: resource.h:46
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
struct @1623 Msg[]
struct tagContext Context
Definition: acpixf.h:1034
#define WM_SYSKEYDOWN
Definition: winuser.h:1701
HWND WINAPI CreateDialogParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
VOID SaveShutdownSelState(IN DWORD ShutdownCode)
Definition: shutdown.c:710
BOOLEAN WINAPI IsPwrHibernateAllowed(VOID)
Definition: powrprof.c:450
#define IDD_SHUTDOWN_FANCY
Definition: resource.h:44
BOOL WINAPI IsDialogMessageW(_In_ HWND, _In_ LPMSG)
BOOL WINAPI ShellIsFriendlyUIActive(VOID)
Definition: shutdown.c:414

Referenced by OnShutDown(), and ShellShutdownDialog().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msgina  )

Variable Documentation

◆ hDllInstance

HINSTANCE hDllInstance

Definition at line 17 of file browser.c.