ReactOS 0.4.15-dev-5865-g640e228
sysparams.c File Reference
#include <assert.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winreg.h"
#include "winuser.h"
#include "winnls.h"
Include dependency graph for sysparams.c:

Go to the source code of this file.

Classes

struct  LOGFONT16
 

Macros

#define SPI_GETDESKWALLPAPER   0x0073
 
#define eq(received, expected, label, type)    ok((received) == (expected), "%s: got " type " instead of " type "\n", (label),(received),(expected))
 
#define SPI_SETBEEP_REGKEY   "Control Panel\\Sound"
 
#define SPI_SETBEEP_VALNAME   "Beep"
 
#define SPI_SETMOUSE_REGKEY   "Control Panel\\Mouse"
 
#define SPI_SETMOUSE_VALNAME1   "MouseThreshold1"
 
#define SPI_SETMOUSE_VALNAME2   "MouseThreshold2"
 
#define SPI_SETMOUSE_VALNAME3   "MouseSpeed"
 
#define SPI_SETBORDER_REGKEY   "Control Panel\\Desktop\\WindowMetrics"
 
#define SPI_SETBORDER_REGKEY2   "Control Panel\\Desktop"
 
#define SPI_SETBORDER_VALNAME   "BorderWidth"
 
#define SPI_METRIC_REGKEY   "Control Panel\\Desktop\\WindowMetrics"
 
#define SPI_SCROLLWIDTH_VALNAME   "ScrollWidth"
 
#define SPI_SCROLLHEIGHT_VALNAME   "ScrollHeight"
 
#define SPI_CAPTIONWIDTH_VALNAME   "CaptionWidth"
 
#define SPI_CAPTIONHEIGHT_VALNAME   "CaptionHeight"
 
#define SPI_CAPTIONFONT_VALNAME   "CaptionFont"
 
#define SPI_SMCAPTIONWIDTH_VALNAME   "SmCaptionWidth"
 
#define SPI_SMCAPTIONHEIGHT_VALNAME   "SmCaptionHeight"
 
#define SPI_SMCAPTIONFONT_VALNAME   "SmCaptionFont"
 
#define SPI_MENUWIDTH_VALNAME   "MenuWidth"
 
#define SPI_MENUHEIGHT_VALNAME   "MenuHeight"
 
#define SPI_MENUFONT_VALNAME   "MenuFont"
 
#define SPI_STATUSFONT_VALNAME   "StatusFont"
 
#define SPI_MESSAGEFONT_VALNAME   "MessageFont"
 
#define SPI_SETKEYBOARDSPEED_REGKEY   "Control Panel\\Keyboard"
 
#define SPI_SETKEYBOARDSPEED_VALNAME   "KeyboardSpeed"
 
#define SPI_ICONHORIZONTALSPACING_REGKEY   "Control Panel\\Desktop\\WindowMetrics"
 
#define SPI_ICONHORIZONTALSPACING_REGKEY2   "Control Panel\\Desktop"
 
#define SPI_ICONHORIZONTALSPACING_VALNAME   "IconSpacing"
 
#define SPI_ICONVERTICALSPACING_REGKEY   "Control Panel\\Desktop\\WindowMetrics"
 
#define SPI_ICONVERTICALSPACING_REGKEY2   "Control Panel\\Desktop"
 
#define SPI_ICONVERTICALSPACING_VALNAME   "IconVerticalSpacing"
 
#define SPI_MINIMIZEDMETRICS_REGKEY   "Control Panel\\Desktop\\WindowMetrics"
 
#define SPI_MINWIDTH_VALNAME   "MinWidth"
 
#define SPI_MINHORZGAP_VALNAME   "MinHorzGap"
 
#define SPI_MINVERTGAP_VALNAME   "MinVertGap"
 
#define SPI_MINARRANGE_VALNAME   "MinArrange"
 
#define SPI_SETSCREENSAVETIMEOUT_REGKEY   "Control Panel\\Desktop"
 
#define SPI_SETSCREENSAVETIMEOUT_VALNAME   "ScreenSaveTimeOut"
 
#define SPI_SETSCREENSAVEACTIVE_REGKEY   "Control Panel\\Desktop"
 
#define SPI_SETSCREENSAVEACTIVE_VALNAME   "ScreenSaveActive"
 
#define SPI_SETGRIDGRANULARITY_REGKEY   "Control Panel\\Desktop"
 
#define SPI_SETGRIDGRANULARITY_VALNAME   "GridGranularity"
 
#define SPI_SETKEYBOARDDELAY_REGKEY   "Control Panel\\Keyboard"
 
#define SPI_SETKEYBOARDDELAY_VALNAME   "KeyboardDelay"
 
#define SPI_SETICONTITLEWRAP_REGKEY1   "Control Panel\\Desktop\\WindowMetrics"
 
#define SPI_SETICONTITLEWRAP_REGKEY2   "Control Panel\\Desktop"
 
#define SPI_SETICONTITLEWRAP_VALNAME   "IconTitleWrap"
 
#define SPI_SETMENUDROPALIGNMENT_REGKEY1   "Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows"
 
#define SPI_SETMENUDROPALIGNMENT_REGKEY2   "Control Panel\\Desktop"
 
#define SPI_SETMENUDROPALIGNMENT_VALNAME   "MenuDropAlignment"
 
#define SPI_SETDOUBLECLKWIDTH_REGKEY1   "Control Panel\\Mouse"
 
#define SPI_SETDOUBLECLKWIDTH_REGKEY2   "Control Panel\\Desktop"
 
#define SPI_SETDOUBLECLKWIDTH_VALNAME   "DoubleClickWidth"
 
#define SPI_SETDOUBLECLKHEIGHT_REGKEY1   "Control Panel\\Mouse"
 
#define SPI_SETDOUBLECLKHEIGHT_REGKEY2   "Control Panel\\Desktop"
 
#define SPI_SETDOUBLECLKHEIGHT_VALNAME   "DoubleClickHeight"
 
#define SPI_SETDOUBLECLICKTIME_REGKEY   "Control Panel\\Mouse"
 
#define SPI_SETDOUBLECLICKTIME_VALNAME   "DoubleClickSpeed"
 
#define SPI_SETMOUSEBUTTONSWAP_REGKEY   "Control Panel\\Mouse"
 
#define SPI_SETMOUSEBUTTONSWAP_VALNAME   "SwapMouseButtons"
 
#define SPI_SETWORKAREA_REGKEY   "Control Panel\\Desktop"
 
#define SPI_SETWORKAREA_VALNAME   "WINE_WorkArea"
 
#define SPI_SETSHOWSOUNDS_REGKEY   "Control Panel\\Accessibility\\ShowSounds"
 
#define SPI_SETSHOWSOUNDS_VALNAME   "On"
 
#define SPI_SETKEYBOARDPREF_REGKEY   "Control Panel\\Accessibility\\Keyboard Preference"
 
#define SPI_SETKEYBOARDPREF_VALNAME   "On"
 
#define SPI_SETKEYBOARDPREF_REGKEY_LEGACY   "Control Panel\\Accessibility"
 
#define SPI_SETKEYBOARDPREF_VALNAME_LEGACY   "Keyboard Preference"
 
#define SPI_SETSCREENREADER_REGKEY   "Control Panel\\Accessibility\\Blind Access"
 
#define SPI_SETSCREENREADER_VALNAME   "On"
 
#define SPI_SETSCREENREADER_REGKEY_LEGACY   "Control Panel\\Accessibility"
 
#define SPI_SETSCREENREADER_VALNAME_LEGACY   "Blind Access"
 
#define SPI_SETFONTSMOOTHING_REGKEY   "Control Panel\\Desktop"
 
#define SPI_SETFONTSMOOTHING_VALNAME   "FontSmoothing"
 
#define SPI_SETFONTSMOOTHINGTYPE_VALNAME   "FontSmoothingType"
 
#define SPI_SETFONTSMOOTHINGCONTRAST_VALNAME   "FontSmoothingGamma"
 
#define SPI_SETFONTSMOOTHINGORIENTATION_VALNAME   "FontSmoothingOrientation"
 
#define SPI_SETLOWPOWERACTIVE_REGKEY   "Control Panel\\Desktop"
 
#define SPI_SETLOWPOWERACTIVE_VALNAME   "LowPowerActive"
 
#define SPI_SETPOWEROFFACTIVE_REGKEY   "Control Panel\\Desktop"
 
#define SPI_SETPOWEROFFACTIVE_VALNAME   "PowerOffActive"
 
#define SPI_SETDRAGFULLWINDOWS_REGKEY   "Control Panel\\Desktop"
 
#define SPI_SETDRAGFULLWINDOWS_VALNAME   "DragFullWindows"
 
#define SPI_SETSNAPTODEFBUTTON_REGKEY   "Control Panel\\Mouse"
 
#define SPI_SETSNAPTODEFBUTTON_VALNAME   "SnapToDefaultButton"
 
#define SPI_SETMOUSEHOVERWIDTH_REGKEY   "Control Panel\\Mouse"
 
#define SPI_SETMOUSEHOVERWIDTH_VALNAME   "MouseHoverWidth"
 
#define SPI_SETMOUSEHOVERHEIGHT_REGKEY   "Control Panel\\Mouse"
 
#define SPI_SETMOUSEHOVERHEIGHT_VALNAME   "MouseHoverHeight"
 
#define SPI_SETMOUSEHOVERTIME_REGKEY   "Control Panel\\Mouse"
 
#define SPI_SETMOUSEHOVERTIME_VALNAME   "MouseHoverTime"
 
#define SPI_SETMOUSESCROLLCHARS_REGKEY   "Control Panel\\Desktop"
 
#define SPI_SETMOUSESCROLLCHARS_VALNAME   "WheelScrollChars"
 
#define SPI_SETMOUSESCROLLLINES_REGKEY   "Control Panel\\Desktop"
 
#define SPI_SETMOUSESCROLLLINES_VALNAME   "WheelScrollLines"
 
#define SPI_SETMENUSHOWDELAY_REGKEY   "Control Panel\\Desktop"
 
#define SPI_SETMENUSHOWDELAY_VALNAME   "MenuShowDelay"
 
#define SPI_SETDESKWALLPAPER_REGKEY   "Control Panel\\Desktop"
 
#define SPI_SETDESKWALLPAPER_VALNAME   "Wallpaper"
 
#define WINE_CURRENT_USER_REGKEY   "Wine"
 
#define test_reg_key(subKey, valName, testValue)    _test_reg_key( subKey, NULL, valName, NULL, testValue, REG_SZ, FALSE )
 
#define test_reg_key_optional(subKey, valName, testValue)    _test_reg_key( subKey, NULL, valName, NULL, testValue, REG_SZ, TRUE )
 
#define test_reg_key_ex(subKey1, subKey2, valName, testValue)    _test_reg_key( subKey1, subKey2, valName, NULL, testValue, REG_SZ, FALSE )
 
#define test_reg_key_ex2(subKey1, subKey2, valName1, valName2, testValue)    _test_reg_key( subKey1, subKey2, valName1, valName2, testValue, REG_SZ, FALSE )
 
#define test_reg_key_ex2_optional(subKey1, subKey2, valName1, valName2, testValue)    _test_reg_key( subKey1, subKey2, valName1, valName2, testValue, REG_SZ, TRUE )
 
#define test_reg_key_dword(subKey, valName, testValue)    _test_reg_key( subKey, NULL, valName, NULL, testValue, REG_DWORD, FALSE )
 
#define test_reg_metric(KEY, VAL, val)
 
#define test_reg_metric2(KEY1, KEY2, VAL, val)
 
#define test_reg_font(KEY, VAL, LF)
 
#define TEST_NONCLIENTMETRICS_REG(ncm)
 
#define ok_gsm(i, e)
 
#define ok_gsm_2(i, e1, e2)
 
#define ok_gsm_3(i, e1, e2, e3)
 

Typedefs

typedef struct LOGFONT16LPLOGFONT16
 

Functions

