v2: Fix test failures under Windows 8.
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/prntvpt/Makefile.in | 4 +++- dlls/prntvpt/main.c | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/dlls/prntvpt/Makefile.in b/dlls/prntvpt/Makefile.in index 5efd1c4eb2..a3db8760c2 100644 --- a/dlls/prntvpt/Makefile.in +++ b/dlls/prntvpt/Makefile.in @@ -1,4 +1,6 @@ -MODULE = prntvpt.dll +MODULE = prntvpt.dll +IMPORTLIB = prntvpt +IMPORTS = winspool
EXTRADLLFLAGS = -mno-cygwin
diff --git a/dlls/prntvpt/main.c b/dlls/prntvpt/main.c index ec7cf7c3e2..902be87114 100644 --- a/dlls/prntvpt/main.c +++ b/dlls/prntvpt/main.c @@ -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; }