Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/prntvpt/main.c | 21 +++++++++++++++++++++ dlls/prntvpt/prntvpt.spec | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/dlls/prntvpt/main.c b/dlls/prntvpt/main.c index 9c12b0cbfa..dee5ca519a 100644 --- a/dlls/prntvpt/main.c +++ b/dlls/prntvpt/main.c @@ -57,6 +57,27 @@ HRESULT WINAPI PTQuerySchemaVersionSupport(PCWSTR printer, DWORD *version) return E_NOTIMPL; }
+static BOOL is_valid_provider(struct prn_provider *prov) +{ + return prov && prov->owner == GetCurrentThreadId(); +} + +HRESULT WINAPI PTCloseProvider(HPTPROVIDER provider) +{ + struct prn_provider *prov = (struct prn_provider *)provider; + + TRACE("%p\n", provider); + + if (!is_valid_provider(prov)) + return E_HANDLE; + + prov->owner = 0; + ClosePrinter(prov->hprn); + heap_free(prov); + + return S_OK; +} + HRESULT WINAPI PTOpenProvider(PCWSTR printer, DWORD version, HPTPROVIDER *provider) { DWORD used_version; diff --git a/dlls/prntvpt/prntvpt.spec b/dlls/prntvpt/prntvpt.spec index 5581fa4c50..99c6708242 100644 --- a/dlls/prntvpt/prntvpt.spec +++ b/dlls/prntvpt/prntvpt.spec @@ -1,7 +1,7 @@ @ stdcall PTQuerySchemaVersionSupport(wstr ptr) @ stdcall PTOpenProvider(wstr long ptr) @ stdcall PTOpenProviderEx(wstr long long ptr ptr) -@ stub PTCloseProvider +@ stdcall PTCloseProvider(ptr) @ stub BindPTProviderThunk @ stub PTGetPrintCapabilities @ stub PTMergeAndValidatePrintTicket