spoolss: Implement AllocSplStr + DllFreeSplStr.

This commit is contained in:
Detlef Riekenberg 2006-11-28 00:42:28 +01:00 committed by Alexandre Julliard
parent 8e8e8f073d
commit 0e57af887e
2 changed files with 51 additions and 2 deletions

View File

@ -12,7 +12,7 @@
@ stub AddPrinterDriverW @ stub AddPrinterDriverW
@ stub AddPrinterExW @ stub AddPrinterExW
@ stub AddPrinterW @ stub AddPrinterW
@ stub AllocSplStr @ stdcall AllocSplStr(wstr)
@ stub AppendPrinterNotifyInfoData @ stub AppendPrinterNotifyInfoData
@ stub BuildOtherNamesFromMachineName @ stub BuildOtherNamesFromMachineName
@ stub CallDrvDevModeConversion @ stub CallDrvDevModeConversion
@ -40,7 +40,7 @@
@ stub DeletePrinterKeyW @ stub DeletePrinterKeyW
@ stdcall DllAllocSplMem(long) @ stdcall DllAllocSplMem(long)
@ stdcall DllFreeSplMem(ptr) @ stdcall DllFreeSplMem(ptr)
@ stub DllFreeSplStr @ stdcall DllFreeSplStr(wstr)
@ stub EndDocPrinter @ stub EndDocPrinter
@ stub EndPagePrinter @ stub EndPagePrinter
@ stub EnumFormsW @ stub EnumFormsW

View File

@ -46,6 +46,35 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
return TRUE; 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.@] * DllAllocSplMem [SPOOLSS.@]
* *
@ -93,3 +122,23 @@ BOOL WINAPI DllFreeSplMem(LPBYTE memory)
TRACE("(%p)\n", memory); TRACE("(%p)\n", memory);
return HeapFree(GetProcessHeap(), 0, 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);
}