mirror of
https://github.com/reactos/reactos.git
synced 2024-09-28 21:44:31 +00:00
[Win32k]
- Get screen saver running. Need more work on WinLogon register issues and problems. - Miscellaneous changes and cleanups. svn path=/trunk/; revision=51971
This commit is contained in:
parent
6b5280da8a
commit
90e1322075
|
@ -25,6 +25,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(winlogon);
|
|||
#define HK_CTRL_ALT_DEL 0
|
||||
#define HK_CTRL_SHIFT_ESC 1
|
||||
|
||||
static BOOL inScrn = FALSE;
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
static BOOL
|
||||
|
@ -962,6 +964,28 @@ SASWindowProc(
|
|||
}
|
||||
break;
|
||||
}
|
||||
case LN_START_SCREENSAVE:
|
||||
{
|
||||
BOOL bSecure = FALSE;
|
||||
|
||||
if (inScrn)
|
||||
break;
|
||||
|
||||
inScrn = TRUE;
|
||||
|
||||
// lParam 1 == Secure
|
||||
if (lParam)
|
||||
{
|
||||
if (Session->Gina.Functions.WlxScreenSaverNotify(Session->Gina.Context, &bSecure))
|
||||
{
|
||||
if (bSecure) DoGenericAction(Session, WLX_SAS_ACTION_LOCK_WKSTA);
|
||||
}
|
||||
}
|
||||
|
||||
StartScreenSaver(Session);
|
||||
inScrn = FALSE;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
ERR("WM_LOGONNOTIFY case %d is unimplemented\n", wParam);
|
||||
|
|
|
@ -231,7 +231,7 @@ InitializeScreenSaver(
|
|||
if (ScreenSaverThread)
|
||||
CloseHandle(ScreenSaverThread);
|
||||
else
|
||||
WARN("WL: Unable to start screen saver thread\n");
|
||||
ERR("WL: Unable to start screen saver thread\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ StartScreenSaver(
|
|||
|
||||
if (!ImpersonateLoggedOnUser(Session->UserToken))
|
||||
{
|
||||
ERR("ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
|
||||
ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,10 @@ StartScreenSaver(
|
|||
KEY_QUERY_VALUE,
|
||||
&hKey);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
ERR("WL: RegOpenKeyEx Error!\n");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
rc = RegQueryValueExW(
|
||||
hKey,
|
||||
|
@ -275,15 +278,24 @@ StartScreenSaver(
|
|||
(LPBYTE)szApplicationName,
|
||||
&bufferSize);
|
||||
if (rc != ERROR_SUCCESS || dwType != REG_SZ)
|
||||
{
|
||||
ERR("WL: RegQueryValueEx Error!\n");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (bufferSize == 0)
|
||||
{
|
||||
ERR("WL: Buffer size is NULL!\n");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
szApplicationName[bufferSize / sizeof(WCHAR)] = 0; /* Terminate the string */
|
||||
|
||||
if (wcslen(szApplicationName) == 0)
|
||||
{
|
||||
ERR("WL: Application Name length is zero!\n");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
wsprintfW(szCommandLine, L"%s /s", szApplicationName);
|
||||
TRACE("WL: Executing %S\n", szCommandLine);
|
||||
|
@ -291,6 +303,7 @@ StartScreenSaver(
|
|||
ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
|
||||
ZeroMemory(&ProcessInformation, sizeof(PROCESS_INFORMATION));
|
||||
StartupInfo.cb = sizeof(STARTUPINFOW);
|
||||
StartupInfo.dwFlags = STARTF_SCRNSAVER;
|
||||
/* FIXME: run the screen saver on the screen saver desktop */
|
||||
ret = CreateProcessW(
|
||||
szApplicationName,
|
||||
|
@ -305,7 +318,7 @@ StartScreenSaver(
|
|||
&ProcessInformation);
|
||||
if (!ret)
|
||||
{
|
||||
WARN("WL: Unable to start %S, error %lu\n", szApplicationName, GetLastError());
|
||||
ERR("WL: Unable to start %S, error %lu\n", szApplicationName, GetLastError());
|
||||
goto cleanup;
|
||||
}
|
||||
CloseHandle(ProcessInformation.hThread);
|
||||
|
|
|
@ -456,6 +456,7 @@ TeInstrumentation = 0xf2c
|
|||
TeGdiBatchCount = 0xf70
|
||||
TeGuaranteedStackBytes = 0xf78
|
||||
TeFlsData = 0xfb4
|
||||
TeSafeThunkCall = 0xfb8
|
||||
ThreadEnvironmentBlockLength = 0xfbc
|
||||
|
||||
/* TIME_FIELDS */
|
||||
|
|
|
@ -82,6 +82,9 @@
|
|||
#define LN_LOCK_WORKSTATION 0x5
|
||||
#define LN_UNLOCK_WORKSTATION 0x6
|
||||
#define LN_MESSAGE_BEEP 0x9
|
||||
#define LN_START_SCREENSAVE 0xA
|
||||
|
||||
#define STARTF_SCRNSAVER 0x80000000
|
||||
|
||||
#define CW_USEDEFAULT16 ((short)0x8000)
|
||||
|
||||
|
|
|
@ -3146,12 +3146,6 @@ NtUserBuildMenuItemList(
|
|||
ULONG nBufSize,
|
||||
DWORD Reserved);
|
||||
|
||||
|
||||
/* Should be done in usermode and use NtUserGetCPD. */
|
||||
ULONG_PTR
|
||||
NTAPI
|
||||
NtUserGetClassLong(HWND hWnd, INT Offset, BOOL Ansi);
|
||||
|
||||
UINT
|
||||
NTAPI
|
||||
NtUserGetMenuDefaultItem(
|
||||
|
|
|
@ -23,6 +23,7 @@ PSECTION_OBJECT GlobalUserHeapSection = NULL;
|
|||
PSERVERINFO gpsi = NULL; // Global User Server Information.
|
||||
|
||||
SHORT gusLanguageID;
|
||||
PPROCESSINFO ppiScrnSaver;
|
||||
|
||||
extern ULONG_PTR Win32kSSDT[];
|
||||
extern UCHAR Win32kSSPT[];
|
||||
|
@ -63,6 +64,8 @@ Win32kProcessCallback(struct _EPROCESS *Process,
|
|||
SIZE_T ViewSize = 0;
|
||||
LARGE_INTEGER Offset;
|
||||
PVOID UserBase = NULL;
|
||||
BOOL Connected;
|
||||
PRTL_USER_PROCESS_PARAMETERS pParams = NULL;
|
||||
NTSTATUS Status;
|
||||
extern PSECTION_OBJECT GlobalUserHeapSection;
|
||||
DPRINT("Creating W32 process PID:%d at IRQ level: %lu\n", Process->UniqueProcessId, KeGetCurrentIrql());
|
||||
|
@ -109,12 +112,24 @@ Win32kProcessCallback(struct _EPROCESS *Process,
|
|||
/* map the gdi handle table to user land */
|
||||
Process->Peb->GdiSharedHandleTable = GDI_MapHandleTable(Process);
|
||||
Process->Peb->GdiDCAttributeList = GDI_BATCH_LIMIT;
|
||||
pParams = Process->Peb->ProcessParameters;
|
||||
}
|
||||
|
||||
Win32Process->peProcess = Process;
|
||||
/* setup process flags */
|
||||
Win32Process->W32PF_flags = 0;
|
||||
|
||||
Connected = !(Win32Process->W32PF_flags & W32PF_THREADCONNECTED);
|
||||
Win32Process->W32PF_flags |= W32PF_THREADCONNECTED;
|
||||
|
||||
if ( pParams &&
|
||||
pParams->WindowFlags & STARTF_SCRNSAVER &&
|
||||
Connected)
|
||||
{
|
||||
ppiScrnSaver = Win32Process;
|
||||
Win32Process->W32PF_flags |= W32PF_SCREENSAVER;
|
||||
}
|
||||
|
||||
/* Create pools for GDI object attributes */
|
||||
Win32Process->pPoolDcAttr = GdiPoolCreate(sizeof(DC_ATTR), 'acdG');
|
||||
Win32Process->pPoolBrushAttr = GdiPoolCreate(sizeof(BRUSH_ATTR), 'arbG');
|
||||
|
@ -128,6 +143,8 @@ Win32kProcessCallback(struct _EPROCESS *Process,
|
|||
DPRINT("Destroying W32 process PID:%d at IRQ level: %lu\n", Process->UniqueProcessId, KeGetCurrentIrql());
|
||||
Win32Process->W32PF_flags |= W32PF_TERMINATED;
|
||||
|
||||
if (ppiScrnSaver == Win32Process) ppiScrnSaver = NULL;
|
||||
|
||||
/* Notify logon application to restart shell if needed */
|
||||
if(Win32Process->rpdeskStartup->pDeskInfo)
|
||||
{
|
||||
|
|
|
@ -115,6 +115,7 @@ DefWndHandleSysCommand(PWND pWnd, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
case SC_SCREENSAVE:
|
||||
DPRINT1("Screensaver Called!\n");
|
||||
UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_START_SCREENSAVE, 0); // always lParam 0 == not Secure
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
extern BYTE gQueueKeyStateTable[];
|
||||
extern NTSTATUS Win32kInitWin32Thread(PETHREAD Thread);
|
||||
extern PPROCESSINFO ppiScrnSaver;
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
|
@ -27,6 +28,7 @@ PTHREADINFO ptiMouse;
|
|||
PKTIMER MasterTimer = NULL;
|
||||
PATTACHINFO gpai = NULL;
|
||||
|
||||
static DWORD LastInputTick = 0;
|
||||
static HANDLE MouseDeviceHandle;
|
||||
static HANDLE MouseThreadHandle;
|
||||
static CLIENT_ID MouseThreadId;
|
||||
|
@ -59,15 +61,49 @@ DWORD IntLastInputTick(BOOL LastInputTickSetGet);
|
|||
|
||||
DWORD IntLastInputTick(BOOL LastInputTickSetGet)
|
||||
{
|
||||
static DWORD LastInputTick = 0;
|
||||
if (LastInputTickSetGet == TRUE)
|
||||
{
|
||||
LARGE_INTEGER TickCount;
|
||||
KeQueryTickCount(&TickCount);
|
||||
LastInputTick = TickCount.u.LowPart * (KeQueryTimeIncrement() / 10000);
|
||||
if (gpsi) gpsi->dwLastRITEventTickCount = LastInputTick;
|
||||
}
|
||||
return LastInputTick;
|
||||
if (LastInputTickSetGet == TRUE)
|
||||
{
|
||||
LARGE_INTEGER TickCount;
|
||||
KeQueryTickCount(&TickCount);
|
||||
LastInputTick = MsqCalculateMessageTime(&TickCount);
|
||||
if (gpsi) gpsi->dwLastRITEventTickCount = LastInputTick;
|
||||
}
|
||||
return LastInputTick;
|
||||
}
|
||||
|
||||
|
||||
VOID FASTCALL DoTheScreenSaver(VOID)
|
||||
{
|
||||
LARGE_INTEGER TickCount;
|
||||
DWORD Test;
|
||||
|
||||
if (gspv.iScrSaverTimeout > 0) // Zero means Off.
|
||||
{
|
||||
KeQueryTickCount(&TickCount);
|
||||
Test = MsqCalculateMessageTime(&TickCount);
|
||||
Test = Test - LastInputTick;
|
||||
if (Test > gspv.iScrSaverTimeout)
|
||||
{
|
||||
DPRINT("Screensaver Message Start! Tick %d Timeout %d \n", Test, gspv.iScrSaverTimeout);
|
||||
|
||||
if (ppiScrnSaver) // We are or we are not the screensaver, prevent reentry...
|
||||
{
|
||||
if (!(ppiScrnSaver->W32PF_flags & W32PF_IDLESCREENSAVER))
|
||||
{
|
||||
ppiScrnSaver->W32PF_flags |= W32PF_IDLESCREENSAVER;
|
||||
DPRINT1("Screensaver is Idle\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PUSER_MESSAGE_QUEUE ForegroundQueue = IntGetFocusMessageQueue();
|
||||
if (ForegroundQueue && ForegroundQueue->ActiveWindow)
|
||||
UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_START_SCREENSAVE, 1); // lParam 1 == Secure
|
||||
else
|
||||
UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_START_SCREENSAVE, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VOID FASTCALL
|
||||
|
@ -449,7 +485,7 @@ static VOID APIENTRY
|
|||
co_IntKeyboardSendAltKeyMsg()
|
||||
{
|
||||
DPRINT1("co_IntKeyboardSendAltKeyMsg\n");
|
||||
//co_MsqPostKeyboardMessage(WM_SYSCOMMAND,SC_KEYMENU,0); // This sends everything into a msg loop!
|
||||
// co_MsqPostKeyboardMessage(WM_SYSCOMMAND,SC_KEYMENU,0); // This sends everything into a msg loop!
|
||||
}
|
||||
|
||||
static VOID APIENTRY
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
VOID FASTCALL DoTheScreenSaver(VOID);
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
static PAGED_LOOKASIDE_LIST MessageLookasideList;
|
||||
|
@ -1581,7 +1583,7 @@ VOID
|
|||
CALLBACK
|
||||
HungAppSysTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
|
||||
{
|
||||
//DoTheScreenSaver();
|
||||
DoTheScreenSaver();
|
||||
DPRINT("HungAppSysTimerProc\n");
|
||||
// Process list of windows that are hung and waiting.
|
||||
}
|
||||
|
|
|
@ -280,7 +280,7 @@ SpiUpdatePerUserSystemParameters()
|
|||
gspv.bDropShadow = 1;
|
||||
gspv.dwMenuShowDelay = 100;
|
||||
|
||||
gspv.iScrSaverTimeout = 10;
|
||||
gspv.iScrSaverTimeout = 600000; // TO in 10 minutes.
|
||||
gspv.bScrSaverActive = FALSE;
|
||||
gspv.bScrSaverRunning = FALSE;
|
||||
#if(WINVER >= 0x0600)
|
||||
|
|
Loading…
Reference in a new issue