Dmitry Timoshkov : prntvpt: Implement PTOpenProviderEx.
Alexandre Julliard
julliard at winehq.org
Wed Jun 10 16:09:42 CDT 2020
Module: wine
Branch: master
Commit: 645d909b28b29970af220d5d241ac8b5c5add38e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=645d909b28b29970af220d5d241ac8b5c5add38e
Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date: Wed Jun 10 13:31:36 2020 +0800
prntvpt: Implement PTOpenProviderEx.
Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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;
}
More information about the wine-cvs
mailing list