static LONG (WINAPI *pChangeDisplaySettingsExA)(LPCSTR
 
static BOOL (WINAPI *pIsProcessDPIAware)(void)
 
static UINT (WINAPI *pGetDpiForSystem)(void)
 
static UINT UINT *static DPI_AWARENESS_CONTEXT (WINAPI *pGetThreadDpiAwarenessContext)(void)
 
static DPI_AWARENESS (WINAPI *pGetAwarenessFromDpiAwarenessContext)(DPI_AWARENESS_CONTEXT)
 
static INT (WINAPI *pGetSystemMetricsForDpi)(INT
 
static DWORD WINAPI SysParamsThreadFunc (LPVOID lpParam)
 
static LRESULT CALLBACK SysParamsTestWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static BOOL get_reg_dword (HKEY base, const char *key_name, const char *value_name, DWORD *value)
 
static DWORD get_real_dpi (void)
 
static void test_change_message (int action, int optional)
 
static BOOL test_error_msg (int rc, const char *name)
 
static void _test_reg_key (LPCSTR subKey1, LPCSTR subKey2, LPCSTR valName1, LPCSTR valName2, const void *exp_value, DWORD exp_type, BOOL optional)
 
static UINT metricfromreg (const char *keyname, const char *valname, int dpi)
 
static int lffromreg (const char *keyname, const char *valname, LOGFONTA *plf)
 
static void test_SPI_SETBEEP (void)
 
static BOOL run_spi_setmouse_test (int curr_val[], POINT *req_change, POINT *proj_change, int nchange)
 
static void test_SPI_SETMOUSE (void)
 
static BOOL test_setborder (UINT curr_val, int usesetborder, int dpi)
 
static void test_SPI_SETBORDER (void)
 
static void test_SPI_SETKEYBOARDSPEED (void)
 
static BOOL dotest_spi_iconhorizontalspacing (INT curr_val)
 
static void test_SPI_ICONHORIZONTALSPACING (void)
 
static void test_SPI_SETSCREENSAVETIMEOUT (void)
 
static void test_SPI_SETSCREENSAVEACTIVE (void)
 
static void test_SPI_SETGRIDGRANULARITY (void)
 
static void test_SPI_SETKEYBOARDDELAY (void)
 
static BOOL dotest_spi_iconverticalspacing (INT curr_val)
 
static void test_SPI_ICONVERTICALSPACING (void)
 
static void test_SPI_SETICONTITLEWRAP (void)
 
static void test_SPI_SETMENUDROPALIGNMENT (void)
 
static void test_SPI_SETDOUBLECLKWIDTH (void)
 
static void test_SPI_SETDOUBLECLKHEIGHT (void)
 
static void test_SPI_SETDOUBLECLICKTIME (void)
 
static void test_SPI_SETMOUSEBUTTONSWAP (void)
 
static void test_SPI_SETFASTTASKSWITCH (void)
 
static void test_SPI_SETDRAGFULLWINDOWS (void)
 
static int get_tmheight (LOGFONTA *plf, int flag)
 
static int get_tmheightW (LOGFONTW *plf, int flag)
 
static void test_GetSystemMetrics (void)
 
static void test_SPI_SETNONCLIENTMETRICS (void)
 
static void test_SPI_SETMINIMIZEDMETRICS (void)
 
static void test_SPI_SETICONMETRICS (void)
 
static void test_SPI_SETWORKAREA (void)
 
static void test_SPI_SETSHOWSOUNDS (void)
 
static void test_SPI_SETKEYBOARDPREF (void)
 
static void test_SPI_SETSCREENREADER (void)
 
static void test_SPI_SETFONTSMOOTHING (void)
 
static void test_SPI_SETLOWPOWERACTIVE (void)
 
static void test_SPI_SETPOWEROFFACTIVE (void)
 
static void test_SPI_SETSNAPTODEFBUTTON (void)
 
static void test_SPI_SETMOUSEHOVERWIDTH (void)
 
static void test_SPI_SETMOUSEHOVERHEIGHT (void)
 
static void test_SPI_SETMOUSEHOVERTIME (void)
 
static void test_SPI_SETWHEELSCROLLLINES (void)
 
static void test_SPI_SETMENUSHOWDELAY (void)
 
static void test_SPI_SETWHEELSCROLLCHARS (void)
 
static void test_SPI_SETWALLPAPER (void)
 
static void test_WM_DISPLAYCHANGE (void)
 
static LONG _GdiGetCharDimensions (HDC hdc, LPTEXTMETRICA lptm, LONG *height)
 
static void get_text_metr_size (HDC hdc, LOGFONTA *plf, TEXTMETRICA *ptm, UINT *psz)
 
static INT CALLBACK enum_all_fonts_proc (const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lparam)
 
static BOOL is_font_enumerated (const char *name)
 
static int get_cursor_size (int size)
 
static void compare_font (const LOGFONTW *lf1, const LOGFONTW *lf2, int dpi, int custom_dpi, int line)
 
static void test_metrics_for_dpi (int custom_dpi)
 
static void test_EnumDisplaySettings (void)
 
static void test_GetSysColorBrush (void)
 
static void test_dpi_stock_objects (HDC hdc)
 
static void scale_point_dpi (POINT *pt, UINT src_dpi, UINT target_dpi)
 
static void scale_rect_dpi (RECT *rect, UINT src_dpi, UINT target_dpi)
 
static void scale_point_dpi_aware (POINT *pt, DPI_AWARENESS from, DPI_AWARENESS to)
 
static void scale_rect_dpi_aware (RECT *rect, DPI_AWARENESS from, DPI_AWARENESS to)
 
static void test_dpi_mapping (void)
 
static void test_dpi_aware (void)
 
static void test_dpi_context (void)
 
static LRESULT CALLBACK dpi_winproc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
 
static void test_dpi_window (void)
 
static void test_GetAutoRotationState (void)
 
 START_TEST (sysparams)
 

Variables

static LPDEVMODEA
 
static HWND
 
static DWORD
 
static LPVOID
 
static UINT
 
static BOOL
 
static BOOL strict
 
static int dpi
 
static int real_dpi
 
static HWND ghTestWnd
 
static int change_counter
 
static int change_setworkarea_param
 
static int change_iconverticalspacing_param
 
static int change_last_param
 
static int last_bpp
 
static BOOL displaychange_ok = FALSE
 
static BOOL displaychange_test_active = FALSE
 
static HANDLE displaychange_sem = 0
 
static const charsetmouse_valuenames [3]
 
static UINT smcxsmsize = 999999999
 
static int gsm_error_ctr
 

Macro Definition Documentation

◆ eq

#define eq (   received,
  expected,
  label,
  type 
)     ok((received) == (expected), "%s: got " type " instead of " type "\n", (label),(received),(expected))

Definition at line 61 of file sysparams.c.

◆ ok_gsm

#define ok_gsm (   i,
  e 
)
Value:
{\
int exp = (e);\
int act = GetSystemMetrics( (i));\
if( exp != act) gsm_error_ctr++;\
ok( !( exp != act),"GetSystemMetrics(%s): expected %d actual %d\n", #i, exp,act);\
}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define e
Definition: ke_i.h:82
DWORD exp
Definition: msg.c:16058
static int gsm_error_ctr
Definition: sysparams.c:2646
int WINAPI GetSystemMetrics(_In_ int)

Definition at line 2648 of file sysparams.c.

◆ ok_gsm_2

#define ok_gsm_2 (   i,
  e1,
  e2 
)
Value:
{\
int exp1 = (e1);\
int exp2 = (e2);\
int act = GetSystemMetrics( (i));\
if( exp1 != act && exp2 != act) gsm_error_ctr++;\
ok( !( exp1 != act && exp2 != act), "GetSystemMetrics(%s): expected %d or %d actual %d\n", #i, exp1, exp2, act);\
}
double __cdecl exp2(double)

Definition at line 2655 of file sysparams.c.

◆ ok_gsm_3

#define ok_gsm_3 (   i,
  e1,
  e2,
  e3 
)
Value:
{\
int exp1 = (e1);\
int exp2 = (e2);\
int exp3 = (e3);\
int act = GetSystemMetrics( (i));\
if( exp1 != act && exp2 != act && exp3 != act) gsm_error_ctr++;\
ok( !( exp1 != act && exp2 != act && exp3 != act),"GetSystemMetrics(%s): expected %d or %d or %d actual %d\n", #i, exp1, exp2, exp3, act);\
}

Definition at line 2663 of file sysparams.c.

◆ SPI_CAPTIONFONT_VALNAME

#define SPI_CAPTIONFONT_VALNAME   "CaptionFont"

Definition at line 79 of file sysparams.c.

◆ SPI_CAPTIONHEIGHT_VALNAME

#define SPI_CAPTIONHEIGHT_VALNAME   "CaptionHeight"

Definition at line 78 of file sysparams.c.

◆ SPI_CAPTIONWIDTH_VALNAME

#define SPI_CAPTIONWIDTH_VALNAME   "CaptionWidth"

Definition at line 77 of file sysparams.c.

◆ SPI_GETDESKWALLPAPER

#define SPI_GETDESKWALLPAPER   0x0073

Definition at line 34 of file sysparams.c.

◆ SPI_ICONHORIZONTALSPACING_REGKEY

#define SPI_ICONHORIZONTALSPACING_REGKEY   "Control Panel\\Desktop\\WindowMetrics"

Definition at line 91 of file sysparams.c.

◆ SPI_ICONHORIZONTALSPACING_REGKEY2

#define SPI_ICONHORIZONTALSPACING_REGKEY2   "Control Panel\\Desktop"

Definition at line 92 of file sysparams.c.

◆ SPI_ICONHORIZONTALSPACING_VALNAME

#define SPI_ICONHORIZONTALSPACING_VALNAME   "IconSpacing"

Definition at line 93 of file sysparams.c.

◆ SPI_ICONVERTICALSPACING_REGKEY

#define SPI_ICONVERTICALSPACING_REGKEY   "Control Panel\\Desktop\\WindowMetrics"

Definition at line 94 of file sysparams.c.

◆ SPI_ICONVERTICALSPACING_REGKEY2

#define SPI_ICONVERTICALSPACING_REGKEY2   "Control Panel\\Desktop"

Definition at line 95 of file sysparams.c.

◆ SPI_ICONVERTICALSPACING_VALNAME

#define SPI_ICONVERTICALSPACING_VALNAME   "IconVerticalSpacing"

Definition at line 96 of file sysparams.c.

◆ SPI_MENUFONT_VALNAME

#define SPI_MENUFONT_VALNAME   "MenuFont"

Definition at line 85 of file sysparams.c.

◆ SPI_MENUHEIGHT_VALNAME

#define SPI_MENUHEIGHT_VALNAME   "MenuHeight"

Definition at line 84 of file sysparams.c.

◆ SPI_MENUWIDTH_VALNAME

#define SPI_MENUWIDTH_VALNAME   "MenuWidth"

Definition at line 83 of file sysparams.c.

◆ SPI_MESSAGEFONT_VALNAME

#define SPI_MESSAGEFONT_VALNAME   "MessageFont"

Definition at line 87 of file sysparams.c.

◆ SPI_METRIC_REGKEY

#define SPI_METRIC_REGKEY   "Control Panel\\Desktop\\WindowMetrics"

Definition at line 74 of file sysparams.c.

◆ SPI_MINARRANGE_VALNAME

#define SPI_MINARRANGE_VALNAME   "MinArrange"

Definition at line 101 of file sysparams.c.

◆ SPI_MINHORZGAP_VALNAME

#define SPI_MINHORZGAP_VALNAME   "MinHorzGap"

Definition at line 99 of file sysparams.c.

◆ SPI_MINIMIZEDMETRICS_REGKEY

#define SPI_MINIMIZEDMETRICS_REGKEY   "Control Panel\\Desktop\\WindowMetrics"

Definition at line 97 of file sysparams.c.

◆ SPI_MINVERTGAP_VALNAME

#define SPI_MINVERTGAP_VALNAME   "MinVertGap"

Definition at line 100 of file sysparams.c.

◆ SPI_MINWIDTH_VALNAME

#define SPI_MINWIDTH_VALNAME   "MinWidth"

Definition at line 98 of file sysparams.c.

◆ SPI_SCROLLHEIGHT_VALNAME

#define SPI_SCROLLHEIGHT_VALNAME   "ScrollHeight"

Definition at line 76 of file sysparams.c.

◆ SPI_SCROLLWIDTH_VALNAME

#define SPI_SCROLLWIDTH_VALNAME   "ScrollWidth"

Definition at line 75 of file sysparams.c.

◆ SPI_SETBEEP_REGKEY

#define SPI_SETBEEP_REGKEY   "Control Panel\\Sound"

Definition at line 65 of file sysparams.c.

◆ SPI_SETBEEP_VALNAME

#define SPI_SETBEEP_VALNAME   "Beep"

Definition at line 66 of file sysparams.c.

◆ SPI_SETBORDER_REGKEY

#define SPI_SETBORDER_REGKEY   "Control Panel\\Desktop\\WindowMetrics"

Definition at line 71 of file sysparams.c.

◆ SPI_SETBORDER_REGKEY2

#define SPI_SETBORDER_REGKEY2   "Control Panel\\Desktop"

Definition at line 72 of file sysparams.c.

◆ SPI_SETBORDER_VALNAME

#define SPI_SETBORDER_VALNAME   "BorderWidth"

Definition at line 73 of file sysparams.c.

◆ SPI_SETDESKWALLPAPER_REGKEY

#define SPI_SETDESKWALLPAPER_REGKEY   "Control Panel\\Desktop"

Definition at line 163 of file sysparams.c.

◆ SPI_SETDESKWALLPAPER_VALNAME

#define SPI_SETDESKWALLPAPER_VALNAME   "Wallpaper"

Definition at line 164 of file sysparams.c.

◆ SPI_SETDOUBLECLICKTIME_REGKEY

#define SPI_SETDOUBLECLICKTIME_REGKEY   "Control Panel\\Mouse"

Definition at line 122 of file sysparams.c.

◆ SPI_SETDOUBLECLICKTIME_VALNAME

#define SPI_SETDOUBLECLICKTIME_VALNAME   "DoubleClickSpeed"

Definition at line 123 of file sysparams.c.

◆ SPI_SETDOUBLECLKHEIGHT_REGKEY1

#define SPI_SETDOUBLECLKHEIGHT_REGKEY1   "Control Panel\\Mouse"

Definition at line 119 of file sysparams.c.

◆ SPI_SETDOUBLECLKHEIGHT_REGKEY2

#define SPI_SETDOUBLECLKHEIGHT_REGKEY2   "Control Panel\\Desktop"

Definition at line 120 of file sysparams.c.

◆ SPI_SETDOUBLECLKHEIGHT_VALNAME

#define SPI_SETDOUBLECLKHEIGHT_VALNAME   "DoubleClickHeight"

Definition at line 121 of file sysparams.c.

◆ SPI_SETDOUBLECLKWIDTH_REGKEY1

#define SPI_SETDOUBLECLKWIDTH_REGKEY1   "Control Panel\\Mouse"

Definition at line 116 of file sysparams.c.

◆ SPI_SETDOUBLECLKWIDTH_REGKEY2

#define SPI_SETDOUBLECLKWIDTH_REGKEY2   "Control Panel\\Desktop"

Definition at line 117 of file sysparams.c.

◆ SPI_SETDOUBLECLKWIDTH_VALNAME

#define SPI_SETDOUBLECLKWIDTH_VALNAME   "DoubleClickWidth"

Definition at line 118 of file sysparams.c.

◆ SPI_SETDRAGFULLWINDOWS_REGKEY

#define SPI_SETDRAGFULLWINDOWS_REGKEY   "Control Panel\\Desktop"

Definition at line 147 of file sysparams.c.

◆ SPI_SETDRAGFULLWINDOWS_VALNAME

#define SPI_SETDRAGFULLWINDOWS_VALNAME   "DragFullWindows"

Definition at line 148 of file sysparams.c.

◆ SPI_SETFONTSMOOTHING_REGKEY

#define SPI_SETFONTSMOOTHING_REGKEY   "Control Panel\\Desktop"

Definition at line 138 of file sysparams.c.

◆ SPI_SETFONTSMOOTHING_VALNAME

#define SPI_SETFONTSMOOTHING_VALNAME   "FontSmoothing"

Definition at line 139 of file sysparams.c.

◆ SPI_SETFONTSMOOTHINGCONTRAST_VALNAME

#define SPI_SETFONTSMOOTHINGCONTRAST_VALNAME   "FontSmoothingGamma"

Definition at line 141 of file sysparams.c.

◆ SPI_SETFONTSMOOTHINGORIENTATION_VALNAME

#define SPI_SETFONTSMOOTHINGORIENTATION_VALNAME   "FontSmoothingOrientation"

Definition at line 142 of file sysparams.c.

◆ SPI_SETFONTSMOOTHINGTYPE_VALNAME

#define SPI_SETFONTSMOOTHINGTYPE_VALNAME   "FontSmoothingType"

Definition at line 140 of file sysparams.c.

◆ SPI_SETGRIDGRANULARITY_REGKEY

#define SPI_SETGRIDGRANULARITY_REGKEY   "Control Panel\\Desktop"

Definition at line 106 of file sysparams.c.

◆ SPI_SETGRIDGRANULARITY_VALNAME

#define SPI_SETGRIDGRANULARITY_VALNAME   "GridGranularity"

Definition at line 107 of file sysparams.c.

◆ SPI_SETICONTITLEWRAP_REGKEY1

#define SPI_SETICONTITLEWRAP_REGKEY1   "Control Panel\\Desktop\\WindowMetrics"

Definition at line 110 of file sysparams.c.

◆ SPI_SETICONTITLEWRAP_REGKEY2

#define SPI_SETICONTITLEWRAP_REGKEY2   "Control Panel\\Desktop"

Definition at line 111 of file sysparams.c.

◆ SPI_SETICONTITLEWRAP_VALNAME

#define SPI_SETICONTITLEWRAP_VALNAME   "IconTitleWrap"

Definition at line 112 of file sysparams.c.

◆ SPI_SETKEYBOARDDELAY_REGKEY

#define SPI_SETKEYBOARDDELAY_REGKEY   "Control Panel\\Keyboard"

Definition at line 108 of file sysparams.c.

◆ SPI_SETKEYBOARDDELAY_VALNAME

#define SPI_SETKEYBOARDDELAY_VALNAME   "KeyboardDelay"

Definition at line 109 of file sysparams.c.

◆ SPI_SETKEYBOARDPREF_REGKEY

#define SPI_SETKEYBOARDPREF_REGKEY   "Control Panel\\Accessibility\\Keyboard Preference"

Definition at line 130 of file sysparams.c.

◆ SPI_SETKEYBOARDPREF_REGKEY_LEGACY

#define SPI_SETKEYBOARDPREF_REGKEY_LEGACY   "Control Panel\\Accessibility"

Definition at line 132 of file sysparams.c.

◆ SPI_SETKEYBOARDPREF_VALNAME

#define SPI_SETKEYBOARDPREF_VALNAME   "On"

Definition at line 131 of file sysparams.c.

◆ SPI_SETKEYBOARDPREF_VALNAME_LEGACY

#define SPI_SETKEYBOARDPREF_VALNAME_LEGACY   "Keyboard Preference"

Definition at line 133 of file sysparams.c.

◆ SPI_SETKEYBOARDSPEED_REGKEY

#define SPI_SETKEYBOARDSPEED_REGKEY   "Control Panel\\Keyboard"

Definition at line 89 of file sysparams.c.

◆ SPI_SETKEYBOARDSPEED_VALNAME

#define SPI_SETKEYBOARDSPEED_VALNAME   "KeyboardSpeed"

Definition at line 90 of file sysparams.c.

◆ SPI_SETLOWPOWERACTIVE_REGKEY

#define SPI_SETLOWPOWERACTIVE_REGKEY   "Control Panel\\Desktop"

Definition at line 143 of file sysparams.c.

◆ SPI_SETLOWPOWERACTIVE_VALNAME

#define SPI_SETLOWPOWERACTIVE_VALNAME   "LowPowerActive"

Definition at line 144 of file sysparams.c.

◆ SPI_SETMENUDROPALIGNMENT_REGKEY1

#define SPI_SETMENUDROPALIGNMENT_REGKEY1   "Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows"

Definition at line 113 of file sysparams.c.

◆ SPI_SETMENUDROPALIGNMENT_REGKEY2

#define SPI_SETMENUDROPALIGNMENT_REGKEY2   "Control Panel\\Desktop"

Definition at line 114 of file sysparams.c.

◆ SPI_SETMENUDROPALIGNMENT_VALNAME

#define SPI_SETMENUDROPALIGNMENT_VALNAME   "MenuDropAlignment"

Definition at line 115 of file sysparams.c.

◆ SPI_SETMENUSHOWDELAY_REGKEY

#define SPI_SETMENUSHOWDELAY_REGKEY   "Control Panel\\Desktop"

Definition at line 161 of file sysparams.c.

◆ SPI_SETMENUSHOWDELAY_VALNAME

#define SPI_SETMENUSHOWDELAY_VALNAME   "MenuShowDelay"

Definition at line 162 of file sysparams.c.

◆ SPI_SETMOUSE_REGKEY

#define SPI_SETMOUSE_REGKEY   "Control Panel\\Mouse"

Definition at line 67 of file sysparams.c.

◆ SPI_SETMOUSE_VALNAME1

#define SPI_SETMOUSE_VALNAME1   "MouseThreshold1"

Definition at line 68 of file sysparams.c.

◆ SPI_SETMOUSE_VALNAME2

#define SPI_SETMOUSE_VALNAME2   "MouseThreshold2"

Definition at line 69 of file sysparams.c.

◆ SPI_SETMOUSE_VALNAME3

#define SPI_SETMOUSE_VALNAME3   "MouseSpeed"

Definition at line 70 of file sysparams.c.

◆ SPI_SETMOUSEBUTTONSWAP_REGKEY

#define SPI_SETMOUSEBUTTONSWAP_REGKEY   "Control Panel\\Mouse"

Definition at line 124 of file sysparams.c.

◆ SPI_SETMOUSEBUTTONSWAP_VALNAME

#define SPI_SETMOUSEBUTTONSWAP_VALNAME   "SwapMouseButtons"

Definition at line 125 of file sysparams.c.

◆ SPI_SETMOUSEHOVERHEIGHT_REGKEY

#define SPI_SETMOUSEHOVERHEIGHT_REGKEY   "Control Panel\\Mouse"

Definition at line 153 of file sysparams.c.

◆ SPI_SETMOUSEHOVERHEIGHT_VALNAME

#define SPI_SETMOUSEHOVERHEIGHT_VALNAME   "MouseHoverHeight"

Definition at line 154 of file sysparams.c.

◆ SPI_SETMOUSEHOVERTIME_REGKEY

#define SPI_SETMOUSEHOVERTIME_REGKEY   "Control Panel\\Mouse"

Definition at line 155 of file sysparams.c.

◆ SPI_SETMOUSEHOVERTIME_VALNAME

#define SPI_SETMOUSEHOVERTIME_VALNAME   "MouseHoverTime"

Definition at line 156 of file sysparams.c.

◆ SPI_SETMOUSEHOVERWIDTH_REGKEY

#define SPI_SETMOUSEHOVERWIDTH_REGKEY   "Control Panel\\Mouse"

Definition at line 151 of file sysparams.c.

◆ SPI_SETMOUSEHOVERWIDTH_VALNAME

#define SPI_SETMOUSEHOVERWIDTH_VALNAME   "MouseHoverWidth"

Definition at line 152 of file sysparams.c.

◆ SPI_SETMOUSESCROLLCHARS_REGKEY

#define SPI_SETMOUSESCROLLCHARS_REGKEY   "Control Panel\\Desktop"

Definition at line 157 of file sysparams.c.

◆ SPI_SETMOUSESCROLLCHARS_VALNAME

#define SPI_SETMOUSESCROLLCHARS_VALNAME   "WheelScrollChars"

Definition at line 158 of file sysparams.c.

◆ SPI_SETMOUSESCROLLLINES_REGKEY

#define SPI_SETMOUSESCROLLLINES_REGKEY   "Control Panel\\Desktop"

Definition at line 159 of file sysparams.c.

◆ SPI_SETMOUSESCROLLLINES_VALNAME

#define SPI_SETMOUSESCROLLLINES_VALNAME   "WheelScrollLines"

Definition at line 160 of file sysparams.c.

◆ SPI_SETPOWEROFFACTIVE_REGKEY

#define SPI_SETPOWEROFFACTIVE_REGKEY   "Control Panel\\Desktop"

Definition at line 145 of file sysparams.c.

◆ SPI_SETPOWEROFFACTIVE_VALNAME

#define SPI_SETPOWEROFFACTIVE_VALNAME   "PowerOffActive"

Definition at line 146 of file sysparams.c.

◆ SPI_SETSCREENREADER_REGKEY

#define SPI_SETSCREENREADER_REGKEY   "Control Panel\\Accessibility\\Blind Access"

Definition at line 134 of file sysparams.c.

◆ SPI_SETSCREENREADER_REGKEY_LEGACY

#define SPI_SETSCREENREADER_REGKEY_LEGACY   "Control Panel\\Accessibility"

Definition at line 136 of file sysparams.c.

◆ SPI_SETSCREENREADER_VALNAME

#define SPI_SETSCREENREADER_VALNAME   "On"

Definition at line 135 of file sysparams.c.

◆ SPI_SETSCREENREADER_VALNAME_LEGACY

#define SPI_SETSCREENREADER_VALNAME_LEGACY   "Blind Access"

Definition at line 137 of file sysparams.c.

◆ SPI_SETSCREENSAVEACTIVE_REGKEY

#define SPI_SETSCREENSAVEACTIVE_REGKEY   "Control Panel\\Desktop"

Definition at line 104 of file sysparams.c.

◆ SPI_SETSCREENSAVEACTIVE_VALNAME

#define SPI_SETSCREENSAVEACTIVE_VALNAME   "ScreenSaveActive"

Definition at line 105 of file sysparams.c.

◆ SPI_SETSCREENSAVETIMEOUT_REGKEY

#define SPI_SETSCREENSAVETIMEOUT_REGKEY   "Control Panel\\Desktop"

Definition at line 102 of file sysparams.c.

◆ SPI_SETSCREENSAVETIMEOUT_VALNAME

#define SPI_SETSCREENSAVETIMEOUT_VALNAME   "ScreenSaveTimeOut"

Definition at line 103 of file sysparams.c.

◆ SPI_SETSHOWSOUNDS_REGKEY

#define SPI_SETSHOWSOUNDS_REGKEY   "Control Panel\\Accessibility\\ShowSounds"

Definition at line 128 of file sysparams.c.

◆ SPI_SETSHOWSOUNDS_VALNAME

#define SPI_SETSHOWSOUNDS_VALNAME   "On"

Definition at line 129 of file sysparams.c.

◆ SPI_SETSNAPTODEFBUTTON_REGKEY

#define SPI_SETSNAPTODEFBUTTON_REGKEY   "Control Panel\\Mouse"

Definition at line 149 of file sysparams.c.

◆ SPI_SETSNAPTODEFBUTTON_VALNAME

#define SPI_SETSNAPTODEFBUTTON_VALNAME   "SnapToDefaultButton"

Definition at line 150 of file sysparams.c.

◆ SPI_SETWORKAREA_REGKEY

#define SPI_SETWORKAREA_REGKEY   "Control Panel\\Desktop"

Definition at line 126 of file sysparams.c.

◆ SPI_SETWORKAREA_VALNAME

#define SPI_SETWORKAREA_VALNAME   "WINE_WorkArea"

Definition at line 127 of file sysparams.c.

◆ SPI_SMCAPTIONFONT_VALNAME

#define SPI_SMCAPTIONFONT_VALNAME   "SmCaptionFont"

Definition at line 82 of file sysparams.c.

◆ SPI_SMCAPTIONHEIGHT_VALNAME

#define SPI_SMCAPTIONHEIGHT_VALNAME   "SmCaptionHeight"

Definition at line 81 of file sysparams.c.

◆ SPI_SMCAPTIONWIDTH_VALNAME

#define SPI_SMCAPTIONWIDTH_VALNAME   "SmCaptionWidth"

Definition at line 80 of file sysparams.c.

◆ SPI_STATUSFONT_VALNAME

#define SPI_STATUSFONT_VALNAME   "StatusFont"

Definition at line 86 of file sysparams.c.

◆ TEST_NONCLIENTMETRICS_REG

#define TEST_NONCLIENTMETRICS_REG (   ncm)
Value:
do { \
/*FIXME: test_reg_metric2( SPI_SETBORDER_REGKEY2, SPI_SETBORDER_REGKEY, SPI_SETBORDER_VALNAME, (ncm).iBorderWidth);*/\
test_reg_metric( SPI_METRIC_REGKEY, SPI_SCROLLWIDTH_VALNAME, (ncm).iScrollWidth);\
test_reg_metric( SPI_METRIC_REGKEY, SPI_SCROLLHEIGHT_VALNAME, (ncm).iScrollHeight);\
/*FIXME: test_reg_metric( SPI_METRIC_REGKEY, SPI_CAPTIONWIDTH_VALNAME, (ncm).iCaptionWidth);*/\
test_reg_metric( SPI_METRIC_REGKEY, SPI_CAPTIONHEIGHT_VALNAME, (ncm).iCaptionHeight);\
test_reg_metric( SPI_METRIC_REGKEY, SPI_SMCAPTIONWIDTH_VALNAME, (ncm).iSmCaptionWidth);\
test_reg_metric( SPI_METRIC_REGKEY, SPI_SMCAPTIONHEIGHT_VALNAME, (ncm).iSmCaptionHeight);\
test_reg_metric( SPI_METRIC_REGKEY, SPI_MENUWIDTH_VALNAME, (ncm).iMenuWidth);\
test_reg_metric( SPI_METRIC_REGKEY, SPI_MENUHEIGHT_VALNAME, (ncm).iMenuHeight);\
test_reg_font( SPI_METRIC_REGKEY, SPI_MENUFONT_VALNAME, (ncm).lfMenuFont);\
test_reg_font( SPI_METRIC_REGKEY, SPI_CAPTIONFONT_VALNAME, (ncm).lfCaptionFont);\
test_reg_font( SPI_METRIC_REGKEY, SPI_SMCAPTIONFONT_VALNAME, (ncm).lfSmCaptionFont);\
test_reg_font( SPI_METRIC_REGKEY, SPI_STATUSFONT_VALNAME, (ncm).lfStatusFont);\
test_reg_font( SPI_METRIC_REGKEY, SPI_MESSAGEFONT_VALNAME, (ncm).lfMessageFont); } while(0)
#define SPI_MESSAGEFONT_VALNAME
Definition: sysparams.c:87
#define SPI_SCROLLHEIGHT_VALNAME
Definition: sysparams.c:76
#define SPI_CAPTIONFONT_VALNAME
Definition: sysparams.c:79
#define SPI_MENUFONT_VALNAME
Definition: sysparams.c:85
#define SPI_SCROLLWIDTH_VALNAME
Definition: sysparams.c:75
#define SPI_SMCAPTIONFONT_VALNAME
Definition: sysparams.c:82
#define SPI_CAPTIONHEIGHT_VALNAME
Definition: sysparams.c:78
#define SPI_MENUHEIGHT_VALNAME
Definition: sysparams.c:84
#define SPI_SMCAPTIONHEIGHT_VALNAME
Definition: sysparams.c:81
#define SPI_MENUWIDTH_VALNAME
Definition: sysparams.c:83
#define SPI_STATUSFONT_VALNAME
Definition: sysparams.c:86
#define SPI_SMCAPTIONWIDTH_VALNAME
Definition: sysparams.c:80
#define SPI_METRIC_REGKEY
Definition: sysparams.c:74

Definition at line 1450 of file sysparams.c.

◆ test_reg_font

#define test_reg_font (   KEY,
  VAL,
  LF 
)
Value:
do { \
LOGFONTA lfreg;\
lffromreg( KEY, VAL, &lfreg);\
ok( (lfreg.lfHeight < 0 ? (LF).lfHeight == MulDiv( lfreg.lfHeight, dpi, real_dpi ) : \
MulDiv( -(LF).lfHeight , 72, dpi) == lfreg.lfHeight )&&\
(LF).lfWidth == lfreg.lfWidth &&\
(LF).lfWeight == lfreg.lfWeight &&\
!strcmp( (LF).lfFaceName, lfreg.lfFaceName)\
, "wrong value \"%s\" in registry %d, %d\n", VAL, (LF).lfHeight, lfreg.lfHeight);\
} while(0)
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static int real_dpi
Definition: sysparams.c:59
static int dpi
Definition: sysparams.c:59
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
Definition: btrfs.h:143
LONG lfHeight
Definition: dimm.idl:42
LONG lfWeight
Definition: dimm.idl:46
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
LONG lfWidth
Definition: dimm.idl:43
#define LF
Definition: telnetd.h:24
#define VAL(data, px, pl, pos)
Definition: driver.h:91

