mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 06:05:48 +00:00
[PRINTING] Fix GetPrinterW, add tests for it and GetDefaultPrinterA/W, and add a proper stub for GetPrinterDriverDirectoryA.
* Pass the correct handle to _RpcGetPrinter in GetPrinterW. * Pass an empty string instead of a NULL pointer as wszComputerName to the GetPrinterLevel* functions, because this variable is later used as source for StringCbCopyExW. * Don't check for GetLastError() == ERROR_SUCCESS in tests. Windows apparently only sets the last error in case of failure. The Printing code should probably be changed similarly in a future commit. Should fix CORE-14072
This commit is contained in:
parent
3449296f7b
commit
3a69fd4e96
8 changed files with 155 additions and 31 deletions
|
@ -87,6 +87,14 @@ EnumPrinterDriversW(PWSTR pName, PWSTR pEnvironment, DWORD Level, PBYTE pDriverI
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI
|
||||
GetPrinterDriverDirectoryA(PSTR pName, PSTR pEnvironment, DWORD Level, PBYTE pDriverDirectory, DWORD cbBuf, PDWORD pcbNeeded)
|
||||
{
|
||||
TRACE("GetPrinterDriverDirectoryA(%s, %s, %lu, %p, %lu, %p)\n", pName, pEnvironment, Level, pDriverDirectory, cbBuf, pcbNeeded);
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI
|
||||
GetPrinterDriverDirectoryW(PWSTR pName, PWSTR pEnvironment, DWORD Level, PBYTE pDriverDirectory, DWORD cbBuf, PDWORD pcbNeeded)
|
||||
{
|
||||
|
|
|
@ -630,9 +630,17 @@ BOOL WINAPI
|
|||
GetPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
|
||||
{
|
||||
DWORD dwErrorCode;
|
||||
PSPOOLER_HANDLE pHandle = (PSPOOLER_HANDLE)hPrinter;
|
||||
|
||||
TRACE("GetPrinterW(%p, %lu, %p, %lu, %p)\n", hPrinter, Level, pPrinter, cbBuf, pcbNeeded);
|
||||
|
||||
// Sanity checks.
|
||||
if (!pHandle)
|
||||
{
|
||||
dwErrorCode = ERROR_INVALID_HANDLE;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
// Dismiss invalid levels already at this point.
|
||||
if (Level > 9)
|
||||
{
|
||||
|
@ -646,7 +654,7 @@ GetPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD
|
|||
// Do the RPC call
|
||||
RpcTryExcept
|
||||
{
|
||||
dwErrorCode = _RpcGetPrinter(hPrinter, Level, pPrinter, cbBuf, pcbNeeded);
|
||||
dwErrorCode = _RpcGetPrinter(pHandle->hPrinter, Level, pPrinter, cbBuf, pcbNeeded);
|
||||
}
|
||||
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
|
|
@ -152,7 +152,7 @@
|
|||
251 stdcall GetPrinterDataExW(ptr wstr wstr ptr ptr long ptr)
|
||||
252 stdcall GetPrinterDataW(ptr wstr ptr ptr long ptr)
|
||||
253 stdcall GetPrinterDriverA(ptr str long ptr long ptr)
|
||||
254 stdcall -stub GetPrinterDriverDirectoryA(str str long ptr long ptr)
|
||||
254 stdcall GetPrinterDriverDirectoryA(str str long ptr long ptr)
|
||||
255 stdcall GetPrinterDriverDirectoryW(wstr wstr long ptr long ptr)
|
||||
256 stdcall GetPrinterDriverW(ptr wstr long ptr long ptr)
|
||||
257 stdcall GetPrinterW(ptr long ptr long ptr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue