mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 20:59:54 +00:00
Add GetDefaultPrinter() functions.
This commit is contained in:
parent
7aa67c1d6a
commit
a0324f7172
@ -2686,6 +2686,71 @@ BOOL WINAPI EnumPortsA(LPSTR name,DWORD level,LPBYTE ports,DWORD bufsize,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* 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.@)
|
||||
*/
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user