PLIST_ENTRY pEntry;
PLOCAL_PRINT_PROCESSOR pPrintProcessor;
- for (pEntry = _PrintProcessorList.Flink; pEntry; pEntry = pEntry->Flink)
+ for (pEntry = _PrintProcessorList.Flink; pEntry != &_PrintProcessorList; pEntry = pEntry->Flink)
{
pPrintProcessor = CONTAINING_RECORD(pEntry, LOCAL_PRINT_PROCESSOR, Entry);
}
// Get the name of this Print Processor.
- cchPrintProcessorName = cchMaxSubKey;
+ cchPrintProcessorName = cchMaxSubKey + 1;
lStatus = RegEnumKeyExW(hSubKey, i, pwszPrintProcessorName, &cchPrintProcessorName, NULL, NULL, NULL, NULL);
if (lStatus != ERROR_SUCCESS)
{
{
// RegEnumKeyExW sucks! Unlike similar API functions, it only returns the actual numbers of characters copied when you supply a buffer large enough.
// So use pwszTemp with its size cchMaxSubKey for this.
- cchPrintProcessor = cchMaxSubKey;
+ cchPrintProcessor = cchMaxSubKey + 1;
dwErrorCode = (DWORD)RegEnumKeyExW(hSubKey, i, pwszTemp, &cchPrintProcessor, NULL, NULL, NULL, NULL);
if (dwErrorCode != ERROR_SUCCESS)
{
for (i = 0; i < *pcReturned; i++)
{
// This isn't really correct, but doesn't cause any harm, because we've extensively checked the size of the supplied buffer above.
- cchPrintProcessor = cchMaxSubKey;
+ cchPrintProcessor = cchMaxSubKey + 1;
// Copy the Print Processor name.
dwErrorCode = (DWORD)RegEnumKeyExW(hSubKey, i, (PWSTR)pCurrentOutputPrintProcessor, &cchPrintProcessor, NULL, NULL, NULL, NULL);