Definition at line 1439 of file sysparams.c.

◆ test_reg_key

#define test_reg_key (   subKey,
  valName,
  testValue 
)     _test_reg_key( subKey, NULL, valName, NULL, testValue, REG_SZ, FALSE )

Definition at line 461 of file sysparams.c.

◆ test_reg_key_dword

#define test_reg_key_dword (   subKey,
  valName,
  testValue 
)     _test_reg_key( subKey, NULL, valName, NULL, testValue, REG_DWORD, FALSE )

Definition at line 471 of file sysparams.c.

◆ test_reg_key_ex

#define test_reg_key_ex (   subKey1,
  subKey2,
  valName,
  testValue 
)     _test_reg_key( subKey1, subKey2, valName, NULL, testValue, REG_SZ, FALSE )

Definition at line 465 of file sysparams.c.

◆ test_reg_key_ex2

#define test_reg_key_ex2 (   subKey1,
  subKey2,
  valName1,
  valName2,
  testValue 
)     _test_reg_key( subKey1, subKey2, valName1, valName2, testValue, REG_SZ, FALSE )

Definition at line 467 of file sysparams.c.

◆ test_reg_key_ex2_optional

#define test_reg_key_ex2_optional (   subKey1,
  subKey2,
  valName1,
  valName2,
  testValue 
)     _test_reg_key( subKey1, subKey2, valName1, valName2, testValue, REG_SZ, TRUE )

Definition at line 469 of file sysparams.c.

◆ test_reg_key_optional

#define test_reg_key_optional (   subKey,
  valName,
  testValue 
)     _test_reg_key( subKey, NULL, valName, NULL, testValue, REG_SZ, TRUE )

Definition at line 463 of file sysparams.c.

◆ test_reg_metric

#define test_reg_metric (   KEY,
  VAL,
  val 
)
Value:
do { \
INT regval;\
regval = metricfromreg( KEY, VAL, dpi);\
ok( regval==val, "wrong value \"%s\" in registry %d, expected %d\n", VAL, regval, val);\
} while(0)
GLuint GLfloat * val
Definition: glext.h:7180
static UINT metricfromreg(const char *keyname, const char *valname, int dpi)
Definition: sysparams.c:476
int32_t INT
Definition: typedefs.h:58

Definition at line 1426 of file sysparams.c.

◆ test_reg_metric2

#define test_reg_metric2 (   KEY1,
  KEY2,
  VAL,
  val 
)
Value:
do { \
INT regval;\
regval = metricfromreg( KEY1, VAL, dpi);\
if( regval != val) regval = metricfromreg( KEY2, VAL, dpi);\
ok( regval==val, "wrong value \"%s\" in registry %d, expected %d\n", VAL, regval, val);\
} while(0)

Definition at line 1432 of file sysparams.c.

◆ WINE_CURRENT_USER_REGKEY

#define WINE_CURRENT_USER_REGKEY   "Wine"

Definition at line 167 of file sysparams.c.

Typedef Documentation

◆ LPLOGFONT16

Function Documentation

◆ _GdiGetCharDimensions()

static LONG _GdiGetCharDimensions ( HDC  hdc,
LPTEXTMETRICA  lptm,
LONG height 
)
static

Definition at line 2608 of file sysparams.c.

2609{
2610 SIZE sz;
2611 static const CHAR alphabet[] = {
2612 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
2613 'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H',
2614 'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',0};
2615
2616 if(lptm && !GetTextMetricsA(hdc, lptm)) return 0;
2617
2618 if(!GetTextExtentPointA(hdc, alphabet, 52, &sz)) return 0;
2619
2620 if (height) *height = sz.cy;
2621 return (sz.cx / 26 + 1) / 2;
2622}
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
HDC hdc
Definition: main.c:9
static LPTEXTMETRICW lptm
Definition: font.c:42
LONG cx
Definition: windef.h:334
LONG cy
Definition: windef.h:335
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
Definition: text.c:200
BOOL WINAPI GetTextExtentPointA(_In_ HDC hdc, _In_reads_(c) LPCSTR lpString, _In_ int c, _Out_ LPSIZE lpsz)
char CHAR
Definition: xmlstorage.h:175

Referenced by get_text_metr_size().

◆ _test_reg_key()

static void _test_reg_key ( LPCSTR  subKey1,
LPCSTR  subKey2,
LPCSTR  valName1,
LPCSTR  valName2,
const void exp_value,
DWORD  exp_type,
BOOL  optional 
)
static

Definition at line 325 of file sysparams.c.

327{
329 DWORD valueLen;
330 DWORD type;
331 HKEY hKey;
332 LONG rc;
333 int found=0;
334
335 *value='\0';
336 valueLen=sizeof(value);
337 RegOpenKeyA( HKEY_CURRENT_USER, subKey1, &hKey );
338 rc=RegQueryValueExA( hKey, valName1, NULL, &type, (LPBYTE)value, &valueLen );
339 RegCloseKey( hKey );
340 if (rc==ERROR_SUCCESS)
341 {
342 ok( type == exp_type, "wrong type %u/%u\n", type, exp_type );
343 switch (exp_type)
344 {
345 case REG_DWORD:
346 ok( *(DWORD *)value == *(DWORD *)exp_value,
347 "Wrong value in registry: %s %s %08x/%08x\n",
348 subKey1, valName1, *(DWORD *)value, *(DWORD *)exp_value );
349 break;
350 case REG_SZ:
351 ok( !strcmp( exp_value, value ),
352 "Wrong value in registry: %s %s '%s' instead of '%s'\n",
353 subKey1, valName1, value, (const char *)exp_value );
354 break;
355 }
356 found++;
357 }
358 else if (strict)
359 {
360 ok(0,"Missing registry entry: subKey=%s, valName=%s\n",
361 subKey1, valName1);
362 }
363 if (valName2)
364 {
365 *value='\0';
366 valueLen=sizeof(value);
367 RegOpenKeyA( HKEY_CURRENT_USER, subKey1, &hKey );
368 rc=RegQueryValueExA( hKey, valName2, NULL, &type, (LPBYTE)value, &valueLen );
369 RegCloseKey( hKey );
370 if (rc==ERROR_SUCCESS)
371 {
372 ok( type == exp_type, "wrong type %u/%u\n", type, exp_type );
373 switch (exp_type)
374 {
375 case REG_DWORD:
376 ok( *(DWORD *)value == *(DWORD *)exp_value,
377 "Wrong value in registry: %s %s %08x/%08x\n",
378 subKey1, valName1, *(DWORD *)value, *(DWORD *)exp_value );
379 break;
380 case REG_SZ:
381 ok( !strcmp( exp_value, value ),
382 "Wrong value in registry: %s %s '%s' instead of '%s'\n",
383 subKey1, valName1, value, (const char *)exp_value );
384 break;
385 }
386 found++;
387 }
388 else if (strict)
389 {
390 ok( 0,"Missing registry entry: subKey=%s, valName=%s\n",
391 subKey1, valName2 );
392 }
393 }
394 if (subKey2 && !strict)
395 {
396 *value='\0';
397 valueLen=sizeof(value);
398 RegOpenKeyA( HKEY_CURRENT_USER, subKey2, &hKey );
399 rc=RegQueryValueExA( hKey, valName1, NULL, &type, (LPBYTE)value, &valueLen );
400 RegCloseKey( hKey );
401 if (rc==ERROR_SUCCESS)
402 {
403 ok( type == exp_type, "wrong type %u/%u\n", type, exp_type );
404 switch (exp_type)
405 {
406 case REG_DWORD:
407 ok( *(DWORD *)value == *(DWORD *)exp_value,
408 "Wrong value in registry: %s %s %08x/%08x\n",
409 subKey1, valName1, *(DWORD *)value, *(DWORD *)exp_value );
410 break;
411 case REG_SZ:
412 ok( !strcmp( exp_value, value ),
413 "Wrong value in registry: %s %s '%s' instead of '%s'\n",
414 subKey1, valName1, value, (const char *)exp_value );
415 break;
416 }
417 found++;
418 }
419 else if (strict)
420 {
421 ok( 0,"Missing registry entry: subKey=%s, valName=%s\n",
422 subKey2, valName1 );
423 }
424 if (valName2)
425 {
426 *value='\0';
427 valueLen=sizeof(value);
428 RegOpenKeyA( HKEY_CURRENT_USER, subKey2, &hKey );
429 rc=RegQueryValueExA( hKey, valName2, NULL, &type, (LPBYTE)value, &valueLen );
430 RegCloseKey( hKey );
431 if (rc==ERROR_SUCCESS)
432 {
433 ok( type == exp_type, "wrong type %u/%u\n", type, exp_type );
434 switch (exp_type)
435 {
436 case REG_DWORD:
437 ok( *(DWORD *)value == *(DWORD *)exp_value,
438 "Wrong value in registry: %s %s %08x/%08x\n",
439 subKey1, valName1, *(DWORD *)value, *(DWORD *)exp_value );
440 break;
441 case REG_SZ:
442 ok( !strcmp( exp_value, value ),
443 "Wrong value in registry: %s %s '%s' instead of '%s'\n",
444 subKey1, valName1, value, (const char *)exp_value );
445 break;
446 }
447 found++;
448 }
449 else if (strict)
450 {
451 ok( 0,"Missing registry entry: subKey=%s, valName=%s\n",
452 subKey2, valName2 );
453 }
454 }
455 }
456 ok(found || optional,
457 "Missing registry values: %s or %s in keys: %s or %s\n",
458 valName1, (valName2?valName2:"<n/a>"), subKey1, (subKey2?subKey2:"<n/a>") );
459}
#define ok(value,...)
Definition: atltest.h:57
#define RegCloseKey(hKey)
Definition: registry.h:47
@ optional
Definition: msg.h:41
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3257
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4027
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define REG_SZ
Definition: layer.c:22
static BOOL strict
Definition: sysparams.c:58
long LONG
Definition: pedump.c:60
#define REG_DWORD
Definition: sdbapi.c:596
unsigned char * LPBYTE
Definition: typedefs.h:53
Definition: pdh_main.c:94
#define HKEY_CURRENT_USER
Definition: winreg.h:11

◆ BOOL()

static BOOL ( WINAPI pIsProcessDPIAware)
static

◆ compare_font()

static void compare_font ( const LOGFONTW lf1,
const LOGFONTW lf2,
int  dpi,
int  custom_dpi,
int  line 
)
static

Definition at line 2918 of file sysparams.c.

