/* INCLUDES ******************************************************************/
-#include <w32k.h>
+#include <win32k.h>
#define NDEBUG
#include <debug.h>
FASTCALL
InitMetrics(VOID)
{
- NTSTATUS Status;
- PWINSTATION_OBJECT WinStaObject;
- ULONG Width = 640, Height = 480;
- PSYSTEM_CURSORINFO CurInfo;
- INT *piSysMet;
-
- Width = pPrimarySurface->GDIInfo.ulHorzRes;
- Height = pPrimarySurface->GDIInfo.ulVertRes;
-
- Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
- KernelMode,
- 0,
- &WinStaObject);
- if (NT_SUCCESS(Status))
+ INT *piSysMet = gpsi->aiSysMet;
+ ULONG Width, Height;
+
+ /* note: used for the SM_CLEANBOOT metric */
+ DWORD dwValue = 0;
+ HKEY hKey = 0;
+
+ /* Clean boot */
+ piSysMet[SM_CLEANBOOT] = 0; // fallback value of 0 (normal mode)
+ if(NT_SUCCESS(RegOpenKey(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Option", &hKey)))
+ {
+ if(RegReadDWORD(hKey, L"OptionValue", &dwValue)) piSysMet[SM_CLEANBOOT] = (INT)dwValue;
+ ZwClose(hKey);
+ }
+
+ /* FIXME: HACK, due to missing PDEV on first init */
+ if (!pPrimarySurface)
{
- CurInfo = IntGetSysCursorInfo(WinStaObject);
+ Width = 640;
+ Height = 480;
}
else
{
- CurInfo = NULL;
+ Width = pPrimarySurface->gdiinfo.ulHorzRes;
+ Height = pPrimarySurface->gdiinfo.ulVertRes;
}
- piSysMet = gpsi->aiSysMet;
-
/* Screen sizes */
piSysMet[SM_CXSCREEN] = Width;
piSysMet[SM_CYSCREEN] = Height;
piSysMet[SM_MOUSEPRESENT] = 1;
piSysMet[SM_MOUSEWHEELPRESENT] = 1;
piSysMet[SM_CMOUSEBUTTONS] = 2;
- piSysMet[SM_SWAPBUTTON] = gspv.bMouseBtnSwap ? 1 : 0; //CurInfo ? CurInfo->SwapButtons : 0;
- piSysMet[SM_CXDOUBLECLK] = gspv.iDblClickWidth;//CurInfo ? CurInfo->DblClickWidth : 4;
- piSysMet[SM_CYDOUBLECLK] = gspv.iDblClickHeight;//CurInfo ? CurInfo->DblClickWidth : 4;
+ piSysMet[SM_SWAPBUTTON] = gspv.bMouseBtnSwap ? 1 : 0;
+ piSysMet[SM_CXDOUBLECLK] = gspv.iDblClickWidth;
+ piSysMet[SM_CYDOUBLECLK] = gspv.iDblClickHeight;
#if (_WIN32_WINNT >= 0x0600)
piSysMet[SM_MOUSEHORIZONTALWHEELPRESENT] = 0;
#endif
piSysMet[SM_SLOWMACHINE] = 0;
piSysMet[SM_SECURE] = 0;
piSysMet[SM_DBCSENABLED] = 0;
- piSysMet[SM_CLEANBOOT] = 0;
piSysMet[SM_SHOWSOUNDS] = gspv.bShowSounds;
piSysMet[SM_MIDEASTENABLED] = 0;
piSysMet[SM_CMONITORS] = 1;
gpsi->dwSRVIFlags |= SRVINFO_METRICS;
Setup = TRUE;
- if (NT_SUCCESS(Status))
- {
- ObDereferenceObject(WinStaObject);
- }
-
return TRUE;
}