Detlef Riekenberg : ntprint: Implement PSetupCreateMonitorInfo.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jun 21 09:47:36 CDT 2007


Module: wine
Branch: master
Commit: f7bd46a49d9bc9a1f53b7ea405339ef5b6ff569f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f7bd46a49d9bc9a1f53b7ea405339ef5b6ff569f

Author: Detlef Riekenberg <wine.dev at web.de>
Date:   Thu Jun 21 06:09:58 2007 +0200

ntprint: Implement PSetupCreateMonitorInfo.

---

 dlls/ntprint/Makefile.in  |    2 +-
 dlls/ntprint/ntprint.c    |   68 ++++++++++++++++++++++++++++++++++++++++++++-
 dlls/ntprint/ntprint.spec |    4 +-
 3 files changed, 70 insertions(+), 4 deletions(-)

diff --git a/dlls/ntprint/Makefile.in b/dlls/ntprint/Makefile.in
index b60b06b..b3ecad8 100644
--- a/dlls/ntprint/Makefile.in
+++ b/dlls/ntprint/Makefile.in
@@ -3,7 +3,7 @@ TOPOBJDIR = ../..
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = ntprint.dll
-IMPORTS   = kernel32
+IMPORTS   = winspool kernel32
 
 C_SRCS = \
 	ntprint.c
diff --git a/dlls/ntprint/ntprint.c b/dlls/ntprint/ntprint.c
index d3f8503..7363b9c 100644
--- a/dlls/ntprint/ntprint.c
+++ b/dlls/ntprint/ntprint.c
@@ -25,8 +25,11 @@
 
 #include "windef.h"
 #include "winbase.h"
-#include "winver.h"
+#include "winerror.h"
+#include "wingdi.h"
 #include "winnls.h"
+#include "winver.h"
+#include "winspool.h"
 
 #include "wine/unicode.h"
 #include "wine/debug.h"
@@ -35,6 +38,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(ntprint);
 
 HINSTANCE NTPRINT_hInstance = NULL;
 
+typedef struct {
+  LPMONITOR_INFO_2W mi2;    /* Buffer for installed Monitors */
+  DWORD installed;          /* Number of installed Monitors */
+} monitorinfo_t;
+
 /*****************************************************
  *      DllMain
  */
@@ -54,3 +62,61 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
     }
     return TRUE;
 }
+
+/*****************************************************
+ *  PSetupCreateMonitorInfo  [NTPRINT.@]
+ *
+ *
+ */
+
+HANDLE WINAPI PSetupCreateMonitorInfo(LPVOID unknown1, LPVOID  unknown2,LPVOID unknown3)
+{
+    monitorinfo_t * mi=NULL;
+    DWORD needed;
+    DWORD res;
+
+    TRACE("(%p, %p, %p)\n", unknown1, unknown2, unknown3);
+
+    if ((unknown2 != NULL) || (unknown3 != NULL)) {
+        FIXME("got unknown parameter: (%p, %p, %p)\n", unknown1, unknown2, unknown3);
+        return NULL;
+    }
+
+    mi = HeapAlloc(GetProcessHeap(), 0, sizeof(monitorinfo_t));
+    if (!mi) {
+        /* FIXME: SetLastError() needed? */
+        return NULL;
+    }
+
+    /* Get the needed size for all Monitors */
+    res = EnumMonitorsW(NULL, 2, NULL, 0, &needed, &mi->installed);
+    if (!res && (GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {
+        mi->mi2 = HeapAlloc(GetProcessHeap(), 0, needed);
+        res = EnumMonitorsW(NULL, 2, (LPBYTE) mi->mi2, needed, &needed, &mi->installed);
+    }
+
+    if (!res) {
+        HeapFree(GetProcessHeap(), 0, mi);
+        /* FIXME: SetLastError() needed? */
+        return NULL;
+    }
+
+    TRACE("=> %p (%u monitors installed)\n", mi, mi->installed);
+    return (HANDLE) mi;
+}
+
+/*****************************************************
+ *  PSetupDestroyMonitorInfo  [NTPRINT.@]
+ *
+ */
+
+VOID WINAPI PSetupDestroyMonitorInfo(HANDLE monitorinfo)
+{
+    monitorinfo_t * mi = (monitorinfo_t *) monitorinfo;
+
+    TRACE("(%p)\n", mi);
+    if (mi) {
+        if (mi->installed) HeapFree(GetProcessHeap(), 0, mi->mi2);
+        HeapFree(GetProcessHeap(), 0, mi);
+    }
+}
diff --git a/dlls/ntprint/ntprint.spec b/dlls/ntprint/ntprint.spec
index f703e96..348ab69 100644
--- a/dlls/ntprint/ntprint.spec
+++ b/dlls/ntprint/ntprint.spec
@@ -2,10 +2,10 @@
 @ stub PSetupAssociateICMProfiles
 @ stub PSetupBuildDriversFromPath
 @ stub PSetupCreateDrvSetupPage
-@ stub PSetupCreateMonitorInfo
+@ stdcall PSetupCreateMonitorInfo(long ptr ptr)
 @ stub PSetupCreatePrinterDeviceInfoList
 @ stub PSetupDestroyDriverInfo3
-@ stub PSetupDestroyMonitorInfo
+@ stdcall PSetupDestroyMonitorInfo(long)
 @ stub PSetupDestroyPrinterDeviceInfoList
 @ stub PSetupDestroySelectedDriverInfo
 @ stub PSetupDriverInfoFromName




More information about the wine-cvs mailing list