2919{
2920 ok_(__FILE__,line)( lf1->lfHeight == MulDiv( lf2->lfHeight, dpi, custom_dpi ),
2921 "wrong lfHeight %d vs %d\n", lf1->lfHeight, lf2->lfHeight );
2922 ok_(__FILE__,line)( abs( lf1->lfWidth - MulDiv( lf2->lfWidth, dpi, custom_dpi )) <= 1,
2923 "wrong lfWidth %d vs %d\n", lf1->lfWidth, lf2->lfWidth );
2924 ok_(__FILE__,line)( !memcmp( &lf1->lfEscapement, &lf2->lfEscapement,
2925 offsetof( LOGFONTW, lfFaceName ) - offsetof( LOGFONTW, lfEscapement )),
2926 "font differs\n" );
2927 ok_(__FILE__,line)( !lstrcmpW( lf1->lfFaceName, lf2->lfFaceName ), "wrong face name %s vs %s\n",
2929}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ok_(x1, x2)
Definition: atltest.h:61
#define abs(i)
Definition: fconv.c:206
#define wine_dbgstr_w
Definition: kernel32.h:34
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define offsetof(TYPE, MEMBER)
LONG lfHeight
Definition: dimm.idl:59
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
LONG lfWidth
Definition: dimm.idl:60
LONG lfEscapement
Definition: dimm.idl:61
Definition: parser.c:49

Referenced by test_metrics_for_dpi().

◆ dotest_spi_iconhorizontalspacing()

static BOOL dotest_spi_iconhorizontalspacing ( INT  curr_val)
static

Definition at line 900 of file sysparams.c.

901{
902 BOOL rc;
903 INT spacing, regval, min_val = MulDiv( 32, dpi, USER_DEFAULT_SCREEN_DPI );
904 ICONMETRICSA im;
905
908 if (!test_error_msg(rc,"SPI_ICONHORIZONTALSPACING")) return FALSE;
909 ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
911 curr_val = max( curr_val, min_val );
912 /* The registry keys depend on the Windows version and the values too
913 * let's test (works on win95,ME,NT4,2k,XP)
914 */
916 if( regval != curr_val)
918 ok( curr_val == regval,
919 "wrong value in registry %d, expected %d\n", regval, curr_val);
920 /* compare with what SPI_ICONHORIZONTALSPACING returns */
922 ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
923 eq( spacing, curr_val, "ICONHORIZONTALSPACING", "%d");
924 /* and with a system metrics */
925 eq( GetSystemMetrics( SM_CXICONSPACING ), curr_val, "SM_CXICONSPACING", "%d" );
926 /* and with what SPI_GETICONMETRICS returns */
927 im.cbSize = sizeof(ICONMETRICSA);
928 rc=SystemParametersInfoA( SPI_GETICONMETRICS, sizeof(ICONMETRICSA), &im, FALSE );
929 ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
930 eq( im.iHorzSpacing, curr_val, "SPI_GETICONMETRICS", "%d" );
931 return TRUE;
932}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SPI_ICONHORIZONTALSPACING_REGKEY2
Definition: sysparams.c:92
#define eq(received, expected, label, type)
Definition: sysparams.c:61
static void test_change_message(int action, int optional)
Definition: sysparams.c:279
#define SPI_ICONHORIZONTALSPACING_REGKEY
Definition: sysparams.c:91
#define SPI_ICONHORIZONTALSPACING_VALNAME
Definition: sysparams.c:93
static BOOL test_error_msg(int rc, const char *name)
Definition: sysparams.c:293
#define max(a, b)
Definition: svc.c:63
DWORD WINAPI GetLastError(void)
Definition: except.c:1040
#define SPIF_SENDCHANGE
Definition: winuser.h:1562
#define SPIF_UPDATEINIFILE
Definition: winuser.h:1561
BOOL WINAPI SystemParametersInfoA(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define SPI_ICONHORIZONTALSPACING
Definition: winuser.h:1352
#define USER_DEFAULT_SCREEN_DPI
Definition: winuser.h:2883
#define SM_CXICONSPACING
Definition: winuser.h:995

Referenced by test_SPI_ICONHORIZONTALSPACING().

◆ dotest_spi_iconverticalspacing()

static BOOL dotest_spi_iconverticalspacing ( INT  curr_val)
static

Definition at line 1069 of file sysparams.c.

1070{
1071 BOOL rc;
1072 INT spacing, regval, min_val = MulDiv( 32, dpi, USER_DEFAULT_SCREEN_DPI );
1073 ICONMETRICSA im;
1074
1077 if (!test_error_msg(rc,"SPI_ICONVERTICALSPACING")) return FALSE;
1078 ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
1080 curr_val = max( curr_val, min_val );
1081 /* The registry keys depend on the Windows version and the values too
1082 * let's test (works on win95,ME,NT4,2k,XP)
1083 */
1085 if( regval != curr_val)
1087 ok( curr_val == regval,
1088 "wrong value in registry %d, expected %d\n", regval, curr_val);
1089 /* compare with what SPI_ICONVERTICALSPACING returns */
1090 rc=SystemParametersInfoA( SPI_ICONVERTICALSPACING, 0, &spacing, 0 );
1091 ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
1092 eq( spacing, curr_val, "ICONVERTICALSPACING", "%d" );
1093 /* and with a system metrics */
1094 eq( GetSystemMetrics( SM_CYICONSPACING ), curr_val, "SM_CYICONSPACING", "%d" );
1095 /* and with what SPI_GETICONMETRICS returns */
1096 im.cbSize = sizeof(ICONMETRICSA);
1097 rc=SystemParametersInfoA( SPI_GETICONMETRICS, sizeof(ICONMETRICSA), &im, FALSE );
1098 ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
1099 eq( im.iVertSpacing, curr_val, "SPI_GETICONMETRICS", "%d" );
1100 return TRUE;
1101}
#define SPI_ICONVERTICALSPACING_REGKEY2
Definition: sysparams.c:95
#define SPI_ICONVERTICALSPACING_VALNAME
Definition: sysparams.c:96
#define SPI_ICONVERTICALSPACING_REGKEY
Definition: sysparams.c:94
#define SPI_ICONVERTICALSPACING
Definition: winuser.h:1363
#define SM_CYICONSPACING
Definition: winuser.h:996

Referenced by test_SPI_ICONVERTICALSPACING().

◆ DPI_AWARENESS()

static DPI_AWARENESS ( WINAPI pGetAwarenessFromDpiAwarenessContext)
static

◆ DPI_AWARENESS_CONTEXT()

static DPI_AWARENESS_CONTEXT ( WINAPI pGetThreadDpiAwarenessContext)
static

◆ dpi_winproc()

static LRESULT CALLBACK dpi_winproc ( HWND  hwnd,
UINT  msg,
WPARAM  wp,
LPARAM  lp 
)
static

Definition at line 3733 of file sysparams.c.

3734{
3735 DPI_AWARENESS_CONTEXT ctx = pGetWindowDpiAwarenessContext( hwnd );
3736 DPI_AWARENESS_CONTEXT ctx2 = pGetThreadDpiAwarenessContext();
3737 DWORD pos, pos2;
3738
3739 ok( pGetAwarenessFromDpiAwarenessContext( ctx ) == pGetAwarenessFromDpiAwarenessContext( ctx2 ),
3740 "msg %04x wrong awareness %p / %p\n", msg, ctx, ctx2 );
3741 pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_UNAWARE );
3742 pos = GetMessagePos();
3743 pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );
3744 pos2 = GetMessagePos();
3745 ok( pos == pos2, "wrong pos %08x / %08x\n", pos, pos2 );
3746 pSetThreadDpiAwarenessContext( ctx2 );
3747 return DefWindowProcA( hwnd, msg, wp, lp );
3748}
#define msg(x)
Definition: auth_time.c:54
static UINT UINT *static DPI_AWARENESS_CONTEXT(WINAPI *pGetThreadDpiAwarenessContext)(void)
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define DPI_AWARENESS_CONTEXT_UNAWARE
Definition: windef.h:292
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE
Definition: windef.h:294
DWORD WINAPI GetMessagePos(void)
Definition: message.c:1351
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by START_TEST(), and test_dpi_window().

◆ enum_all_fonts_proc()

static INT CALLBACK enum_all_fonts_proc ( const LOGFONTA elf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lparam 
)
static

Definition at line 2673 of file sysparams.c.

2674{
2675 return lstrcmpiA(elf->lfFaceName, (const char *)lparam);
2676}
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
static UINT WPARAM LPARAM lparam
Definition: combo.c:716

Referenced by is_font_enumerated().

◆ get_cursor_size()

static int get_cursor_size ( int  size)
static

Definition at line 2690 of file sysparams.c.

2691{
2692 /* only certain sizes are allowed for cursors */
2693 if (size >= 64) return 64;
2694 if (size >= 48) return 48;
2695 return 32;
2696}
GLsizeiptr size
Definition: glext.h:5919

Referenced by test_GetSystemMetrics().

◆ get_real_dpi()

static DWORD get_real_dpi ( void  )
static

Definition at line 200 of file sysparams.c.

201{
202 DWORD dpi;
203
204 if (pSetThreadDpiAwarenessContext)
205 {
206 DPI_AWARENESS_CONTEXT context = pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_SYSTEM_AWARE );
207 dpi = pGetDpiForSystem();
208 pSetThreadDpiAwarenessContext( context );
209 return dpi;
210 }
211 if (get_reg_dword(HKEY_CURRENT_USER, "Control Panel\\Desktop", "LogPixels", &dpi))
212 return dpi;
213 if (get_reg_dword(HKEY_CURRENT_CONFIG, "Software\\Fonts", "LogPixels", &dpi))
214 return dpi;
216}
static BOOL get_reg_dword(HKEY base, const char *key_name, const char *value_name, DWORD *value)
Definition: sysparams.c:181
Definition: http.c:7252
#define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE
Definition: windef.h:293
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15

Referenced by START_TEST().

◆ get_reg_dword()

static BOOL get_reg_dword ( HKEY  base,
const char key_name,
const char value_name,
DWORD value 
)
static

Definition at line 181 of file sysparams.c.

182{
183 HKEY key;
184 DWORD type, data, size = sizeof(data);
185 BOOL ret = FALSE;
186
188 {
189 if (RegQueryValueExA(key, value_name, NULL, &type, (void *)&data, &size) == ERROR_SUCCESS &&
190 type == REG_DWORD)
191 {
192 *value = data;
193 ret = TRUE;
194 }
196 }
197 return ret;
198}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
Definition: copy.c:22
int ret

Referenced by get_real_dpi().

◆ get_text_metr_size()

static void get_text_metr_size ( HDC  hdc,
LOGFONTA plf,
TEXTMETRICA ptm,
UINT psz 
)
static

Definition at line 2626 of file sysparams.c.

2627{
2628 HFONT hfont, hfontsav;
2630 if( !ptm) ptm = &tm;
2631 hfont = CreateFontIndirectA( plf);
2632 if( !hfont || ( hfontsav = SelectObject( hdc, hfont)) == NULL ) {
2633 ptm->tmHeight = -1;
2634 if( psz) *psz = 10;
2635 if( hfont) DeleteObject( hfont);
2636 return;
2637 }
2638 GetTextMetricsA( hdc, ptm);
2639 if( psz)
2640 if( !(*psz = _GdiGetCharDimensions( hdc, ptm, NULL)))
2641 *psz = 10;
2642 SelectObject( hdc, hfontsav);
2644}
static HFONT hfont
pKey DeleteObject()
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static LONG _GdiGetCharDimensions(HDC hdc, LPTEXTMETRICA lptm, LONG *height)
Definition: sysparams.c:2608
LONG tmHeight
Definition: wingdi.h:2361
Definition: time.h:68
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539

Referenced by test_GetSystemMetrics().

◆ get_tmheight()

static int get_tmheight ( LOGFONTA plf,
int  flag 
)
static

Definition at line 1467 of file sysparams.c.

1468{
1470 HDC hdc = GetDC(0);
1475 ReleaseDC( 0, hdc );
1476 return tm.tmHeight + (flag ? tm.tmExternalLeading : 0);
1477}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
static HDC
Definition: imagelist.c:92
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by test_SPI_SETNONCLIENTMETRICS().

◆ get_tmheightW()

static int get_tmheightW ( LOGFONTW plf,
int  flag 
)
static

Definition at line 1479 of file sysparams.c.

1480{
1482 HDC hdc = GetDC(0);
1487 ReleaseDC( 0, hdc );
1488 return tm.tmHeight + (flag ? tm.tmExternalLeading : 0);
1489}
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)

Referenced by test_metrics_for_dpi().

◆ INT()

static INT ( WINAPI pGetSystemMetricsForDpi)
static

◆ is_font_enumerated()

static BOOL is_font_enumerated ( const char name)
static

Definition at line 2678 of file sysparams.c.

2679{
2681 BOOL ret = FALSE;
2682
2684 ret = TRUE;
2685
2686 DeleteDC(hdc);
2687 return ret;
2688}
static INT CALLBACK enum_all_fonts_proc(const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lparam)
Definition: sysparams.c:2673
Definition: name.c:39
LONG_PTR LPARAM
Definition: windef.h:208
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
int WINAPI EnumFontFamiliesA(_In_ HDC, _In_opt_ LPCSTR, _In_ FONTENUMPROCA, _In_ LPARAM)
BOOL WINAPI DeleteDC(_In_ HDC)

Referenced by test_GetSystemMetrics().

◆ lffromreg()

static int lffromreg ( const char keyname,
const char valname,
LOGFONTA plf 
)
static

Definition at line 514 of file sysparams.c.

515{
516 HKEY hkey;
517 LOGFONTW lfw;
518 DWORD ret, size, type;
519
520 RegOpenKeyA( HKEY_CURRENT_USER, keyname, &hkey );
521 size = sizeof( lfw);
522 ret=RegQueryValueExA( hkey, valname, NULL, &type, (LPBYTE)&lfw, &size );
523 RegCloseKey( hkey );
524 ok( ret == ERROR_SUCCESS, "Key \"%s\" value \"%s\" not found\n", keyname, valname);
525 if( ret != ERROR_SUCCESS)
526 return FALSE;
527 if( size <= sizeof( LOGFONT16)) {
528 LOGFONT16 *plf16 = (LOGFONT16*) &lfw;
529 plf->lfHeight = plf16->lfHeight;
530 plf->lfWidth = plf16->lfWidth;
531 plf->lfEscapement = plf16->lfEscapement;
532 plf->lfOrientation = plf16->lfOrientation;
533 plf->lfWeight = plf16->lfWeight;
534 plf->lfItalic = plf16->lfItalic;
535 plf->lfUnderline = plf16->lfUnderline;
536 plf->lfStrikeOut = plf16->lfStrikeOut;
537 plf->lfCharSet = plf16->lfCharSet;
538 plf->lfOutPrecision = plf16->lfOutPrecision;
539 plf->lfClipPrecision = plf16->lfClipPrecision;
540 plf->lfQuality = plf16->lfQuality;
542 memcpy( plf->lfFaceName, plf16->lfFaceName, LF_FACESIZE );
543 } else if( size <= sizeof( LOGFONTA)) {
544 plf = (LOGFONTA*) &lfw;
545 } else {
546 plf->lfHeight = lfw.lfHeight;
547 plf->lfWidth = lfw.lfWidth;
548 plf->lfEscapement = lfw.lfEscapement;
549 plf->lfOrientation = lfw.lfOrientation;
550 plf->lfWeight = lfw.lfWeight;
551 plf->lfItalic = lfw.lfItalic;
552 plf->lfUnderline = lfw.lfUnderline;
553 plf->lfStrikeOut = lfw.lfStrikeOut;
554 plf->lfCharSet = lfw.lfCharSet;
557 plf->lfQuality = lfw.lfQuality;
561
562 }
563 return TRUE;
564}
#define LF_FACESIZE
Definition: dimm.idl:39
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BYTE lfStrikeOut
Definition: sysparams.c:504
BYTE lfCharSet
Definition: sysparams.c:505
BYTE lfPitchAndFamily
Definition: sysparams.c:509
BYTE lfClipPrecision
Definition: sysparams.c:507
CHAR lfFaceName[LF_FACESIZE]
Definition: sysparams.c:510
BYTE lfUnderline
Definition: sysparams.c:503
INT16 lfWeight
Definition: sysparams.c:501
INT16 lfHeight
Definition: sysparams.c:497
INT16 lfEscapement
Definition: sysparams.c:499
INT16 lfWidth
Definition: sysparams.c:498
BYTE lfOutPrecision
Definition: sysparams.c:506
BYTE lfQuality
Definition: sysparams.c:508
BYTE lfItalic
Definition: sysparams.c:502
INT16 lfOrientation
Definition: sysparams.c:500
BYTE lfStrikeOut
Definition: dimm.idl:49
BYTE lfClipPrecision
Definition: dimm.idl:52
BYTE lfUnderline
Definition: dimm.idl:48
BYTE lfQuality
Definition: dimm.idl:53
BYTE lfOutPrecision
Definition: dimm.idl:51
LONG lfOrientation
Definition: dimm.idl:45
BYTE lfItalic
Definition: dimm.idl:47
BYTE lfPitchAndFamily
Definition: dimm.idl:54
LONG lfEscapement
Definition: dimm.idl:44
BYTE lfCharSet
Definition: dimm.idl:50
BYTE lfOutPrecision
Definition: dimm.idl:68
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfItalic
Definition: dimm.idl:64
LONG lfWeight
Definition: dimm.idl:63
LONG lfOrientation
Definition: dimm.idl:62
BYTE lfUnderline
Definition: dimm.idl:65
BYTE lfClipPrecision
Definition: dimm.idl:69
BYTE lfCharSet
Definition: dimm.idl:67
BYTE lfQuality
Definition: dimm.idl:70
BYTE lfPitchAndFamily
Definition: dimm.idl:71

◆ LONG()

static LONG ( WINAPI pChangeDisplaySettingsExA)
static

◆ metricfromreg()

static UINT metricfromreg ( const char keyname,
const char valname,
int  dpi 
)
static

Definition at line 476 of file sysparams.c.

477{
478 HKEY hkey;
479 char buf[64];
480 DWORD ret;
481 DWORD size, type;
482 int value;
483
484 RegOpenKeyA( HKEY_CURRENT_USER, keyname, &hkey );
485 size = sizeof(buf);
486 ret=RegQueryValueExA( hkey, valname, NULL, &type, (LPBYTE)buf, &size );
487 RegCloseKey( hkey );
488 if( ret != ERROR_SUCCESS) return -1;
489 value = atoi( buf);
490 if( value < 0)
491 value = ( -value * dpi + 720) / 1440;
492 return value;
493}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)

Referenced by dotest_spi_iconhorizontalspacing(), dotest_spi_iconverticalspacing(), test_GetSystemMetrics(), test_setborder(), test_SPI_SETBORDER(), test_SPI_SETICONMETRICS(), test_SPI_SETICONTITLEWRAP(), test_SPI_SETMINIMIZEDMETRICS(), and test_SPI_SETNONCLIENTMETRICS().

◆ run_spi_setmouse_test()

static BOOL run_spi_setmouse_test ( int  curr_val[],
POINT req_change,
POINT proj_change,
int  nchange 
)
static

Definition at line 635 of file sysparams.c.

636{
637 BOOL rc;
638 INT mi[3];
639 static int aw_turn = 0;
640
641 char buf[20];
642 int i;
643
644 aw_turn++;
645 rc = FALSE;
646 SetLastError(0xdeadbeef);
647 if (aw_turn % 2) /* call unicode on odd (non even) calls */
649 else
651 if (!test_error_msg(rc,"SPI_SETMOUSE")) return FALSE;
652
653 ok(rc, "SystemParametersInfo: rc=%d err=%d\n", rc, GetLastError());
655 for (i = 0; i < 3; i++)
656 {
657 sprintf( buf, "%d", curr_val[i] );
659 }
660
662 ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
663 for (i = 0; i < 3; i++)
664 {
665 ok(mi[i] == curr_val[i],
666 "incorrect value for %d: %d != %d\n", i, mi[i], curr_val[i]);
667 }
668
670 ok(rc, "SystemParametersInfoW: rc=%d err=%d\n", rc, GetLastError());
671 for (i = 0; i < 3; i++)
672 {
673 ok(mi[i] == curr_val[i],
674 "incorrect value for %d: %d != %d\n", i, mi[i], curr_val[i]);
675 }
676
677 if (0)
678 {
679 /* FIXME: this always fails for me - AJ */
680 for (i = 0; i < nchange; i++)
681 {
682 POINT mv;
684 mouse_event( MOUSEEVENTF_MOVE, req_change[i].x, req_change[i].y, 0, 0 );
685 GetCursorPos( &mv );
686 ok( proj_change[i].x == mv.x, "Projected dx and real dx comparison. May fail under high load.\n" );
687 ok( proj_change[i].y == mv.y, "Projected dy equals real dy. May fail under high load.\n" );
688 }
689 }
690 return TRUE;
691}
#define SetLastError(x)
Definition: compat.h:752
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static const char * setmouse_valuenames[3]
Definition: sysparams.c:626
#define SPI_SETMOUSE_REGKEY
Definition: sysparams.c:67
#define test_reg_key(subKey, valName, testValue)
Definition: sysparams.c:461
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
static MONITORINFO mi
Definition: win.c:7338
#define MOUSEEVENTF_ABSOLUTE
Definition: winuser.h:1184
void WINAPI mouse_event(_In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ ULONG_PTR)
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2639
#define SPI_GETMOUSE
Definition: winuser.h:1345
#define MOUSEEVENTF_MOVE
Definition: winuser.h:1173
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define SPI_SETMOUSE
Definition: winuser.h:1346

