diff --git a/dlls/spoolss/spoolss.spec b/dlls/spoolss/spoolss.spec index 0862626e4a5..c96c9c20bee 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 d39cac3362e..a4a08e6027c 100644 --- a/dlls/spoolss/spoolss_main.c +++ b/dlls/spoolss/spoolss_main.c @@ -46,6 +46,35 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) return TRUE; } +/****************************************************************** + * 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.@] * @@ -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); +}