Make winecfg DPI interval to be the same as in Windows

Robert Shearman rob at codeweavers.com
Fri Mar 7 02:57:10 CST 2008


L. Rahyen wrote:
> @@ -37,7 +37,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
>  
>  #define RES_MAXLEN 5 /* the maximum number of characters in a screen dimension. 5 digits should be plenty, what kind of crazy person runs their screen >10,000 pixels across? */
>  #define MINDPI 96
> -#define MAXDPI 160
> +#define MAXDPI 480
>  #define DEFDPI 96
>  
>  static const char logpixels_reg[] = "System\\CurrentControlSet\\Hardware Profiles\\Current\\Software\\Fonts";
> @@ -243,9 +243,12 @@ static void on_d3d_pshader_mode_clicked(HWND dialog) {
>  }
>  static INT read_logpixels_reg(void)
>  {
> +    static const WCHAR szLogPixels[] = {'L', 'o', 'g', 'P', 'i', 'x', 'e', 'l', 's', 0};
>      DWORD dwLogPixels;
> -    char *buf  = get_reg_key(HKEY_LOCAL_MACHINE, logpixels_reg,
> -                             "LogPixels", NULL);
> +    WCHAR *buf;
> +    WCHAR szLogPixelsReg[MAXBUFLEN];
> +    MultiByteToWideChar(GetACP(), 0, logpixels_reg, -1, szLogPixelsReg, sizeof(szLogPixelsReg)/sizeof(szLogPixelsReg[0]) );
> +    buf = get_reg_keyW(HKEY_LOCAL_MACHINE, szLogPixelsReg, szLogPixels, NULL);
>      dwLogPixels = buf ? *buf : DEFDPI;
>      HeapFree(GetProcessHeap(), 0, buf);
>      return dwLogPixels;
>   

Don't convert a constant string using MultiByteToWideChar.

-- 
Rob Shearman




More information about the wine-devel mailing list