Referenced by test_SPI_SETMOUSE().

◆ scale_point_dpi()

static void scale_point_dpi ( POINT pt,
UINT  src_dpi,
UINT  target_dpi 
)
static

Definition at line 3182 of file sysparams.c.

3183{
3184 pt->x = MulDiv( pt->x, target_dpi, src_dpi );
3185 pt->y = MulDiv( pt->y, target_dpi, src_dpi );
3186}
#define pt(x, y)
Definition: drawing.c:79

Referenced by scale_point_dpi_aware().

◆ scale_point_dpi_aware()

static void scale_point_dpi_aware ( POINT pt,
DPI_AWARENESS  from,
DPI_AWARENESS  to 
)
static

Definition at line 3196 of file sysparams.c.

3197{
3202}
static void scale_point_dpi(POINT *pt, UINT src_dpi, UINT target_dpi)
Definition: sysparams.c:3182
CardRegion * from
Definition: spigame.cpp:19
@ DPI_AWARENESS_UNAWARE
Definition: windef.h:287

Referenced by test_dpi_mapping().

◆ scale_rect_dpi()

static void scale_rect_dpi ( RECT rect,
UINT  src_dpi,
UINT  target_dpi 
)
static

Definition at line 3188 of file sysparams.c.

3189{
3190 rect->left = MulDiv( rect->left, target_dpi, src_dpi );
3191 rect->top = MulDiv( rect->top, target_dpi, src_dpi );
3192 rect->right = MulDiv( rect->right, target_dpi, src_dpi );
3193 rect->bottom = MulDiv( rect->bottom, target_dpi, src_dpi );
3194}
& rect
Definition: startmenu.cpp:1413

Referenced by scale_rect_dpi_aware(), and test_dpi_mapping().

◆ scale_rect_dpi_aware()

static void scale_rect_dpi_aware ( RECT rect,
DPI_AWARENESS  from,
DPI_AWARENESS  to 
)
static

Definition at line 3204 of file sysparams.c.

3205{
3210}
static void scale_rect_dpi(RECT *rect, UINT src_dpi, UINT target_dpi)
Definition: sysparams.c:3188

Referenced by test_dpi_mapping().

◆ START_TEST()

START_TEST ( sysparams  )

Definition at line 3892 of file sysparams.c.

3893{
3894 int argc;
3895 char** argv;
3896 WNDCLASSA wc;
3897 MSG msg;
3898 HDC hdc;
3902
3903 hdll = GetModuleHandleA("user32.dll");
3904 pChangeDisplaySettingsExA = (void*)GetProcAddress(hdll, "ChangeDisplaySettingsExA");
3905 pIsProcessDPIAware = (void*)GetProcAddress(hdll, "IsProcessDPIAware");
3906 pSetProcessDPIAware = (void*)GetProcAddress(hdll, "SetProcessDPIAware");
3907 pGetDpiForSystem = (void*)GetProcAddress(hdll, "GetDpiForSystem");
3908 pGetDpiForWindow = (void*)GetProcAddress(hdll, "GetDpiForWindow");
3909 pGetDpiForMonitorInternal = (void*)GetProcAddress(hdll, "GetDpiForMonitorInternal");
3910 pSetProcessDpiAwarenessContext = (void*)GetProcAddress(hdll, "SetProcessDpiAwarenessContext");
3911 pGetProcessDpiAwarenessInternal = (void*)GetProcAddress(hdll, "GetProcessDpiAwarenessInternal");
3912 pSetProcessDpiAwarenessInternal = (void*)GetProcAddress(hdll, "SetProcessDpiAwarenessInternal");
3913 pGetThreadDpiAwarenessContext = (void*)GetProcAddress(hdll, "GetThreadDpiAwarenessContext");
3914 pSetThreadDpiAwarenessContext = (void*)GetProcAddress(hdll, "SetThreadDpiAwarenessContext");
3915 pGetWindowDpiAwarenessContext = (void*)GetProcAddress(hdll, "GetWindowDpiAwarenessContext");
3916 pGetAwarenessFromDpiAwarenessContext = (void*)GetProcAddress(hdll, "GetAwarenessFromDpiAwarenessContext");
3917 pIsValidDpiAwarenessContext = (void*)GetProcAddress(hdll, "IsValidDpiAwarenessContext");
3918 pGetSystemMetricsForDpi = (void*)GetProcAddress(hdll, "GetSystemMetricsForDpi");
3919 pSystemParametersInfoForDpi = (void*)GetProcAddress(hdll, "SystemParametersInfoForDpi");
3920 pAdjustWindowRectExForDpi = (void*)GetProcAddress(hdll, "AdjustWindowRectExForDpi");
3921 pLogicalToPhysicalPointForPerMonitorDPI = (void*)GetProcAddress(hdll, "LogicalToPhysicalPointForPerMonitorDPI");
3922 pPhysicalToLogicalPointForPerMonitorDPI = (void*)GetProcAddress(hdll, "PhysicalToLogicalPointForPerMonitorDPI");
3923 pGetAutoRotationState = (void*)GetProcAddress(hdll, "GetAutoRotationState");
3924
3926 hdc = GetDC(0);
3929 trace("dpi %d real_dpi %d\n", dpi, real_dpi);
3930 ReleaseDC( 0, hdc);
3931
3932 /* This test requires interactivity, if we don't have it, give up */
3935
3937 strict=(argc >= 3 && strcmp(argv[2],"strict")==0);
3938 trace("strict=%d\n",strict);
3939
3940 trace("testing GetSystemMetrics with your current desktop settings\n");
3942 test_metrics_for_dpi( 192 );
3946
3947 change_counter = 0;
3949
3950 wc.lpszClassName = "SysParamsTestClass";
3953 wc.hInstance = hInstance;
3955 wc.hCursor = LoadCursorA( 0, (LPCSTR)IDC_ARROW );
3956 wc.hbrBackground = (HBRUSH)( COLOR_WINDOW + 1 );
3957 wc.lpszMenuName = 0;
3958 wc.cbClsExtra = 0;
3959 wc.cbWndExtra = 0;
3960 RegisterClassA( &wc );
3961 wc.lpszClassName = "DpiTestClass";
3963 RegisterClassA( &wc );
3964
3965 ghTestWnd = CreateWindowA( "SysParamsTestClass", "Test System Parameters Application",
3966 WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, hInstance, NULL );
3967
3969 assert( hThread );
3971
3972 while( GetMessageA( &msg, 0, 0, 0 )) {
3975 }
3976
3977 if (pSetThreadDpiAwarenessContext)
3978 {
3982 }
3983 else win_skip( "SetThreadDpiAwarenessContext not supported\n" );
3984
3986}
static int argc
Definition: ServiceArgs.c:12
#define trace
Definition: atltest.h:70
HINSTANCE hInstance
Definition: charmap.c:19
#define CloseHandle
Definition: compat.h:739
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
#define assert(x)
Definition: debug.h:53
DWORD dwThreadId
Definition: fdebug.c:31
static void test_EnumDisplaySettings(void)
Definition: sysparams.c:3077
static DWORD WINAPI SysParamsThreadFunc(LPVOID lpParam)
Definition: sysparams.c:2550
static int change_last_param
Definition: sysparams.c:176
static void test_dpi_context(void)
Definition: sysparams.c:3532
static LRESULT CALLBACK dpi_winproc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
Definition: sysparams.c:3733
static void test_dpi_mapping(void)
Definition: sysparams.c:3212
static void test_dpi_window(void)
Definition: sysparams.c:3750
static void test_GetSysColorBrush(void)
Definition: sysparams.c:3117
static void test_GetAutoRotationState(void)
Definition: sysparams.c:3871
static int change_counter
Definition: sysparams.c:174
static DWORD get_real_dpi(void)
Definition: sysparams.c:200
static void test_GetSystemMetrics(void)
Definition: sysparams.c:2698
static LRESULT CALLBACK SysParamsTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: sysparams.c:218
static void test_dpi_aware(void)
Definition: sysparams.c:3510
static HWND ghTestWnd
Definition: sysparams.c:169
static void test_metrics_for_dpi(int custom_dpi)
Definition: sysparams.c:2931
#define argv
Definition: mplay32.c:18
HANDLE hThread
Definition: wizard.c:28
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define win_skip
Definition: test.h:160
int winetest_get_mainargs(char ***pargv)
static PVOID hdll
Definition: shimdbg.c:126
HBRUSH hbrBackground
Definition: winuser.h:3160
HICON hIcon
Definition: winuser.h:3158
HINSTANCE hInstance
Definition: winuser.h:3157
HCURSOR hCursor
Definition: winuser.h:3159
int cbWndExtra
Definition: winuser.h:3156
UINT style
Definition: winuser.h:3153
LPCSTR lpszMenuName
Definition: winuser.h:3161
LPCSTR lpszClassName
Definition: winuser.h:3162
WNDPROC lpfnWndProc
Definition: winuser.h:3154
int cbClsExtra
Definition: winuser.h:3155
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION
Definition: winerror.h:940
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LOGPIXELSY
Definition: wingdi.h:719
#define CS_VREDRAW
Definition: winuser.h:653
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define COLOR_WINDOW
Definition: winuser.h:912
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4305
#define SPI_SETBEEP
Definition: winuser.h:1344
#define CS_HREDRAW
Definition: winuser.h:648
#define IDC_ARROW
Definition: winuser.h:682
#define IDI_APPLICATION
Definition: winuser.h:699
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HICON WINAPI LoadIconA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2029
#define CS_OWNDC
Definition: winuser.h:650
BOOL WINAPI GetMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
const char * LPCSTR
Definition: xmlstorage.h:183

◆ SysParamsTestWndProc()

static LRESULT CALLBACK SysParamsTestWndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 218 of file sysparams.c.

220{
221 switch (msg) {
222
223 case WM_DISPLAYCHANGE:
224 ok(displaychange_ok, "Unexpected WM_DISPLAYCHANGE message\n");
228 break;
229
230 case WM_SETTINGCHANGE:
231 if (change_counter>0) {
232 /* ignore these messages caused by resizing of toolbars */
233 if( wParam == SPI_SETWORKAREA){
235 break;
236 } else if( wParam == SPI_ICONVERTICALSPACING) {
238 break;
239 } else if( displaychange_test_active)
240 break;
241 if( !change_last_param){
243 break;
244 }
245 ok(0,"too many changes counter=%d last change=%d\n",
249 break;
250 }
253 if( wParam == SPI_SETWORKAREA)
257 else
259 break;
260
261 case WM_DESTROY:
262 PostQuitMessage( 0 );
263 break;
264
265 /* drop through */
266 default:
267 return( DefWindowProcA( hWnd, msg, wParam, lParam ) );
268 }
269
270 return 0;
271}
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static BOOL displaychange_test_active
Definition: sysparams.c:178
static BOOL displaychange_ok
Definition: sysparams.c:178
static int change_setworkarea_param
Definition: sysparams.c:175
static HANDLE displaychange_sem
Definition: sysparams.c:179
static int change_iconverticalspacing_param
Definition: sysparams.c:175
static int last_bpp
Definition: sysparams.c:177
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
Definition: synch.c:542
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_SETTINGCHANGE
Definition: winuser.h:1619
#define WM_DESTROY
Definition: winuser.h:1599

Referenced by START_TEST().

◆ SysParamsThreadFunc()

static DWORD WINAPI SysParamsThreadFunc ( LPVOID  lpParam)
static

Definition at line 2550 of file sysparams.c.

2551{
2552 test_SPI_SETBEEP(); /* 1 */
2553 test_SPI_SETMOUSE(); /* 4 */
2554 test_SPI_SETBORDER(); /* 6 */
2555 test_SPI_SETKEYBOARDSPEED(); /* 10 */
2559 test_SPI_SETGRIDGRANULARITY(); /* 19 */
2560 test_SPI_SETKEYBOARDDELAY(); /* 23 */
2562 test_SPI_SETICONTITLEWRAP(); /* 26 */
2564 test_SPI_SETDOUBLECLKWIDTH(); /* 29 */
2565 test_SPI_SETDOUBLECLKHEIGHT(); /* 30 */
2566 test_SPI_SETDOUBLECLICKTIME(); /* 32 */
2567 test_SPI_SETMOUSEBUTTONSWAP(); /* 33 */
2568 test_SPI_SETFASTTASKSWITCH(); /* 36 */
2569 test_SPI_SETDRAGFULLWINDOWS(); /* 37 */
2570 /* test_WM_DISPLAYCHANGE seems to be somewhat buggy on
2571 * some versions of Windows (Vista, Win2k8, Win7B) in that
2572 * not all metrics are properly restored. Problems are
2573 * SM_CXMAXTRACK, SM_CYMAXTRACK
2574 * Fortunately setting the Non-Client metrics like in
2575 * test_SPI_SETNONCLIENTMETRICS will correct this. That is why
2576 * we do the DISPLAY change now... */
2580 test_SPI_SETICONMETRICS(); /* 46 */
2581 test_SPI_SETWORKAREA(); /* 47 */
2582 test_SPI_SETSHOWSOUNDS(); /* 57 */
2583 test_SPI_SETKEYBOARDPREF(); /* 69 */
2584 test_SPI_SETSCREENREADER(); /* 71 */
2585 test_SPI_SETFONTSMOOTHING(); /* 75 */
2586 test_SPI_SETLOWPOWERACTIVE(); /* 85 */
2587 test_SPI_SETPOWEROFFACTIVE(); /* 86 */
2588 test_SPI_SETSNAPTODEFBUTTON(); /* 95 */
2589 test_SPI_SETMOUSEHOVERWIDTH(); /* 99 */
2590 test_SPI_SETMOUSEHOVERHEIGHT(); /* 101 */
2591 test_SPI_SETMOUSEHOVERTIME(); /* 103 */
2592 test_SPI_SETWHEELSCROLLLINES(); /* 105 */
2593 test_SPI_SETMENUSHOWDELAY(); /* 107 */
2594 test_SPI_SETWHEELSCROLLCHARS(); /* 108 */
2595 test_SPI_SETWALLPAPER(); /* 115 */
2596
2597
2599 return 0;
2600}
static void test_SPI_SETSCREENREADER(void)
Definition: sysparams.c:1986
static void test_SPI_SETBORDER(void)
Definition: sysparams.c:805
static void test_SPI_SETWHEELSCROLLLINES(void)
Definition: sysparams.c:2328
static void test_SPI_SETICONMETRICS(void)
Definition: sysparams.c:1743
static void test_SPI_SETKEYBOARDDELAY(void)
Definition: sysparams.c:1031
static void test_SPI_SETLOWPOWERACTIVE(void)
Definition: sysparams.c:2102
static void test_SPI_SETSHOWSOUNDS(void)
Definition: sysparams.c:1914
static void test_SPI_SETKEYBOARDSPEED(void)
Definition: sysparams.c:864
static void test_SPI_SETICONTITLEWRAP(void)
Definition: sysparams.c:1124
static void test_SPI_SETWALLPAPER(void)
Definition: sysparams.c:2444
static void test_SPI_SETBEEP(void)
Definition: sysparams.c:566
static void test_SPI_SETMOUSEHOVERWIDTH(void)
Definition: sysparams.c:2213
static void test_SPI_SETMOUSEBUTTONSWAP(void)
Definition: sysparams.c:1339
static void test_SPI_SETKEYBOARDPREF(void)
Definition: sysparams.c:1951
static void test_SPI_SETSCREENSAVEACTIVE(void)
Definition: sysparams.c:990
static void test_SPI_SETDOUBLECLICKTIME(void)
Definition: sysparams.c:1283
static void test_SPI_SETMOUSE(void)
Definition: sysparams.c:693
static void test_WM_DISPLAYCHANGE(void)
Definition: sysparams.c:2468
static void test_SPI_SETFONTSMOOTHING(void)
Definition: sysparams.c:2021
static void test_SPI_SETMINIMIZEDMETRICS(void)
Definition: sysparams.c:1617
static void test_SPI_SETWHEELSCROLLCHARS(void)
Definition: sysparams.c:2406
static void test_SPI_SETDRAGFULLWINDOWS(void)
Definition: sysparams.c:1389
static void test_SPI_SETPOWEROFFACTIVE(void)
Definition: sysparams.c:2140
static void test_SPI_SETSNAPTODEFBUTTON(void)
Definition: sysparams.c:2178
static void test_SPI_SETWORKAREA(void)
Definition: sysparams.c:1862
static void test_SPI_SETMOUSEHOVERTIME(void)
Definition: sysparams.c:2287
static void test_SPI_SETFASTTASKSWITCH(void)
Definition: sysparams.c:1373
static void test_SPI_ICONVERTICALSPACING(void)
Definition: sysparams.c:1103
static void test_SPI_SETMENUSHOWDELAY(void)
Definition: sysparams.c:2367
static void test_SPI_SETDOUBLECLKWIDTH(void)
Definition: sysparams.c:1215
static void test_SPI_SETMENUDROPALIGNMENT(void)
Definition: sysparams.c:1176
static void test_SPI_ICONHORIZONTALSPACING(void)
Definition: sysparams.c:934
static void test_SPI_SETGRIDGRANULARITY(void)
Definition: sysparams.c:1026
static void test_SPI_SETDOUBLECLKHEIGHT(void)
Definition: sysparams.c:1249
static void test_SPI_SETSCREENSAVETIMEOUT(void)
Definition: sysparams.c:953
static void test_SPI_SETNONCLIENTMETRICS(void)
Definition: sysparams.c:1494
static void test_SPI_SETMOUSEHOVERHEIGHT(void)
Definition: sysparams.c:2250
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by START_TEST().

◆ test_change_message()

static void test_change_message ( int  action,
int  optional 
)
static

Definition at line 279 of file sysparams.c.

280{
281 if (change_counter==0 && optional==1)
282 return;
283 ok( 1 == change_counter,
284 "Missed a message: change_counter=%d\n", change_counter );
285 change_counter = 0;
287 ( change_setworkarea_param && action == SPI_SETWORKAREA) ||
289 "Wrong action got %d expected %d\n", change_last_param, action );
291}
const WCHAR * action
Definition: action.c:7479

