LocalEnumJobs(HANDLE hPrinter, DWORD FirstJob, DWORD NoJobs, DWORD Level, PBYTE pStart, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
{
DWORD dwErrorCode;
+ DWORD i;
PBYTE pEnd = &pStart[cbBuf];
PLOCAL_HANDLE pHandle;
PLOCAL_JOB pJob;
pFirstJobNode = LookupNodeByIndexSkiplist(&pPrinterHandle->pPrinter->JobList, FirstJob);
// Count the required buffer size and the number of jobs.
+ i = 0;
pNode = pFirstJobNode;
- while (*pcReturned < NoJobs && pNode)
+ while (i < NoJobs && pNode)
{
pJob = (PLOCAL_JOB)pNode->Element;
_LocalGetJobLevel2(pPrinterHandle, pJob, NULL, NULL, 0, pcbNeeded);
// We stop either when there are no more jobs in the list or when the caller didn't request more, whatever comes first.
- (*pcReturned)++;
+ i++;
pNode = pNode->Next[0];
}
// Begin counting again and also empty the given buffer.
*pcbNeeded = 0;
- *pcReturned = 0;
ZeroMemory(pStart, cbBuf);
// Now call the same functions again to copy the actual data for each job into the buffer.
+ i = 0;
pNode = pFirstJobNode;
- while (*pcReturned < NoJobs && pNode)
+ while (i < NoJobs && pNode)
{
pJob = (PLOCAL_JOB)pNode->Element;
goto Cleanup;
// We stop either when there are no more jobs in the list or when the caller didn't request more, whatever comes first.
- (*pcReturned)++;
+ i++;
pNode = pNode->Next[0];
}
+ *pcReturned = i;
dwErrorCode = ERROR_SUCCESS;
Cleanup: