spoolss: [2/2] Implement EnumPorts (Forward to winspool.drv)
Detlef Riekenberg
wine.dev at web.de
Mon Nov 27 17:43:50 CST 2006
Native Printmonitors need this from spoolss.dll
The most compatible way would be:
- Implement the Printprovider in localspl.dll
- Call all Printprovider from spoolss.dll
- Do RPC-Calls to the the spooler from winspool.drv
We can take this short path
Changelog:
spoolss: [2/2] Implement EnumPorts (Forward to winspool.drv)
The Documentation are my own words
(Also for spoolss [1/2])
--
By by ... Detlef
-------------- next part --------------
>From d26b73930fcb83c47c09547d6e3876b096bb0972 Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Mon, 27 Nov 2006 23:35:04 +0100
Subject: [PATCH] spoolss: Implement EnumPortsW (Forward to winspool.drv)
---
dlls/spoolss/spoolss.spec | 2 +-
dlls/spoolss/spoolss_main.c | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 1 deletions(-)
diff --git a/dlls/spoolss/spoolss.spec b/dlls/spoolss/spoolss.spec
index c96c9c2..99bb91e 100644
--- a/dlls/spoolss/spoolss.spec
+++ b/dlls/spoolss/spoolss.spec
@@ -47,7 +47,7 @@
@ stub EnumJobsW
@ stub EnumMonitorsW
@ stub EnumPerMachineConnectionsW
-@ stub EnumPortsW
+@ stdcall EnumPortsW(wstr long ptr ptr ptr ptr)
@ stub EnumPrintProcessorDatatypesW
@ stub EnumPrintProcessorsW
@ stub EnumPrinterDataExW
diff --git a/dlls/spoolss/spoolss_main.c b/dlls/spoolss/spoolss_main.c
index a14cebb..6106997 100644
--- a/dlls/spoolss/spoolss_main.c
+++ b/dlls/spoolss/spoolss_main.c
@@ -27,6 +27,10 @@ #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(spoolss);
+static HMODULE hwinspool = NULL;
+static DWORD (WINAPI *pEnumPortsW)(LPWSTR, DWORD, LPBYTE, DWORD, LPDWORD, LPDWORD) = NULL;
+
+static WCHAR winspoolW[] = {'w','i','n','s','p','o','o','l','.','d','r','v',0};
/******************************************************************
*
@@ -40,6 +44,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,
return FALSE; /* prefer native version */
case DLL_PROCESS_ATTACH: {
DisableThreadLibraryCalls(hinstDLL);
+ hwinspool = LoadLibraryW(winspoolW);
+ pEnumPortsW = (VOID *) GetProcAddress(hwinspool, "EnumPortsW");
break;
}
}
@@ -143,3 +149,40 @@ BOOL WINAPI DllFreeSplStr(LPWSTR pwstr)
return HeapFree(GetProcessHeap(), 0, pwstr);
}
+/******************************************************************
+ * EnumPortsW (SPOOLSS.@)
+ *
+ * Enumerate available Ports
+ *
+ * PARAMS
+ * servername [I] Servername or NULL (local Computer)
+ * level [I] Structure-Level (1 or 2)
+ * buffer [O] PTR to Buffer that receives the Result
+ * cbBuf [I] Size of Buffer at buffer
+ * pcbNeeded [O] PTR to DWORD that receives the size in Bytes used / required for buffer
+ * pcReturned [O] PTR to DWORD that receives the number of Ports in buffer
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE and in pcbNeeded the Bytes required for buffer, if cbBuf is too small
+ *
+ * NOTES
+ * We use EnumPortsW from winspool.drv
+ *
+ */
+BOOL WINAPI EnumPortsW(LPWSTR servername, DWORD level, LPBYTE buffer,
+ DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
+{
+ BOOL res = FALSE;
+ TRACE("(%s, %d, %p, %d, %p, %p)\n", debugstr_w(servername),
+ level, buffer, cbBuf, pcbNeeded, pcReturned);
+
+ if(pEnumPortsW)
+ res = pEnumPortsW(servername, level, buffer, cbBuf, pcbNeeded, pcReturned);
+
+ TRACE(" => %d with %d (%d, %d)\n", res, GetLastError(),
+ pcbNeeded ? *pcbNeeded : 0, pcReturned ? *pcReturned : 0);
+ return res;
+}
+
+
--
1.4.1
More information about the wine-patches
mailing list