winspool: Remove unvarying unicode parameter from WINSPOOL_OpenDriverReg.

This commit is contained in:
Jeremy White 2009-11-30 17:03:58 -06:00 committed by Alexandre Julliard
parent 4376ccf3fc
commit 602d9058fb
1 changed files with 7 additions and 21 deletions

View File

@ -2191,29 +2191,15 @@ BOOL WINAPI GetPrintProcessorDirectoryW(LPWSTR server, LPWSTR env,
* the opened hkey on success * the opened hkey on success
* NULL on error * NULL on error
*/ */
static HKEY WINSPOOL_OpenDriverReg( LPCVOID pEnvironment, BOOL unicode) static HKEY WINSPOOL_OpenDriverReg( LPCVOID pEnvironment)
{ {
HKEY retval = NULL; HKEY retval = NULL;
LPWSTR buffer; LPWSTR buffer;
const printenv_t * env; const printenv_t * env;
TRACE("(%s, %d)\n", TRACE("(%s)\n", debugstr_w(pEnvironment));
(unicode) ? debugstr_w(pEnvironment) : debugstr_a(pEnvironment), unicode);
if (!pEnvironment || unicode) { env = validate_envW(pEnvironment);
/* pEnvironment was NULL or a Unicode-String: use it direct */
env = validate_envW(pEnvironment);
}
else
{
/* pEnvironment was an ANSI-String: convert to unicode first */
LPWSTR buffer;
INT len = MultiByteToWideChar(CP_ACP, 0, pEnvironment, -1, NULL, 0);
buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (buffer) MultiByteToWideChar(CP_ACP, 0, pEnvironment, -1, buffer, len);
env = validate_envW(buffer);
HeapFree(GetProcessHeap(), 0, buffer);
}
if (!env) return NULL; if (!env) return NULL;
buffer = HeapAlloc( GetProcessHeap(), 0, buffer = HeapAlloc( GetProcessHeap(), 0,
@ -2275,7 +2261,7 @@ HANDLE WINAPI AddPrinterW(LPWSTR pName, DWORD Level, LPBYTE pPrinter)
} }
RegCloseKey(hkeyPrinter); RegCloseKey(hkeyPrinter);
} }
hkeyDrivers = WINSPOOL_OpenDriverReg( NULL, TRUE); hkeyDrivers = WINSPOOL_OpenDriverReg(NULL);
if(!hkeyDrivers) { if(!hkeyDrivers) {
ERR("Can't create Drivers key\n"); ERR("Can't create Drivers key\n");
RegCloseKey(hkeyPrinters); RegCloseKey(hkeyPrinters);
@ -4304,7 +4290,7 @@ static BOOL WINSPOOL_GetPrinterDriver(HANDLE hPrinter, LPCWSTR pEnvironment,
return FALSE; return FALSE;
} }
hkeyDrivers = WINSPOOL_OpenDriverReg( pEnvironment, TRUE); hkeyDrivers = WINSPOOL_OpenDriverReg(pEnvironment);
if(!hkeyDrivers) { if(!hkeyDrivers) {
ERR("Can't create Drivers key\n"); ERR("Can't create Drivers key\n");
return FALSE; return FALSE;
@ -4669,7 +4655,7 @@ static BOOL WINSPOOL_EnumPrinterDrivers(LPWSTR pName, LPCWSTR pEnvironment,
*pcbNeeded = 0; *pcbNeeded = 0;
*pcReturned = 0; *pcReturned = 0;
hkeyDrivers = WINSPOOL_OpenDriverReg(pEnvironment, TRUE); hkeyDrivers = WINSPOOL_OpenDriverReg(pEnvironment);
if(!hkeyDrivers) { if(!hkeyDrivers) {
ERR("Can't open Drivers key\n"); ERR("Can't open Drivers key\n");
return FALSE; return FALSE;
@ -6163,7 +6149,7 @@ BOOL WINAPI DeletePrinterDriverExW( LPWSTR pName, LPWSTR pEnvironment,
return FALSE; return FALSE;
} }
hkey_drivers = WINSPOOL_OpenDriverReg(pEnvironment, TRUE); hkey_drivers = WINSPOOL_OpenDriverReg(pEnvironment);
if(!hkey_drivers) if(!hkey_drivers)
{ {