diff --git a/reactos/lib/user32/include/user32.h b/reactos/lib/user32/include/user32.h index 1b32e4ef497..d44f29edf27 100644 --- a/reactos/lib/user32/include/user32.h +++ b/reactos/lib/user32/include/user32.h @@ -82,3 +82,6 @@ void DrawCaret(HWND hWnd, PTHRDCARETINFO CaretInfo); #define NtUserGetWindowContextHelpId(hwnd) \ NtUserCallOneParam((DWORD)hwnd, ONEPARAM_ROUTINE_GETWNDCONTEXTHLPID) +LONG WINAPI RegCloseKey(HKEY); +LONG WINAPI RegOpenKeyExW(HKEY,LPCWSTR,DWORD,REGSAM,PHKEY); +LONG WINAPI RegQueryValueExW(HKEY,LPCWSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD); diff --git a/reactos/lib/user32/misc/desktop.c b/reactos/lib/user32/misc/desktop.c index a51af63df8b..84aeef7927d 100644 --- a/reactos/lib/user32/misc/desktop.c +++ b/reactos/lib/user32/misc/desktop.c @@ -1,4 +1,4 @@ -/* $Id: desktop.c,v 1.28 2004/01/23 23:38:26 ekohl Exp $ +/* $Id: desktop.c,v 1.29 2004/02/16 07:25:01 rcampbell Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS user32.dll @@ -14,6 +14,8 @@ #include #include #include +#include + /* * @implemented @@ -87,6 +89,22 @@ SystemParametersInfoA(UINT uiAction, } +BOOL IntGetFontMetricSetting(LPCWSTR lpKey, PLOGFONTW font) +{ + HKEY hKey; + DWORD dwType = REG_BINARY; + DWORD dwSize = sizeof(LOGFONTW); + BOOL bRet = FALSE; + if ( RegOpenKeyExW(HKEY_CURRENT_USER, L"Control Panel\\Desktop\\WindowMetrics", 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS ) + { + if ( RegQueryValueExW(hKey, lpKey, NULL, &dwType, (LPBYTE)font, &dwSize) == ERROR_SUCCESS ) + bRet = TRUE; + } + + RegCloseKey(hKey); + return bRet; +} + /* * @implemented */ @@ -96,7 +114,58 @@ SystemParametersInfoW(UINT uiAction, PVOID pvParam, UINT fWinIni) { - return NtUserSystemParametersInfo(uiAction, uiParam, pvParam, fWinIni); + static LOGFONTW IconFont; + static NONCLIENTMETRICSW pMetrics; + static BOOL bInitialized = FALSE; + + if (!bInitialized) + { + ZeroMemory(&IconFont, sizeof(LOGFONTW)); + ZeroMemory(&pMetrics, sizeof(NONCLIENTMETRICSW)); + + IntGetFontMetricSetting(L"CaptionFont", &pMetrics.lfCaptionFont); + IntGetFontMetricSetting(L"SmCaptionFont", &pMetrics.lfSmCaptionFont); + IntGetFontMetricSetting(L"MenuFont", &pMetrics.lfMenuFont); + IntGetFontMetricSetting(L"StatusFont", &pMetrics.lfStatusFont); + IntGetFontMetricSetting(L"MessageFont", &pMetrics.lfStatusFont); + IntGetFontMetricSetting(L"IconFont", &IconFont); + + pMetrics.iBorderWidth = 1; + pMetrics.iScrollWidth = NtUserGetSystemMetrics(SM_CXVSCROLL); + pMetrics.iScrollHeight = NtUserGetSystemMetrics(SM_CYHSCROLL); + pMetrics.iCaptionWidth = NtUserGetSystemMetrics(SM_CXSIZE); + pMetrics.iCaptionHeight = NtUserGetSystemMetrics(SM_CYSIZE); + pMetrics.iSmCaptionWidth = NtUserGetSystemMetrics(SM_CXSMSIZE); + pMetrics.iSmCaptionHeight = NtUserGetSystemMetrics(SM_CYSMSIZE); + pMetrics.iMenuWidth = NtUserGetSystemMetrics(SM_CXMENUSIZE); + pMetrics.iMenuHeight = NtUserGetSystemMetrics(SM_CYMENUSIZE); + pMetrics.cbSize = sizeof(LPNONCLIENTMETRICSW); + + bInitialized = TRUE; + } + switch(uiAction) + { + + case SPI_GETICONTITLELOGFONT: + { + memcpy(pvParam, (PVOID)&IconFont, sizeof(LOGFONTW)); + return TRUE; + } + case SPI_GETNONCLIENTMETRICS: + { + /* FIXME: Is this windows default behavior? */ + LPNONCLIENTMETRICSW lpMetrics = (LPNONCLIENTMETRICSW)pvParam; + if ( lpMetrics->cbSize != sizeof(NONCLIENTMETRICSW) || + uiParam != sizeof(NONCLIENTMETRICSW )) + { + return FALSE; + } + memcpy(pvParam, (PVOID)&pMetrics, sizeof(NONCLIENTMETRICSW)); + return TRUE; + } + default: + return NtUserSystemParametersInfo(uiAction, uiParam, pvParam, fWinIni); + } } diff --git a/reactos/subsys/win32k/ntuser/misc.c b/reactos/subsys/win32k/ntuser/misc.c index 35325d45513..4b9a23437d8 100644 --- a/reactos/subsys/win32k/ntuser/misc.c +++ b/reactos/subsys/win32k/ntuser/misc.c @@ -1,4 +1,4 @@ -/* $Id: misc.c,v 1.49 2004/02/15 07:39:12 gvg Exp $ +/* $Id: misc.c,v 1.50 2004/02/16 07:25:01 rcampbell Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -548,37 +548,6 @@ NtUserSystemParametersInfo( } return TRUE; } - case SPI_GETNONCLIENTMETRICS: - { - /* FIXME - use MmCopyToCaller() !!! */ - LPNONCLIENTMETRICSW pMetrics = (LPNONCLIENTMETRICSW)pvParam; - - if (pMetrics->cbSize != sizeof(NONCLIENTMETRICSW) || - uiParam != sizeof(NONCLIENTMETRICSW)) - { - return FALSE; - } - - memset((char *)pvParam + sizeof(pMetrics->cbSize), 0, - pMetrics->cbSize - sizeof(pMetrics->cbSize)); - - pMetrics->iBorderWidth = 1; - pMetrics->iScrollWidth = NtUserGetSystemMetrics(SM_CXVSCROLL); - pMetrics->iScrollHeight = NtUserGetSystemMetrics(SM_CYHSCROLL); - pMetrics->iCaptionWidth = NtUserGetSystemMetrics(SM_CXSIZE); - pMetrics->iCaptionHeight = NtUserGetSystemMetrics(SM_CYSIZE); - memcpy((LPVOID)&(pMetrics->lfCaptionFont), &CaptionFont, sizeof(CaptionFont)); - pMetrics->lfCaptionFont.lfWeight = FW_BOLD; - pMetrics->iSmCaptionWidth = NtUserGetSystemMetrics(SM_CXSMSIZE); - pMetrics->iSmCaptionHeight = NtUserGetSystemMetrics(SM_CYSMSIZE); - memcpy((LPVOID)&(pMetrics->lfSmCaptionFont), &CaptionFont, sizeof(CaptionFont)); - pMetrics->iMenuWidth = NtUserGetSystemMetrics(SM_CXMENUSIZE); - pMetrics->iMenuHeight = NtUserGetSystemMetrics(SM_CYMENUSIZE); - memcpy((LPVOID)&(pMetrics->lfMenuFont), &CaptionFont, sizeof(CaptionFont)); - memcpy((LPVOID)&(pMetrics->lfStatusFont), &CaptionFont, sizeof(CaptionFont)); - memcpy((LPVOID)&(pMetrics->lfMessageFont), &CaptionFont, sizeof(CaptionFont)); - return TRUE; - } case SPI_GETGRADIENTCAPTIONS: { HDC hDC;