Author: greatlrd
Date: Thu Jul 6 05:44:01 2006
New Revision: 22879
URL:
http://svn.reactos.org/svn/reactos?rev=22879&view=rev
Log:
Commit initiate work of implement of autostart of screen saver.
Modified:
trunk/reactos/include/reactos/subsys/csrss/csrss.h
trunk/reactos/subsystems/win32/csrss/include/desktopbg.h
trunk/reactos/subsystems/win32/csrss/win32csr/conio.c
trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c
trunk/reactos/subsystems/win32/win32k/ntuser/csr.c
Modified: trunk/reactos/include/reactos/subsys/csrss/csrss.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/csr…
==============================================================================
--- trunk/reactos/include/reactos/subsys/csrss/csrss.h (original)
+++ trunk/reactos/include/reactos/subsys/csrss/csrss.h Thu Jul 6 05:44:01 2006
@@ -409,6 +409,12 @@
{
HANDLE InputWaitHandle;
} CSRSS_GET_INPUT_WAIT_HANDLE, *PCSRSS_GET_INPUT_WAIT_HANDLE;
+
+typedef struct
+{
+ BOOL Start;
+} CSRSS_START_SCREEN_SAVER, *PCSRSS_START_SCREEN_SAVER;
+
#define CSR_API_MESSAGE_HEADER_SIZE(Type) (FIELD_OFFSET(CSR_API_MESSAGE, Data) +
sizeof(Type))
#define CSRSS_MAX_WRITE_CONSOLE (LPC_MAX_DATA_LENGTH -
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE))
@@ -477,6 +483,7 @@
#define SET_CONSOLE_OUTPUT_CP (0x34)
#define GET_INPUT_WAIT_HANDLE (0x35)
#define GET_PROCESS_LIST (0x36)
+#define START_SCREEN_SAVER (0x37)
/* Keep in sync with definition below. */
#define CSRSS_HEADER_SIZE (sizeof(PORT_MESSAGE) + sizeof(ULONG) + sizeof(NTSTATUS))
@@ -542,6 +549,7 @@
CSRSS_SET_CONSOLE_OUTPUT_CP SetConsoleOutputCodePage;
CSRSS_GET_INPUT_WAIT_HANDLE GetConsoleInputWaitHandle;
CSRSS_GET_PROCESS_LIST GetProcessListRequest;
+ CSRSS_START_SCREEN_SAVER StartScreenSaver;
} Data;
} CSR_API_MESSAGE, *PCSR_API_MESSAGE;
Modified: trunk/reactos/subsystems/win32/csrss/include/desktopbg.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/inc…
==============================================================================
--- trunk/reactos/subsystems/win32/csrss/include/desktopbg.h (original)
+++ trunk/reactos/subsystems/win32/csrss/include/desktopbg.h Thu Jul 6 05:44:01 2006
@@ -16,6 +16,7 @@
CSR_API(CsrShowDesktop);
CSR_API(CsrHideDesktop);
CSR_API(CsrRegisterSystemClasses);
+CSR_API(CsrStartScreenSaver);
BOOL FASTCALL DtbgIsDesktopVisible(VOID);
Modified: trunk/reactos/subsystems/win32/csrss/win32csr/conio.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
==============================================================================
--- trunk/reactos/subsystems/win32/csrss/win32csr/conio.c (original)
+++ trunk/reactos/subsystems/win32/csrss/win32csr/conio.c Thu Jul 6 05:44:01 2006
@@ -3301,4 +3301,52 @@
return Request->Status = STATUS_SUCCESS;
}
+
+CSR_API(CsrStartScreenSaver)
+{
+
+ DPRINT1("CsrStartScreenSaver : Start Screen Saver \n");
+
+ if (Request->Data.StartScreenSaver.Start == TRUE)
+ {
+ STARTUPINFOW si;
+ PROCESS_INFORMATION pi;
+ WCHAR szCmdline[MAX_PATH];
+
+ HKEY hKey;
+ WCHAR szBuffer[MAX_PATH];
+ DWORD bufferSize = sizeof(szBuffer);
+ DWORD varType = REG_SZ;
+ LONG result;
+
+
+
+ // FIXME read the register key for the screen saver
+ //swprintf(szCmdline, L"c:\\reactos\\system32\\matrix.scr /s");
+
+ RegOpenKeyExW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", 0,
KEY_ALL_ACCESS, &hKey);
+ result = RegQueryValueExW(hKey, L"SCRNSAVE.EXE", 0, &varType,
(LPBYTE)szBuffer, &bufferSize);
+ if(result == ERROR_SUCCESS)
+ {
+ swprintf(szCmdline, L"%s /s",szBuffer);
+ DPRINT1("CsrStartScreenSaver : OK %S\n",szCmdline);
+ ZeroMemory( &si, sizeof(si) );
+ si.cb = sizeof(si);
+ ZeroMemory( &pi, sizeof(pi) );
+ if(CreateProcessW( NULL, szCmdline, NULL, NULL, FALSE, 0,
NULL,NULL,&si, &pi ))
+ {
+ CloseHandle( pi.hProcess );
+ CloseHandle( pi.hThread );
+ }
+ }
+ else
+ {
+ DPRINT1("CsrStartScreenSaver : FAIL %S\n",szBuffer);
+ }
+
+ RegCloseKey(hKey);
+ }
+ return Request->Status = STATUS_SUCCESS;
+}
+
/* EOF */
Modified: trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
==============================================================================
--- trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c (original)
+++ trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c Thu Jul 6 05:44:01 2006
@@ -68,6 +68,7 @@
CSRSS_DEFINE_API(GET_CONSOLE_OUTPUT_CP, CsrGetConsoleOutputCodePage),
CSRSS_DEFINE_API(SET_CONSOLE_OUTPUT_CP, CsrSetConsoleOutputCodePage),
CSRSS_DEFINE_API(GET_PROCESS_LIST, CsrGetProcessList),
+ CSRSS_DEFINE_API(START_SCREEN_SAVER, CsrStartScreenSaver),
{ 0, 0, NULL }
};
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/csr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/csr.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/csr.c Thu Jul 6 05:44:01 2006
@@ -85,6 +85,47 @@
return Status;
}
+
+NTSTATUS FASTCALL
+co_CsrNotifyScreenSaver(PCSR_API_MESSAGE Request)
+{
+ NTSTATUS Status;
+ PEPROCESS OldProcess;
+
+ if (NULL == CsrProcess)
+ {
+ return STATUS_INVALID_PORT_HANDLE;
+ }
+
+ Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
+ Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
+
+ /* Switch to the process in which the WindowsApiPort handle is valid */
+ OldProcess = PsGetCurrentProcess();
+ if (CsrProcess != OldProcess)
+ {
+ KeAttachProcess(&CsrProcess->Pcb);
+ }
+
+ Status = ZwRequestWaitReplyPort(WindowsApiPort,
+ &Request->Header,
+ &Request->Header);
+
+
+ if (CsrProcess != OldProcess)
+ {
+ KeDetachProcess();
+ }
+
+ if (NT_SUCCESS(Status))
+ {
+ Status = Request->Status;
+ }
+
+ return Status;
+}
+
+
NTSTATUS
STDCALL
CsrInsertObject(HANDLE ObjectHandle,