Referenced by dotest_spi_iconhorizontalspacing(), dotest_spi_iconverticalspacing(), run_spi_setmouse_test(), test_setborder(), test_SPI_SETBEEP(), test_SPI_SETBORDER(), test_SPI_SETDOUBLECLICKTIME(), test_SPI_SETDOUBLECLKHEIGHT(), test_SPI_SETDOUBLECLKWIDTH(), test_SPI_SETDRAGFULLWINDOWS(), test_SPI_SETFONTSMOOTHING(), test_SPI_SETICONTITLEWRAP(), test_SPI_SETKEYBOARDDELAY(), test_SPI_SETKEYBOARDPREF(), test_SPI_SETKEYBOARDSPEED(), test_SPI_SETLOWPOWERACTIVE(), test_SPI_SETMENUDROPALIGNMENT(), test_SPI_SETMENUSHOWDELAY(), test_SPI_SETMOUSEBUTTONSWAP(), test_SPI_SETMOUSEHOVERHEIGHT(), test_SPI_SETMOUSEHOVERTIME(), test_SPI_SETMOUSEHOVERWIDTH(), test_SPI_SETNONCLIENTMETRICS(), test_SPI_SETPOWEROFFACTIVE(), test_SPI_SETSCREENREADER(), test_SPI_SETSCREENSAVEACTIVE(), test_SPI_SETSCREENSAVETIMEOUT(), test_SPI_SETSHOWSOUNDS(), test_SPI_SETSNAPTODEFBUTTON(), test_SPI_SETWALLPAPER(), test_SPI_SETWHEELSCROLLCHARS(), test_SPI_SETWHEELSCROLLLINES(), and test_SPI_SETWORKAREA().

◆ test_dpi_aware()

static void test_dpi_aware ( void  )
static

Definition at line 3510 of file sysparams.c.

3511{
3512 BOOL ret;
3513
3514 if (!pIsProcessDPIAware)
3515 {
3516 win_skip("IsProcessDPIAware not available\n");
3517 return;
3518 }
3519
3520 ret = pSetProcessDPIAware();
3521 ok(ret, "got %d\n", ret);
3522
3523 ret = pIsProcessDPIAware();
3524 ok(ret, "got %d\n", ret);
3525
3526 dpi = real_dpi;
3529 test_metrics_for_dpi( 192 );
3530}

Referenced by START_TEST().

◆ test_dpi_context()

static void test_dpi_context ( void  )
static

Definition at line 3532 of file sysparams.c.

3533{
3534 DPI_AWARENESS awareness;
3536 ULONG_PTR i, flags;
3537 BOOL ret;
3538 UINT dpi;
3539 HDC hdc = GetDC( 0 );
3540
3541 context = pGetThreadDpiAwarenessContext();
3542 /* Windows 10 >= 1709 adds extra 0x6000 flags */
3543 flags = (ULONG_PTR)context & 0x6000;
3544 todo_wine
3545 ok( context == (DPI_AWARENESS_CONTEXT)(0x10 | flags), "wrong context %p\n", context );
3546 awareness = pGetAwarenessFromDpiAwarenessContext( context );
3547 todo_wine
3548 ok( awareness == DPI_AWARENESS_UNAWARE, "wrong awareness %u\n", awareness );
3549 todo_wine
3550 ok( !pIsProcessDPIAware(), "already aware\n" );
3551 dpi = pGetDpiForSystem();
3553 ok( dpi == USER_DEFAULT_SCREEN_DPI, "wrong dpi %u\n", dpi );
3556 ok( dpi == USER_DEFAULT_SCREEN_DPI, "wrong dpi %u\n", dpi );
3557 SetLastError( 0xdeadbeef );
3558 ret = pSetProcessDpiAwarenessContext( NULL );
3559 ok( !ret, "got %d\n", ret );
3560 ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
3561 SetLastError( 0xdeadbeef );
3562 ret = pSetProcessDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)-6 );
3563 ok( !ret, "got %d\n", ret );
3564 ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
3565 ret = pSetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT_SYSTEM_AWARE );
3566 todo_wine
3567 ok( ret, "got %d\n", ret );
3568 ok( pIsProcessDPIAware(), "not aware\n" );
3569 real_dpi = pGetDpiForSystem();
3570 SetLastError( 0xdeadbeef );
3571 ret = pSetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT_SYSTEM_AWARE );
3572 ok( !ret, "got %d\n", ret );
3573 ok( GetLastError() == ERROR_ACCESS_DENIED, "wrong error %u\n", GetLastError() );
3574 SetLastError( 0xdeadbeef );
3575 ret = pSetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT_UNAWARE );
3576 ok( !ret, "got %d\n", ret );
3577 ok( GetLastError() == ERROR_ACCESS_DENIED, "wrong error %u\n", GetLastError() );
3578
3579 ret = pSetProcessDpiAwarenessInternal( DPI_AWARENESS_INVALID );
3580 ok( !ret, "got %d\n", ret );
3581 ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
3582 ret = pSetProcessDpiAwarenessInternal( DPI_AWARENESS_UNAWARE );
3583 ok( !ret, "got %d\n", ret );
3584 ok( GetLastError() == ERROR_ACCESS_DENIED, "wrong error %u\n", GetLastError() );
3585 ret = pGetProcessDpiAwarenessInternal( 0, &awareness );
3586 ok( ret, "got %d\n", ret );
3587 todo_wine
3588 ok( awareness == DPI_AWARENESS_SYSTEM_AWARE, "wrong value %d\n", awareness );
3589 ret = pGetProcessDpiAwarenessInternal( GetCurrentProcess(), &awareness );
3590 ok( ret, "got %d\n", ret );
3591 todo_wine
3592 ok( awareness == DPI_AWARENESS_SYSTEM_AWARE, "wrong value %d\n", awareness );
3593 ret = pGetProcessDpiAwarenessInternal( (HANDLE)0xdeadbeef, &awareness );
3594 ok( ret, "got %d\n", ret );
3595 ok( awareness == DPI_AWARENESS_UNAWARE, "wrong value %d\n", awareness );
3596
3597 ret = pIsProcessDPIAware();
3598 ok(ret, "got %d\n", ret);
3599 context = pGetThreadDpiAwarenessContext();
3600 todo_wine
3601 ok( context == (DPI_AWARENESS_CONTEXT)(0x11 | flags), "wrong context %p\n", context );
3602 awareness = pGetAwarenessFromDpiAwarenessContext( context );
3603 todo_wine
3604 ok( awareness == DPI_AWARENESS_SYSTEM_AWARE, "wrong awareness %u\n", awareness );
3605 SetLastError( 0xdeadbeef );
3606 context = pSetThreadDpiAwarenessContext( 0 );
3607 ok( !context, "got %p\n", context );
3608 ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
3609 SetLastError( 0xdeadbeef );
3610 context = pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)-6 );
3611 ok( !context, "got %p\n", context );
3612 ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
3613 context = pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_UNAWARE );
3614 todo_wine
3615 ok( context == (DPI_AWARENESS_CONTEXT)(0x80000011 | flags), "wrong context %p\n", context );
3616 awareness = pGetAwarenessFromDpiAwarenessContext( context );
3617 todo_wine
3618 ok( awareness == DPI_AWARENESS_SYSTEM_AWARE, "wrong awareness %u\n", awareness );
3619 dpi = pGetDpiForSystem();
3620 ok( dpi == USER_DEFAULT_SCREEN_DPI, "wrong dpi %u\n", dpi );
3622 ok( dpi == USER_DEFAULT_SCREEN_DPI, "wrong dpi %u\n", dpi );
3623 ok( !pIsProcessDPIAware(), "still aware\n" );
3624 context = pGetThreadDpiAwarenessContext();
3625 ok( context == (DPI_AWARENESS_CONTEXT)(0x10 | flags), "wrong context %p\n", context );
3626 awareness = pGetAwarenessFromDpiAwarenessContext( context );
3627 ok( awareness == DPI_AWARENESS_UNAWARE, "wrong awareness %u\n", awareness );
3628 context = pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );
3629 ok( context == (DPI_AWARENESS_CONTEXT)(0x10 | flags), "wrong context %p\n", context );
3630 awareness = pGetAwarenessFromDpiAwarenessContext( context );
3631 ok( awareness == DPI_AWARENESS_UNAWARE, "wrong awareness %u\n", awareness );
3632 dpi = pGetDpiForSystem();
3633 ok( dpi == real_dpi, "wrong dpi %u/%u\n", dpi, real_dpi );
3635 ok( dpi == real_dpi, "wrong dpi %u\n", dpi );
3636 context = pGetThreadDpiAwarenessContext();
3637 ok( context == (DPI_AWARENESS_CONTEXT)0x12, "wrong context %p\n", context );
3638 awareness = pGetAwarenessFromDpiAwarenessContext( context );
3639 ok( awareness == DPI_AWARENESS_PER_MONITOR_AWARE, "wrong awareness %u\n", awareness );
3640 context = pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_SYSTEM_AWARE );
3641 ok( context == (DPI_AWARENESS_CONTEXT)0x12, "wrong context %p\n", context );
3642 awareness = pGetAwarenessFromDpiAwarenessContext( context );
3643 ok( awareness == DPI_AWARENESS_PER_MONITOR_AWARE, "wrong awareness %u\n", awareness );
3644 dpi = pGetDpiForSystem();
3645 ok( dpi == real_dpi, "wrong dpi %u/%u\n", dpi, real_dpi );
3647 ok( dpi == real_dpi, "wrong dpi %u\n", dpi );
3648 ok( pIsProcessDPIAware(), "not aware\n" );
3649 context = pGetThreadDpiAwarenessContext();
3650 ok( context == (DPI_AWARENESS_CONTEXT)(0x11 | flags), "wrong context %p\n", context );
3651 context = pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)(0x80000010 | flags) );
3652 ok( context == (DPI_AWARENESS_CONTEXT)(0x11 | flags), "wrong context %p\n", context );
3653 context = pGetThreadDpiAwarenessContext();
3654 todo_wine
3655 ok( context == (DPI_AWARENESS_CONTEXT)(0x11 | flags), "wrong context %p\n", context );
3656 context = pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)(0x80000011 | flags) );
3657 todo_wine
3658 ok( context == (DPI_AWARENESS_CONTEXT)(0x80000011 | flags), "wrong context %p\n", context );
3659 context = pGetThreadDpiAwarenessContext();
3660 todo_wine
3661 ok( context == (DPI_AWARENESS_CONTEXT)(0x11 | flags), "wrong context %p\n", context );
3662 context = pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)0x12 );
3663 todo_wine
3664 ok( context == (DPI_AWARENESS_CONTEXT)(0x80000011 | flags), "wrong context %p\n", context );
3665 context = pSetThreadDpiAwarenessContext( context );
3666 ok( context == (DPI_AWARENESS_CONTEXT)(0x12), "wrong context %p\n", context );
3667 context = pGetThreadDpiAwarenessContext();
3668 todo_wine
3669 ok( context == (DPI_AWARENESS_CONTEXT)(0x11 | flags), "wrong context %p\n", context );
3670 for (i = 0; i < 0x100; i++)
3671 {
3672 awareness = pGetAwarenessFromDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)i );
3673 switch (i)
3674 {
3675 case 0x10:
3676 case 0x11:
3677 case 0x12:
3678 ok( awareness == (i & ~0x10), "%lx: wrong value %u\n", i, awareness );
3679 ok( pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)i ), "%lx: not valid\n", i );
3680 break;
3681 default:
3682 ok( awareness == DPI_AWARENESS_INVALID, "%lx: wrong value %u\n", i, awareness );
3683 ok( !pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)i ), "%lx: valid\n", i );
3684 break;
3685 }
3686 awareness = pGetAwarenessFromDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)(i | 0x80000000) );
3687 switch (i)
3688 {
3689 case 0x10:
3690 case 0x11:
3691 case 0x12:
3692 ok( awareness == (i & ~0x10), "%lx: wrong value %u\n", i | 0x80000000, awareness );
3693 ok( pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)(i | 0x80000000) ),
3694 "%lx: not valid\n", i | 0x80000000 );
3695 break;
3696 default:
3697 ok( awareness == DPI_AWARENESS_INVALID, "%lx: wrong value %u\n", i | 0x80000000, awareness );
3698 ok( !pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)(i | 0x80000000) ),
3699 "%lx: valid\n", i | 0x80000000 );
3700 break;
3701 }
3702 awareness = pGetAwarenessFromDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i );
3703 switch (~i)
3704 {
3708 ok( awareness == i, "%lx: wrong value %u\n", ~i, awareness );
3709 ok( pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i ), "%lx: not valid\n", ~i );
3710 break;
3712 if (pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i ))
3713 ok( awareness == DPI_AWARENESS_PER_MONITOR_AWARE, "%lx: wrong value %u\n", ~i, awareness );
3714 else
3715 ok( awareness == DPI_AWARENESS_INVALID, "%lx: wrong value %u\n", ~i, awareness );
3716 break;
3718 if (pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i ))
3719 ok( awareness == DPI_AWARENESS_UNAWARE, "%lx: wrong value %u\n", ~i, awareness );
3720 else
3721 ok( awareness == DPI_AWARENESS_INVALID, "%lx: wrong value %u\n", ~i, awareness );
3722 break;
3723 default:
3724 ok( awareness == DPI_AWARENESS_INVALID, "%lx: wrong value %u\n", ~i, awareness );
3725 ok( !pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i ), "%lx: valid\n", ~i );
3726 break;
3727 }
3728 }
3730 ReleaseDC( 0, hdc );
3731}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define GetCurrentProcess()
Definition: compat.h:759
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
#define ULONG_PTR
Definition: config.h:101
GLbitfield flags
Definition: glext.h:7161
#define todo_wine_if(is_todo)
Definition: custom.c:76
#define todo_wine
Definition: custom.c:79
static void test_dpi_stock_objects(HDC hdc)
Definition: sysparams.c:3138
unsigned int UINT
Definition: ndis.h:50
uint32_t ULONG_PTR
Definition: typedefs.h:65
DPI_AWARENESS
Definition: windef.h:285
@ DPI_AWARENESS_PER_MONITOR_AWARE
Definition: windef.h:289
@ DPI_AWARENESS_SYSTEM_AWARE
Definition: windef.h:288
@ DPI_AWARENESS_INVALID
Definition: windef.h:286
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2
Definition: windef.h:295
#define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED
Definition: windef.h:296
#define LOGPIXELSX
Definition: wingdi.h:718

Referenced by START_TEST().

◆ test_dpi_mapping()

static void test_dpi_mapping ( void  )
static

Definition at line 3212 of file sysparams.c.

