Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exit devicecapabilities if return is -1 #1098

Merged
merged 1 commit into from
Jan 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion winspool/winspool.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ DWORD WINAPI DeviceCapabilities16(LPCSTR pDevice, LPCSTR pPort, WORD fwCapabilit
{
LPWORD papers;
result = DeviceCapabilitiesA(pDevice, pPort, fwCapability, NULL, pDevMode ? (LPDEVMODEA)&devmode32[0] : NULL);
if (result)
if (result && (result != -1))
{
LPWORD output = (LPWORD)pOutput;
DWORD i, j = 0;
Expand All @@ -184,6 +184,8 @@ DWORD WINAPI DeviceCapabilities16(LPCSTR pDevice, LPCSTR pPort, WORD fwCapabilit
case DC_PAPERNAMES:
{
DWORD papers_count = DeviceCapabilitiesA(pDevice, pPort, DC_PAPERS, pOutput, pDevMode ? (LPDEVMODEA)&devmode32[0] : NULL);
if (papers_count == -1)
return -1;
LPDWORD papers = (LPDWORD)HeapAlloc(GetProcessHeap(), 0, papers_count * sizeof(WORD));
DWORD i, j = 0;
char (*names)[CCHPAPERNAME16] = !pOutput ? NULL : (char(*)[CCHPAPERNAME16])HeapAlloc(GetProcessHeap(), 0, papers_count * CCHPAPERNAME16 * sizeof(char));
Expand Down