PXC_Document::WriteToFile access violation

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
RichHolliday
User
Posts: 6
Joined: Tue Jul 13, 2010 8:54 am

PXC_Document::WriteToFile access violation

Post by RichHolliday »

Hi,

I am a developer of an application that attempts to render hundreds of PDF documents consecutively. I am experiencing arbitrary access violation crashes when calling IPXC_Document::WriteToFile.

I am using a test that attempts to render approximately 500 documents. The number of PDF documents that I can create before this crash happens varies considerably: sometimes it might be 10 documents, sometimes it might over 300 documents.

Re-runs of exactly the same test produces access violation crashes at the same IPXC_Document::WriteToFile code location - but the number of documents successfully rendered always differs. A document that caused a crash in one run may render successfully in the next identical run. Sometimes this test may even complete successfully and render all the documents without crashing.

This is single threaded C++ native app using Core API v6.0.322.7. The files concerned are being written into the user's Local\Temp area of their Windows profile and the supplied filenames are all valid. I would be most grateful if anyone could assist me with this issue.

Many thanks,

Richard.
RichHolliday
User
Posts: 6
Joined: Tue Jul 13, 2010 8:54 am

Re: PXC_Document::WriteToFile access violation

Post by RichHolliday »

I have managed to extract the error code from PXC_Document::WriteToFile. Please can someone tell me what error code: 83ff0020 means
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: PXC_Document::WriteToFile access violation

Post by Lzcat - Tracker Supp »

Hi Richard.
We moved your topic to the correct forum.
Can you clarify what are you expecting - crash or error? If error - you can figure issue urself, see IAUX_Inst::FormatHRESULT.
For your case "83ff0020" means "The process cannot access the file because it is being used by another process.".
Also, which OS you are using and is your code 32-bit or 64-bit?
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
RichHolliday
User
Posts: 6
Joined: Tue Jul 13, 2010 8:54 am

Re: PXC_Document::WriteToFile access violation

Post by RichHolliday »

Hi Victor

I very much appreciate your prompt reply.

Just to clarify - I am not expecting either a crash or an error, I am expecting my test to run to completion without issue. I am running the test on a 64-bit Windows 10 virtual machine and my application is a 32-bit native C++ application.

What is puzzling is that this issue is highly intermittent and inconsistent. The PXC_Document::WriteToFile method is being called sequentially on a single thread and I am unaware of any other processes accessing the files being written. Even antivirus is not installed in the VM.

This issue, once encountered, can result in either a access violation crash or the 83ff0020 error. It does not seem to be predictable. I can potentially do something about the error, but I cannot prevent a crash associated with an access violation.

Do have any ideas on what could be causing this?

Many Thanks
Richard.
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: PXC_Document::WriteToFile access violation

Post by Lzcat - Tracker Supp »

Hi Richard.
Do you saving files with different names or name is always same?
Also, why are you using 32-bit code on 64-bit OS?
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
jadsonbr
User
Posts: 7
Joined: Tue Sep 13, 2016 11:41 am

Re: PXC_Document::WriteToFile access violation

Post by jadsonbr »

I'm getting the same error too.
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: PXC_Document::WriteToFile access violation

Post by Lzcat - Tracker Supp »

jadsonbr wrote:I'm getting the same error too.
And using same environment and code? :D
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
jadsonbr
User
Posts: 7
Joined: Tue Sep 13, 2016 11:41 am

Re: PXC_Document::WriteToFile access violation

Post by jadsonbr »

My code is in pascal.
Now when I withdraw the license it works normally in trial mode plus if I put the license I'm getting this error.
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: PXC_Document::WriteToFile access violation

Post by Lzcat - Tracker Supp »

Hi jadsonbr.
0. Which build are you using and which error did you get?
1. Do you save files with same name or different?
2. Can we see a code reproducing problem?
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
jadsonbr
User
Posts: 7
Joined: Tue Sep 13, 2016 11:41 am

Re: PXC_Document::WriteToFile access violation

Post by jadsonbr »

0. Which build are you using and which error did you get?
Re: Build 6.0.322.6
Error: floating point invalid operation at 0x6806606b
Error: OLE error 83FF0020
1. Do you save files with same name or different?
Re: Yes
2. Can we see a code reproducing problem?

