Module: wine Branch: master Commit: 0e57af887e9f3c981355eb465f18a2e51711349c URL: http://source.winehq.org/git/wine.git/?a=commit;h=0e57af887e9f3c981355eb465f...
Author: Detlef Riekenberg wine.dev@web.de Date: Tue Nov 28 00:42:28 2006 +0100
spoolss: Implement AllocSplStr + DllFreeSplStr.
---
dlls/spoolss/spoolss.spec | 4 +- dlls/spoolss/spoolss_main.c | 49 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 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..a4a08e6 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,23 @@ 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); +}