3213{
3214 HWND hwnd, child;
3215 HDC hdc;
3216 UINT win_dpi, units;
3217 POINT point;
3218 BOOL ret;
3219 HRGN rgn, update;
3220 RECT rect, orig, client, desktop, expect;
3221 ULONG_PTR i, j, k;
3222 WINDOWPLACEMENT wpl_orig, wpl;
3223 HMONITOR monitor;
3224 MONITORINFO mon_info;
3226
3227 if (!pLogicalToPhysicalPointForPerMonitorDPI)
3228 {
3229 win_skip( "LogicalToPhysicalPointForPerMonitorDPI not supported\n" );
3230 return;
3231 }
3232 context = pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );
3233 GetWindowRect( GetDesktopWindow(), &desktop );
3235 {
3236 pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i );
3237 /* test desktop rect */
3239 expect = desktop;
3241 ok( EqualRect( &expect, &rect ), "%lu: wrong desktop rect %s expected %s\n",
3244 ok( EqualRect( &expect, &rect ), "%lu: wrong desktop rect %s expected %s\n",
3247 ok( EqualRect( &expect, &rect ), "%lu: wrong virt desktop rect %s expected %s\n",
3249 SetRect( &rect, 0, 0, 1, 1 );
3250 monitor = MonitorFromRect( &rect, MONITOR_DEFAULTTOPRIMARY );
3251 ok( monitor != 0, "failed to get monitor\n" );
3252 mon_info.cbSize = sizeof(mon_info);
3253 ok( GetMonitorInfoW( monitor, &mon_info ), "GetMonitorInfoExW failed\n" );
3254 ok( EqualRect( &expect, &mon_info.rcMonitor ), "%lu: wrong monitor rect %s expected %s\n",
3256 hdc = CreateDCA( "display", NULL, NULL, NULL );
3258 ok( EqualRect( &expect, &rect ), "%lu: wrong caps desktop rect %s expected %s\n",
3261 ok( EqualRect( &desktop, &rect ), "%lu: wrong caps virt desktop rect %s expected %s\n",
3262 i, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&desktop) );
3263 DeleteDC( hdc );
3264 /* test message window rect */
3265 hwnd = CreateWindowA( "SysParamsTestClass", "test", WS_CHILD,
3266 10, 10, 20, 20, HWND_MESSAGE, 0, GetModuleHandleA(0), NULL );
3268 SetRect( &expect, 0, 0, 100, 100 );
3270 ok( EqualRect( &expect, &rect ), "%lu: wrong message rect %s expected %s\n",
3273 }
3275 {
3276 pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i );
3277 hwnd = CreateWindowA( "SysParamsTestClass", "test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
3278 193, 177, 295, 303, 0, 0, GetModuleHandleA(0), NULL );
3279 ok( hwnd != 0, "creating window failed err %u\n", GetLastError());
3280 child = CreateWindowA( "SysParamsTestClass", "child", WS_CHILD | WS_VISIBLE,
3281 50, 60, 70, 80, hwnd, 0, GetModuleHandleA(0), NULL );
3282 ok( child != 0, "creating child failed err %u\n", GetLastError());
3283 GetWindowRect( hwnd, &orig );
3284 SetRect( &rect, 0, 0, 0, 0 );
3285 pAdjustWindowRectExForDpi( &rect, WS_OVERLAPPEDWINDOW, FALSE, 0, pGetDpiForWindow( hwnd ));
3286 SetRect( &client, orig.left - rect.left, orig.top - rect.top,
3287 orig.right - rect.right, orig.bottom - rect.bottom );
3290 GetWindowPlacement( hwnd, &wpl_orig );
3292
3294 {
3295 pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~j );
3296 /* test window rect */
3297 GetWindowRect( hwnd, &rect );
3298 expect = orig;
3300 ok( EqualRect( &expect, &rect ), "%lu/%lu: wrong window rect %s expected %s\n",
3302 /* test client rect */
3303 GetClientRect( hwnd, &rect );
3304 expect = client;
3305 OffsetRect( &expect, -expect.left, -expect.top );
3307 ok( EqualRect( &expect, &rect ), "%lu/%lu: wrong client rect %s expected %s\n",
3309 /* test window placement */
3310 GetWindowPlacement( hwnd, &wpl );
3311 point = wpl_orig.ptMinPosition;
3312 if (point.x != -1 || point.y != -1) scale_point_dpi_aware( &point, i, j );
3313 ok( wpl.ptMinPosition.x == point.x && wpl.ptMinPosition.y == point.y,
3314 "%lu/%lu: wrong placement min pos %d,%d expected %d,%d\n", i, j,
3315 wpl.ptMinPosition.x, wpl.ptMinPosition.y, point.x, point.y );
3316 point = wpl_orig.ptMaxPosition;
3317 if (point.x != -1 || point.y != -1) scale_point_dpi_aware( &point, i, j );
3318 ok( wpl.ptMaxPosition.x == point.x && wpl.ptMaxPosition.y == point.y,
3319 "%lu/%lu: wrong placement max pos %d,%d expected %d,%d\n", i, j,
3320 wpl.ptMaxPosition.x, wpl.ptMaxPosition.y, point.x, point.y );
3321 expect = wpl_orig.rcNormalPosition;
3324 "%lu/%lu: wrong placement rect %s expect %s\n", i, j,
3326 /* test DC rect */
3327 hdc = GetDC( hwnd );
3328 GetClipBox( hdc, &rect );
3329 SetRect( &expect, 0, 0, client.right - client.left, client.bottom - client.top );
3330 ok( EqualRect( &expect, &rect ), "%lu/%lu: wrong clip box %s expected %s\n",
3332 /* test DC resolution */
3334 expect = desktop;
3336 ok( EqualRect( &expect, &rect ), "%lu/%lu: wrong DC resolution %s expected %s\n",
3339 ok( EqualRect( &desktop, &rect ), "%lu/%lu: wrong desktop resolution %s expected %s\n",
3340 i, j, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&desktop) );
3341 ReleaseDC( hwnd, hdc );
3342 /* test DC win rect */
3343 hdc = GetWindowDC( hwnd );
3344 GetClipBox( hdc, &rect );
3345 SetRect( &expect, 0, 0, 295, 303 );
3346 todo_wine
3347 ok( EqualRect( &expect, &rect ), "%lu/%lu: wrong clip box win DC %s expected %s\n",
3349 ReleaseDC( hwnd, hdc );
3350 /* test window invalidation */
3351 UpdateWindow( hwnd );
3352 update = CreateRectRgn( 0, 0, 0, 0 );
3353 ret = GetUpdateRgn( hwnd, update, FALSE );
3354 ok( ret == NULLREGION, "update region not empty\n" );
3355 rgn = CreateRectRgn( 20, 20, 25, 25 );
3357 {
3358 pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~k );
3359 RedrawWindow( hwnd, 0, rgn, RDW_INVALIDATE );
3360 pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~j );
3361 GetUpdateRgn( hwnd, update, FALSE );
3362 GetRgnBox( update, &rect );
3363 SetRect( &expect, 20, 20, 25, 25 );
3364 ok( EqualRect( &expect, &rect ), "%lu/%lu/%lu: wrong update region %s expected %s\n",
3368 ok( EqualRect( &expect, &rect ), "%lu/%lu/%lu: wrong update rect %s expected %s\n",
3370 UpdateWindow( hwnd );
3371 }
3373 {
3374 RedrawWindow( hwnd, 0, rgn, RDW_INVALIDATE );
3375 pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~k );
3376 GetUpdateRgn( hwnd, update, FALSE );
3377 pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~j );
3378 GetRgnBox( update, &rect );
3379 SetRect( &expect, 20, 20, 25, 25 );
3380 ok( EqualRect( &expect, &rect ), "%lu/%lu/%lu: wrong update region %s expected %s\n",
3384 ok( EqualRect( &expect, &rect ), "%lu/%lu/%lu: wrong update rect %s expected %s\n",
3386 UpdateWindow( hwnd );
3387 }
3388 /* test desktop window invalidation */
3389 pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );
3390 GetClientRect( hwnd, &rect );
3391 InflateRect( &rect, -50, -50 );
3392 expect = rect;
3393 MapWindowPoints( hwnd, 0, (POINT *)&rect, 2 );
3394 pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~j );
3396 GetUpdateRgn( hwnd, update, TRUE );
3397 GetRgnBox( update, &rect );
3399 ok( EqualRect( &expect, &rect ), "%lu/%lu: wrong update region %s expected %s\n",
3403 ok( EqualRect( &expect, &rect ), "%lu/%lu: wrong update rect %s expected %s\n",
3405 UpdateWindow( hwnd );
3406 DeleteObject( update );
3407 /* test dialog units */
3409 point.x = LOWORD( units );
3410 point.y = HIWORD( units );
3412 ok( LOWORD(ret) == point.x && HIWORD(ret) == point.y, "%lu/%lu: wrong units %d,%d / %d,%d\n",
3413 i, j, LOWORD(ret), HIWORD(ret), point.x, point.y );
3414 /* test window points mapping */
3415 SetRect( &rect, 0, 0, 100, 100 );
3416 rect.right = rect.left + 100;
3417 rect.bottom = rect.top + 100;
3418 MapWindowPoints( hwnd, 0, (POINT *)&rect, 2 );
3419 expect = client;
3421 expect.right = expect.left + 100;
3422 expect.bottom = expect.top + 100;
3423 ok( EqualRect( &expect, &rect ), "%lu/%lu: wrong MapWindowPoints rect %s expected %s\n",
3425 SetRect( &rect, 50, 60, 70, 80 );
3427 SetRect( &expect, 40, 30, 60, 80 );
3428 OffsetRect( &expect, -rect.left, -rect.top );
3429 SetRect( &rect, 40, 30, 60, 80 );
3430 MapWindowPoints( hwnd, child, (POINT *)&rect, 2 );
3431 ok( EqualRect( &expect, &rect ), "%lu/%lu: wrong MapWindowPoints child rect %s expected %s\n",
3433 /* test logical<->physical coords mapping */
3434 win_dpi = pGetDpiForWindow( hwnd );
3435 if (i == DPI_AWARENESS_UNAWARE)
3436 ok( win_dpi == USER_DEFAULT_SCREEN_DPI, "wrong dpi %u\n", win_dpi );
3437 else if (i == DPI_AWARENESS_SYSTEM_AWARE)
3438 ok( win_dpi == real_dpi, "wrong dpi %u / %u\n", win_dpi, real_dpi );
3439 point.x = 373;
3440 point.y = 377;
3441 ret = pLogicalToPhysicalPointForPerMonitorDPI( hwnd, &point );
3442 ok( ret, "%lu/%lu: LogicalToPhysicalPointForPerMonitorDPI failed\n", i, j );
3443 ok( point.x == MulDiv( 373, real_dpi, win_dpi ) &&
3444 point.y == MulDiv( 377, real_dpi, win_dpi ),
3445 "%lu/%lu: wrong pos %d,%d dpi %u\n", i, j, point.x, point.y, win_dpi );
3446 point.x = 405;
3447 point.y = 423;
3448 ret = pPhysicalToLogicalPointForPerMonitorDPI( hwnd, &point );
3449 ok( ret, "%lu/%lu: PhysicalToLogicalPointForPerMonitorDPI failed\n", i, j );
3450 ok( point.x == MulDiv( 405, win_dpi, real_dpi ) &&
3451 point.y == MulDiv( 423, win_dpi, real_dpi ),
3452 "%lu/%lu: wrong pos %d,%d dpi %u\n", i, j, point.x, point.y, win_dpi );
3453 /* point outside the window fails, but note that Windows (wrongly) checks against the
3454 * window rect transformed relative to the thread's awareness */
3455 GetWindowRect( hwnd, &rect );
3456 point.x = rect.left - 1;
3457 point.y = rect.top;
3458 ret = pLogicalToPhysicalPointForPerMonitorDPI( hwnd, &point );
3459 ok( !ret, "%lu/%lu: LogicalToPhysicalPointForPerMonitorDPI succeeded\n", i, j );
3460 point.x++;
3461 point.y--;
3462 ret = pLogicalToPhysicalPointForPerMonitorDPI( hwnd, &point );
3463 ok( !ret, "%lu/%lu: LogicalToPhysicalPointForPerMonitorDPI succeeded\n", i, j );
3464 point.y++;
3465 ret = pLogicalToPhysicalPointForPerMonitorDPI( hwnd, &point );
3466 ok( ret, "%lu/%lu: LogicalToPhysicalPointForPerMonitorDPI failed\n", i, j );
3467 point.x = rect.right;
3468 point.y = rect.bottom + 1;
3469 ret = pLogicalToPhysicalPointForPerMonitorDPI( hwnd, &point );
3470 ok( !ret, "%lu/%lu: LogicalToPhysicalPointForPerMonitorDPI succeeded\n", i, j );
3471 point.x++;
3472 point.y--;
3473 ret = pLogicalToPhysicalPointForPerMonitorDPI( hwnd, &point );
3474 ok( !ret, "%lu/%lu: LogicalToPhysicalPointForPerMonitorDPI succeeded\n", i, j );
3475 point.x--;
3476 ret = pLogicalToPhysicalPointForPerMonitorDPI( hwnd, &point );
3477 ok( ret, "%lu/%lu: LogicalToPhysicalPointForPerMonitorDPI failed\n", i, j );
3478 /* get physical window rect */
3479 pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );
3480 GetWindowRect( hwnd, &rect );
3481 pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~j );
3482 point.x = rect.left - 1;
3483 point.y = rect.top;
3484 ret = pPhysicalToLogicalPointForPerMonitorDPI( hwnd, &point );
3485 ok( !ret, "%lu/%lu: PhysicalToLogicalPointForPerMonitorDPI succeeded\n", i, j );
3486 point.x++;
3487 point.y--;
3488 ret = pPhysicalToLogicalPointForPerMonitorDPI( hwnd, &point );
3489 ok( !ret, "%lu/%lu: PhysicalToLogicalPointForPerMonitorDPI succeeded\n", i, j );
3490 point.y++;
3491 ret = pPhysicalToLogicalPointForPerMonitorDPI( hwnd, &point );
3492 ok( ret, "%lu/%lu: PhysicalToLogicalPointForPerMonitorDPI failed\n", i, j );
3493 point.x = rect.right;
3494 point.y = rect.bottom + 1;
3495 ret = pPhysicalToLogicalPointForPerMonitorDPI( hwnd, &point );
3496 ok( !ret, "%lu/%lu: PhysicalToLogicalPointForPerMonitorDPI succeeded\n", i, j );
3497 point.x++;
3498 point.y--;
3499 ret = pPhysicalToLogicalPointForPerMonitorDPI( hwnd, &point );
3500 ok( !ret, "%lu/%lu: PhysicalToLogicalPointForPerMonitorDPI succeeded\n", i, j );
3501 point.x--;
3502 ret = pPhysicalToLogicalPointForPerMonitorDPI( hwnd, &point );
3503 ok( ret, "%lu/%lu: PhysicalToLogicalPointForPerMonitorDPI failed\n", i, j );
3504 }
3506 }
3507 pSetThreadDpiAwarenessContext( context );
3508}
POINTL point
Definition: edittest.c:50
GLfloat units
Definition: glext.h:11727
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define expect(expected, got)
Definition: combo.c:36
static HWND child
Definition: cursoricon.c:298
static void scale_point_dpi_aware(POINT *pt, DPI_AWARENESS from, DPI_AWARENESS to)
Definition: sysparams.c:3196
static void scale_rect_dpi_aware(RECT *rect, DPI_AWARENESS from, DPI_AWARENESS to)
Definition: sysparams.c:3204
int k
Definition: mpi.c:3369
HMONITOR WINAPI MonitorFromRect(LPCRECT, DWORD)
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
#define WS_VISIBLE
Definition: pedump.c:620
static __inline const char * wine_dbgstr_rect(const RECT *rect)
Definition: debug.h:219
static FILE * client
Definition: client.c:41
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
POINT ptMaxPosition
Definition: winuser.h:3284
RECT rcNormalPosition
Definition: winuser.h:3285
POINT ptMinPosition
Definition: winuser.h:3283
RECT rcMonitor
Definition: winuser.h:3775
DWORD cbSize
Definition: winuser.h:3774
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define HIWORD(l)
Definition: typedefs.h:247
#define HORZRES
Definition: wingdi.h:716
int WINAPI GetClipBox(_In_ HDC, _Out_ LPRECT)
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
#define NULLREGION
Definition: wingdi.h:361
HDC WINAPI CreateDCA(_In_opt_ LPCSTR pszDriver, _In_opt_ LPCSTR pszDevice, _In_opt_ LPCSTR pszOutput, _In_opt_ const DEVMODEA *pdmInit)
#define VERTRES
Definition: wingdi.h:717
#define DESKTOPHORZRES
Definition: wingdi.h:742
#define DESKTOPVERTRES
Definition: wingdi.h:743
int WINAPI GetRgnBox(_In_ HRGN, _Out_ LPRECT)
#define HWND_MESSAGE
Definition: winuser.h:1200
#define SM_CYVIRTUALSCREEN
Definition: winuser.h:1033
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
HDC WINAPI GetWindowDC(_In_opt_ HWND)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define SM_CYSCREEN
Definition: winuser.h:954
BOOL WINAPI GetWindowPlacement(_In_ HWND, _Inout_ WINDOWPLACEMENT *)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define SW_MINIMIZE
Definition: winuser.h:770
#define GA_PARENT
Definition: winuser.h:2778
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
#define SM_CXVIRTUALSCREEN
Definition: winuser.h:1032
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
#define RDW_FRAME
Definition: winuser.h:1202
int WINAPI GetUpdateRgn(_In_ HWND, _In_ HRGN, _In_ BOOL)
BOOL WINAPI UpdateWindow(_In_ HWND)
LONG WINAPI GetDialogBaseUnits(void)
Definition: dialog.c:2144
#define SW_RESTORE
Definition: winuser.h:773
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define SM_CXSCREEN
Definition: winuser.h:953
BOOL WINAPI GetMonitorInfoW(_In_ HMONITOR, _Inout_ LPMONITORINFO)
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
BOOL WINAPI GetUpdateRect(_In_ HWND, _Out_opt_ LPRECT, _In_ BOOL)
BOOL WINAPI DestroyWindow(_In_ HWND)
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
HWND WINAPI GetAncestor(_In_ HWND, _In_ UINT)
#define RDW_INVALIDATE
Definition: winuser.h:1204
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by START_TEST().

◆ test_dpi_stock_objects()

static void test_dpi_stock_objects ( HDC  hdc)
static

Definition at line 3138 of file sysparams.c.

3139{
3141 HGDIOBJ obj[STOCK_LAST + 1], obj2[STOCK_LAST + 1];
3142 LOGFONTW lf, lf2;
3143 UINT i, dpi;
3144
3145 context = pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_UNAWARE );
3147 ok( dpi == USER_DEFAULT_SCREEN_DPI, "wrong dpi %u\n", dpi );
3148 ok( !pIsProcessDPIAware(), "not aware\n" );
3149 for (i = 0; i <= STOCK_LAST; i++) obj[i] = GetStockObject( i );
3150
3151 pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_SYSTEM_AWARE );
3153 ok( dpi == real_dpi, "wrong dpi %u\n", dpi );
3154 ok( pIsProcessDPIAware(), "not aware\n" );
3155 for (i = 0; i <= STOCK_LAST; i++) obj2[i] = GetStockObject( i );
3156
3157 for (i = 0; i <= STOCK_LAST; i++)
3158 {
3159 switch (i)
3160 {
3161 case OEM_FIXED_FONT:
3162 case SYSTEM_FIXED_FONT:
3163 ok( obj[i] != obj2[i], "%u: same object\n", i );
3164 break;
3165 case SYSTEM_FONT:
3166 case DEFAULT_GUI_FONT:
3167 ok( obj[i] != obj2[i], "%u: same object\n", i );
3168 GetObjectW( obj[i], sizeof(lf), &lf );
3169 GetObjectW( obj2[i], sizeof(lf2), &lf2 );
3171 "%u: wrong height %d / %d\n", i, lf.lfHeight, lf2.lfHeight );
3172 break;
3173 default:
3174 ok( obj[i] == obj2[i], "%u: different object\n", i );
3175 break;
3176 }
3177 }
3178
3179 pSetThreadDpiAwarenessContext( context );
3180}
HGDIOBJ WINAPI GetStockObject(_In_ int)
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define STOCK_LAST
Definition: wingdi.h:923
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
#define SYSTEM_FIXED_FONT
Definition: wingdi.h:912
#define OEM_FIXED_FONT
Definition: wingdi.h:910
#define SYSTEM_FONT
Definition: wingdi.h:911

Referenced by test_dpi_context().

◆ test_dpi_window()

static void test_dpi_window ( void  )
static

Definition at line 3750 of file sysparams.c.

3751{
3753 DPI_AWARENESS awareness;
3754 ULONG_PTR i, j;
3755 UINT dpi;
3756 HWND hwnd, child, ret;
3757 MSG msg = { 0, WM_USER + 1, 0, 0 };
3758
3759 if (!pGetWindowDpiAwarenessContext)
3760 {
3761 win_skip( "GetWindowDpiAwarenessContext not supported\n" );
3762 return;
3763 }
3764 orig = pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_UNAWARE );
3766 {
3767 pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i );
3768 hwnd = CreateWindowA( "DpiTestClass", "Test",
3769 WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, GetModuleHandleA(0), NULL );
3770 ok( hwnd != 0, "failed to create window\n" );
3771 context = pGetWindowDpiAwarenessContext( hwnd );
3772 awareness = pGetAwarenessFromDpiAwarenessContext( context );
3773 ok( awareness == i, "%lu: wrong awareness %u\n", i, awareness );
3774 dpi = pGetDpiForWindow( hwnd );
3776 "%lu: got %u / %u\n", i, dpi, real_dpi );
3777 if (pGetDpiForMonitorInternal)
3778 {
3779 BOOL res;
3780 SetLastError( 0xdeadbeef );
3781 res = pGetDpiForMonitorInternal( MonitorFromWindow( hwnd, 0 ), 0, &dpi, NULL );
3782 ok( !res, "succeeded\n" );
3783 ok( GetLastError() == ERROR_INVALID_ADDRESS, "wrong error %u\n", GetLastError() );
3784 SetLastError( 0xdeadbeef );
3785 res = pGetDpiForMonitorInternal( MonitorFromWindow( hwnd, 0 ), 3, &dpi, &dpi );
3786 ok( !res, "succeeded\n" );
3787 ok( GetLastError() == ERROR_BAD_ARGUMENTS, "wrong error %u\n", GetLastError() );
3788 SetLastError( 0xdeadbeef );
3789 res = pGetDpiForMonitorInternal( MonitorFromWindow( hwnd, 0 ), 3, &dpi, NULL );
3790 ok( !res, "succeeded\n" );
3791 ok( GetLastError() == ERROR_BAD_ARGUMENTS, "wrong error %u\n", GetLastError() );
3792 res = pGetDpiForMonitorInternal( MonitorFromWindow( hwnd, 0 ), 0, &dpi, &dpi );
3793 ok( res, "failed err %u\n", GetLastError() );
3795 "%lu: got %u / %u\n", i, dpi, real_dpi );
3796 }
3797 msg.hwnd = hwnd;
3799 {
3800 pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~j );
3801 SendMessageA( hwnd, WM_USER, 0, 0 );
3803 CallWindowProcA( dpi_winproc, hwnd, WM_USER + 2, 0, 0 );
3804 child = CreateWindowA( "DpiTestClass", "Test",
3805 WS_CHILD, 0, 0, 100, 100, hwnd, 0, GetModuleHandleA(0), NULL );
3806 context = pGetWindowDpiAwarenessContext( child );
3807 awareness = pGetAwarenessFromDpiAwarenessContext( context );
3808 ok( awareness == i, "%lu/%lu: wrong awareness %u\n", i, j, awareness );
3809 dpi = pGetDpiForWindow( child );
3811 "%lu/%lu: got %u / %u\n", i, j, dpi, real_dpi );
3812 ret = SetParent( child, NULL );
3813 ok( ret != 0, "SetParent failed err %u\n", GetLastError() );
3814 context = pGetWindowDpiAwarenessContext( child );
3815 awareness = pGetAwarenessFromDpiAwarenessContext( context );
3816 ok( awareness == i, "%lu/%lu: wrong awareness %u\n", i, j, awareness );
3817 dpi = pGetDpiForWindow( child );
3819 "%lu/%lu: got %u / %u\n", i, j, dpi, real_dpi );
3821 child = CreateWindowA( "DpiTestClass", "Test",
3822 WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, GetModuleHandleA(0), NULL );
3823 context = pGetWindowDpiAwarenessContext( child );
3824 awareness = pGetAwarenessFromDpiAwarenessContext( context );
3825 ok( awareness == j, "%lu/%lu: wrong awareness %u\n", i, j, awareness );
3826 dpi = pGetDpiForWindow( child );
3828 "%lu/%lu: got %u / %u\n", i, j, dpi, real_dpi );
3829 ret = SetParent( child, hwnd );
3830 ok( ret != 0 || GetLastError() == ERROR_INVALID_STATE,
3831 "SetParent failed err %u\n", GetLastError() );
3832 context = pGetWindowDpiAwarenessContext( child );
3833 awareness = pGetAwarenessFromDpiAwarenessContext( context );
3834 ok( awareness == (ret ? i : j), "%lu/%lu: wrong awareness %u\n", i, j, awareness );
3835 dpi = pGetDpiForWindow( child );
3837 "%lu/%lu: got %u / %u\n", i, j, dpi, real_dpi );
3839 }
3841 }
3842
3843 SetLastError( 0xdeadbeef );
3844 context = pGetWindowDpiAwarenessContext( (HWND)0xdeadbeef );
3845 ok( !context, "got %p\n", context );
3846 ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError() );
3847 SetLastError( 0xdeadbeef );
3848 dpi = pGetDpiForWindow( (HWND)0xdeadbeef );
3849 ok( !dpi, "got %u\n", dpi );
3851 "wrong error %u\n", GetLastError() );
3852
3853 SetLastError( 0xdeadbeef );
3854 context = pGetWindowDpiAwarenessContext( GetDesktopWindow() );
3855 awareness = pGetAwarenessFromDpiAwarenessContext( context );
3856 ok( awareness == DPI_AWARENESS_PER_MONITOR_AWARE, "wrong awareness %u\n", awareness );
3857 dpi = pGetDpiForWindow( GetDesktopWindow() );
3858 ok( dpi == real_dpi, "got %u / %u\n", dpi, real_dpi );
3859
3860 pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_UNAWARE );
3861 SetLastError( 0xdeadbeef );
3862 context = pGetWindowDpiAwarenessContext( GetDesktopWindow() );
3863 awareness = pGetAwarenessFromDpiAwarenessContext( context );
3864 ok( awareness == DPI_AWARENESS_PER_MONITOR_AWARE, "wrong awareness %u\n", awareness );
3865 dpi = pGetDpiForWindow( GetDesktopWindow() );
3866 ok( dpi == real_dpi, "got %u / %u\n", dpi, real_dpi );
3867
3868 pSetThreadDpiAwarenessContext( orig );
3869}
#define ERROR_INVALID_ADDRESS
Definition: compat.h:106
GLuint res
Definition: glext.h:9613
HMONITOR WINAPI MonitorFromWindow(HWND, DWORD)
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
#define ERROR_INVALID_STATE
Definition: winerror.h:1316
#define ERROR_BAD_ARGUMENTS
Definition: winerror.h:232
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
#define WM_USER
Definition: winuser.h:1885
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by START_TEST().

