CoCPXCControlEx crashes
Posted: Mon Jul 12, 2021 6:33 am
Hello,
on some of our customers' systems, the program crashes when a virtual printer is to be created with "CoCPXCControlEx".
We are using version 4.0.203.0 and 6.0.320.0
Unfortunately, the error cannot be reliably reproduced.
Do you have any idea what could be the cause here?
Here is a code excerpt for version 4:
function PDFXChangeV4CreateDriver(
aFileName,
aOldPrinter : string;
aCaller: TPDFCaller): string;
var
sTmpPrinterName : string;
begin
Log('PDFXChangeV4CreateDriver');
Log('- aFileName: ' + aFileName);
Log('- aOldPrinter: ' + aOldPrinter);
// save old printer name
if aOldPrinter <> '' then
sOLDPrinterName := aOldPrinter;
// Read the path for saveing the PDF for function result
Result := TPDF.PDFXChangeV4GetSavePath;
// Create a new intance with the name "PDF-XChange 4.0 (R)"
try
Log('- PXCComLib_TLB.CoCPXCControlEx.Create');
moPDFPFactory := PXCComLib_TLB.CoCPXCControlEx.Create;
if not (VarType(PDFPrinter) in [varNull, varEmpty]) then
begin
Log('- free temp. driver, if created before');
VarClear(PDFPrinter);
end;
Log('- create the dirver in registry - start');
sTmpPrinterName := 'PDF-XChange 4.0 (R)';
//--> the next line causes the AV
PDFPrinter :=
moPDFPFactory.
Printer['',
sTmpPrinterName,
'OurKey',
'OurCodeDev'];
//--> the next line never reched, because of the AV above
Log('- create the dirver in registry - done');
except on E:Exception do
begin
//--> this line also never reched, because the AV above. The AV is that heavy.
// The Application crashes hard and disappear out of the taskmanager
Log('- error at creation of driver: '+sTmpPrinterName);
Log('- reason: ' + E.Message);
end;
end;
Log('- PDFPrinter.Name: ' + PDFPrinter.Name);
end;
thanks for your efforts.
on some of our customers' systems, the program crashes when a virtual printer is to be created with "CoCPXCControlEx".
We are using version 4.0.203.0 and 6.0.320.0
Unfortunately, the error cannot be reliably reproduced.
Do you have any idea what could be the cause here?
Here is a code excerpt for version 4:
function PDFXChangeV4CreateDriver(
aFileName,
aOldPrinter : string;
aCaller: TPDFCaller): string;
var
sTmpPrinterName : string;
begin
Log('PDFXChangeV4CreateDriver');
Log('- aFileName: ' + aFileName);
Log('- aOldPrinter: ' + aOldPrinter);
// save old printer name
if aOldPrinter <> '' then
sOLDPrinterName := aOldPrinter;
// Read the path for saveing the PDF for function result
Result := TPDF.PDFXChangeV4GetSavePath;
// Create a new intance with the name "PDF-XChange 4.0 (R)"
try
Log('- PXCComLib_TLB.CoCPXCControlEx.Create');
moPDFPFactory := PXCComLib_TLB.CoCPXCControlEx.Create;
if not (VarType(PDFPrinter) in [varNull, varEmpty]) then
begin
Log('- free temp. driver, if created before');
VarClear(PDFPrinter);
end;
Log('- create the dirver in registry - start');
sTmpPrinterName := 'PDF-XChange 4.0 (R)';
//--> the next line causes the AV
PDFPrinter :=
moPDFPFactory.
Printer['',
sTmpPrinterName,
'OurKey',
'OurCodeDev'];
//--> the next line never reched, because of the AV above
Log('- create the dirver in registry - done');
except on E:Exception do
begin
//--> this line also never reched, because the AV above. The AV is that heavy.
// The Application crashes hard and disappear out of the taskmanager
Log('- error at creation of driver: '+sTmpPrinterName);
Log('- reason: ' + E.Message);
end;
end;
Log('- PDFPrinter.Name: ' + PDFPrinter.Name);
end;
thanks for your efforts.