spoolss: [1/2] Implement AllocSplStr + DllFreeSplStr

Detlef Riekenberg wine.dev at web.de
Mon Nov 27 17:42:28 CST 2006


Native Printmonitors need this from spoolss.dll


Changelog:
spoolss: [1/2] Implement AllocSplStr + DllFreeSplStr

-- 
 
By by ... Detlef

-------------- next part --------------
>From c846aca7746e34a300e7c4a0d7d3802d76700733 Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Mon, 27 Nov 2006 23:30:32 +0100
Subject: [PATCH] spoolss: Implement AllocSplStr and DllFreeSplStr
---
 dlls/spoolss/spoolss.spec   |    4 ++-
 dlls/spoolss/spoolss_main.c |   50 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/dlls/spoolss/spoolss.spec b/dlls/spoolss/spoolss.spec
index 0862626..c96c9c2 100644
--- a/dlls/spoolss/spoolss.spec
+++ b/dlls/spoolss/spoolss.spec
@@ -12,7 +12,7 @@
 @ stub AddPrinterDriverW
 @ stub AddPrinterExW
 @ stub AddPrinterW
-@ stub AllocSplStr
+@ stdcall AllocSplStr(wstr)
 @ stub AppendPrinterNotifyInfoData
 @ stub BuildOtherNamesFromMachineName
 @ stub CallDrvDevModeConversion
@@ -40,7 +40,7 @@
 @ stub DeletePrinterKeyW
 @ stdcall DllAllocSplMem(long)
 @ stdcall DllFreeSplMem(ptr)
-@ stub DllFreeSplStr
+@ stdcall DllFreeSplStr(wstr)
 @ stub EndDocPrinter
 @ stub EndPagePrinter
 @ stub EnumFormsW
diff --git a/dlls/spoolss/spoolss_main.c b/dlls/spoolss/spoolss_main.c
index d39cac3..a14cebb 100644
--- a/dlls/spoolss/spoolss_main.c
+++ b/dlls/spoolss/spoolss_main.c
@@ -47,6 +47,35 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, 
 }
 
 /******************************************************************
+ *   AllocSplStr   [SPOOLSS.@]
+ *
+ * Create a copy from the String on the Spooler-Heap
+ *
+ * PARAMS
+ *  pwstr [I] PTR to the String to copy
+ *
+ * RETURNS
+ *  Failure: NULL
+ *  Success: PTR to the copied String
+ *
+ */
+LPWSTR WINAPI AllocSplStr(LPCWSTR pwstr)
+{
+    LPWSTR  res = NULL;
+    DWORD   len;
+
+    TRACE("(%s)\n", debugstr_w(pwstr));
+    if (!pwstr) return NULL;
+
+    len = (lstrlenW(pwstr) + 1) * sizeof(WCHAR);
+    res = HeapAlloc(GetProcessHeap(), 0, len);
+    if (res) lstrcpyW(res, pwstr);
+        
+    TRACE("returning %p\n", res);
+    return res;
+}
+
+/******************************************************************
  *   DllAllocSplMem   [SPOOLSS.@]
  *
  * Allocate cleared memory from the spooler heap
@@ -93,3 +122,24 @@ BOOL WINAPI DllFreeSplMem(LPBYTE memory)
     TRACE("(%p)\n", memory);
     return HeapFree(GetProcessHeap(), 0, memory);
 }
+
+/******************************************************************
+ *   DllFreeSplStr   [SPOOLSS.@]
+ *
+ * Free the allocated Spooler-String
+ *
+ * PARAMS
+ *  pwstr [I] PTR to the WSTR, allocated by AllocSplStr
+ *
+ * RETURNS
+ *  Failure: FALSE
+ *  Success: TRUE
+ *
+ */
+
+BOOL WINAPI DllFreeSplStr(LPWSTR pwstr)
+{
+    TRACE("(%s) PTR: %p\n", debugstr_w(pwstr), pwstr);
+    return HeapFree(GetProcessHeap(), 0, pwstr);
+}
+
-- 
1.4.1



More information about the wine-patches mailing list