Commit a0324f71 authored by Mark G. Adams's avatar Mark G. Adams Committed by Alexandre Julliard

Add GetDefaultPrinter() functions.

parent 7aa67c1d
......@@ -2687,6 +2687,71 @@ BOOL WINAPI EnumPortsA(LPSTR name,DWORD level,LPBYTE ports,DWORD bufsize,
}
/******************************************************************************
* GetDefaultPrinterA (WINSPOOL.@)
*
* Based on PRINTDLG_GetDefaultPrinterName in dlls/commdlg/printdlg.c
*/
BOOL WINAPI GetDefaultPrinterA(LPSTR name, LPDWORD namesize)
{
char *ptr;
if (*namesize < 1)
{
SetLastError (ERROR_INSUFFICIENT_BUFFER);
return FALSE;
}
if (!GetProfileStringA ("windows", "device", "", name, *namesize))
{
SetLastError (ERROR_FILE_NOT_FOUND);
return FALSE;
}
if ((ptr = strchr (name, ',')) == NULL)
{
SetLastError (ERROR_FILE_NOT_FOUND);
return FALSE;
}
*ptr = '\0';
*namesize = strlen (name) + 1;
return TRUE;
}
/******************************************************************************
* GetDefaultPrinterW (WINSPOOL.@)
*/
BOOL WINAPI GetDefaultPrinterW(LPWSTR name, LPDWORD namesize)
{
char *buf;
BOOL ret;
if (*namesize < 1)
{
SetLastError (ERROR_INSUFFICIENT_BUFFER);
return FALSE;
}
buf = HeapAlloc (GetProcessHeap (), 0, *namesize);
ret = GetDefaultPrinterA (buf, namesize);
if (ret)
{
DWORD len = MultiByteToWideChar (CP_ACP, 0, buf, -1, name, *namesize);
if (!len)
{
SetLastError (ERROR_INSUFFICIENT_BUFFER);
ret = FALSE;
}
else *namesize = len;
}
HeapFree (GetProcessHeap (), 0, buf);
return ret;
}
/******************************************************************************
* SetPrinterDataExA (WINSPOOL.@)
*/
DWORD WINAPI SetPrinterDataExA(HANDLE hPrinter, LPSTR pKeyName,
......
......@@ -94,6 +94,8 @@ debug_channels (winspool)
@ stub FindFirstPrinterChangeNotification
@ stub FindNextPrinterChangeNotification
@ stub FreePrinterNotifyInfo
@ stdcall GetDefaultPrinterA(str ptr) GetDefaultPrinterA
@ stdcall GetDefaultPrinterW(wstr ptr) GetDefaultPrinterW
@ stdcall GetFormA(long str long ptr long ptr) GetFormA
@ stdcall GetFormW(long wstr long ptr long ptr) GetFormW
@ stub GetJobA
......
......@@ -888,6 +888,10 @@ BOOL WINAPI EnumPrinterDriversW(LPWSTR pName, LPWSTR pEnvironment, DWORD Level,
LPDWORD pcbNeeded, LPDWORD pcbReturned);
#define EnumPrinterDrivers WINELIB_NAME_AW(EnumPrinterDrivers)
BOOL WINAPI GetDefaultPrinterA(LPSTR pName, LPDWORD pcbNameSize);
BOOL WINAPI GetDefaultPrinterW(LPWSTR pName, LPDWORD pcbNameSize);
#define GetDefaultPrinter WINELIB_NAME_AW(GetDefaultPrinter)
BOOL WINAPI DeletePrinterDriverA(LPSTR pName, LPSTR pEnvironment,
LPSTR pDriverName);
BOOL WINAPI DeletePrinterDriverW(LPWSTR pName, LPWSTR pEnvironment,
......
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