Printers, win: check for PDev.DevModeSize that prevents error 204, from DaLiv, issue #27970

git-svn-id: trunk@48887 -
This commit is contained in:
jesus 2015-04-29 05:08:31 +00:00
parent aae4334209
commit 28089b25f7

View File

@ -257,15 +257,17 @@ begin
begin
PDev.DevModeSize := DocumentPropertiesW(0, FPrinterHandle, Pwidechar(UTF8Decode(PDev.Name)),
nil, nil, 0);
ReallocMem(Pdev.DevModeW, PDev.DevModeSize);
if PDev.DevModeSize>0 then
ReallocMem(Pdev.DevModeW, PDev.DevModeSize);
end
else
begin
PDev.DevModeSize := DocumentProperties(0, FPrinterHandle, pchar(PDev.Name),
nil, nil, 0);
ReallocMem(Pdev.DevModeA, PDev.DevModeSize);
if PDev.DevModeSize>0 then
ReallocMem(Pdev.DevModeA, PDev.DevModeSize);
end;
if PDev.DevModeSize=0 then begin
if PDev.DevModeSize<=0 then begin
result := false;
exit;
end;