Code: Select all

procedure SignDocument(doc: PDFXCoreAPI_TLB.IPXC_Document);
const
  CERT_FIND_SUBJECT_STR = $00080007;
  CERT_ENCODING = $00000001 or $00010000;
  MyFlags = (PDFXCoreAPI_TLB.Sign_GR_Name or PDFXCoreAPI_TLB.Sign_TX_Name or
    PDFXCoreAPI_TLB.Sign_TX_Date or PDFXCoreAPI_TLB.Sign_TX_Location or
    PDFXCoreAPI_TLB.Sign_TX_Reason or PDFXCoreAPI_TLB.Sign_TX_DName);
var
  strCertSubject: WideString;
  lpszCertSubject: array [0 .. 64] of WideChar;
  hSysStore: HCERTSTORE;
  hCertCntxt: PCCERT_CONTEXT;
  rc: PDFXCoreAPI_TLB.PXC_Rect;
  MyContext: PDFXCoreAPI_TLB.PUserType8;
  tmpFileName : string;
begin

  hSysStore := CertOpenSystemStore(2, 'MY');
  if (hSysStore = nil) then
  begin
    Assert(false, 'CertOpenSystemStore');
    exit;
  end;
  strCertSubject := cert.SubjectName; 
  StringToWideChar(strCertSubject, lpszCertSubject, Length(lpszCertSubject));
  hCertCntxt := CertFindCertificateInStore(hSysStore, CERT_ENCODING,
    CERT_FIND_ANY, CERT_FIND_SUBJECT_STR, @lpszCertSubject, nil);
  if (hCertCntxt = nil) then
  Begin
    Assert(false, 'CertFindCertificateInStore');
    exit;
  End;

  rc.left := 0;
  rc.top := 36;
  rc.right := rc.left + 144;
  rc.bottom := 0;
  MyContext := PDFXCoreAPI_TLB.PUserType8(hCertCntxt);
  try
    doc.DeferedDigitalSign(PDFXCoreAPI_TLB.PUserType14(MyContext)^, MyFlags, 0,
      rc, '', '', '', '');
  except
    on E: Exception do
      Assert(false, E.Message);
  end;
  try
    try
      DateTimeToString(tmpFileName,'dd-mm-yyyy_hh-nn-ss',now);
      doc.WriteToFile('D:\out_'+tmpFileName+'.pdf', nil, 0);
    finally
      FreeAndNil(doc);
    end;
  except
    on E: Exception do
    begin
      MSGErro(E.Message);
    end;
  end;
end;
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: PXC_Document::WriteToFile access violation

Post by Lzcat - Tracker Supp »

Error: floating point invalid operation at 0x6806606b
This is known Delphi issue with changing floating point stings. Please Add following code to your project

Code: Select all

procedure VerifyFPControlWord;
var
FPUCW: Word;
begin
FPUCW := Get8087CW();
if ( FPUCW <> $027F ) then
Set8087CW( $027F );
end;
And call VerifyFPControlWord before call to WriteToFile.
Error: OLE error 83FF0020
It is not an OLE error, and you can see error description above.
1. Do you save files with same name or different?
Re: Yes
Nice joke, really :D
2. Can we see a code reproducing problem?

Code: Select all

...
This is not complete code and it miss important part of document workflow, so it is not enough. Please provide complete project and needed data to reproduce your behavior.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
jadsonbr
User
Posts: 7
Joined: Tue Sep 13, 2016 11:41 am

Re: PXC_Document::WriteToFile access violation

Post by jadsonbr »

It worked with the code below that sent.
And sorry if there was any misunderstanding. It's that I do not speak English and I was with google help.

Code: Select all

procedure VerifyFPControlWord;
var
	FPUCW: Word;
begin
	FPUCW := Get8087CW();
	if ( FPUCW <> $027F ) then
		Set8087CW( $027F );
end;
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: PXC_Document::WriteToFile access violation

Post by Lzcat - Tracker Supp »

Hi jadsonbr.
So all errors gone, 83FF0020 too?
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Post Reply