◆ test_EnumDisplaySettings()

static void test_EnumDisplaySettings ( void  )
static

Definition at line 3077 of file sysparams.c.

3078{
3080 DWORD val;
3081 HDC hdc;
3082 DWORD num;
3083
3084 memset(&devmode, 0, sizeof(devmode));
3086
3087 hdc = GetDC(0);
3090 "GetDeviceCaps(BITSPIXEL) returned %d, EnumDisplaySettings returned %d\n",
3092
3094 if(devmode.dmBitsPerPel <= 8) {
3095 ok(val == 256, "Screen bpp is %d, NUMCOLORS returned %d\n", devmode.dmBitsPerPel, val);
3096 } else {
3097 ok(val == -1, "Screen bpp is %d, NUMCOLORS returned %d\n", devmode.dmBitsPerPel, val);
3098 }
3099
3100 ReleaseDC(0, hdc);
3101
3102 num = 1;
3103 while (1) {
3104 SetLastError (0xdeadbeef);
3106 DWORD le = GetLastError();
3107 ok(le == ERROR_NO_MORE_FILES ||
3108 le == ERROR_MOD_NOT_FOUND /* Win8 */ ||
3109 le == 0xdeadbeef, /* XP, 2003 */
3110 "Expected ERROR_NO_MORE_FILES, ERROR_MOD_NOT_FOUND or 0xdeadbeef, got %d for %d\n", le, num);
3111 break;
3112 }
3113 num++;
3114 }
3115}
DEVMODEW devmode
#define ERROR_MOD_NOT_FOUND
Definition: compat.h:104
GLuint GLuint num
Definition: glext.h:9618
#define memset(x, y, z)
Definition: compat.h:39
DWORD dmBitsPerPel
Definition: wingdi.h:1647
BOOL WINAPI EnumDisplaySettingsA(LPCSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEA lpDevMode)
Definition: display.c:312
#define ERROR_NO_MORE_FILES
Definition: winerror.h:121
#define NUMCOLORS
Definition: wingdi.h:725
#define BITSPIXEL
Definition: wingdi.h:720
#define ENUM_CURRENT_SETTINGS
Definition: winuser.h:179

Referenced by START_TEST().

◆ test_error_msg()

static BOOL test_error_msg ( int  rc,
const char name 
)
static

Definition at line 293 of file sysparams.c.

294{
296
297 if (rc==0)
298 {
300 {
301 skip("%s not supported on this platform\n", name);
302 }
304 {
305 skip("%s does not have privileges to run\n", name);
306 }
307 else
308 {
309 trace("%s failed for reason: %d. Indicating test failure and skipping remainder of test\n",name,last_error);
310 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%d\n",rc,last_error);
311 }
312 return FALSE;
313 }
314 else
315 {
316 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%d\n",rc,last_error);
317 return TRUE;
318 }
319}
#define skip(...)
Definition: atltest.h:64
#define ERROR_INVALID_SPI_VALUE
Definition: winerror.h:920

Referenced by dotest_spi_iconhorizontalspacing(), dotest_spi_iconverticalspacing(), run_spi_setmouse_test(), test_setborder(), test_SPI_ICONHORIZONTALSPACING(), test_SPI_ICONVERTICALSPACING(), test_SPI_SETBEEP(), test_SPI_SETBORDER(), test_SPI_SETDOUBLECLICKTIME(), test_SPI_SETDOUBLECLKHEIGHT(), test_SPI_SETDOUBLECLKWIDTH(), test_SPI_SETDRAGFULLWINDOWS(), test_SPI_SETFASTTASKSWITCH(), test_SPI_SETFONTSMOOTHING(), test_SPI_SETICONMETRICS(), test_SPI_SETICONTITLEWRAP(), test_SPI_SETKEYBOARDDELAY(), test_SPI_SETKEYBOARDPREF(), test_SPI_SETKEYBOARDSPEED(), test_SPI_SETLOWPOWERACTIVE(), test_SPI_SETMENUDROPALIGNMENT(), test_SPI_SETMENUSHOWDELAY(), test_SPI_SETMINIMIZEDMETRICS(), test_SPI_SETMOUSE(), test_SPI_SETMOUSEBUTTONSWAP(), test_SPI_SETMOUSEHOVERHEIGHT(), test_SPI_SETMOUSEHOVERTIME(), test_SPI_SETMOUSEHOVERWIDTH(), test_SPI_SETNONCLIENTMETRICS(), test_SPI_SETPOWEROFFACTIVE(), test_SPI_SETSCREENREADER(), test_SPI_SETSCREENSAVEACTIVE(), test_SPI_SETSCREENSAVETIMEOUT(), test_SPI_SETSHOWSOUNDS(), test_SPI_SETSNAPTODEFBUTTON(), test_SPI_SETWALLPAPER(), test_SPI_SETWHEELSCROLLCHARS(), test_SPI_SETWHEELSCROLLLINES(), and test_SPI_SETWORKAREA().

◆ test_GetAutoRotationState()

static void test_GetAutoRotationState ( void  )
static

Definition at line 3871 of file sysparams.c.

3872{
3874 BOOL ret;
3875
3876 if (!pGetAutoRotationState)
3877 {
3878 win_skip("GetAutoRotationState not supported\n");
3879 return;
3880 }
3881
3882 SetLastError(0xdeadbeef);
3883 ret = pGetAutoRotationState(NULL);
3884 ok(!ret, "Expected GetAutoRotationState to fail\n");
3885 ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
3886
3887 state = 0;
3888 ret = pGetAutoRotationState(&state);
3889 ok(ret, "Expected GetAutoRotationState to succeed, error %d\n", GetLastError());
3890}
static int state
Definition: maze.c:121
enum tagAR_STATE AR_STATE

Referenced by START_TEST().

◆ test_GetSysColorBrush()

static void test_GetSysColorBrush ( void  )
static

Definition at line 3117 of file sysparams.c.

3118{
3119 HBRUSH hbr;
3120
3121 SetLastError(0xdeadbeef);
3122 hbr = GetSysColorBrush(-1);
3123 ok(hbr == NULL, "Expected NULL brush\n");
3124 ok(GetLastError() == 0xdeadbeef, "Expected last error not set, got %x\n", GetLastError());
3125 /* greater than max index */
3126 hbr = GetSysColorBrush(COLOR_MENUBAR);
3127 if (hbr)
3128 {
3129 SetLastError(0xdeadbeef);
3130 hbr = GetSysColorBrush(COLOR_MENUBAR + 1);
3131 ok(hbr == NULL, "Expected NULL brush\n");
3132 ok(GetLastError() == 0xdeadbeef, "Expected last error not set, got %x\n", GetLastError());
3133 }
3134 else
3135 win_skip("COLOR_MENUBAR unsupported\n");
3136}
HBRUSH WINAPI GetSysColorBrush(_In_ int)

Referenced by START_TEST().

◆ test_GetSystemMetrics()

static void test_GetSystemMetrics ( void  )
static

Definition at line 2698 of file sysparams.c.

2699{
2700 TEXTMETRICA tmMenuFont;
2701 UINT IconSpacing, IconVerticalSpacing;
2702 BOOL rc;
2703
2704 HDC hdc = CreateICA( "Display", 0, 0, 0);
2705 UINT avcwCaption;
2706 INT CaptionWidthfromreg, smicon, broken_val;
2707 MINIMIZEDMETRICS minim;
2708 NONCLIENTMETRICSA ncm;
2709 SIZE screen;
2710
2711 assert(sizeof(ncm) == 344);
2712
2713 ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth);
2714 rc = SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
2715 ok(rc, "SystemParametersInfoA failed\n");
2716
2717 ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth) - 1;
2718 rc = SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
2719 ok(!rc, "SystemParametersInfoA should fail\n");
2720
2721 ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth) + 1;
2722 SetLastError(0xdeadbeef);
2723 rc = SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
2724 ok(!rc, "SystemParametersInfoA should fail\n");
2725
2726 ncm.cbSize = sizeof(ncm); /* Vista added padding */
2727 SetLastError(0xdeadbeef);
2728 ncm.iPaddedBorderWidth = 0xcccc;
2729 rc = SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
2730 ok(rc || broken(!rc) /* before Vista */, "SystemParametersInfoA failed\n");
2731 if (rc) ok( ncm.iPaddedBorderWidth == 0, "wrong iPaddedBorderWidth %u\n", ncm.iPaddedBorderWidth );
2732
2733 minim.cbSize = sizeof( minim);
2734 ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth);
2735 SystemParametersInfoA( SPI_GETMINIMIZEDMETRICS, 0, &minim, 0);
2736 rc = SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
2737 if( !rc) {
2738 win_skip("SPI_GETNONCLIENTMETRICS is not available\n");
2739 return;
2740 }
2741
2742 ok(is_font_enumerated(ncm.lfCaptionFont.lfFaceName), "font %s should be enumerated\n", ncm.lfCaptionFont.lfFaceName);
2743 ok(is_font_enumerated(ncm.lfSmCaptionFont.lfFaceName), "font %s should be enumerated\n", ncm.lfSmCaptionFont.lfFaceName);
2744 ok(is_font_enumerated(ncm.lfMenuFont.lfFaceName), "font %s should be enumerated\n", ncm.lfMenuFont.lfFaceName);
2745 ok(is_font_enumerated(ncm.lfStatusFont.lfFaceName), "font %s should be enumerated\n", ncm.lfStatusFont.lfFaceName);
2746 ok(is_font_enumerated(ncm.lfMessageFont.lfFaceName), "font %s should be enumerated\n", ncm.lfMessageFont.lfFaceName);
2747
2748 /* CaptionWidth from the registry may have different value of iCaptionWidth
2749 * from the non client metrics (observed on WinXP) */
2750 CaptionWidthfromreg = metricfromreg(
2751 "Control Panel\\Desktop\\WindowMetrics","CaptionWidth", dpi);
2752 get_text_metr_size( hdc, &ncm.lfMenuFont, &tmMenuFont, NULL);
2753 get_text_metr_size( hdc, &ncm.lfCaptionFont, NULL, &avcwCaption);
2754 /* FIXME: use icon metric */
2755 if( !SystemParametersInfoA( SPI_ICONVERTICALSPACING, 0, &IconVerticalSpacing, 0))
2756 IconVerticalSpacing = 0;
2757 if( !SystemParametersInfoA( SPI_ICONHORIZONTALSPACING, 0, &IconSpacing, 0 ))
2758 IconSpacing = 0;
2759 /* reset error counters */
2760 gsm_error_ctr = 0;
2761
2762 /* the tests: */
2763
2764 /* SM_CXSCREEN, cannot test these two */
2765 /* SM_CYSCREEN */
2766 ok_gsm( SM_CXVSCROLL, ncm.iScrollWidth);
2767 ok_gsm( SM_CYHSCROLL, ncm.iScrollWidth);
2768 ok_gsm( SM_CYCAPTION, ncm.iCaptionHeight+1);
2769 ok_gsm( SM_CXBORDER, 1);
2770 ok_gsm( SM_CYBORDER, 1);
2771 ok_gsm( SM_CXDLGFRAME, 3);
2772 ok_gsm( SM_CYDLGFRAME, 3);
2773 ok_gsm( SM_CYVTHUMB, ncm.iScrollHeight);
2774 ok_gsm( SM_CXHTHUMB, ncm.iScrollHeight);
2775 /* These don't depend on the Shell Icon Size registry value */
2780 ok_gsm( SM_CYMENU, ncm.iMenuHeight + 1);
2785 /* SM_CYKANJIWINDOW */
2786 /* SM_MOUSEPRESENT */
2787 ok_gsm( SM_CYVSCROLL, ncm.iScrollHeight);
2788 ok_gsm( SM_CXHSCROLL, ncm.iScrollHeight);
2789 /* SM_DEBUG */
2790 /* SM_SWAPBUTTON */
2791 /* SM_RESERVED1 */
2792 /* SM_RESERVED2 */
2793 /* SM_RESERVED3 */
2794 /* SM_RESERVED4 */
2795 ok_gsm( SM_CXMIN, 3 * max( CaptionWidthfromreg >= 0 ? CaptionWidthfromreg : ncm.iCaptionWidth, 8) +
2796 GetSystemMetrics( SM_CYSIZE) + 4 + 4 * avcwCaption + 2 * GetSystemMetrics( SM_CXFRAME));
2800 ncm.iCaptionWidth, /* classic/standard windows style */
2801 GetSystemMetrics( SM_CYCAPTION) - 1 /* WinXP style */
2802 );
2803 ok_gsm( SM_CYSIZE, ncm.iCaptionHeight);
2804 ok_gsm( SM_CXFRAME, ncm.iBorderWidth + 3);
2805 ok_gsm( SM_CYFRAME, ncm.iBorderWidth + 3);
2808 /* SM_CXDOUBLECLK */
2809 /* SM_CYDOUBLECLK */
2810 if( IconSpacing) ok_gsm( SM_CXICONSPACING, IconSpacing);
2811 if( IconVerticalSpacing) ok_gsm( SM_CYICONSPACING, IconVerticalSpacing);
2812 /* SM_MENUDROPALIGNMENT */
2813 /* SM_PENWINDOWS */
2814 /* SM_DBCSENABLED */
2815 /* SM_CMOUSEBUTTONS */
2816 /* SM_SECURE */
2817 ok_gsm( SM_CXEDGE, 2);
2818 ok_gsm( SM_CYEDGE, 2);
2819 /* sign-extension for iHorzGap/iVertGap is broken on Win9x */
2822
2823 smicon = MulDiv( 16, dpi, USER_DEFAULT_SCREEN_DPI );
2824 if (!pIsProcessDPIAware || pIsProcessDPIAware())
2825 smicon = max( min( smicon, CaptionWidthfromreg - 2), 4 ) & ~1;
2826 todo_wine_if( real_dpi == dpi && smicon != (MulDiv( 16, dpi, USER_DEFAULT_SCREEN_DPI) & ~1) )
2827 {
2828 broken_val = (min( ncm.iCaptionHeight, CaptionWidthfromreg ) - 2) & ~1;
2829 broken_val = min( broken_val, 20 );
2830
2831 if (smicon == 4)
2832 {
2833 ok_gsm_2( SM_CXSMICON, smicon, 6 );
2834 ok_gsm_2( SM_CYSMICON, smicon, 6 );
2835 }
2836 else if (smicon < broken_val)
2837 {
2838 ok_gsm_2( SM_CXSMICON, smicon, broken_val );
2839 ok_gsm_2( SM_CYSMICON, smicon, broken_val );
2840 }
2841