Author: fireball
Date: Thu Jul 13 01:33:14 2006
New Revision: 23032
URL:
http://svn.reactos.org/svn/reactos?rev=23032&view=rev
Log:
- Fix a mistake with outputting always non-initialized buffer in a DPRINT1
- Add a branch for stopping the screensaver
- Prettify the tracing debug message (it shows now if it's a start or a stop request)
- Add a success-check for RegOpenKeyExW too
Modified:
trunk/reactos/subsystems/win32/csrss/win32csr/conio.c
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 13 01:33:14 2006
@@ -3326,22 +3326,23 @@
}
CSR_API(CsrStartScreenSaver)
-{
-
- DPRINT("CsrStartScreenSaver : Start Screen Saver \n");
-
+{
+
+ DPRINT("CsrStartScreenSaver : %s Screen Saver \n",
+ (Request->Data.StartScreenSaver.Start) ? "Start" :
"Stop");
+
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 :
1. Make it unicode and ansi compatible with TCHAR
@@ -3356,32 +3357,43 @@
4. Move the code to winlogon SAS and screen saver must run in
the secuar desktop. But current our Winlogon does not working
well with SAS and with Secure desktop, So I (Magnus Olsen aka GreatLord)
- add the code here as w3seek recomandete
+ add the code here as w3seek recommended
*/
-
-
- 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;
+
+ result = RegOpenKeyExW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", 0,
KEY_ALL_ACCESS, &hKey);
+ if (result == ERROR_SUCCESS)
+ {
+ 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, Name %S\n", szCmdline,
szBuffer);
+ 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 : failed 0x%08X\n", result);
+ }
+ RegCloseKey(hKey);
+ }
+ else
+ {
+ DPRINT1("CsrStartScreenSaver : failed to RegOpenKeyExW 0x%08X\n",
result);
+ }
+ return Request->Status = STATUS_SUCCESS;
+ }
+ else
+ {
+ /* TODO: Stopping the screensaver */
+ return Request->Status = STATUS_NOT_IMPLEMENTED;
+ }
}
/* EOF */