localspl: Implement InitializePrintMonitor
Detlef Riekenberg
wine.dev at web.de
Thu Oct 5 17:17:16 CDT 2006
Changelog:
- localspl: Implement InitializePrintMonitor
Native Windows has a seperate Heap for the
spooler-subsystem, but we do not need that.
The Memory-Macros are from msi. Thanks Mike.
--
By by ... Detlef
-------------- next part --------------
Subject: [PATCH] localspl: Implement InitializePrintMonitor
---
dlls/localspl/localmon.c | 30 ++++++++++++++++--
dlls/localspl/localspl_main.c | 2 +
dlls/localspl/localspl_private.h | 62 ++++++++++++++++++++++++++++++++++++++
3 files changed, 90 insertions(+), 4 deletions(-)
create mode 100644 dlls/localspl/localspl_private.h
b3b9a778cac0f4018f55414c723f5a7999f5a983
diff --git a/dlls/localspl/localmon.c b/dlls/localspl/localmon.c
index 6665585..8685045 100644
--- a/dlls/localspl/localmon.c
+++ b/dlls/localspl/localmon.c
@@ -36,10 +36,30 @@
#include "wine/unicode.h"
#include "wine/debug.h"
+#include "localspl_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(localspl);
+/* ### Internal Globals ### */
+
+static LPMONITOREX g_monitorex = NULL;
+
+/*****************************************************
+ * localmon_create_globals [internal]
+ *
+ */
+BOOL WINAPI localmon_create_globals(void)
+{
+ if (g_monitorex == NULL) {
+ g_monitorex = spl_alloc_zero(sizeof(MONITOREX));
+ if (g_monitorex == NULL) return FALSE;
+
+ g_monitorex->dwMonitorSize = sizeof(MONITOREX) - sizeof(DWORD);
+ }
+ return TRUE;
+}
+
/*****************************************************
* InitializePrintMonitor (LOCALSPL.@)
*
@@ -53,18 +73,20 @@ WINE_DEFAULT_DEBUG_CHANNEL(localspl);
* Failure: NULL
*
* NOTES
- * Native localspl.dll fails, when the Section "Ports" is missing in "win.ini".
+ * The fixed location "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Ports"
+ * is used to store the Ports (IniFileMapping from "win.ini", Section "Ports").
+ * Native localspl.dll fails, when no valid Port-Entry is present.
*
*/
LPMONITOREX WINAPI InitializePrintMonitor(LPWSTR regroot)
{
- FIXME("(%s) stub\n", debugstr_w(regroot));
+ TRACE("(%s)\n", debugstr_w(regroot));
+ /* Parameter "regroot" is ignored on NT4.0 (localmon.dll) */
if (!regroot || !regroot[0]) {
SetLastError(ERROR_INVALID_PARAMETER);
return NULL;
}
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return NULL;
+ return g_monitorex;
}
diff --git a/dlls/localspl/localspl_main.c b/dlls/localspl/localspl_main.c
index b1de446..e88d818 100644
--- a/dlls/localspl/localspl_main.c
+++ b/dlls/localspl/localspl_main.c
@@ -36,6 +36,7 @@
#include "wine/unicode.h"
#include "wine/debug.h"
+#include "localspl_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(localspl);
@@ -54,6 +55,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls( hinstDLL );
+ if (!localmon_create_globals()) return FALSE;
break;
}
return TRUE;
diff --git a/dlls/localspl/localspl_private.h b/dlls/localspl/localspl_private.h
new file mode 100644
index 0000000..9c1bfd6
--- /dev/null
+++ b/dlls/localspl/localspl_private.h
@@ -0,0 +1,62 @@
+/*
+ * Implementation of the Local Printmonitor: internal include file
+ *
+ * Copyright 2006 Detlef Riekenberg
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WINE_LOCALSPL_PRIVATE__
+#define __WINE_LOCALSPL_PRIVATE__
+
+
+/* ## DLL-wide Globals ## */
+
+
+
+/* Memory allocation macros */
+/* Native localspl.dll uses the the Memory-Functions from spoolss.dll,
+ but we want to be independant as much as possible */
+
+static inline void *spl_alloc( size_t len )
+{
+ return HeapAlloc( GetProcessHeap(), 0, len );
+}
+
+static inline void *spl_alloc_zero( size_t len )
+{
+ return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, len );
+}
+
+static inline void *spl_realloc( void *mem, size_t len )
+{
+ return HeapReAlloc( GetProcessHeap(), 0, mem, len );
+}
+
+static inline void *spl_realloc_zero( void *mem, size_t len )
+{
+ return HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len );
+}
+
+static inline BOOL spl_free( void *mem )
+{
+ return HeapFree( GetProcessHeap(), 0, mem );
+}
+
+/* ### Functions ### */
+BOOL WINAPI localmon_create_globals(void);
+
+
+#endif /* __WINE_LOCALSPL_PRIVATE__ */
--
1.1.3
More information about the wine-patches
mailing list