Author: jimtabor
Date: Fri May 27 23:18:57 2011
New Revision: 51971
URL:
http://svn.reactos.org/svn/reactos?rev=51971&view=rev
Log:
[Win32k]
- Get screen saver running. Need more work on WinLogon register issues and problems.
- Miscellaneous changes and cleanups.
Modified:
trunk/reactos/base/system/winlogon/sas.c
trunk/reactos/base/system/winlogon/screensaver.c
trunk/reactos/include/reactos/ks386.inc
trunk/reactos/include/reactos/undocuser.h
trunk/reactos/include/reactos/win32k/ntuser.h
trunk/reactos/subsystems/win32/win32k/main/dllmain.c
trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c
trunk/reactos/subsystems/win32/win32k/ntuser/input.c
trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c
Modified: trunk/reactos/base/system/winlogon/sas.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/sas.c…
==============================================================================
--- trunk/reactos/base/system/winlogon/sas.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/winlogon/sas.c [iso-8859-1] Fri May 27 23:18:57 2011
@@ -24,6 +24,8 @@
#define HK_CTRL_ALT_DEL 0
#define HK_CTRL_SHIFT_ESC 1
+
+static BOOL inScrn = FALSE;
/* FUNCTIONS ****************************************************************/
@@ -962,6 +964,28 @@
}
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);
Modified: trunk/reactos/base/system/winlogon/screensaver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/scree…
==============================================================================
--- trunk/reactos/base/system/winlogon/screensaver.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/winlogon/screensaver.c [iso-8859-1] Fri May 27 23:18:57
2011
@@ -231,7 +231,7 @@
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 @@
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 @@
KEY_QUERY_VALUE,
&hKey);
if (rc != ERROR_SUCCESS)
- goto cleanup;
+ {
+ ERR("WL: RegOpenKeyEx Error!\n");
+ goto cleanup;
+ }
rc = RegQueryValueExW(
hKey,
@@ -275,15 +278,24 @@
(LPBYTE)szApplicationName,
&bufferSize);
if (rc != ERROR_SUCCESS || dwType != REG_SZ)
- goto cleanup;
+ {
+ ERR("WL: RegQueryValueEx Error!\n");
+ goto cleanup;
+ }
if (bufferSize == 0)
- goto cleanup;
+ {
+ ERR("WL: Buffer size is NULL!\n");
+ goto cleanup;
+ }
szApplicationName[bufferSize / sizeof(WCHAR)] = 0; /* Terminate the string */
if (wcslen(szApplicationName) == 0)
- goto cleanup;
+ {
+ 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 @@
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 @@
&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);
Modified: trunk/reactos/include/reactos/ks386.inc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/ks386.inc?…
==============================================================================
--- trunk/reactos/include/reactos/ks386.inc [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/ks386.inc [iso-8859-1] Fri May 27 23:18:57 2011
@@ -456,6 +456,7 @@
TeGdiBatchCount = 0xf70
TeGuaranteedStackBytes = 0xf78
TeFlsData = 0xfb4
+TeSafeThunkCall = 0xfb8
ThreadEnvironmentBlockLength = 0xfbc
/* TIME_FIELDS */
Modified: trunk/reactos/include/reactos/undocuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/undocuser.…
==============================================================================
--- trunk/reactos/include/reactos/undocuser.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/undocuser.h [iso-8859-1] Fri May 27 23:18:57 2011
@@ -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)
Modified: trunk/reactos/include/reactos/win32k/ntuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Fri May 27 23:18:57 2011
@@ -3146,12 +3146,6 @@
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(
Modified: trunk/reactos/subsystems/win32/win32k/main/dllmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ma…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/main/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/main/dllmain.c [iso-8859-1] Fri May 27 23:18:57
2011
@@ -23,6 +23,7 @@
PSERVERINFO gpsi = NULL; // Global User Server Information.
SHORT gusLanguageID;
+PPROCESSINFO ppiScrnSaver;
extern ULONG_PTR Win32kSSDT[];
extern UCHAR Win32kSSPT[];
@@ -63,6 +64,8 @@
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,11 +112,23 @@
/* 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');
@@ -127,6 +142,8 @@
{
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)
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c [iso-8859-1] Fri May 27 23:18:57
2011
@@ -115,6 +115,7 @@
{
case SC_SCREENSAVE:
DPRINT1("Screensaver Called!\n");
+ UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_START_SCREENSAVE, 0); // always
lParam 0 == not Secure
break;
default:
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] Fri May 27 23:18:57
2011
@@ -18,6 +18,7 @@
extern BYTE gQueueKeyStateTable[];
extern NTSTATUS Win32kInitWin32Thread(PETHREAD Thread);
+extern PPROCESSINFO ppiScrnSaver;
/* GLOBALS *******************************************************************/
@@ -27,6 +28,7 @@
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)
{
- 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 @@
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
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Fri May 27
23:18:57 2011
@@ -16,6 +16,8 @@
#define NDEBUG
#include <debug.h>
+
+VOID FASTCALL DoTheScreenSaver(VOID);
/* GLOBALS *******************************************************************/
@@ -1581,7 +1583,7 @@
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.
}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c [iso-8859-1] Fri May 27
23:18:57 2011
@@ -280,7 +280,7 @@
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)