prntvpt: Implement PTOpenProviderEx.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2020-06-10 13:31:36 +08:00 committed by Alexandre Julliard
parent 15c8e5dee6
commit 645d909b28
2 changed files with 33 additions and 4 deletions

View File

@ -1,4 +1,6 @@
MODULE = prntvpt.dll
MODULE = prntvpt.dll
IMPORTLIB = prntvpt
IMPORTS = winspool
EXTRADLLFLAGS = -mno-cygwin

View File

@ -22,11 +22,20 @@
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winspool.h"
#include "prntvpt.h"
#include "wine/heap.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(prntvpt);
struct prn_provider
{
DWORD owner;
HANDLE hprn;
};
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved)
{
TRACE("(%p, %d, %p)\n", hinst, reason, reserved);
@ -42,7 +51,6 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved)
return TRUE;
}
HRESULT WINAPI PTQuerySchemaVersionSupport(PCWSTR printer, DWORD *version)
{
FIXME("stub:%s %p\n", debugstr_w(printer), version);
@ -57,6 +65,25 @@ HRESULT WINAPI PTOpenProvider(PCWSTR printer, DWORD version, HPTPROVIDER *provid
HRESULT WINAPI PTOpenProviderEx(const WCHAR *printer, DWORD max_version, DWORD pref_version, HPTPROVIDER *provider, DWORD *used_version)
{
FIXME("%s, %d, %d, %p, %p: stub\n", debugstr_w(printer), max_version, pref_version, provider, used_version);
return E_NOTIMPL;
struct prn_provider *prov;
TRACE("%s, %d, %d, %p, %p\n", debugstr_w(printer), max_version, pref_version, provider, used_version);
if (!max_version || !provider || !used_version)
return E_INVALIDARG;
prov = heap_alloc(sizeof(*prov));
if (!prov) return E_OUTOFMEMORY;
if (!OpenPrinterW((LPWSTR)printer, &prov->hprn, NULL))
{
heap_free(prov);
return HRESULT_FROM_WIN32(GetLastError());
}
prov->owner = GetCurrentThreadId();
*provider = (HPTPROVIDER)prov;
*used_version = 1;
return S_OK;
}