Commit 27faf02e authored by Stefan Leichter's avatar Stefan Leichter Committed by Alexandre Julliard

Moved implementation of EnumDisplaySettings from ASCII to Unicode.

parent 997e2359
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "sysmetrics.h" #include "sysmetrics.h"
#include "local.h" #include "local.h"
#include "module.h" #include "module.h"
#include "winternl.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DECLARE_DEBUG_CHANNEL(hook); WINE_DECLARE_DEBUG_CHANNEL(hook);
...@@ -337,17 +338,17 @@ LONG WINAPI ChangeDisplaySettingsExA( ...@@ -337,17 +338,17 @@ LONG WINAPI ChangeDisplaySettingsExA(
} }
/*********************************************************************** /***********************************************************************
* EnumDisplaySettingsA (USER32.@) * EnumDisplaySettingsW (USER32.@)
* FIXME: Currently uses static list of modes. * FIXME: Currently uses static list of modes.
* *
* RETURNS * RETURNS
* TRUE if nth setting exists found (described in the LPDEVMODEA struct) * TRUE if nth setting exists found (described in the LPDEVMODEW struct)
* FALSE if we do not have the nth setting * FALSE if we do not have the nth setting
*/ */
BOOL WINAPI EnumDisplaySettingsA( BOOL WINAPI EnumDisplaySettingsW(
LPCSTR name, /* [in] huh? */ LPCWSTR name, /* [in] huh? */
DWORD n, /* [in] nth entry in display settings list*/ DWORD n, /* [in] nth entry in display settings list*/
LPDEVMODEA devmode /* [out] devmode for that setting */ LPDEVMODEW devmode /* [out] devmode for that setting */
) { ) {
#define NRMODES 5 #define NRMODES 5
#define NRDEPTHS 4 #define NRDEPTHS 4
...@@ -356,7 +357,7 @@ BOOL WINAPI EnumDisplaySettingsA( ...@@ -356,7 +357,7 @@ BOOL WINAPI EnumDisplaySettingsA(
} modes[NRMODES]={{512,384},{640,400},{640,480},{800,600},{1024,768}}; } modes[NRMODES]={{512,384},{640,400},{640,480},{800,600},{1024,768}};
int depths[4] = {8,16,24,32}; int depths[4] = {8,16,24,32};
TRACE_(system)("(%s,%ld,%p)\n",name,n,devmode); TRACE_(system)("(%s,%ld,%p)\n",debugstr_w(name),n,devmode);
devmode->dmDisplayFlags = 0; devmode->dmDisplayFlags = 0;
devmode->dmDisplayFrequency = 85; devmode->dmDisplayFrequency = 85;
if (n==0 || n == (DWORD)-1 || n == (DWORD)-2) { if (n==0 || n == (DWORD)-1 || n == (DWORD)-2) {
...@@ -375,27 +376,28 @@ BOOL WINAPI EnumDisplaySettingsA( ...@@ -375,27 +376,28 @@ BOOL WINAPI EnumDisplaySettingsA(
} }
/*********************************************************************** /***********************************************************************
* EnumDisplaySettingsW (USER32.@) * EnumDisplaySettingsA (USER32.@)
*/ */
BOOL WINAPI EnumDisplaySettingsW(LPCWSTR name,DWORD n,LPDEVMODEW devmode) BOOL WINAPI EnumDisplaySettingsA(LPCSTR name,DWORD n,LPDEVMODEA devmode)
{ {
DEVMODEA devmodeA; DEVMODEW devmodeW;
BOOL ret; BOOL ret;
DWORD len = WideCharToMultiByte( CP_ACP, 0, name, -1, NULL, 0, NULL, NULL ); UNICODE_STRING nameW;
LPSTR nameA = HeapAlloc( GetProcessHeap(), 0, len );
if (name) RtlCreateUnicodeStringFromAsciiz(&nameW, name);
else nameW.Buffer = NULL;
WideCharToMultiByte( CP_ACP, 0, name, -1, nameA, len, NULL, NULL ); ret = EnumDisplaySettingsW(nameW.Buffer,n,&devmodeW);
ret = EnumDisplaySettingsA(nameA,n,&devmodeA);
if (ret) if (ret)
{ {
devmode->dmBitsPerPel = devmodeA.dmBitsPerPel; devmode->dmBitsPerPel = devmodeW.dmBitsPerPel;
devmode->dmPelsHeight = devmodeA.dmPelsHeight; devmode->dmPelsHeight = devmodeW.dmPelsHeight;
devmode->dmPelsWidth = devmodeA.dmPelsWidth; devmode->dmPelsWidth = devmodeW.dmPelsWidth;
devmode->dmDisplayFlags = devmodeA.dmDisplayFlags; devmode->dmDisplayFlags = devmodeW.dmDisplayFlags;
devmode->dmDisplayFrequency = devmodeA.dmDisplayFrequency; devmode->dmDisplayFrequency = devmodeW.dmDisplayFrequency;
/* FIXME: convert rest too, if they are ever returned */ /* FIXME: convert rest too, if they are ever returned */
} }
HeapFree(GetProcessHeap(),0,nameA); RtlFreeUnicodeString(&nameW);
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment