Commit d4193bbd authored by Dimitrie O. Paun's avatar Dimitrie O. Paun Committed by Alexandre Julliard

Unicodify WINSPOOL_OpenDriverReg().

parent e42a23d2
...@@ -70,8 +70,13 @@ static INT (WINAPI *GDI_CallExtDeviceMode16)( HWND hwnd, LPDEVMODEA lpdmOutput, ...@@ -70,8 +70,13 @@ static INT (WINAPI *GDI_CallExtDeviceMode16)( HWND hwnd, LPDEVMODEA lpdmOutput,
static const char Printers[] = static const char Printers[] =
"System\\CurrentControlSet\\control\\Print\\Printers\\"; "System\\CurrentControlSet\\control\\Print\\Printers\\";
static const char Drivers[] =
"System\\CurrentControlSet\\control\\Print\\Environments\\%s\\Drivers\\"; static const WCHAR DriversW[] = { 'S','y','s','t','e','m','\\',
'C','u', 'r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
'c','o','n','t','r','o','l','\\',
'P','r','i','n','t','\\',
'E','n','v','i','r','o','n','m','e','n','t','s','\\',
'%','s','\\','D','r','i','v','e','r','s','\\',0 };
static const WCHAR DefaultEnvironmentW[] = {'W','i','n','e',0}; static const WCHAR DefaultEnvironmentW[] = {'W','i','n','e',0};
...@@ -1155,49 +1160,56 @@ BOOL WINAPI GetPrintProcessorDirectoryW(LPWSTR server, LPWSTR env, ...@@ -1155,49 +1160,56 @@ BOOL WINAPI GetPrintProcessorDirectoryW(LPWSTR server, LPWSTR env,
* NULL on error * NULL on error
*/ */
static HKEY WINSPOOL_OpenDriverReg( LPVOID pEnvironment, BOOL unicode) static HKEY WINSPOOL_OpenDriverReg( LPVOID pEnvironment, BOOL unicode)
{ HKEY retval; {
LPSTR lpKey, p = NULL; static const WCHAR WinNTW[] = { 'W','i','n','d','o','w','s',' ','N','T',' ','x','8','6',0 };
static const WCHAR Win40W[] = { 'W','i','n','d','o','w','s',' ','4','.','0',0 };
HKEY retval;
LPWSTR lpKey, buffer = NULL;
LPCWSTR pEnvW;
TRACE("%s\n", TRACE("%s\n",
(unicode) ? debugstr_w(pEnvironment) : debugstr_a(pEnvironment)); (unicode) ? debugstr_w(pEnvironment) : debugstr_a(pEnvironment));
if(pEnvironment) if(pEnvironment) {
p = (unicode) ? HEAP_strdupWtoA( GetProcessHeap(), 0, pEnvironment) : if (unicode) {
pEnvironment; pEnvW = pEnvironment;
else { } else {
OSVERSIONINFOA ver; INT len = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pEnvironment, -1, NULL, 0);
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA); buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (buffer) MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pEnvironment, -1, buffer, len);
pEnvW = buffer;
}
} else {
OSVERSIONINFOW ver;
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
if(!GetVersionExA( &ver)) if(!GetVersionExW( &ver))
return 0; return 0;
switch (ver.dwPlatformId) { switch (ver.dwPlatformId) {
case VER_PLATFORM_WIN32s: case VER_PLATFORM_WIN32s:
ERR("win32 style printing used with 16 bits app, try specifying 'win95' Windows version\n"); ERR("win32 style printing used with 16 bits app, try specifying 'win95' Windows version\n");
return 0; return 0;
case VER_PLATFORM_WIN32_NT: case VER_PLATFORM_WIN32_NT:
p = "Windows NT x86"; pEnvW = WinNTW;
break; break;
default: default:
p = "Windows 4.0"; pEnvW = Win40W;
break; break;
} }
TRACE("set environment to %s\n", p); TRACE("set environment to %s\n", debugstr_w(pEnvW));
} }
lpKey = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, lpKey = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
strlen(p) + strlen(Drivers)); (strlenW(pEnvW) + strlenW(DriversW) + 1) * sizeof(WCHAR));
sprintf( lpKey, Drivers, p); wsprintfW( lpKey, DriversW, pEnvW);
TRACE("%s\n", lpKey); TRACE("%s\n", debugstr_w(lpKey));
if(RegCreateKeyA(HKEY_LOCAL_MACHINE, lpKey, &retval) != if(RegCreateKeyW(HKEY_LOCAL_MACHINE, lpKey, &retval) != ERROR_SUCCESS)
ERROR_SUCCESS)
retval = 0; retval = 0;
if(pEnvironment && unicode) HeapFree( GetProcessHeap(), 0, buffer);
HeapFree( GetProcessHeap(), 0, p);
HeapFree( GetProcessHeap(), 0, lpKey); HeapFree( GetProcessHeap(), 0, lpKey);
return retval; return retval;
......
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