Rewrite (NtUser)SystemParametersInfo and related.

- Instead of getting the data from the window station and other strange places, the values are now mostly stored in a global variable. This is possible because NtUserSystemParametersInfo should fail anyway when being called from a non-interactive windowstation (tested on windows XP).
- WM_SETTINGCHANGE is now properly sent not posted to all toplevel Windows also passing the registry string as the lParam value (strings could need some testing).
- SystemMetrics are now set and updated from system parameters.
- Most values are now properly loaded from registry and also saved.
- user32_winetest sysparams: before: 634 executed / 235 failures, after: 1093 executed, 11 failures
- Fixes the non-bold caption font in 2nd stage.
- Implements a number SPI codes.
- Implements helper functions for registry and file access
Thanks to all testers for all the regression testing :)


See issue #4595 for more details.

svn path=/trunk/; revision=41604
This commit is contained in:
Timo Kreuzer 2009-06-25 02:43:38 +00:00
parent 8101b8e12f
commit 68ccd5f6e4
21 changed files with 2527 additions and 2077 deletions

View file

@ -401,99 +401,10 @@ VOID SetUserSysColors(VOID)
RegCloseKey(hKey);
}
static
VOID LoadUserFontSetting(
IN LPWSTR lpValueName,
OUT PLOGFONTW pFont)
{
HKEY hKey;
LOGFONTW lfTemp;
DWORD Type, Size;
LONG rc;
DWORD
WINAPI
UpdatePerUserSystemParameters(DWORD dw1, BOOL bEnable);
TRACE("(%s, %p)\n", debugstr_w(lpValueName), pFont);
Size = sizeof(LOGFONTW);
rc = RegOpenKeyEx(HKEY_CURRENT_USER, REGSTR_PATH_METRICS,
0, KEY_QUERY_VALUE, &hKey);
if (rc != ERROR_SUCCESS)
{
WARN("RegOpenKeyEx() failed with error %lu\n", rc);
return;
}
rc = RegQueryValueEx(hKey, lpValueName, NULL, &Type, (LPBYTE)&lfTemp, &Size);
if (rc != ERROR_SUCCESS || Type != REG_BINARY)
{
WARN("RegQueryValueEx() failed with error %lu\n", rc);
return;
}
RegCloseKey(hKey);
/* FIXME: Check if lfTemp is a valid font */
*pFont = lfTemp;
}
static
VOID LoadUserMetricSetting(
IN LPWSTR lpValueName,
OUT INT *pValue)
{
HKEY hKey;
DWORD Type, Size;
WCHAR strValue[8];
LONG rc;
TRACE("(%s, %p)\n", debugstr_w(lpValueName), pValue);
Size = sizeof(strValue);
rc = RegOpenKeyEx(HKEY_CURRENT_USER, REGSTR_PATH_METRICS,
0, KEY_QUERY_VALUE, &hKey);
if (rc != ERROR_SUCCESS)
{
WARN("RegOpenKeyEx() failed with error %lu\n", rc);
return;
}
rc = RegQueryValueEx(hKey, lpValueName, NULL, &Type, (LPBYTE)&strValue, &Size);
if (rc != ERROR_SUCCESS || Type != REG_SZ)
{
WARN("RegQueryValueEx() failed with error %lu\n", rc);
return;
}
RegCloseKey(hKey);
*pValue = StrToInt(strValue);
}
static
VOID SetUserMetrics(VOID)
{
NONCLIENTMETRICSW ncmetrics;
MINIMIZEDMETRICS mmmetrics;
TRACE("()\n");
ncmetrics.cbSize = sizeof(NONCLIENTMETRICSW);
mmmetrics.cbSize = sizeof(MINIMIZEDMETRICS);
SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &ncmetrics, 0);
SystemParametersInfoW(SPI_GETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS), &mmmetrics, 0);
LoadUserFontSetting(L"CaptionFont", &ncmetrics.lfCaptionFont);
LoadUserFontSetting(L"SmCaptionFont", &ncmetrics.lfSmCaptionFont);
LoadUserFontSetting(L"MenuFont", &ncmetrics.lfMenuFont);
LoadUserFontSetting(L"StatusFont", &ncmetrics.lfStatusFont);
LoadUserFontSetting(L"MessageFont", &ncmetrics.lfMessageFont);
/* FIXME: load icon font ? */
LoadUserMetricSetting(L"BorderWidth", &ncmetrics.iBorderWidth);
LoadUserMetricSetting(L"ScrollWidth", &ncmetrics.iScrollWidth);
LoadUserMetricSetting(L"ScrollHeight", &ncmetrics.iScrollHeight);
LoadUserMetricSetting(L"CaptionWidth", &ncmetrics.iCaptionWidth);
LoadUserMetricSetting(L"CaptionHeight", &ncmetrics.iCaptionHeight);
LoadUserMetricSetting(L"SmCaptionWidth", &ncmetrics.iSmCaptionWidth);
LoadUserMetricSetting(L"SmCaptionHeight", &ncmetrics.iSmCaptionHeight);
LoadUserMetricSetting(L"Menuwidth", &ncmetrics.iMenuWidth);
LoadUserMetricSetting(L"MenuHeight", &ncmetrics.iMenuHeight);
SystemParametersInfoW(SPI_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &ncmetrics, 0);
}
static
VOID SetUserWallpaper(VOID)
@ -536,61 +447,6 @@ VOID SetUserWallpaper(VOID)
WARN("RegOpenKeyEx() failed with error %lu\n", rc);
}
static VOID SetUserPreference(UINT uiAction,BOOL bValue,UINT fWinIni)
{
DWORD dwvalue = bValue;
SystemParametersInfo(uiAction, 0, (PVOID)&dwvalue, fWinIni);
}
static VOID SetUserPreferences(VOID)
{
HKEY hKey;
DWORD Type, Size;
LONG rc;
USERPREFERENCESMASK Preferences;
TRACE("()\n");
rc = RegOpenKeyEx(HKEY_CURRENT_USER, REGSTR_PATH_DESKTOP,
0, KEY_QUERY_VALUE, &hKey);
if (rc == ERROR_SUCCESS)
{
Size = sizeof(USERPREFERENCESMASK);
ERR("USERPREFERENCESMASK size: %d\n",Size);
rc = RegQueryValueEx(hKey,
L"UserPreferencesMask",
NULL,
&Type,
(LPBYTE)&Preferences,
&Size);
if (rc == ERROR_SUCCESS && Type == REG_BINARY)
{
SetUserPreference(SPI_SETUIEFFECTS, Preferences.bUiEffects, SPIF_SENDCHANGE);
SetUserPreference(SPI_SETACTIVEWINDOWTRACKING, Preferences.bActiveWindowTracking, SPIF_SENDCHANGE);
SetUserPreference(SPI_SETMENUANIMATION, Preferences.bMenuAnimation, SPIF_SENDCHANGE);
SetUserPreference(SPI_SETCOMBOBOXANIMATION, Preferences.bComboBoxAnimation, SPIF_SENDCHANGE);
SetUserPreference(SPI_SETLISTBOXSMOOTHSCROLLING, Preferences.bListBoxSmoothScrolling, SPIF_SENDCHANGE);
SetUserPreference(SPI_SETGRADIENTCAPTIONS, Preferences.bGradientCaptions, SPIF_SENDCHANGE);
SetUserPreference(SPI_SETKEYBOARDCUES, Preferences.bKeyboardCues, SPIF_SENDCHANGE);
SetUserPreference(SPI_SETACTIVEWNDTRKZORDER, Preferences.bActiveWndTrkZorder, SPIF_SENDCHANGE);
SetUserPreference(SPI_SETHOTTRACKING, Preferences.bHotTracking, SPIF_SENDCHANGE);
SetUserPreference(SPI_SETMENUFADE, Preferences.bMenuFade, SPIF_SENDCHANGE);
SetUserPreference(SPI_SETSELECTIONFADE, Preferences.bSelectionFade, SPIF_SENDCHANGE);
SetUserPreference(SPI_SETTOOLTIPANIMATION, Preferences.bTooltipAnimation, SPIF_SENDCHANGE);
SetUserPreference(SPI_SETTOOLTIPFADE, Preferences.bTooltipFade, SPIF_SENDCHANGE);
SetUserPreference(SPI_SETCURSORSHADOW, Preferences.bCursorShadow, SPIF_SENDCHANGE);
}
else
{
ERR("No User Preferences set in registry or incorrect type (error %lu)\n", rc);
}
RegCloseKey(hKey);
}
else
WARN("RegOpenKeyEx() failed with error %lu\n", rc);
}
static VOID
PlayLogonSound()
{
@ -641,10 +497,9 @@ VOID SetUserSettings(VOID)
{
TRACE("()\n");
UpdatePerUserSystemParameters(1, TRUE);
SetUserSysColors();
SetUserMetrics();
SetUserWallpaper();
SetUserPreferences();
}
typedef DWORD (WINAPI *PCMP_REPORT_LOGON)(DWORD, DWORD);

View file

@ -124,15 +124,6 @@ SystemParametersInfoA(UINT uiAction,
{
switch (uiAction)
{
case SPI_GETHIGHCONTRAST:
case SPI_SETHIGHCONTRAST:
case SPI_GETSOUNDSENTRY:
case SPI_SETSOUNDSENTRY:
{
/* FIXME: Support this accessibility SPI actions */
FIXME("FIXME: Unsupported SPI Code: %lx \n",uiAction );
return FALSE;
}
case SPI_GETNONCLIENTMETRICS:
{
@ -248,88 +239,40 @@ SystemParametersInfoA(UINT uiAction,
}
case SPI_GETDESKWALLPAPER:
{
HKEY hKey;
BOOL Ret = FALSE;
BOOL Ret;
WCHAR awc[MAX_PATH];
UNICODE_STRING ustrWallpaper;
ANSI_STRING astrWallpaper;
#if 0
/* Get the desktop bitmap handle, this does NOT return the file name! */
if(!NtUserSystemParametersInfo(SPI_GETDESKWALLPAPER, 0, &hbmWallpaper, 0))
{
/* Return an empty string, no wallpapaper is set */
*(CHAR*)pvParam = '\0';
return TRUE;
}
#endif
Ret = NtUserSystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, awc, fWinIni);
RtlInitUnicodeString(&ustrWallpaper, awc);
RtlUnicodeStringToAnsiString(&astrWallpaper, &ustrWallpaper, TRUE);
/* FIXME - Read the registry key for now, but what happens if the wallpaper was
changed without SPIF_UPDATEINIFILE?! */
if(RegOpenKeyExW(HKEY_CURRENT_USER,
L"Control Panel\\Desktop",
0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
{
DWORD Type, Size;
Size = uiParam;
if(RegQueryValueExA(hKey,
"Wallpaper",
NULL,
&Type,
(LPBYTE)pvParam,
&Size) == ERROR_SUCCESS
&& Type == REG_SZ)
{
Ret = TRUE;
}
RegCloseKey(hKey);
}
RtlCopyMemory(pvParam, astrWallpaper.Buffer, uiParam);
RtlFreeAnsiString(&astrWallpaper);
return Ret;
}
case SPI_SETDESKWALLPAPER:
{
HBITMAP hNewWallpaper;
BOOL Ret;
LPSTR lpWallpaper = (LPSTR)pvParam;
NTSTATUS Status;
UNICODE_STRING ustrWallpaper;
BOOL Ret;
if(lpWallpaper != NULL && *lpWallpaper != '\0')
{
hNewWallpaper = LoadImageA(0, lpWallpaper, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
if(hNewWallpaper == NULL)
if (pvParam)
{
return FALSE;
Status = RtlCreateUnicodeStringFromAsciiz(&ustrWallpaper, pvParam);
if (!NT_SUCCESS(Status))
{
ERR("Status = 0x%x\n", Status);
return FALSE;
}
pvParam = &ustrWallpaper;
}
}
else
{
hNewWallpaper = NULL;
lpWallpaper = NULL;
}
/* Set the wallpaper bitmap */
if(!NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, 0, &hNewWallpaper, fWinIni & SPIF_SENDCHANGE))
{
if(hNewWallpaper != NULL)
DeleteObject(hNewWallpaper);
return FALSE;
}
/* Do not use the bitmap handle anymore, it doesn't belong to our process anymore! */
Ret = TRUE;
if(fWinIni & SPIF_UPDATEINIFILE)
{
/* Save the path to the file in the registry */
HKEY hKey;
if(RegOpenKeyExW(HKEY_CURRENT_USER,
L"Control Panel\\Desktop",
0, KEY_SET_VALUE, &hKey) == ERROR_SUCCESS)
{
Ret = RegSetValueExA(hKey, "Wallpaper", 0, REG_SZ, (LPBYTE)(lpWallpaper != NULL ? lpWallpaper : ""),
(lpWallpaper != NULL ? (lstrlenA(lpWallpaper) + 1) * sizeof(CHAR) : sizeof(CHAR)) == ERROR_SUCCESS);
RegCloseKey(hKey);
}
}
RedrawWindow(GetShellWindow(), NULL, NULL, RDW_INVALIDATE | RDW_ERASE);
return Ret;
Ret = NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, uiParam, pvParam, fWinIni);
RtlFreeUnicodeString(&ustrWallpaper);
return Ret;
}
}
return NtUserSystemParametersInfo(uiAction, uiParam, pvParam, fWinIni);
@ -347,97 +290,14 @@ SystemParametersInfoW(UINT uiAction,
{
switch(uiAction)
{
case SPI_GETHIGHCONTRAST:
case SPI_SETHIGHCONTRAST:
case SPI_GETSOUNDSENTRY:
case SPI_SETSOUNDSENTRY:
{
/* FIXME: Support this accessibility SPI actions */
FIXME("FIXME: Unsupported SPI Code: %lx \n",uiAction );
return FALSE;
}
case SPI_GETDESKWALLPAPER:
{
HKEY hKey;
BOOL Ret = FALSE;
#if 0
/* Get the desktop bitmap handle, this does NOT return the file name! */
if(!NtUserSystemParametersInfo(SPI_GETDESKWALLPAPER, 0, &hbmWallpaper, 0))
{
/* Return an empty string, no wallpapaper is set */
*(WCHAR*)pvParam = L'\0';
return TRUE;
}
#endif
/* FIXME - Read the registry key for now, but what happens if the wallpaper was
changed without SPIF_UPDATEINIFILE?! */
if(RegOpenKeyExW(HKEY_CURRENT_USER,
L"Control Panel\\Desktop",
0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
{
DWORD Type, Size;
Size = uiParam * sizeof(WCHAR);
if(RegQueryValueExW(hKey,
L"Wallpaper",
NULL,
&Type,
(LPBYTE)pvParam,
&Size) == ERROR_SUCCESS
&& Type == REG_SZ)
{
Ret = TRUE;
}
RegCloseKey(hKey);
}
return Ret;
}
case SPI_SETDESKWALLPAPER:
{
HBITMAP hNewWallpaper;
BOOL Ret;
LPWSTR lpWallpaper = (LPWSTR)pvParam;
if(lpWallpaper != NULL && *lpWallpaper != L'\0')
{
hNewWallpaper = LoadImageW(0, lpWallpaper, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
UNICODE_STRING ustrWallpaper;
if(hNewWallpaper == NULL)
{
return FALSE;
}
RtlInitUnicodeString(&ustrWallpaper, pvParam);
return NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, uiParam, &ustrWallpaper, fWinIni);
}
else
{
hNewWallpaper = NULL;
lpWallpaper = NULL;
}
/* Set the wallpaper bitmap */
if(!NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, 0, &hNewWallpaper, fWinIni & SPIF_SENDCHANGE))
return FALSE;
/* Do not use the bitmap handle anymore, it doesn't belong to our process anymore! */
Ret = TRUE;
if(fWinIni & SPIF_UPDATEINIFILE)
{
/* Save the path to the file in the registry */
HKEY hKey;
if(RegOpenKeyExW(HKEY_CURRENT_USER,
L"Control Panel\\Desktop",
0, KEY_SET_VALUE, &hKey) == ERROR_SUCCESS)
{
Ret = (RegSetValueExW(hKey, L"Wallpaper", 0, REG_SZ, (lpWallpaper != NULL ? (LPBYTE)lpWallpaper : (LPBYTE)L""),
(lpWallpaper != NULL ? (lstrlenW(lpWallpaper) + 1) * sizeof(WCHAR) : sizeof(WCHAR))) == ERROR_SUCCESS);
RegCloseKey(hKey);
}
}
RedrawWindow(GetShellWindow(), NULL, NULL, RDW_INVALIDATE | RDW_ERASE);
return Ret;
}
}
return NtUserSystemParametersInfo(uiAction, uiParam, pvParam, fWinIni);
}

View file

@ -1334,21 +1334,6 @@ extern "C" {
#define SPI_SETICONTITLELOGFONT 0x0022
#define SPI_GETFASTTASKSWITCH 0x0023
#define SPI_SETFASTTASKSWITCH 0x0024
#define SPI_GETFILTERKEYS 0x0032
#define SPI_SETFILTERKEYS 0x0033
#define SPI_GETTOGGLEKEYS 0x0034
#define SPI_SETTOGGLEKEYS 0x0035
#define SPI_GETMOUSEKEYS 0x0036
#define SPI_SETMOUSEKEYS 0x0037
#define SPI_GETSHOWSOUNDS 0x0038
#define SPI_SETSHOWSOUNDS 0x0039
#define SPI_GETSTICKYKEYS 0x003A
#define SPI_SETSTICKYKEYS 0x003B
#define SPI_GETACCESSTIMEOUT 0x003C
#define SPI_SETACCESSTIMEOUT 0x003D
#define SPI_GETSOUNDSENTRY 0x0040
#define SPI_SETSOUNDSENTRY 0x0041
#if(WINVER >= 0x0400)
#define SPI_SETDRAGFULLWINDOWS 0x0025
#define SPI_GETDRAGFULLWINDOWS 0x0026
@ -1361,6 +1346,26 @@ extern "C" {
#define SPI_SETWORKAREA 0x002F
#define SPI_GETWORKAREA 0x0030
#define SPI_SETPENWINDOWS 0x0031
#endif
#define SPI_GETFILTERKEYS 0x0032
#define SPI_SETFILTERKEYS 0x0033
#define SPI_GETTOGGLEKEYS 0x0034
#define SPI_SETTOGGLEKEYS 0x0035
#define SPI_GETMOUSEKEYS 0x0036
#define SPI_SETMOUSEKEYS 0x0037
#define SPI_GETSHOWSOUNDS 0x0038
#define SPI_SETSHOWSOUNDS 0x0039
#define SPI_GETSTICKYKEYS 0x003A
#define SPI_SETSTICKYKEYS 0x003B
#define SPI_GETACCESSTIMEOUT 0x003C
#define SPI_SETACCESSTIMEOUT 0x003D
#if(WINVER >= 0x0400)
#define SPI_GETSERIALKEYS 0x003E
#define SPI_SETSERIALKEYS 0x003F
#endif
#define SPI_GETSOUNDSENTRY 0x0040
#define SPI_SETSOUNDSENTRY 0x0041
#if(WINVER >= 0x0400)
#define SPI_GETHIGHCONTRAST 0x0042
#define SPI_SETHIGHCONTRAST 0x0043
#define SPI_GETKEYBOARDPREF 0x0044
@ -1390,17 +1395,15 @@ extern "C" {
#define SPI_GETWINDOWSEXTENSION 0x005C
#define SPI_SETMOUSETRAILS 0x005D
#define SPI_GETMOUSETRAILS 0x005E
#define SPI_SCREENSAVERRUNNING 0x0061
#define SPI_SETSCREENSAVERRUNNING SPI_SCREENSAVERRUNNING
#define SPI_GETSERIALKEYS 0x003E
#define SPI_SETSERIALKEYS 0x003F
#endif
#if(_WIN32_WINNT >= 0x0400)
#define SPI_GETSNAPTODEFBUTTON 0x005F
#define SPI_SETSNAPTODEFBUTTON 0x0060
#endif
#if(WINVER >= 0x0400)
#define SPI_SCREENSAVERRUNNING 0x0061
#define SPI_SETSCREENSAVERRUNNING SPI_SCREENSAVERRUNNING
#endif
#if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
#define SPI_GETMOUSEHOVERWIDTH 0x0062
#define SPI_SETMOUSEHOVERWIDTH 0x0063
@ -1412,20 +1415,25 @@ extern "C" {
#define SPI_SETWHEELSCROLLLINES 0x0069
#define SPI_GETMENUSHOWDELAY 0x006A
#define SPI_SETMENUSHOWDELAY 0x006B
#if (_WIN32_WINNT >= 0x0600)
#define SPI_GETWHEELSCROLLCHARS 0x006C
#define SPI_SETWHEELSCROLLCHARS 0x006D
#endif
#define SPI_GETSHOWIMEUI 0x006E
#define SPI_SETSHOWIMEUI 0x006F
/* Correct ? */
#define SPI_GETWHEELSCROLLCHARS 0x006C
#define SPI_SETWHEELSCROLLCHARS 0x006D
#endif
#if(WINVER >= 0x0500)
#define SPI_GETMOUSESPEED 0x0070
#define SPI_SETMOUSESPEED 0x0071
#define SPI_GETSCREENSAVERRUNNING 0x0072
#define SPI_GETDESKWALLPAPER 0x0073
#endif
#if(WINVER >= 0x0600)
#define SPI_GETAUDIODESCRIPTION 0x0074
#define SPI_SETAUDIODESCRIPTION 0x0075
#define SPI_GETSCREENSAVESECURE 0x0076
#define SPI_SETSCREENSAVESECURE 0x0077
#endif
#if(WINVER >= 0x0500)
#define SPI_GETACTIVEWINDOWTRACKING 0x1000
#define SPI_SETACTIVEWINDOWTRACKING 0x1001
@ -1455,17 +1463,6 @@ extern "C" {
#define SPI_SETTOOLTIPFADE 0x1019
#define SPI_GETCURSORSHADOW 0x101A
#define SPI_SETCURSORSHADOW 0x101B
#define SPI_GETUIEFFECTS 0x103E
#define SPI_SETUIEFFECTS 0x103F
#define SPI_GETFOREGROUNDLOCKTIMEOUT 0x2000
#define SPI_SETFOREGROUNDLOCKTIMEOUT 0x2001
#define SPI_GETACTIVEWNDTRKTIMEOUT 0x2002
#define SPI_SETACTIVEWNDTRKTIMEOUT 0x2003
#define SPI_GETFOREGROUNDFLASHCOUNT 0x2004
#define SPI_SETFOREGROUNDFLASHCOUNT 0x2005
#define SPI_GETCARETWIDTH 0x2006
#define SPI_SETCARETWIDTH 0x2007
#if(_WIN32_WINNT >= 0x0501)
#define SPI_GETMOUSESONAR 0x101C
#define SPI_SETMOUSESONAR 0x101D
@ -1480,13 +1477,31 @@ extern "C" {
#define SPI_GETBLOCKSENDINPUTRESETS 0x1026
#define SPI_SETBLOCKSENDINPUTRESETS 0x1027
#endif
#define SPI_GETUIEFFECTS 0x103E
#define SPI_SETUIEFFECTS 0x103F
#if(_WIN32_WINNT >= 0x0600)
#define SPI_GETDISABLEOVERLAPPEDCONTENT 0x1040
#define SPI_SETDISABLEOVERLAPPEDCONTENT 0x1041
#define SPI_GETCLIENTAREAANIMATION 0x1042
#define SPI_SETCLIENTAREAANIMATION 0x1043
#define SPI_GETCLEARTYPE 0x1048
#define SPI_SETCLEARTYPE 0x1049
#define SPI_GETSPEECHRECOGNITION 0x104A
#define SPI_SETSPEECHRECOGNITION 0x104B
#endif
#define SPI_GETFOREGROUNDLOCKTIMEOUT 0x2000
#define SPI_SETFOREGROUNDLOCKTIMEOUT 0x2001
#define SPI_GETACTIVEWNDTRKTIMEOUT 0x2002
#define SPI_SETACTIVEWNDTRKTIMEOUT 0x2003
#define SPI_GETFOREGROUNDFLASHCOUNT 0x2004
#define SPI_SETFOREGROUNDFLASHCOUNT 0x2005
#define SPI_GETCARETWIDTH 0x2006
#define SPI_SETCARETWIDTH 0x2007
#if(_WIN32_WINNT >= 0x0501)
#define SPI_GETMOUSECLICKLOCKTIME 0x2008
#define SPI_SETMOUSECLICKLOCKTIME 0x2009
#define SPI_GETFONTSMOOTHINGTYPE 0x200A
#define SPI_SETFONTSMOOTHINGTYPE 0x200B
#define SPI_GETFONTSMOOTHINGCONTRAST 0x200C
#define SPI_SETFONTSMOOTHINGCONTRAST 0x200D
#define SPI_GETFOCUSBORDERWIDTH 0x200E

View file

@ -41,14 +41,14 @@ typedef struct _CURSORACCELERATION_INFO
typedef struct _SYSTEM_CURSORINFO
{
BOOL Enabled;
BOOL SwapButtons;
BOOL SwapButtons;//
UINT ButtonsDown;
CURSORCLIP_INFO CursorClipInfo;
PCURICON_OBJECT CurrentCursorObject;
UINT WheelScroLines;
UINT WheelScroChars;
// UINT WheelScroLines;
// UINT WheelScroChars;
BYTE ShowingCursor;
UINT DblClickSpeed;
UINT DblClickSpeed;//
UINT DblClickWidth;
UINT DblClickHeight;
@ -56,8 +56,8 @@ typedef struct _SYSTEM_CURSORINFO
UINT MouseHoverWidth;
UINT MouseHoverHeight;
UINT MouseSpeed;
CURSORACCELERATION_INFO CursorAccelerationInfo;
// UINT MouseSpeed;
// CURSORACCELERATION_INFO CursorAccelerationInfo;
DWORD LastBtnDown;
LONG LastBtnDownX;

View file

@ -54,10 +54,27 @@ extern HGDIOBJ StockObjects[];
extern SHORT gusLanguageID;
SHORT FASTCALL IntGdiGetLanguageID();
ULONG FASTCALL IntSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni);
DWORD APIENTRY IntGetQueueStatus(BOOL ClearChanges);
VOID FASTCALL IntUserManualGuiCheck(LONG Check);
PVOID APIENTRY HackSecureVirtualMemory(IN PVOID,IN SIZE_T,IN ULONG,OUT PVOID *);
VOID APIENTRY HackUnsecureVirtualMemory(IN PVOID);
BOOL
NTAPI
RegReadUserSetting(
IN PCWSTR pwszKeyName,
IN PCWSTR pwszValueName,
IN ULONG ulType,
OUT PVOID pvData,
IN ULONG cbDataSize);
BOOL
NTAPI
RegWriteUserSetting(
IN PCWSTR pwszKeyName,
IN PCWSTR pwszValueName,
IN ULONG ulType,
OUT PVOID pvData,
IN ULONG cbDataSize);
#endif /* __WIN32K_MISC_H */

View file

@ -14,6 +14,21 @@ typedef struct _MONITOR_OBJECT
PDEVOBJ *GdiDevice; /* pointer to the GDI device to
which this monitor is attached */
struct _MONITOR_OBJECT *Prev, *Next; /* doubly linked list */
// This is the structure Windows uses:
// HEAD head;
// struct _MONITOR_OBJECT *pMonitorNext;
// DWORD dwMONFlags;
RECT rcMonitor;
RECT rcWork;
// HRGN hrgnMonitor;
// SHORT Spare0;
// SHORT cWndStack;
// HDEV hDev;
// HDEV hDevReal;
// BYTE DockTargets[4][7];
// struct _MONITOR_OBJECT* Flink;
// struct _MONITOR_OBJECT* Blink;
} MONITOR_OBJECT, *PMONITOR_OBJECT;
/* functions */

View file

@ -0,0 +1,180 @@
#ifndef _WIN32K_SYSPARAMS_H
#define _WIN32K_SYSPARAMS_H
#include "cursoricon.h"
// create one struct
// make usable for different users (multiple structs!)
#define SPI_TABLE1_MIN 1
#define SPI_TABLE1_MAX 119
#define SPI_TABLE2_MIN 4096
#define SPI_TABLE2_MAX 4171
#define SPI_TABLE3_MIN 8192
#define SPI_TABLE3_MAX 8215
#define SPIF_PROTECT 0x80000
enum
{
UPM_ACTIVEWINDOWTRACKING = 0x01,
UPM_MENUANIMATION = 0x02,
UPM_COMBOBOXANIMATION = 0x04,
UPM_LISTBOXSMOOTHSCROLLING = 0x08,
UPM_GRADIENTCAPTIONS = 0x10,
UPM_KEYBOARDCUES = 0x20,
UPM_ACTIVEWNDTRKZORDER = 0x40,
UPM_HOTTRACKING = 0x80,
UPM_RESERVED = 0x100,
UPM_MENUFADE = 0x200,
UPM_SELECTIONFADE = 0x400,
UPM_TOOLTIPANIMATION = 0x800,
UPM_TOOLTIPFADE = 0x1000,
UPM_CURSORSHADOW = 0x2000,
// room for more
UPM_UIEFFECTS = 0x80000000,
UPM_DEFAULT = 0x80003E9E
} USERPREFMASKS;
typedef struct _SPIVALUES
{
/* Metrics */
NONCLIENTMETRICSW ncm;
MINIMIZEDMETRICS mm;
ICONMETRICSW im;
UINT uiFocusBorderWidth;
UINT uiFocusBorderHeight;
/* Accessability */
ACCESSTIMEOUT accesstimeout;
HIGHCONTRAST highcontrast;
BOOL bScreenReader;
#if(WINVER >= 0x0600)
AUDIODESCRIPTION audiodescription;
BOOL bClientAreaAnimation;
BOOL bDisableOverlappedContent;
ULONG ulMsgDuration;
BOOL bSpeechRecognition;
#endif
/* Sound */
SOUNDSENTRY soundsentry;
BOOL bShowSounds;
BOOL bBeep;
/* Mouse */
CURSORACCELERATION_INFO caiMouse;
MOUSEKEYS mousekeys;
BOOL bMouseClickLock;
DWORD dwMouseClickLockTime;
BOOL bMouseSonar;
BOOL bMouseVanish;
BOOL bMouseBtnSwap;
BOOL bSmoothScrolling;
INT iMouseSpeed;
INT iMouseHoverWidth;
INT iMouseHoverHeight;
INT iMouseHoverTime;
INT iDblClickWidth;
INT iDblClickHeight;
INT iDblClickTime;
INT iDragWidth;
INT iDragHeight;
INT iMouseTrails;
INT iWheelScrollLines;
#if (_WIN32_WINNT >= 0x0600)
UINT uiWheelScrollChars;
#endif
/* Keyboard */
FILTERKEYS filterkeys;
SERIALKEYS serialkeys;
STICKYKEYS stickykeys;
TOGGLEKEYS togglekeys;
DWORD dwKbdSpeed;
BOOL bKbdPref;
HKL hklDefInputLang;
INT iKbdDelay;
/* Screen saver */
INT iScrSaverTimeout;
BOOL bScrSaverActive;
BOOL bScrSaverRunning;
#if(WINVER >= 0x0600)
BOOL bScrSaverSecure;
#endif
/* Power */
INT iLowPwrTimeout;
INT iPwrOffTimeout;
BOOL bLowPwrActive;
BOOL bPwrOffActive;
/* UI Effects */
DWORD dwUserPrefMask;
BOOL bFontSmoothing;
UINT uiFontSmoothingType;
UINT uiFontSmoothingContrast;
UINT uiFontSmoothingOrientation;
BOOL bDragFullWindows;
BOOL bMenuDropAlign;
BOOL bFlatMenu;
DWORD dwMenuShowDelay;
BOOL bDropShadow;
BOOL bBlockSendInputResets;
#if(_WIN32_WINNT >= 0x0600)
BOOL bClearType;
#endif
/* Text metrics */
TEXTMETRICW tmMenuFont;
TEXTMETRICW tmCaptionFont;
BOOL bHandHeld;
BOOL bFastTaskSwitch;
UINT uiGridGranularity;
UNICODE_STRING ustrWallpaper;
WCHAR awcWallpaper[MAX_PATH];
ANIMATIONINFO animationinfo;
BOOL bSnapToDefBtn;
BOOL bShowImeUi;
DWORD dwForegroundLockTimeout;
DWORD dwActiveTrackingTimeout;
DWORD dwForegroundFlashCount;
DWORD dwCaretWidth;
// SPI_LANGDRIVER
// SPI_SETDESKPATTERN
// SPI_SETPENWINDOWS
// SPI_SETCURSORS
// SPI_SETICONS
// SPI_SETLANGTOGGLE
// SPI_GETWINDOWSEXTENSION
} SPIVALUES, *PSPIVALUES;
typedef union _SPIBUFFER
{
char ach[1];
WCHAR awcWallpaper[MAX_PATH+1];
FILTERKEYS fiterkeys;
TOGGLEKEYS togglekeys;
MOUSEKEYS mousekeys;
STICKYKEYS stickykeys;
ACCESSTIMEOUT accesstimeout;
SERIALKEYS serialkeys;
SOUNDSENTRY soundsentry;
NONCLIENTMETRICSW ncmetrics;
MINIMIZEDMETRICS mmmetrics;
ICONMETRICS iconmetrics;
HIGHCONTRAST highcontrast;
ANIMATIONINFO animationinfo;
#if(WINVER >= 0x0600)
AUDIODESCRIPTION audiodescription;
#endif
} SPIBUFFER;
extern SPIVALUES gspv;
#endif /* _WIN32K_SYSPARAMS_H */

View file

@ -35,6 +35,7 @@
#include <include/palette.h>
#include <include/pdevobj.h>
#include <include/rect.h>
#include <include/sysparams.h>
#include <include/win32.h>
#include <include/window.h>
#include <include/winsta.h>

View file

@ -41,7 +41,6 @@ typedef struct _WINSTATION_OBJECT
BOOL DropShadow;
BOOL DragFullWindows;
BOOL FlatMenu;
USERPREFERENCESMASK UserPreferences;
/* ScreenSaver */
BOOL ScreenSaverRunning;

View file

@ -0,0 +1,356 @@
/*
* COPYRIGHT: GPL, see COPYING in the top level directory
* PROJECT: ReactOS win32 kernel mode subsystem server
* PURPOSE: File access support routines
* FILE: subsystem/win32/win32k/misc/registry.c
* PROGRAMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
#include <w32k.h>
#define NDEBUG
#include <debug.h>
BOOL
NTAPI
W32kDosPathNameToNtPathName(
IN PCWSTR pwszDosPathName,
OUT PUNICODE_STRING pustrNtPathName)
{
NTSTATUS Status;
/* Prepend "\??\" */
pustrNtPathName->Length = 0;
Status = RtlAppendUnicodeToString(pustrNtPathName, L"\\??\\");
if (!NT_SUCCESS(Status))
{
return FALSE;
}
/* Append the dos name */
Status = RtlAppendUnicodeToString(pustrNtPathName, pwszDosPathName);
if (!NT_SUCCESS(Status))
{
return FALSE;
}
return TRUE;
}
HANDLE
NTAPI
W32kOpenFile(PCWSTR pwszFileName, DWORD dwDesiredAccess)
{
UNICODE_STRING ustrFile;
OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock;
HANDLE hFile = INVALID_HANDLE_VALUE;
NTSTATUS Status;
DPRINT("W32kOpenFile(%S)\n", pwszFileName);
RtlInitUnicodeString(&ustrFile, pwszFileName);
InitializeObjectAttributes(&ObjectAttributes, &ustrFile, 0, NULL, NULL);
Status = ZwCreateFile(&hFile,
dwDesiredAccess,
&ObjectAttributes,
&IoStatusBlock,
NULL,
FILE_ATTRIBUTE_NORMAL,
0,
FILE_OPEN,
FILE_NON_DIRECTORY_FILE,
NULL,
0);
if (!NT_SUCCESS(Status))
{
SetLastNtError(Status);
hFile = NULL;
}
DPRINT("Leaving W32kOpenFile, Status=0x%x, hFile=0x%x\n", Status, hFile);
return hFile;
}
HANDLE
NTAPI
W32kCreateFileSection(HANDLE hFile,
ULONG flAllocation,
DWORD flPageProtection,
ULONGLONG ullMaxSize)
{
NTSTATUS Status;
HANDLE hSection = NULL;
ACCESS_MASK amDesiredAccess;
/* Set access mask */
amDesiredAccess = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ;
/* Check if write access is requested */
if (flPageProtection == PAGE_READWRITE)
{
/* Add it to access mask */
amDesiredAccess |= SECTION_MAP_WRITE;
}
/* Now create the actual section */
Status = ZwCreateSection(&hSection,
amDesiredAccess,
NULL,
NULL,
flPageProtection,
flAllocation,
hFile);
if (!NT_SUCCESS(Status))
{
SetLastNtError(Status);
}
DPRINT("Leaving W32kCreateFileSection, Status=0x%x, hSection=0x%x\n", Status, hSection);
/* Return section handle */
return hSection;
}
PVOID
NTAPI
W32kMapViewOfSection(
HANDLE hSection,
DWORD dwPageProtect,
ULONG_PTR ulSectionOffset)
{
NTSTATUS Status;
LARGE_INTEGER liSectionOffset;
ULONG_PTR ulViewSize;
PVOID pvBase = 0;
ulViewSize =
liSectionOffset.QuadPart = ulSectionOffset;
Status = ZwMapViewOfSection(hSection,
NtCurrentProcess(),
&pvBase,
0,
0,
&liSectionOffset,
&ulViewSize,
ViewShare,
0,
dwPageProtect);
if (!NT_SUCCESS(Status))
{
SetLastNtError(Status);
}
DPRINT("Leaving W32kMapViewOfSection, Status=0x%x, pvBase=0x%x\n", Status, pvBase);
return pvBase;
}
typedef struct tagBITMAPV5INFO
{
BITMAPV5HEADER bmiHeader;
RGBQUAD bmiColors[256];
} BITMAPV5INFO, *PBITMAPV5INFO;
// FIXME: this should go to dibobj.c
NTSTATUS
ProbeAndConvertBitmapInfo(
OUT PBITMAPV5INFO pbmiDst,
IN PBITMAPINFO pbmiUnsafe)
{
BITMAPV5HEADER *pbmhDst = (BITMAPV5HEADER*)&pbmiDst->bmiHeader;
DWORD dwSize;
RGBQUAD *pbmiColors;
ULONG ulWidthBytes;
/* Get the size and probe */
ProbeForRead(&pbmiUnsafe->bmiHeader.biSize, sizeof(DWORD), 1);
dwSize = pbmiUnsafe->bmiHeader.biSize;
ProbeForRead(pbmiUnsafe, dwSize, 1);
/* Check the size */
// FIXME: are intermediate sizes allowed? As what are they interpreted?
// make sure we don't use a too big dwSize later
if (dwSize != sizeof(BITMAPCOREHEADER) &&
dwSize != sizeof(BITMAPINFOHEADER) &&
dwSize != sizeof(BITMAPV4HEADER) &&
dwSize != sizeof(BITMAPV5HEADER))
{
return STATUS_INVALID_PARAMETER;
}
pbmiColors = (RGBQUAD*)((PCHAR)pbmiUnsafe + dwSize);
pbmhDst->bV5Size = sizeof(BITMAPV5HEADER);
if (dwSize == sizeof(BITMAPCOREHEADER))
{
PBITMAPCOREHEADER pbch = (PBITMAPCOREHEADER)pbmiUnsafe;
/* Manually copy the fields that are present */
pbmhDst->bV5Width = pbch->bcWidth;
pbmhDst->bV5Height = pbch->bcHeight;
pbmhDst->bV5Planes = pbch->bcPlanes;
pbmhDst->bV5BitCount = pbch->bcBitCount;
/* Set some default values */
pbmhDst->bV5Compression = BI_RGB;
pbmhDst->bV5SizeImage = 0;
pbmhDst->bV5XPelsPerMeter = 72;
pbmhDst->bV5YPelsPerMeter = 72;
pbmhDst->bV5ClrUsed = 0;
pbmhDst->bV5ClrImportant = 0;
}
else
{
/* Copy valid fields */
memcpy(pbmhDst, pbmiUnsafe, dwSize);
/* Zero out the rest of the V5 header */
memset((char*)pbmhDst + dwSize, 0, sizeof(BITMAPV5HEADER) - dwSize);
}
if (dwSize < sizeof(BITMAPV4HEADER))
{
if (pbmhDst->bV5Compression == BI_BITFIELDS)
{
DWORD *pMasks = (DWORD*)pbmiColors;
pbmhDst->bV5RedMask = pMasks[0];
pbmhDst->bV5GreenMask = pMasks[1];
pbmhDst->bV5BlueMask = pMasks[2];
pbmhDst->bV5AlphaMask = 0;
pbmhDst->bV5ClrUsed = 0;
}
// pbmhDst->bV5CSType;
// pbmhDst->bV5Endpoints;
// pbmhDst->bV5GammaRed;
// pbmhDst->bV5GammaGreen;
// pbmhDst->bV5GammaBlue;
}
if (dwSize < sizeof(BITMAPV5HEADER))
{
// pbmhDst->bV5Intent;
// pbmhDst->bV5ProfileData;
// pbmhDst->bV5ProfileSize;
// pbmhDst->bV5Reserved;
}
ulWidthBytes = ((pbmhDst->bV5Width * pbmhDst->bV5Planes *
pbmhDst->bV5BitCount + 31) & ~31) / 8;
if (pbmhDst->bV5SizeImage == 0)
pbmhDst->bV5SizeImage = abs(ulWidthBytes * pbmhDst->bV5Height);
if (pbmhDst->bV5ClrUsed == 0)
pbmhDst->bV5ClrUsed = pbmhDst->bV5BitCount == 1 ? 2 :
(pbmhDst->bV5BitCount == 4 ? 16 :
(pbmhDst->bV5BitCount == 8 ? 256 : 0));
if (pbmhDst->bV5Planes != 1)
{
return STATUS_INVALID_PARAMETER;
}
if (pbmhDst->bV5BitCount != 0 && pbmhDst->bV5BitCount != 1 &&
pbmhDst->bV5BitCount != 4 && pbmhDst->bV5BitCount != 8 &&
pbmhDst->bV5BitCount != 16 && pbmhDst->bV5BitCount != 24 &&
pbmhDst->bV5BitCount != 32)
{
DPRINT("Invalid bit count: %d\n", pbmhDst->bV5BitCount);
return STATUS_INVALID_PARAMETER;
}
if ((pbmhDst->bV5BitCount == 0 &&
pbmhDst->bV5Compression != BI_JPEG && pbmhDst->bV5Compression != BI_PNG))
{
DPRINT("Bit count 0 is invalid for compression %d.\n", pbmhDst->bV5Compression);
return STATUS_INVALID_PARAMETER;
}
if (pbmhDst->bV5Compression == BI_BITFIELDS &&
pbmhDst->bV5BitCount != 16 && pbmhDst->bV5BitCount != 32)
{
DPRINT("Bit count %d is invalid for compression BI_BITFIELDS.\n", pbmhDst->bV5BitCount);
return STATUS_INVALID_PARAMETER;
}
return STATUS_SUCCESS;
}
HBITMAP
NTAPI
UserLoadImage(PCWSTR pwszName)
{
NTSTATUS Status;
HANDLE hFile, hSection;
BITMAPFILEHEADER *pbmfh;
LPBITMAPINFO pbmi;
ULONG cjInfoSize;
PVOID pvBits;
HBITMAP hbmp = 0;
BITMAPV5INFO bmiLocal;
/* Open the file */
hFile = W32kOpenFile(pwszName, FILE_READ_DATA);
if (hFile == INVALID_HANDLE_VALUE)
return NULL;
/* Create a section */
hSection = W32kCreateFileSection(hFile, SEC_COMMIT, PAGE_READONLY, 0);
ZwClose(hFile);
if (!hSection)
return NULL;
/* Map the section */
pbmfh = W32kMapViewOfSection(hSection, PAGE_READONLY, 0);
ZwClose(hSection);
if (!pbmfh)
return NULL;
/* Get a pointer to the BITMAPINFO */
pbmi = (LPBITMAPINFO)(pbmfh + 1);
/* Create a normalized local BITMAPINFO */
_SEH2_TRY
{
Status = ProbeAndConvertBitmapInfo(&bmiLocal, pbmi);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
Status = _SEH2_GetExceptionCode();
}
_SEH2_END
if (NT_SUCCESS(Status))
{
cjInfoSize = bmiLocal.bmiHeader.bV5Size +
bmiLocal.bmiHeader.bV5ClrUsed * sizeof(RGBQUAD);
pvBits = (PVOID)((PCHAR)pbmi + cjInfoSize);
// FIXME: use Gre... so that the BITMAPINFO doesn't get probed
hbmp = NtGdiCreateDIBitmapInternal(NULL,
bmiLocal.bmiHeader.bV5Width,
bmiLocal.bmiHeader.bV5Height,
CBM_INIT,
pvBits,
pbmi,
DIB_RGB_COLORS,
bmiLocal.bmiHeader.bV5Size,
bmiLocal.bmiHeader.bV5SizeImage,
0,
0);
}
/* Unmap our section, we don't need it anymore */
ZwUnmapViewOfSection(NtCurrentProcess(), pbmfh);
DPRINT("Leaving UserLoadImage, hbmp = %p\n", hbmp);
return hbmp;
}

View file

@ -0,0 +1,206 @@
/*
* COPYRIGHT: GPL, see COPYING in the top level directory
* PROJECT: ReactOS win32 kernel mode subsystem server
* PURPOSE: Registry loading and storing
* FILE: subsystem/win32/win32k/misc/registry.c
* PROGRAMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
#include <w32k.h>
#define NDEBUG
#include <debug.h>
BOOL
NTAPI
RegReadUserSetting(
IN PCWSTR pwszKeyName,
IN PCWSTR pwszValueName,
IN ULONG ulType,
OUT PVOID pvData,
IN ULONG cbDataSize)
{
NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING usCurrentUserKey, usKeyName, usValueName;
WCHAR awcBuffer[MAX_PATH];
HKEY hkey;
PKEY_VALUE_PARTIAL_INFORMATION pInfo;
ULONG cbInfoSize, cbReqSize;
/* Get the path of the current user's profile */
Status = RtlFormatCurrentUserKeyPath(&usCurrentUserKey);
if (!NT_SUCCESS(Status))
{
return FALSE;
}
/* Initialize empty key name */
RtlInitEmptyUnicodeString(&usKeyName, awcBuffer, sizeof(awcBuffer));
/* Append the current user key name */
Status = RtlAppendUnicodeStringToString(&usKeyName, &usCurrentUserKey);
/* Free the current user key name */
RtlFreeUnicodeString(&usCurrentUserKey);
/* Check for success */
if (!NT_SUCCESS(Status))
{
return FALSE;
}
/* Append a '\', we can trust in enough space left. */
usKeyName.Buffer[usKeyName.Length / sizeof(WCHAR)] = '\\';
usKeyName.Length += sizeof(WCHAR);
/* Append the subkey name */
Status = RtlAppendUnicodeToString(&usKeyName, pwszKeyName);
if (!NT_SUCCESS(Status))
{
return FALSE;
}
/* Initialize object attributes */
InitializeObjectAttributes(&ObjectAttributes,
&usKeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
/* Open the key */
Status = ZwOpenKey(&hkey, KEY_READ, &ObjectAttributes);
if (!NT_SUCCESS(Status))
{
return FALSE;
}
/* Check if the local buffer is sufficient */
cbInfoSize = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + cbDataSize;
if (cbInfoSize <= sizeof(awcBuffer))
{
pInfo = (PVOID)awcBuffer;
}
else
{
/* It's not, allocate a sufficient buffer */
pInfo = ExAllocatePoolWithTag(PagedPool, cbInfoSize, TAG_TEMP);
if (!pInfo)
{
ZwClose(hkey);
return FALSE;
}
}
/* Query the value */
RtlInitUnicodeString(&usValueName, pwszValueName);
Status = ZwQueryValueKey(hkey,
&usValueName,
KeyValuePartialInformation,
(PVOID)pInfo,
cbInfoSize,
&cbReqSize);
if (NT_SUCCESS(Status))
{
/* Did we get the right type */
if (pInfo->Type == ulType)
{
/* Copy the contents to the caller */
RtlCopyMemory(pvData, pInfo->Data, cbDataSize);
}
}
/* Cleanup */
ZwClose(hkey);
if (pInfo != (PVOID)awcBuffer)
ExFreePoolWithTag(pInfo, TAG_TEMP);
return NT_SUCCESS(Status);
}
BOOL
NTAPI
RegWriteUserSetting(
IN PCWSTR pwszKeyName,
IN PCWSTR pwszValueName,
IN ULONG ulType,
OUT PVOID pvData,
IN ULONG cbDataSize)
{
NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING usCurrentUserKey, usKeyName, usValueName;
WCHAR awcBuffer[MAX_PATH];
HKEY hkey;
// FIXME: logged in user versus current process user?
/* Get the path of the current user's profile */
Status = RtlFormatCurrentUserKeyPath(&usCurrentUserKey);
if (!NT_SUCCESS(Status))
{
DPRINT1("RtlFormatCurrentUserKeyPath failed\n");
return FALSE;
}
/* Initialize empty key name */
RtlInitEmptyUnicodeString(&usKeyName, awcBuffer, sizeof(awcBuffer));
/* Append the current user key name */
Status = RtlAppendUnicodeStringToString(&usKeyName, &usCurrentUserKey);
if (!NT_SUCCESS(Status))
{
return FALSE;
}
/* Free the current user key name */
RtlFreeUnicodeString(&usCurrentUserKey);
/* Append a '\', we can trust in enough space left. */
usKeyName.Buffer[usKeyName.Length / sizeof(WCHAR)] = '\\';
usKeyName.Length += sizeof(WCHAR);
/* Append the subkey name */
Status = RtlAppendUnicodeToString(&usKeyName, pwszKeyName);
if (!NT_SUCCESS(Status))
{
DPRINT1("RtlAppendUnicodeToString failed with Status=%lx, buf:%d,%d\n", Status, usKeyName.Length, usKeyName.MaximumLength);
return FALSE;
}
/* Initialize object attributes */
InitializeObjectAttributes(&ObjectAttributes,
&usKeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
/* Open or create the key */
Status = ZwCreateKey(&hkey,
KEY_READ | KEY_WRITE,
&ObjectAttributes,
0,
NULL,
0,
NULL);
if(!NT_SUCCESS(Status))
{
DPRINT1("Failed to create key: 0x%x\n", Status);
return FALSE;
}
/* Initialize the value name string */
RtlInitUnicodeString(&usValueName, pwszValueName);
Status = ZwSetValueKey(hkey, &usValueName, 0, ulType, pvData, cbDataSize);
if(!NT_SUCCESS(Status))
{
DPRINT1("Failed to write reg key '%S' value '%S', Status = %lx\n",
pwszKeyName, pwszValueName, Status);
}
/* Cleanup */
ZwClose(hkey);
return NT_SUCCESS(Status);
}

View file

@ -55,8 +55,6 @@ static KEVENT InputThreadsStart;
static BOOLEAN InputThreadsRunning = FALSE;
/* FUNCTIONS *****************************************************************/
ULONG FASTCALL
IntSystemParametersInfo(UINT uiAction, UINT uiParam,PVOID pvParam, UINT fWinIni);
DWORD IntLastInputTick(BOOL LastInputTickSetGet);
#define ClearMouseInput(mi) \
@ -885,7 +883,7 @@ RawInputThreadMain(PVOID StartContext)
MasterTimer = ExAllocatePoolWithTag(NonPagedPool, sizeof(KTIMER), TAG_INPUT);
if (!MasterTimer)
{
{
DPRINT1("Win32K: Failed making Raw Input thread a win32 thread.\n");
return;
}
@ -1065,18 +1063,6 @@ CLEANUP:
END_CLEANUP;
}
BOOL FASTCALL
IntSwapMouseButton(PWINSTATION_OBJECT WinStaObject, BOOL Swap)
{
PSYSTEM_CURSORINFO CurInfo;
BOOL res;
CurInfo = IntGetSysCursorInfo(WinStaObject);
res = CurInfo->SwapButtons;
CurInfo->SwapButtons = Swap;
return res;
}
BOOL FASTCALL
IntMouseInput(MOUSEINPUT *mi)
{

View file

@ -4,8 +4,7 @@
* PURPOSE: Window classes
* FILE: subsys/win32k/ntuser/metric.c
* PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
* REVISION HISTORY:
* 06-06-2001 CSH Created
* Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
@ -20,9 +19,6 @@ static BOOL Setup = FALSE;
/* FUNCTIONS *****************************************************************/
// FIXME: These are only win xp default values, mostly hardcoded. They should be
// read from the registry. It must be possible to change or reinitialize the
// values, for example desk.cpl
BOOL
FASTCALL
InitMetrics(VOID)
@ -31,21 +27,10 @@ InitMetrics(VOID)
PWINSTATION_OBJECT WinStaObject;
ULONG Width = 640, Height = 480;
PSYSTEM_CURSORINFO CurInfo;
HDC hScreenDC;
PDC pScreenDC;
INT *piSysMet;
hScreenDC = IntGdiCreateDC(NULL, NULL, NULL, NULL, TRUE);
if (hScreenDC)
{
pScreenDC = DC_LockDc(hScreenDC);
if (pScreenDC)
{
Width = pScreenDC->ppdev->GDIInfo.ulHorzRes;
Height = pScreenDC->ppdev->GDIInfo.ulVertRes;
DC_UnlockDc(pScreenDC);
}
NtGdiDeleteObjectApp(hScreenDC);
}
Width = pPrimarySurface->GDIInfo.ulHorzRes;
Height = pPrimarySurface->GDIInfo.ulVertRes;
Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
KernelMode,
@ -60,103 +45,131 @@ InitMetrics(VOID)
CurInfo = NULL;
}
gpsi->SystemMetrics[SM_CXSCREEN] = Width;
gpsi->SystemMetrics[SM_CYSCREEN] = Height;
gpsi->SystemMetrics[SM_CXVSCROLL] = 16;
gpsi->SystemMetrics[SM_CYHSCROLL] = 16;
/* FIXME: "reg://Control Panel/Desktop/WindowMetrics/CaptionHeight" + 1 */
gpsi->SystemMetrics[SM_CYCAPTION] = 19;
gpsi->SystemMetrics[SM_CXBORDER] = 1;
gpsi->SystemMetrics[SM_CYBORDER] = 1;
gpsi->SystemMetrics[SM_CXDLGFRAME] = 3;
gpsi->SystemMetrics[SM_CYDLGFRAME] = 3;
gpsi->SystemMetrics[SM_CYVTHUMB] = 16;
gpsi->SystemMetrics[SM_CXHTHUMB] = 16;
gpsi->SystemMetrics[SM_CXICON] = 32;
gpsi->SystemMetrics[SM_CYICON] = 32;
gpsi->SystemMetrics[SM_CXCURSOR] = 32;
gpsi->SystemMetrics[SM_CYCURSOR] = 32;
gpsi->SystemMetrics[SM_CYMENU] = 19;
/* FIXME: shouldn't we take borders etc into account??? */
gpsi->SystemMetrics[SM_CXFULLSCREEN] = gpsi->SystemMetrics[SM_CXSCREEN];
gpsi->SystemMetrics[SM_CYFULLSCREEN] = gpsi->SystemMetrics[SM_CYSCREEN];
gpsi->SystemMetrics[SM_CYKANJIWINDOW] = 0;
gpsi->SystemMetrics[SM_MOUSEPRESENT] = 1;
gpsi->SystemMetrics[SM_CYVSCROLL] = 16;
gpsi->SystemMetrics[SM_CXHSCROLL] = 16;
gpsi->SystemMetrics[SM_DEBUG] = 0;
gpsi->SystemMetrics[SM_SWAPBUTTON] = CurInfo ? CurInfo->SwapButtons : 0;
gpsi->SystemMetrics[SM_RESERVED1] = 0;
gpsi->SystemMetrics[SM_RESERVED2] = 0;
gpsi->SystemMetrics[SM_RESERVED3] = 0;
gpsi->SystemMetrics[SM_RESERVED4] = 0;
gpsi->SystemMetrics[SM_CXMIN] = 112;
gpsi->SystemMetrics[SM_CYMIN] = 27;
gpsi->SystemMetrics[SM_CXSIZE] = 18;
gpsi->SystemMetrics[SM_CYSIZE] = 18;
gpsi->SystemMetrics[SM_CXFRAME] = 4;
gpsi->SystemMetrics[SM_CYFRAME] = 4;
gpsi->SystemMetrics[SM_CXMINTRACK] = 112;
gpsi->SystemMetrics[SM_CYMINTRACK] = 27;
gpsi->SystemMetrics[SM_CXDOUBLECLK] = CurInfo ? CurInfo->DblClickWidth : 4;
gpsi->SystemMetrics[SM_CYDOUBLECLK] = CurInfo ? CurInfo->DblClickWidth : 4;
gpsi->SystemMetrics[SM_CXICONSPACING] = 64;
gpsi->SystemMetrics[SM_CYICONSPACING] = 64;
gpsi->SystemMetrics[SM_MENUDROPALIGNMENT] = 0;
gpsi->SystemMetrics[SM_PENWINDOWS] = 0;
gpsi->SystemMetrics[SM_DBCSENABLED] = 0;
gpsi->SystemMetrics[SM_CMOUSEBUTTONS] = 2;
gpsi->SystemMetrics[SM_SECURE] = 0;
gpsi->SystemMetrics[SM_CXEDGE] = 2;
gpsi->SystemMetrics[SM_CYEDGE] = 2;
gpsi->SystemMetrics[SM_CXMINSPACING] = 160;
gpsi->SystemMetrics[SM_CYMINSPACING] = 24;
gpsi->SystemMetrics[SM_CXSMICON] = 16;
gpsi->SystemMetrics[SM_CYSMICON] = 16;
gpsi->SystemMetrics[SM_CYSMCAPTION] = 15;
gpsi->SystemMetrics[SM_CXSMSIZE] = 12;
gpsi->SystemMetrics[SM_CYSMSIZE] = 14;
gpsi->SystemMetrics[SM_CXMENUSIZE] = 18;
gpsi->SystemMetrics[SM_CYMENUSIZE] = 18;
gpsi->SystemMetrics[SM_ARRANGE] = 8;
gpsi->SystemMetrics[SM_CXMINIMIZED] = 160;
gpsi->SystemMetrics[SM_CYMINIMIZED] = 24;
gpsi->SystemMetrics[SM_CXMAXTRACK] = gpsi->SystemMetrics[SM_CYSCREEN] + 12;
gpsi->SystemMetrics[SM_CYMAXTRACK] = gpsi->SystemMetrics[SM_CYSCREEN] + 12;
/* This seems to be 8 pixels greater than the screen width */
gpsi->SystemMetrics[SM_CXMAXIMIZED] = gpsi->SystemMetrics[SM_CXSCREEN] + 8;
/* This seems to be 20 pixels less than the screen height, taskbar maybe? */
gpsi->SystemMetrics[SM_CYMAXIMIZED] = gpsi->SystemMetrics[SM_CYSCREEN] - 20;
gpsi->SystemMetrics[SM_NETWORK] = 3;
gpsi->SystemMetrics[64] = 0;
gpsi->SystemMetrics[65] = 0;
gpsi->SystemMetrics[66] = 0;
gpsi->SystemMetrics[SM_CLEANBOOT] = 0;
gpsi->SystemMetrics[SM_CXDRAG] = 4;
gpsi->SystemMetrics[SM_CYDRAG] = 4;
gpsi->SystemMetrics[SM_SHOWSOUNDS] = 0;
gpsi->SystemMetrics[SM_CXMENUCHECK] = 13;
gpsi->SystemMetrics[SM_CYMENUCHECK] = 13;
gpsi->SystemMetrics[SM_SLOWMACHINE] = 0;
gpsi->SystemMetrics[SM_MIDEASTENABLED] = 0;
gpsi->SystemMetrics[SM_MOUSEWHEELPRESENT] = 1;
gpsi->SystemMetrics[SM_XVIRTUALSCREEN] = 0;
gpsi->SystemMetrics[SM_YVIRTUALSCREEN] = 0;
gpsi->SystemMetrics[SM_CXVIRTUALSCREEN] = Width;
gpsi->SystemMetrics[SM_CYVIRTUALSCREEN] = Height;
gpsi->SystemMetrics[SM_CMONITORS] = 1;
gpsi->SystemMetrics[SM_SAMEDISPLAYFORMAT] = 1;
gpsi->SystemMetrics[SM_IMMENABLED] = 0;
gpsi->SystemMetrics[SM_CXFOCUSBORDER] = 1;
gpsi->SystemMetrics[SM_CYFOCUSBORDER] = 1;
gpsi->SystemMetrics[SM_TABLETPC] = 0;
gpsi->SystemMetrics[SM_MEDIACENTER] = 0;
gpsi->SystemMetrics[SM_STARTER] = 0;
gpsi->SystemMetrics[SM_SERVERR2] = 0;
piSysMet = (INT*)gpsi->SystemMetrics;
/* Screen sizes */
piSysMet[SM_CXSCREEN] = Width;
piSysMet[SM_CYSCREEN] = Height;
piSysMet[SM_XVIRTUALSCREEN] = 0;
piSysMet[SM_YVIRTUALSCREEN] = 0;
piSysMet[SM_CXVIRTUALSCREEN] = Width;
piSysMet[SM_CYVIRTUALSCREEN] = Height;
/* NC area sizes */
piSysMet[SM_CYCAPTION] = gspv.ncm.iCaptionHeight + 1; // 19
piSysMet[SM_CYSMCAPTION] = gspv.ncm.iSmCaptionHeight + 1; // 15;
piSysMet[SM_CXSIZE] = gspv.ncm.iCaptionHeight; // 18;
piSysMet[SM_CYSIZE] = gspv.ncm.iCaptionHeight; // 18;
piSysMet[SM_CXSMSIZE] = gspv.ncm.iSmCaptionWidth; // 12; xp: piSysMet(SM_CYSMCAPTION) - 1
piSysMet[SM_CYSMSIZE] = gspv.ncm.iSmCaptionHeight; // 14;
piSysMet[SM_CXBORDER] = 1; // seems to be hardcoded
piSysMet[SM_CYBORDER] = 1; // seems to be hardcoded
piSysMet[SM_CXFOCUSBORDER] = 1;
piSysMet[SM_CYFOCUSBORDER] = 1;
piSysMet[SM_CXDLGFRAME] = 3;
piSysMet[SM_CYDLGFRAME] = 3;
piSysMet[SM_CXEDGE] = 2;
piSysMet[SM_CYEDGE] = 2;
piSysMet[SM_CXFRAME] = piSysMet[SM_CXDLGFRAME] + gspv.ncm.iBorderWidth; // 4
piSysMet[SM_CYFRAME] = piSysMet[SM_CYDLGFRAME] + gspv.ncm.iBorderWidth; // 4
#if (_WIN32_WINNT >= 0x0600)
gpsi->SystemMetrics[90] = 0;
gpsi->SystemMetrics[SM_MOUSEHORIZONTALWHEELPRESENT] = 0;
gpsi->SystemMetrics[SM_CXPADDEDBORDER] = 0;
piSysMet[SM_CXPADDEDBORDER] = 0;
#endif
/* Window sizes */
DPRINT("ncm.iCaptionWidth=%d,GetSystemMetrics(SM_CYSIZE)=%d,GetSystemMetrics(SM_CXFRAME)=%d,avcwCaption=%d \n",
gspv.ncm.iCaptionWidth, piSysMet[SM_CYSIZE],piSysMet[SM_CXFRAME], gspv.tmCaptionFont.tmAveCharWidth);
piSysMet[SM_CXMIN] = 3 * max(gspv.ncm.iCaptionWidth, 8) // 112
+ piSysMet[SM_CYSIZE] + 4
+ 4 * gspv.tmCaptionFont.tmAveCharWidth
+ 2 * piSysMet[SM_CXFRAME];
piSysMet[SM_CYMIN] = piSysMet[SM_CYCAPTION] + 2 * piSysMet[SM_CYFRAME];// 27
piSysMet[SM_CXMAXIMIZED] = piSysMet[SM_CXSCREEN] + 2 * piSysMet[SM_CXFRAME];
piSysMet[SM_CYMAXIMIZED] = piSysMet[SM_CYSCREEN] - 20;
piSysMet[SM_CXFULLSCREEN] = piSysMet[SM_CXSCREEN];
piSysMet[SM_CYFULLSCREEN] = piSysMet[SM_CYMAXIMIZED] - piSysMet[SM_CYMIN];
piSysMet[SM_CYKANJIWINDOW] = 0;
piSysMet[SM_CXMINIMIZED] = gspv.mm.iWidth + 6;
piSysMet[SM_CYMINIMIZED] = piSysMet[SM_CYCAPTION] + 5;
piSysMet[SM_CXMINSPACING] = piSysMet[SM_CXMINIMIZED] + gspv.mm.iHorzGap;
piSysMet[SM_CYMINSPACING] = piSysMet[SM_CYMINIMIZED] + gspv.mm.iVertGap;
piSysMet[SM_CXMAXTRACK] = piSysMet[SM_CXVIRTUALSCREEN] + 4
+ 2 * piSysMet[SM_CXFRAME];
piSysMet[SM_CYMAXTRACK] = piSysMet[SM_CYVIRTUALSCREEN] + 4
+ 2 * piSysMet[SM_CYFRAME];
/* Icon */
piSysMet[SM_CXVSCROLL] = gspv.ncm.iScrollWidth; //16;
piSysMet[SM_CYVTHUMB] = gspv.ncm.iScrollHeight; //16;
piSysMet[SM_CYHSCROLL] = gspv.ncm.iScrollWidth; //16;
piSysMet[SM_CXHTHUMB] = gspv.ncm.iScrollHeight; //16;
piSysMet[SM_CYVSCROLL] = gspv.ncm.iScrollHeight; // 16
piSysMet[SM_CXHSCROLL] = gspv.ncm.iScrollHeight; // 16;
piSysMet[SM_CXICON] = 32;
piSysMet[SM_CYICON] = 32;
piSysMet[SM_CXSMICON] = 16;
piSysMet[SM_CYSMICON] = 16;
piSysMet[SM_CXICONSPACING] = gspv.im.iHorzSpacing;// 64;
piSysMet[SM_CYICONSPACING] = gspv.im.iVertSpacing; // 64;
piSysMet[SM_CXCURSOR] = 32;
piSysMet[SM_CYCURSOR] = 32;
piSysMet[SM_CXMINTRACK] = piSysMet[SM_CXMIN]; // 117
piSysMet[SM_CYMINTRACK] = piSysMet[SM_CYMIN]; // 27
piSysMet[SM_CXDRAG] = 4;
piSysMet[SM_CYDRAG] = 4;
piSysMet[SM_ARRANGE] = gspv.mm.iArrange; // 8;
/* Menu */
piSysMet[SM_CYMENU] = gspv.ncm.iMenuHeight + 1;//19;
piSysMet[SM_MENUDROPALIGNMENT] = gspv.bMenuDropAlign;
piSysMet[SM_CXMENUCHECK] = ((1 + gspv.tmMenuFont.tmHeight +
gspv.tmMenuFont.tmExternalLeading) & ~1) - 1; // 13;
piSysMet[SM_CYMENUCHECK] = piSysMet[SM_CXMENUCHECK];
piSysMet[SM_CXMENUSIZE] = gspv.ncm.iMenuWidth; //18;
piSysMet[SM_CYMENUSIZE] = gspv.ncm.iMenuHeight; //18;
/* Mouse */
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;
#if (_WIN32_WINNT >= 0x0600)
piSysMet[SM_MOUSEHORIZONTALWHEELPRESENT] = 0;
#endif
/* Version info */
piSysMet[SM_TABLETPC] = 0;
piSysMet[SM_MEDIACENTER] = 0;
piSysMet[SM_STARTER] = 0;
piSysMet[SM_SERVERR2] = 0;
piSysMet[SM_PENWINDOWS] = 0;
/* Other */
piSysMet[SM_DEBUG] = 0;
piSysMet[SM_NETWORK] = 3;
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;
piSysMet[SM_SAMEDISPLAYFORMAT] = 1;
piSysMet[SM_IMMENABLED] = 0;
/* Reserved */
piSysMet[SM_RESERVED1] = 0;
piSysMet[SM_RESERVED2] = 0;
piSysMet[SM_RESERVED3] = 0;
piSysMet[SM_RESERVED4] = 0;
piSysMet[64] = 0;
piSysMet[65] = 0;
piSysMet[66] = 0;
#if (_WIN32_WINNT >= 0x0600)
piSysMet[90] = 0;
#endif
gpsi->SRVINFO_Flags |= SRVINFO_METRICS;
@ -174,14 +187,9 @@ ULONG FASTCALL
UserGetSystemMetrics(ULONG Index)
{
ASSERT(gpsi);
ASSERT(Setup);
DPRINT("UserGetSystemMetrics(%d)\n", Index);
// FIXME: Do this when loading
if (!Setup)
{
InitMetrics();
}
/* Get metrics from array */
if (Index < SM_CMETRICS)
{

View file

@ -136,31 +136,16 @@ APIENTRY
NtUserGetDoubleClickTime(VOID)
{
UINT Result;
NTSTATUS Status;
PWINSTATION_OBJECT WinStaObject;
PSYSTEM_CURSORINFO CurInfo;
DECLARE_RETURN(UINT);
DPRINT("Enter NtUserGetDoubleClickTime\n");
UserEnterShared();
Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
KernelMode,
0,
&WinStaObject);
if (!NT_SUCCESS(Status))
RETURN( (DWORD)FALSE);
// FIXME: Check if this works on non-interactive winsta
Result = gspv.iDblClickTime;
CurInfo = IntGetSysCursorInfo(WinStaObject);
Result = CurInfo->DblClickSpeed;
ObDereferenceObject(WinStaObject);
RETURN( Result);
CLEANUP:
DPRINT("Leave NtUserGetDoubleClickTime, ret=%i\n",_ret_);
DPRINT("Leave NtUserGetDoubleClickTime, ret=%i\n", Result);
UserLeave();
END_CLEANUP;
return Result;
}
BOOL

View file

@ -809,44 +809,6 @@ NtUserHardErrorControl(
return 0;
}
/*
Called from win32csr.
*/
NTSTATUS
APIENTRY
NtUserInitialize(
DWORD dwWinVersion,
HANDLE hPowerRequestEvent,
HANDLE hMediaRequestEvent)
{
UserEnterExclusive();
UNIMPLEMENTED;
// Check to see we have the right version.
// Initialize Power Request List.
// Initialize Media Change.
// Initialize CSRSS
// {
// Startup DxGraphics.
// calls ** IntGdiGetLanguageID() and sets it **.
// Enables Fonts drivers, Initialize Font table & Stock Fonts.
// }
// Set W32PF_Flags |= (W32PF_READSCREENACCESSGRANTED | W32PF_IOWINSTA)
// Create Object Directory,,, Looks like create workstation. "\\Windows\\WindowStations"
// Create Event for Diconnect Desktop.
// Initialize Video.
// {
// DrvInitConsole.
// DrvChangeDisplaySettings.
// Update Shared Device Caps.
// Initialize User Screen.
// }
// Create ThreadInfo for this Thread!
// Set Global SERVERINFO Error flags.
// Load Resources.
UserLeave();
return STATUS_SUCCESS;
}
DWORD
APIENTRY
NtUserMinMaximize(

View file

@ -34,6 +34,10 @@
#include <debug.h>
ERESOURCE UserLock;
BOOL gbInitialized;
BOOL
InitSysParams();
/* FUNCTIONS **********************************************************/
@ -66,9 +70,90 @@ NTSTATUS FASTCALL InitUserImpl(VOID)
DPRINT("Global Server Data -> %x\n", gpsi);
}
}
InitSysParams();
return STATUS_SUCCESS;
}
NTSTATUS
NTAPI
UserInitialize(
HANDLE hPowerRequestEvent,
HANDLE hMediaRequestEvent)
{
// Set W32PF_Flags |= (W32PF_READSCREENACCESSGRANTED | W32PF_IOWINSTA)
// Create Object Directory,,, Looks like create workstation. "\\Windows\\WindowStations"
// Create Event for Diconnect Desktop.
// Initialize Video.
// {
// DrvInitConsole.
// DrvChangeDisplaySettings.
// Update Shared Device Caps.
// Initialize User Screen.
// }
// Create ThreadInfo for this Thread!
// Set Global SERVERINFO Error flags.
// Load Resources.
NtUserUpdatePerUserSystemParameters(0, TRUE);
return STATUS_SUCCESS;
}
/*
Called from win32csr.
*/
NTSTATUS
APIENTRY
NtUserInitialize(
DWORD dwWinVersion,
HANDLE hPowerRequestEvent,
HANDLE hMediaRequestEvent)
{
NTSTATUS Status;
DPRINT1("Enter NtUserInitialize(%lx, %p, %p)\n",
dwWinVersion, hPowerRequestEvent, hMediaRequestEvent);
/* Check the Windows version */
if (dwWinVersion != 0)
{
return STATUS_UNSUCCESSFUL;
}
/* Acquire exclusive lock */
UserEnterExclusive();
/* Check if we are already initialized */
if (gbInitialized)
{
UserLeave();
return STATUS_UNSUCCESSFUL;
}
// Initialize Power Request List.
// Initialize Media Change.
// InitializeGreCSRSS();
// {
// Startup DxGraphics.
// calls ** IntGdiGetLanguageID() and sets it **.
// Enables Fonts drivers, Initialize Font table & Stock Fonts.
// }
/* Initialize USER */
Status = UserInitialize(hPowerRequestEvent, hMediaRequestEvent);
/* Set us as initialized */
gbInitialized = TRUE;
/* Return */
UserLeave();
return Status;
}
/*
RETURN
True if current thread owns the lock (possibly shared)

View file

@ -1559,10 +1559,10 @@ UserDrawCaptionText(HDC hDc,
#endif
nclm.cbSize = sizeof(nclm);
if(!IntSystemParametersInfo(SPI_GETNONCLIENTMETRICS,
if(!UserSystemParametersInfo(SPI_GETNONCLIENTMETRICS,
sizeof(NONCLIENTMETRICS), &nclm, 0))
{
DPRINT1("%s: IntSystemParametersInfo() failed!\n", __FUNCTION__);
DPRINT1("%s: UserSystemParametersInfo() failed!\n", __FUNCTION__);
return FALSE;
}

View file

@ -228,23 +228,12 @@ NtUserCallOneParam(
case ONEPARAM_ROUTINE_SWAPMOUSEBUTTON:
{
PWINSTATION_OBJECT WinSta;
NTSTATUS Status;
DWORD Result;
Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
KernelMode,
0,
&WinSta);
if (!NT_SUCCESS(Status))
RETURN( (DWORD)FALSE);
/* FIXME
Result = (DWORD)IntSwapMouseButton(WinStaObject, (BOOL)Param); */
Result = 0;
ObDereferenceObject(WinSta);
RETURN( Result);
Result = gspv.bMouseBtnSwap;
gspv.bMouseBtnSwap = Param ? TRUE : FALSE;
gpsi->SystemMetrics[SM_SWAPBUTTON] = gspv.bMouseBtnSwap;
RETURN(Result);
}
case ONEPARAM_ROUTINE_SWITCHCARETSHOWING:

File diff suppressed because it is too large Load diff

View file

@ -537,40 +537,25 @@ NtUserCreateWindowStation(
/* FIXME: Obtain the following information from the registry */
CurInfo->WheelScroLines = 3;
CurInfo->WheelScroChars = 3;
// CurInfo->WheelScroLines = 3;
// CurInfo->WheelScroChars = 3;
CurInfo->SwapButtons = FALSE;
CurInfo->DblClickSpeed = 500;
CurInfo->DblClickWidth = 4;
CurInfo->DblClickHeight = 4;
CurInfo->MouseSpeed = 10;
CurInfo->CursorAccelerationInfo.FirstThreshold = 6;
CurInfo->CursorAccelerationInfo.SecondThreshold = 10;
CurInfo->CursorAccelerationInfo.Acceleration = 1;
// CurInfo->MouseSpeed = 10;
// CurInfo->CursorAccelerationInfo.FirstThreshold = 6;
// CurInfo->CursorAccelerationInfo.SecondThreshold = 10;
// CurInfo->CursorAccelerationInfo.Acceleration = 1;
CurInfo->MouseHoverTime = 80;
CurInfo->MouseHoverWidth = 4;
CurInfo->MouseHoverHeight = 4;
// CurInfo->MouseHoverTime = 80;
// CurInfo->MouseHoverWidth = 4;
// CurInfo->MouseHoverHeight = 4;
WindowStationObject->ScreenSaverActive = FALSE;
WindowStationObject->ScreenSaverTimeOut = 10;
// WindowStationObject->ScreenSaverActive = FALSE;
// WindowStationObject->ScreenSaverTimeOut = 10;
WindowStationObject->SystemCursor = CurInfo;
RtlZeroMemory(&WindowStationObject->UserPreferences, sizeof(USERPREFERENCESMASK));
/* Set all fields with default value = 1 : */
WindowStationObject->UserPreferences.bMenuAnimation = 1;
WindowStationObject->UserPreferences.bComboBoxAnimation = 1;
WindowStationObject->UserPreferences.bListBoxSmoothScrolling = 1;
WindowStationObject->UserPreferences.bGradientCaptions = 1;
WindowStationObject->UserPreferences.bHotTracking = 1;
WindowStationObject->UserPreferences.bMenuFade = 1;
WindowStationObject->UserPreferences.bSelectionFade = 1;
WindowStationObject->UserPreferences.bMenuFade = 1;
WindowStationObject->UserPreferences.bTooltipAnimation = 1;
WindowStationObject->UserPreferences.bTooltipFade = 1;
WindowStationObject->UserPreferences.bCursorShadow = 1;
WindowStationObject->UserPreferences.bUiEffects = 1;
/* END FIXME loading from register */

View file

@ -86,9 +86,11 @@
<directory name="misc">
<file>driver.c</file>
<file>err.c</file>
<file>file.c</file>
<file>math.c</file>
<file>rtlstr.c</file>
<file>copy.c</file>
<file>registry.c</file>
<file>usrheap.c</file>
<if property="ARCH" value="i386">
<directory name="i386">