Commit b1d920bb authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Use wide-character string literals.

parent 3d72d260
......@@ -34,8 +34,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(dc);
static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 };
static BOOL DC_DeleteObject( HGDIOBJ handle );
static const struct gdi_obj_funcs dc_funcs =
......@@ -699,7 +697,7 @@ HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output,
if (initData)
{
/* don't convert initData for DISPLAY driver, it's not used */
if (!driverW.Buffer || wcsicmp( driverW.Buffer, displayW ))
if (!driverW.Buffer || wcsicmp( driverW.Buffer, L"display" ))
initDataW = GdiConvertToDevmodeW(initData);
}
......@@ -754,7 +752,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
funcs = physDev->funcs;
release_dc_ptr( origDC );
}
else funcs = DRIVER_load_driver( displayW );
else funcs = DRIVER_load_driver( L"display" );
if (!(dc = alloc_dc_ptr( OBJ_MEMDC ))) return 0;
......
......@@ -139,13 +139,11 @@ static const struct gdi_dc_funcs *get_display_driver(void)
*/
static BOOL is_display_device( LPCWSTR name )
{
static const WCHAR display_deviceW[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y'};
const WCHAR *p = name;
if (wcsnicmp( name, display_deviceW, sizeof(display_deviceW) / sizeof(WCHAR) ))
return FALSE;
if (wcsnicmp( name, L"\\\\.\\DISPLAY", lstrlenW(L"\\\\.\\DISPLAY") )) return FALSE;
p += sizeof(display_deviceW) / sizeof(WCHAR);
p += lstrlenW(L"\\\\.\\DISPLAY");
if (!iswdigit( *p++ ))
return FALSE;
......@@ -161,8 +159,7 @@ static BOOL is_display_device( LPCWSTR name )
static HANDLE get_display_device_init_mutex( void )
{
static const WCHAR init_mutex[] = {'d','i','s','p','l','a','y','_','d','e','v','i','c','e','_','i','n','i','t',0};
HANDLE mutex = CreateMutexW( NULL, FALSE, init_mutex );
HANDLE mutex = CreateMutexW( NULL, FALSE, L"display_device_init" );
WaitForSingleObject( mutex, INFINITE );
return mutex;
......@@ -181,10 +178,9 @@ const struct gdi_dc_funcs *DRIVER_load_driver( LPCWSTR name )
{
HMODULE module;
struct graphics_driver *driver, *new_driver;
static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 };
/* display driver is a special case */
if (!wcsicmp( name, displayW ) || is_display_device( name )) return get_display_driver();
if (!wcsicmp( name, L"display" ) || is_display_device( name )) return get_display_driver();
if ((module = GetModuleHandleW( name )))
{
......@@ -936,20 +932,16 @@ const struct gdi_dc_funcs null_driver =
*/
BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size )
{
static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 };
static const WCHAR devicesW[] = { 'd','e','v','i','c','e','s',0 };
static const WCHAR empty_strW[] = { 0 };
WCHAR *p;
/* display is a special case */
if (!wcsicmp( device, displayW ) ||
is_display_device( device ))
if (!wcsicmp( device, L"display" ) || is_display_device( device ))
{
lstrcpynW( driver, displayW, size );
lstrcpynW( driver, L"display", size );
return TRUE;
}
size = GetProfileStringW(devicesW, device, empty_strW, driver, size);
size = GetProfileStringW(L"devices", device, L"", driver, size);
if(!size) {
WARN("Unable to find %s in [devices] section of win.ini\n", debugstr_w(device));
return FALSE;
......@@ -1369,14 +1361,6 @@ NTSTATUS WINAPI D3DKMTCloseAdapter( const D3DKMT_CLOSEADAPTER *desc )
*/
NTSTATUS WINAPI D3DKMTOpenAdapterFromGdiDisplayName( D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME *desc )
{
static const WCHAR displayW[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y'};
static const WCHAR state_flagsW[] = {'S','t','a','t','e','F','l','a','g','s',0};
static const WCHAR video_value_fmtW[] = {'\\','D','e','v','i','c','e','\\',
'V','i','d','e','o','%','d',0};
static const WCHAR video_keyW[] = {'H','A','R','D','W','A','R','E','\\',
'D','E','V','I','C','E','M','A','P','\\',
'V','I','D','E','O','\\',0};
static const WCHAR gpu_idW[] = {'G','P','U','I','D',0};
WCHAR *end, key_nameW[MAX_PATH], bufferW[MAX_PATH];
HDEVINFO devinfo = INVALID_HANDLE_VALUE;
NTSTATUS status = STATUS_UNSUCCESSFUL;
......@@ -1395,10 +1379,10 @@ NTSTATUS WINAPI D3DKMTOpenAdapterFromGdiDisplayName( D3DKMT_OPENADAPTERFROMGDIDI
return STATUS_UNSUCCESSFUL;
TRACE("DeviceName: %s\n", wine_dbgstr_w( desc->DeviceName ));
if (wcsnicmp( desc->DeviceName, displayW, ARRAY_SIZE(displayW) ))
if (wcsnicmp( desc->DeviceName, L"\\\\.\\DISPLAY", lstrlenW(L"\\\\.\\DISPLAY") ))
return STATUS_UNSUCCESSFUL;
index = wcstol( desc->DeviceName + ARRAY_SIZE(displayW), &end, 10 ) - 1;
index = wcstol( desc->DeviceName + lstrlenW(L"\\\\.\\DISPLAY"), &end, 10 ) - 1;
if (*end)
return STATUS_UNSUCCESSFUL;
......@@ -1410,14 +1394,14 @@ NTSTATUS WINAPI D3DKMTOpenAdapterFromGdiDisplayName( D3DKMT_OPENADAPTERFROMGDIDI
mutex = get_display_device_init_mutex();
size = sizeof( bufferW );
swprintf( key_nameW, MAX_PATH, video_value_fmtW, index );
if (RegGetValueW( HKEY_LOCAL_MACHINE, video_keyW, key_nameW, RRF_RT_REG_SZ, NULL, bufferW, &size ))
swprintf( key_nameW, MAX_PATH, L"\\Device\\Video%d", index );
if (RegGetValueW( HKEY_LOCAL_MACHINE, L"HARDWARE\\DEVICEMAP\\VIDEO", key_nameW, RRF_RT_REG_SZ, NULL, bufferW, &size ))
goto done;
/* Strip \Registry\Machine\ prefix and retrieve Wine specific data set by the display driver */
lstrcpyW( key_nameW, bufferW + 18 );
size = sizeof( state_flags );
if (RegGetValueW( HKEY_CURRENT_CONFIG, key_nameW, state_flagsW, RRF_RT_REG_DWORD, NULL,
if (RegGetValueW( HKEY_CURRENT_CONFIG, key_nameW, L"StateFlags", RRF_RT_REG_DWORD, NULL,
&state_flags, &size ))
goto done;
......@@ -1425,7 +1409,7 @@ NTSTATUS WINAPI D3DKMTOpenAdapterFromGdiDisplayName( D3DKMT_OPENADAPTERFROMGDIDI
goto done;
size = sizeof( bufferW );
if (RegGetValueW( HKEY_CURRENT_CONFIG, key_nameW, gpu_idW, RRF_RT_REG_SZ, NULL, bufferW, &size ))
if (RegGetValueW( HKEY_CURRENT_CONFIG, key_nameW, L"GPUID", RRF_RT_REG_SZ, NULL, bufferW, &size ))
goto done;
devinfo = SetupDiCreateDeviceInfoList( &GUID_DEVCLASS_DISPLAY, NULL );
......
......@@ -2836,7 +2836,6 @@ typedef struct wmf_in_emf_comment
HENHMETAFILE WINAPI SetWinMetaFileBits(UINT cbBuffer, const BYTE *lpbBuffer, HDC hdcRef,
const METAFILEPICT *lpmfp)
{
static const WCHAR szDisplayW[] = { 'D','I','S','P','L','A','Y','\0' };
HMETAFILE hmf = NULL;
HENHMETAFILE ret = NULL;
HDC hdc = NULL, hdcdisp = NULL;
......@@ -2857,7 +2856,7 @@ HENHMETAFILE WINAPI SetWinMetaFileBits(UINT cbBuffer, const BYTE *lpbBuffer, HDC
if (ret) return ret;
if(!hdcRef)
hdcRef = hdcdisp = CreateDCW(szDisplayW, NULL, NULL, NULL);
hdcRef = hdcdisp = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
if (lpmfp)
{
......
......@@ -332,7 +332,6 @@ HDC WINAPI CreateEnhMetaFileW(
LPCWSTR description /* [in] optional description */
)
{
static const WCHAR displayW[] = {'D','I','S','P','L','A','Y',0};
HDC ret, ref_dc;
DC *dc;
EMFDRV_PDEVICE *physDev;
......@@ -378,7 +377,7 @@ HDC WINAPI CreateEnhMetaFileW(
if (hdc) /* if no ref, use current display */
ref_dc = hdc;
else
ref_dc = CreateDCW( displayW, NULL, NULL, NULL );
ref_dc = CreateDCW( L"DISPLAY", NULL, NULL, NULL );
memset( physDev->dev_caps, 0, sizeof(physDev->dev_caps) );
for (cap = 0; cap < ARRAY_SIZE( physDev->dev_caps ); cap++)
......
......@@ -33,7 +33,6 @@
#include "gdi_private.h"
static const WCHAR opengl32W[] = {'o','p','e','n','g','l','3','2','.','d','l','l',0};
static HMODULE opengl32;
static INT (WINAPI *wglChoosePixelFormat)(HDC,const PIXELFORMATDESCRIPTOR *);
static INT (WINAPI *wglDescribePixelFormat)(HDC,INT,UINT,PIXELFORMATDESCRIPTOR*);
......@@ -65,7 +64,7 @@ INT WINAPI ChoosePixelFormat( HDC hdc, const PIXELFORMATDESCRIPTOR *pfd )
{
if (!wglChoosePixelFormat)
{
if (!opengl32) opengl32 = LoadLibraryW( opengl32W );
if (!opengl32) opengl32 = LoadLibraryW( L"opengl32.dll" );
if (!(wglChoosePixelFormat = (void *)GetProcAddress( opengl32, "wglChoosePixelFormat" )))
return 0;
}
......@@ -79,7 +78,7 @@ INT WINAPI DescribePixelFormat( HDC hdc, INT fmt, UINT size, PIXELFORMATDESCRIPT
{
if (!wglDescribePixelFormat)
{
if (!opengl32) opengl32 = LoadLibraryW( opengl32W );
if (!opengl32) opengl32 = LoadLibraryW( L"opengl32.dll" );
if (!(wglDescribePixelFormat = (void *)GetProcAddress( opengl32, "wglDescribePixelFormat" )))
return 0;
}
......@@ -93,7 +92,7 @@ INT WINAPI GetPixelFormat( HDC hdc )
{
if (!wglGetPixelFormat)
{
if (!opengl32) opengl32 = LoadLibraryW( opengl32W );
if (!opengl32) opengl32 = LoadLibraryW( L"opengl32.dll" );
if (!(wglGetPixelFormat = (void *)GetProcAddress( opengl32, "wglGetPixelFormat" )))
return 0;
}
......@@ -107,7 +106,7 @@ BOOL WINAPI SetPixelFormat( HDC hdc, INT fmt, const PIXELFORMATDESCRIPTOR *pfd )
{
if (!wglSetPixelFormat)
{
if (!opengl32) opengl32 = LoadLibraryW( opengl32W );
if (!opengl32) opengl32 = LoadLibraryW( L"opengl32.dll" );
if (!(wglSetPixelFormat = (void *)GetProcAddress( opengl32, "wglSetPixelFormat" )))
return FALSE;
}
......@@ -121,7 +120,7 @@ BOOL WINAPI SwapBuffers( HDC hdc )
{
if (!wglSwapBuffers)
{
if (!opengl32) opengl32 = LoadLibraryW( opengl32W );
if (!opengl32) opengl32 = LoadLibraryW( L"opengl32.dll" );
if (!(wglSwapBuffers = (void *)GetProcAddress( opengl32, "wglSwapBuffers" )))
return FALSE;
}
......
......@@ -1437,14 +1437,13 @@ INT mirror_region( HRGN dst, HRGN src, INT width )
*/
BOOL WINAPI MirrorRgn( HWND hwnd, HRGN hrgn )
{
static const WCHAR user32W[] = {'u','s','e','r','3','2','.','d','l','l',0};
static BOOL (WINAPI *pGetWindowRect)( HWND hwnd, LPRECT rect );
RECT rect;
/* yes, a HWND in gdi32, don't ask */
if (!pGetWindowRect)
{
HMODULE user32 = GetModuleHandleW(user32W);
HMODULE user32 = GetModuleHandleW(L"user32.dll");
if (!user32) return FALSE;
if (!(pGetWindowRect = (void *)GetProcAddress( user32, "GetWindowRect" ))) return FALSE;
}
......
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