mirror of
https://github.com/reactos/reactos.git
synced 2024-09-28 21:44:31 +00:00
[PRINTING] The first argument to PackStrings can be const.
This commit is contained in:
parent
d272866550
commit
2e4457f223
|
@ -32,7 +32,7 @@ START_TEST(MarshallDownStructuresArray)
|
||||||
PPORT_INFO_2W pPortInfo2Copy;
|
PPORT_INFO_2W pPortInfo2Copy;
|
||||||
PPORT_INFO_2W pPortInfo2Test;
|
PPORT_INFO_2W pPortInfo2Test;
|
||||||
PBYTE pPortInfoEnd;
|
PBYTE pPortInfoEnd;
|
||||||
PWSTR pwszStrings[] = { L"PortName", L"MonitorName", L"Description" };
|
PCWSTR pwszStrings[] = { L"PortName", L"MonitorName", L"Description" };
|
||||||
DWORD cbPortInfo2Size = cElements * (sizeof(PORT_INFO_2W) + (wcslen(pwszStrings[0]) + 1 + wcslen(pwszStrings[1]) + 1 + wcslen(pwszStrings[2]) + 1) * sizeof(WCHAR));
|
DWORD cbPortInfo2Size = cElements * (sizeof(PORT_INFO_2W) + (wcslen(pwszStrings[0]) + 1 + wcslen(pwszStrings[1]) + 1 + wcslen(pwszStrings[2]) + 1) * sizeof(WCHAR));
|
||||||
DWORD fPortType = 1337;
|
DWORD fPortType = 1337;
|
||||||
DWORD Reserved = 42;
|
DWORD Reserved = 42;
|
||||||
|
|
|
@ -21,8 +21,8 @@ EXAMPLE_STRUCT, *PEXAMPLE_STRUCT;
|
||||||
|
|
||||||
START_TEST(PackStrings)
|
START_TEST(PackStrings)
|
||||||
{
|
{
|
||||||
PWSTR Source1[] = { L"Test", L"String" };
|
PCWSTR Source1[] = { L"Test", L"String" };
|
||||||
PWSTR Source2[] = { L"Test", NULL };
|
PCWSTR Source2[] = { L"Test", NULL };
|
||||||
|
|
||||||
BYTE Buffer[50];
|
BYTE Buffer[50];
|
||||||
PBYTE pEnd;
|
PBYTE pEnd;
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
* The strings are copied in reverse order, so this pointer will point to the last copied string of pSource.
|
* The strings are copied in reverse order, so this pointer will point to the last copied string of pSource.
|
||||||
*/
|
*/
|
||||||
PBYTE WINAPI
|
PBYTE WINAPI
|
||||||
PackStrings(PWSTR* pSource, PBYTE pDest, const DWORD* DestOffsets, PBYTE pEnd)
|
PackStrings(PCWSTR* pSource, PBYTE pDest, const DWORD* DestOffsets, PBYTE pEnd)
|
||||||
{
|
{
|
||||||
DWORD cbString;
|
DWORD cbString;
|
||||||
ULONG_PTR StringAddress;
|
ULONG_PTR StringAddress;
|
||||||
|
|
|
@ -63,7 +63,7 @@ PVOID WINAPI DllAllocSplMem(DWORD dwBytes);
|
||||||
BOOL WINAPI DllFreeSplMem(PVOID pMem);
|
BOOL WINAPI DllFreeSplMem(PVOID pMem);
|
||||||
BOOL WINAPI DllFreeSplStr(PWSTR pwszString);
|
BOOL WINAPI DllFreeSplStr(PWSTR pwszString);
|
||||||
BOOL WINAPI InitializeRouter(HANDLE SpoolerStatusHandle);
|
BOOL WINAPI InitializeRouter(HANDLE SpoolerStatusHandle);
|
||||||
PBYTE WINAPI PackStrings(PWSTR* pSource, PBYTE pDest, const DWORD* DestOffsets, PBYTE pEnd);
|
PBYTE WINAPI PackStrings(PCWSTR* pSource, PBYTE pDest, const DWORD* DestOffsets, PBYTE pEnd);
|
||||||
PVOID WINAPI ReallocSplMem(PVOID pOldMem, DWORD cbOld, DWORD cbNew);
|
PVOID WINAPI ReallocSplMem(PVOID pOldMem, DWORD cbOld, DWORD cbNew);
|
||||||
BOOL WINAPI ReallocSplStr(PWSTR* ppwszString, PCWSTR pwszInput);
|
BOOL WINAPI ReallocSplStr(PWSTR* ppwszString, PCWSTR pwszInput);
|
||||||
BOOL WINAPI SplInitializeWinSpoolDrv(PVOID* pTable);
|
BOOL WINAPI SplInitializeWinSpoolDrv(PVOID* pTable);
|
||||||
|
|
|
@ -374,7 +374,7 @@ static void
|
||||||
_LocalmonGetPortLevel1(PLOCALMON_PORT pPort, PPORT_INFO_1W* ppPortInfo, PBYTE* ppPortInfoEnd, PDWORD pcbNeeded)
|
_LocalmonGetPortLevel1(PLOCALMON_PORT pPort, PPORT_INFO_1W* ppPortInfo, PBYTE* ppPortInfoEnd, PDWORD pcbNeeded)
|
||||||
{
|
{
|
||||||
DWORD cbPortName;
|
DWORD cbPortName;
|
||||||
PWSTR pwszStrings[1];
|
PCWSTR pwszStrings[1];
|
||||||
|
|
||||||
// Calculate the string lengths.
|
// Calculate the string lengths.
|
||||||
if (!ppPortInfo)
|
if (!ppPortInfo)
|
||||||
|
@ -397,7 +397,7 @@ static void
|
||||||
_LocalmonGetPortLevel2(PLOCALMON_PORT pPort, PPORT_INFO_2W* ppPortInfo, PBYTE* ppPortInfoEnd, PDWORD pcbNeeded)
|
_LocalmonGetPortLevel2(PLOCALMON_PORT pPort, PPORT_INFO_2W* ppPortInfo, PBYTE* ppPortInfoEnd, PDWORD pcbNeeded)
|
||||||
{
|
{
|
||||||
DWORD cbPortName;
|
DWORD cbPortName;
|
||||||
PWSTR pwszStrings[3];
|
PCWSTR pwszStrings[3];
|
||||||
|
|
||||||
// Calculate the string lengths.
|
// Calculate the string lengths.
|
||||||
if (!ppPortInfo)
|
if (!ppPortInfo)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
// Local Constants
|
// Local Constants
|
||||||
static PWSTR _pwszDatatypes[] = {
|
static PCWSTR _pwszDatatypes[] = {
|
||||||
L"RAW",
|
L"RAW",
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
@ -113,7 +113,7 @@ EnumPrintProcessorDatatypesW(PWSTR pName, PWSTR pPrintProcessorName, DWORD Level
|
||||||
DWORD cbDatatype;
|
DWORD cbDatatype;
|
||||||
DWORD dwDatatypeCount = 0;
|
DWORD dwDatatypeCount = 0;
|
||||||
DWORD dwOffsets[_countof(_pwszDatatypes)];
|
DWORD dwOffsets[_countof(_pwszDatatypes)];
|
||||||
PWSTR* pCurrentDatatype;
|
PCWSTR* pCurrentDatatype;
|
||||||
PDWORD pCurrentOffset = dwOffsets;
|
PDWORD pCurrentOffset = dwOffsets;
|
||||||
|
|
||||||
TRACE("EnumPrintProcessorDatatypesW(%S, %S, %lu, %p, %lu, %p, %p)\n", pName, pPrintProcessorName, Level, pDatatypes, cbBuf, pcbNeeded, pcReturned);
|
TRACE("EnumPrintProcessorDatatypesW(%S, %S, %lu, %p, %lu, %p, %p)\n", pName, pPrintProcessorName, Level, pDatatypes, cbBuf, pcbNeeded, pcReturned);
|
||||||
|
|
|
@ -455,7 +455,7 @@ _LocalGetJobLevel1(PLOCAL_JOB pJob, PJOB_INFO_1W* ppJobInfo, PBYTE* ppJobInfoEnd
|
||||||
DWORD cbPrinterName;
|
DWORD cbPrinterName;
|
||||||
DWORD cbStatus = 0;
|
DWORD cbStatus = 0;
|
||||||
DWORD cbUserName = 0;
|
DWORD cbUserName = 0;
|
||||||
PWSTR pwszStrings[6];
|
PCWSTR pwszStrings[6];
|
||||||
|
|
||||||
// Calculate the string lengths.
|
// Calculate the string lengths.
|
||||||
if (!ppJobInfo)
|
if (!ppJobInfo)
|
||||||
|
@ -536,7 +536,7 @@ _LocalGetJobLevel2(PLOCAL_JOB pJob, PJOB_INFO_2W* ppJobInfo, PBYTE* ppJobInfoEnd
|
||||||
DWORD cbUserName = 0;
|
DWORD cbUserName = 0;
|
||||||
FILETIME ftNow;
|
FILETIME ftNow;
|
||||||
FILETIME ftSubmitted;
|
FILETIME ftSubmitted;
|
||||||
PWSTR pwszStrings[10];
|
PCWSTR pwszStrings[10];
|
||||||
ULARGE_INTEGER uliNow;
|
ULARGE_INTEGER uliNow;
|
||||||
ULARGE_INTEGER uliSubmitted;
|
ULARGE_INTEGER uliSubmitted;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ const DWORD dwSpoolerMinorVersion = 0;
|
||||||
|
|
||||||
const WCHAR wszDefaultDocumentName[] = L"Local Downlevel Document";
|
const WCHAR wszDefaultDocumentName[] = L"Local Downlevel Document";
|
||||||
|
|
||||||
PWSTR wszPrintProviderInfo[3] = {
|
PCWSTR wszPrintProviderInfo[3] = {
|
||||||
L"Windows NT Local Print Providor", // Name
|
L"Windows NT Local Print Providor", // Name
|
||||||
L"Locally connected Printers", // Comment
|
L"Locally connected Printers", // Comment
|
||||||
L"Windows NT Local Printers" // Description
|
L"Windows NT Local Printers" // Description
|
||||||
|
|
|
@ -257,7 +257,7 @@ static void
|
||||||
_LocalGetMonitorLevel1(PLOCAL_PRINT_MONITOR pPrintMonitor, PMONITOR_INFO_1W* ppMonitorInfo, PBYTE* ppMonitorInfoEnd, PDWORD pcbNeeded)
|
_LocalGetMonitorLevel1(PLOCAL_PRINT_MONITOR pPrintMonitor, PMONITOR_INFO_1W* ppMonitorInfo, PBYTE* ppMonitorInfoEnd, PDWORD pcbNeeded)
|
||||||
{
|
{
|
||||||
DWORD cbMonitorName;
|
DWORD cbMonitorName;
|
||||||
PWSTR pwszStrings[1];
|
PCWSTR pwszStrings[1];
|
||||||
|
|
||||||
// Calculate the string lengths.
|
// Calculate the string lengths.
|
||||||
if (!ppMonitorInfo)
|
if (!ppMonitorInfo)
|
||||||
|
@ -281,7 +281,7 @@ _LocalGetMonitorLevel2(PLOCAL_PRINT_MONITOR pPrintMonitor, PMONITOR_INFO_2W* ppM
|
||||||
{
|
{
|
||||||
DWORD cbFileName;
|
DWORD cbFileName;
|
||||||
DWORD cbMonitorName;
|
DWORD cbMonitorName;
|
||||||
PWSTR pwszStrings[3];
|
PCWSTR pwszStrings[3];
|
||||||
|
|
||||||
// Calculate the string lengths.
|
// Calculate the string lengths.
|
||||||
if (!ppMonitorInfo)
|
if (!ppMonitorInfo)
|
||||||
|
|
|
@ -264,7 +264,7 @@ extern const DWORD dwSpoolerMinorVersion;
|
||||||
extern const WCHAR wszDefaultDocumentName[];
|
extern const WCHAR wszDefaultDocumentName[];
|
||||||
extern HKEY hPrintKey;
|
extern HKEY hPrintKey;
|
||||||
extern HKEY hPrintersKey;
|
extern HKEY hPrintersKey;
|
||||||
extern PWSTR wszPrintProviderInfo[3];
|
extern PCWSTR wszPrintProviderInfo[3];
|
||||||
extern WCHAR wszJobDirectory[MAX_PATH];
|
extern WCHAR wszJobDirectory[MAX_PATH];
|
||||||
extern DWORD cchJobDirectory;
|
extern DWORD cchJobDirectory;
|
||||||
extern WCHAR wszSpoolDirectory[MAX_PATH];
|
extern WCHAR wszSpoolDirectory[MAX_PATH];
|
||||||
|
|
|
@ -491,8 +491,8 @@ static void
|
||||||
_LocalGetPrinterLevel0(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_STRESS* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PCWSTR wszComputerName)
|
_LocalGetPrinterLevel0(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_STRESS* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PCWSTR wszComputerName)
|
||||||
{
|
{
|
||||||
size_t cbName;
|
size_t cbName;
|
||||||
PWSTR p;
|
PWSTR p, Allocation;
|
||||||
PWSTR pwszStrings[1];
|
PCWSTR pwszStrings[1];
|
||||||
SYSTEM_INFO SystemInfo;
|
SYSTEM_INFO SystemInfo;
|
||||||
|
|
||||||
// Calculate the string lengths.
|
// Calculate the string lengths.
|
||||||
|
@ -521,8 +521,8 @@ _LocalGetPrinterLevel0(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_STRESS* ppPrinterI
|
||||||
(*ppPrinterInfo)->wProcessorLevel = SystemInfo.wProcessorLevel;
|
(*ppPrinterInfo)->wProcessorLevel = SystemInfo.wProcessorLevel;
|
||||||
|
|
||||||
// Copy the Printer Name.
|
// Copy the Printer Name.
|
||||||
pwszStrings[0] = DllAllocSplMem(cbName);
|
p = Allocation = DllAllocSplMem(cbName);
|
||||||
p = pwszStrings[0];
|
pwszStrings[0] = Allocation;
|
||||||
StringCbCopyExW(p, cbName, wszComputerName, &p, &cbName, 0);
|
StringCbCopyExW(p, cbName, wszComputerName, &p, &cbName, 0);
|
||||||
StringCbCopyExW(p, cbName, pPrinter->pwszPrinterName, &p, &cbName, 0);
|
StringCbCopyExW(p, cbName, pPrinter->pwszPrinterName, &p, &cbName, 0);
|
||||||
|
|
||||||
|
@ -531,7 +531,7 @@ _LocalGetPrinterLevel0(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_STRESS* ppPrinterI
|
||||||
(*ppPrinterInfo)++;
|
(*ppPrinterInfo)++;
|
||||||
|
|
||||||
// Free the memory for temporary strings.
|
// Free the memory for temporary strings.
|
||||||
DllFreeSplMem(pwszStrings[0]);
|
DllFreeSplMem(Allocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -542,8 +542,8 @@ _LocalGetPrinterLevel1(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_1W* ppPrinterInfo,
|
||||||
size_t cbName;
|
size_t cbName;
|
||||||
size_t cbComment;
|
size_t cbComment;
|
||||||
size_t cbDescription;
|
size_t cbDescription;
|
||||||
PWSTR p;
|
PWSTR p, Allocation1, Allocation2;
|
||||||
PWSTR pwszStrings[3];
|
PCWSTR pwszStrings[3];
|
||||||
|
|
||||||
// Calculate the string lengths.
|
// Calculate the string lengths.
|
||||||
// Attention: pComment equals the "Description" registry value while pDescription is concatenated out of several strings.
|
// Attention: pComment equals the "Description" registry value while pDescription is concatenated out of several strings.
|
||||||
|
@ -562,8 +562,8 @@ _LocalGetPrinterLevel1(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_1W* ppPrinterInfo,
|
||||||
(*ppPrinterInfo)->Flags = PRINTER_ENUM_ICON8;
|
(*ppPrinterInfo)->Flags = PRINTER_ENUM_ICON8;
|
||||||
|
|
||||||
// Copy the Printer Name.
|
// Copy the Printer Name.
|
||||||
pwszStrings[0] = DllAllocSplMem(cbName);
|
p = Allocation1 = DllAllocSplMem(cbName);
|
||||||
p = pwszStrings[0];
|
pwszStrings[0] = Allocation1;
|
||||||
StringCbCopyExW(p, cbName, wszComputerName, &p, &cbName, 0);
|
StringCbCopyExW(p, cbName, wszComputerName, &p, &cbName, 0);
|
||||||
StringCbCopyExW(p, cbName, pPrinter->pwszPrinterName, &p, &cbName, 0);
|
StringCbCopyExW(p, cbName, pPrinter->pwszPrinterName, &p, &cbName, 0);
|
||||||
|
|
||||||
|
@ -571,8 +571,8 @@ _LocalGetPrinterLevel1(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_1W* ppPrinterInfo,
|
||||||
pwszStrings[1] = pPrinter->pwszDescription;
|
pwszStrings[1] = pPrinter->pwszDescription;
|
||||||
|
|
||||||
// Copy the description, which for PRINTER_INFO_1W has the form "Name,Printer Driver,Location"
|
// Copy the description, which for PRINTER_INFO_1W has the form "Name,Printer Driver,Location"
|
||||||
pwszStrings[2] = DllAllocSplMem(cbDescription);
|
p = Allocation2 = DllAllocSplMem(cbDescription);
|
||||||
p = pwszStrings[2];
|
pwszStrings[2] = Allocation2;
|
||||||
StringCbCopyExW(p, cbDescription, wszComputerName, &p, &cbDescription, 0);
|
StringCbCopyExW(p, cbDescription, wszComputerName, &p, &cbDescription, 0);
|
||||||
StringCbCopyExW(p, cbDescription, pPrinter->pwszPrinterName, &p, &cbDescription, 0);
|
StringCbCopyExW(p, cbDescription, pPrinter->pwszPrinterName, &p, &cbDescription, 0);
|
||||||
StringCbCopyExW(p, cbDescription, wszComma, &p, &cbDescription, 0);
|
StringCbCopyExW(p, cbDescription, wszComma, &p, &cbDescription, 0);
|
||||||
|
@ -585,8 +585,8 @@ _LocalGetPrinterLevel1(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_1W* ppPrinterInfo,
|
||||||
(*ppPrinterInfo)++;
|
(*ppPrinterInfo)++;
|
||||||
|
|
||||||
// Free the memory for temporary strings.
|
// Free the memory for temporary strings.
|
||||||
DllFreeSplMem(pwszStrings[0]);
|
DllFreeSplMem(Allocation1);
|
||||||
DllFreeSplMem(pwszStrings[2]);
|
DllFreeSplMem(Allocation2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -605,8 +605,8 @@ _LocalGetPrinterLevel2(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_2W* ppPrinterInfo,
|
||||||
size_t cbPrintProcessor;
|
size_t cbPrintProcessor;
|
||||||
size_t cbDatatype;
|
size_t cbDatatype;
|
||||||
size_t cbParameters;
|
size_t cbParameters;
|
||||||
PWSTR p;
|
PWSTR p, Allocation;
|
||||||
PWSTR pwszStrings[10];
|
PCWSTR pwszStrings[10];
|
||||||
|
|
||||||
// Calculate the string lengths.
|
// Calculate the string lengths.
|
||||||
cbDevMode = pPrinter->pDefaultDevMode->dmSize + pPrinter->pDefaultDevMode->dmDriverExtra;
|
cbDevMode = pPrinter->pDefaultDevMode->dmSize + pPrinter->pDefaultDevMode->dmDriverExtra;
|
||||||
|
@ -641,8 +641,8 @@ _LocalGetPrinterLevel2(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_2W* ppPrinterInfo,
|
||||||
(*ppPrinterInfo)->pDevMode = (PDEVMODEW)(*ppPrinterInfoEnd);
|
(*ppPrinterInfo)->pDevMode = (PDEVMODEW)(*ppPrinterInfoEnd);
|
||||||
|
|
||||||
// Set the pPrinterName field.
|
// Set the pPrinterName field.
|
||||||
pwszStrings[0] = DllAllocSplMem(cbPrinterName);
|
p = Allocation = DllAllocSplMem(cbPrinterName);
|
||||||
p = pwszStrings[0];
|
pwszStrings[0] = Allocation;
|
||||||
StringCbCopyExW(p, cbPrinterName, wszComputerName, &p, &cbPrinterName, 0);
|
StringCbCopyExW(p, cbPrinterName, wszComputerName, &p, &cbPrinterName, 0);
|
||||||
StringCbCopyExW(p, cbPrinterName, pPrinter->pwszPrinterName, &p, &cbPrinterName, 0);
|
StringCbCopyExW(p, cbPrinterName, pPrinter->pwszPrinterName, &p, &cbPrinterName, 0);
|
||||||
|
|
||||||
|
@ -678,7 +678,7 @@ _LocalGetPrinterLevel2(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_2W* ppPrinterInfo,
|
||||||
(*ppPrinterInfo)++;
|
(*ppPrinterInfo)++;
|
||||||
|
|
||||||
// Free the memory for temporary strings.
|
// Free the memory for temporary strings.
|
||||||
DllFreeSplMem(pwszStrings[0]);
|
DllFreeSplMem(Allocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -707,8 +707,8 @@ static void
|
||||||
_LocalGetPrinterLevel4(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_4W* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PCWSTR wszComputerName)
|
_LocalGetPrinterLevel4(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_4W* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PCWSTR wszComputerName)
|
||||||
{
|
{
|
||||||
size_t cbPrinterName;
|
size_t cbPrinterName;
|
||||||
PWSTR p;
|
PWSTR p, Allocation;
|
||||||
PWSTR pwszStrings[1];
|
PCWSTR pwszStrings[1];
|
||||||
|
|
||||||
// Calculate the string lengths.
|
// Calculate the string lengths.
|
||||||
cbPrinterName = (cchComputerName + wcslen(pPrinter->pwszPrinterName) + 1) * sizeof(WCHAR);
|
cbPrinterName = (cchComputerName + wcslen(pPrinter->pwszPrinterName) + 1) * sizeof(WCHAR);
|
||||||
|
@ -724,8 +724,8 @@ _LocalGetPrinterLevel4(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_4W* ppPrinterInfo,
|
||||||
(*ppPrinterInfo)->Attributes = pPrinter->dwAttributes;
|
(*ppPrinterInfo)->Attributes = pPrinter->dwAttributes;
|
||||||
|
|
||||||
// Set the pPrinterName field.
|
// Set the pPrinterName field.
|
||||||
pwszStrings[0] = DllAllocSplMem(cbPrinterName);
|
p = Allocation = DllAllocSplMem(cbPrinterName);
|
||||||
p = pwszStrings[0];
|
pwszStrings[0] = Allocation;
|
||||||
StringCbCopyExW(p, cbPrinterName, wszComputerName, &p, &cbPrinterName, 0);
|
StringCbCopyExW(p, cbPrinterName, wszComputerName, &p, &cbPrinterName, 0);
|
||||||
StringCbCopyExW(p, cbPrinterName, pPrinter->pwszPrinterName, &p, &cbPrinterName, 0);
|
StringCbCopyExW(p, cbPrinterName, pPrinter->pwszPrinterName, &p, &cbPrinterName, 0);
|
||||||
|
|
||||||
|
@ -734,7 +734,7 @@ _LocalGetPrinterLevel4(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_4W* ppPrinterInfo,
|
||||||
(*ppPrinterInfo)++;
|
(*ppPrinterInfo)++;
|
||||||
|
|
||||||
// Free the memory for temporary strings.
|
// Free the memory for temporary strings.
|
||||||
DllFreeSplMem(pwszStrings[0]);
|
DllFreeSplMem(Allocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -742,8 +742,8 @@ _LocalGetPrinterLevel5(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_5W* ppPrinterInfo,
|
||||||
{
|
{
|
||||||
size_t cbPrinterName;
|
size_t cbPrinterName;
|
||||||
size_t cbPortName;
|
size_t cbPortName;
|
||||||
PWSTR p;
|
PWSTR p, Allocation;
|
||||||
PWSTR pwszStrings[2];
|
PCWSTR pwszStrings[2];
|
||||||
|
|
||||||
// Calculate the string lengths.
|
// Calculate the string lengths.
|
||||||
cbPrinterName = (cchComputerName + wcslen(pPrinter->pwszPrinterName) + 1) * sizeof(WCHAR);
|
cbPrinterName = (cchComputerName + wcslen(pPrinter->pwszPrinterName) + 1) * sizeof(WCHAR);
|
||||||
|
@ -762,8 +762,8 @@ _LocalGetPrinterLevel5(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_5W* ppPrinterInfo,
|
||||||
(*ppPrinterInfo)->TransmissionRetryTimeout = dwTransmissionRetryTimeout;
|
(*ppPrinterInfo)->TransmissionRetryTimeout = dwTransmissionRetryTimeout;
|
||||||
|
|
||||||
// Set the pPrinterName field.
|
// Set the pPrinterName field.
|
||||||
pwszStrings[0] = DllAllocSplMem(cbPrinterName);
|
p = Allocation = DllAllocSplMem(cbPrinterName);
|
||||||
p = pwszStrings[0];
|
pwszStrings[0] = Allocation;
|
||||||
StringCbCopyExW(p, cbPrinterName, wszComputerName, &p, &cbPrinterName, 0);
|
StringCbCopyExW(p, cbPrinterName, wszComputerName, &p, &cbPrinterName, 0);
|
||||||
StringCbCopyExW(p, cbPrinterName, pPrinter->pwszPrinterName, &p, &cbPrinterName, 0);
|
StringCbCopyExW(p, cbPrinterName, pPrinter->pwszPrinterName, &p, &cbPrinterName, 0);
|
||||||
|
|
||||||
|
@ -775,7 +775,7 @@ _LocalGetPrinterLevel5(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_5W* ppPrinterInfo,
|
||||||
(*ppPrinterInfo)++;
|
(*ppPrinterInfo)++;
|
||||||
|
|
||||||
// Free the memory for temporary strings.
|
// Free the memory for temporary strings.
|
||||||
DllFreeSplMem(pwszStrings[0]);
|
DllFreeSplMem(Allocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue