Win7 x64 : API Error 122 ERROR_INSUFFICIENT_BUFFER

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
lovison@algolsh.it
Posts: 30
Joined: Fri Apr 04 2003

Win7 x64 : API Error 122 ERROR_INSUFFICIENT_BUFFER

Post by lovison@algolsh.it »

On Windows 7 x64 with Amyuni 4.0.1.1 I have API Error 122 ERROR_INSUFFICIENT_BUFFER:
"The data area passed to a system call is too small".
The solution with the NUL port is not valid, since my printer is already connected to the NUL port.
Any idea ?? :(
Devteam
Posts: 119
Joined: Fri Oct 14 2005
Location: Montreal
Contact:

Re: Win7 x64 : API Error 122 ERROR_INSUFFICIENT_BUFFER

Post by Devteam »

Please clarify when this issue occurs. Which API call generates the error?

Note that you should install on the NUL: port even if another printer is already using it.
Amyuni Development Team

Efficient and accurate conversion to PDF, XPS, PDF/A and more. Free trials at - https://www.amyuni.com
lovison@algolsh.it
Posts: 30
Joined: Fri Apr 04 2003

Re: Win7 x64 : API Error 122 ERROR_INSUFFICIENT_BUFFER

Post by lovison@algolsh.it »

Hi,
The issue is ONLY on Windows 7 x64 at one of our customers, when I call StartDoc , as in the example below.
I installed your PDF Converter as "Algol PDF Printer": the port is already set to NUL port, but with LPT1 port I have same results;
that pc has only your pdf printer.

Code: Select all


	HANDLE		hPDFPrinter;
	HFONT		font, oldFont;
	HDC			dc;
	DOCINFO		di;
	
	hPDFPrinter = DriverInit("Algol PDF Printer");
	if (hPDFPrinter == NULL)
	{
		hPDFPrinter = PDFDriverInit("Algol PDF Printer");
		hPDFPrinter = DriverInit("Algol PDF Printer");
		if (hPDFPrinter == NULL)
			return;
	}

	EnablePrinter(hPDFPrinter,"ALGOL S.r.l.","07EFCDA .....");

	dc = CreateDC("WINSPOOL","Algol PDF Printer", NULL, NULL );
	if (dc == NULL)
		return;

	memset( &di, 0, sizeof(di) );
	di.cbSize = sizeof( di );
	di.lpszDocName = "Test document";
	di.lpszOutput = "c:\\test.pdf";
	
	EnablePrinter(hPDFPrinter,"ALGOL S.r.l.","07EFCDA .....");

	int iRetValue = StartDoc( dc, &di );						// API ERROR 122
	StartPage( dc );
	
	MoveToEx( dc, 100, 100, NULL );
	LineTo( dc, 400, 100 );
	MoveToEx( dc, 100, 100, NULL );
	LineTo( dc, 100, 400 );
	
	font = CreateFont( -24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _T("Verdana") );
	oldFont = (HFONT)SelectObject( dc, font );
	TextOut( dc, 100, 100, _T("Hi There"), 8 );
	if ( oldFont ) 
		SelectObject( dc, oldFont );
	DeleteObject( font );
	
	font = CreateFont( -24, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, _T("Wingdings") );
	oldFont = (HFONT)SelectObject( dc, font );
	TextOut( dc, 100, 200, _T("Hi There"), 8 );
	if ( oldFont ) 
		SelectObject( dc, oldFont );
	DeleteObject( font );

	EndPage( dc );
	EndDoc( dc );
	DeleteDC( dc );
Devteam
Posts: 119
Joined: Fri Oct 14 2005
Location: Montreal
Contact:

Re: Win7 x64 : API Error 122 ERROR_INSUFFICIENT_BUFFER

Post by Devteam »

The problem is with line:
di.lpszOutput = "c:\\test.pdf";

when printing from a 32-bit application to 64-bit OS, the file name should be set using the SetDefaultFileName/SetFileNameOptions API provided by Amyuni and the line above set to:
di.lpszOutput = NULL;
Amyuni Development Team

Efficient and accurate conversion to PDF, XPS, PDF/A and more. Free trials at - https://www.amyuni.com
lovison@algolsh.it
Posts: 30
Joined: Fri Apr 04 2003

Re: Win7 x64 : API Error 122 ERROR_INSUFFICIENT_BUFFER

Post by lovison@algolsh.it »

Hi,
I try with simple test program, but I receive error on STARTDOC line :

Code: Select all

	HFONT		font, oldFont;
	HDC			dc;
	DOCINFO		di;
	int			iRetValue;

	dc = CreateDC("WINSPOOL","Algol PDF Test",NULL,NULL);
	if (dc == NULL)
		return;
	memset( &di, 0, sizeof(di) );
	di.cbSize = sizeof( di );
	di.lpszDocName = "Test document";
	di.lpszOutput  = NULL;
	
	iRetValue = EnablePrinter(m_hPDFPrinter,PDFGENERATOR_ACTIVECOMPANY,PDFGENERATOR_ACTIVEKEY);	
	iRetValue = SetFileNameOptions(m_hPDFPrinter,NoPrompt + UseFileName);
	iRetValue = SetDefaultFileName(m_hPDFPrinter,PDFGENERATOR_PDFFILE);
	// EnablePrinter , SetFileNameOptions and SetDefaultFileName are OK with return 1

	iRetValue = StartDoc( dc, &di );
	// ERROR on StartDoc : return -1
Permissions on registry are FullControl for Everyone on
HKEY_CURRENT_CONFIG\Software and HKEY_CURRENT_CONFIG\Software\Algol PDF Test
keys.

SysOp : Windows 2008 x64 WTS on Intel Core2
Amyuni PDF Converter : 4.0.1.1

Why ???
Devteam
Posts: 119
Joined: Fri Oct 14 2005
Location: Montreal
Contact:

Re: Win7 x64 : API Error 122 ERROR_INSUFFICIENT_BUFFER

Post by Devteam »

The latest code that you sent us is valid and works fine for us. Please make sure that:
- "Algol PDF Test" is a valid printer that appears in the printers' folder. Right-click on it, go to preferences and check that you see the About box.
- The license key that you are sending to EnablePrinter is valid for version 4
- The values that you are giving to SetFileNameOptions and SetDefaultFileName are valid

If all these tests are valid and the printer still doesn't work, then you should open a support ticket with our support department.
Amyuni Development Team

Efficient and accurate conversion to PDF, XPS, PDF/A and more. Free trials at - https://www.amyuni.com
lovison@algolsh.it
Posts: 30
Joined: Fri Apr 04 2003

Re: Win7 x64 : API Error 122 ERROR_INSUFFICIENT_BUFFER

Post by lovison@algolsh.it »

Same code with same license on another sysop work fine.
The printer is ok, I see About Box with Algol ...
If I use Administrator account, the program run ok: which others rights can I check ?!?
lovison@algolsh.it
Posts: 30
Joined: Fri Apr 04 2003

Re: Win7 x64 : API Error 122 ERROR_INSUFFICIENT_BUFFER

Post by lovison@algolsh.it »

How do I open a support ticket with your support department ? :?
lovison@algolsh.it
Posts: 30
Joined: Fri Apr 04 2003

Re: Win7 x64 : API Error 122 ERROR_INSUFFICIENT_BUFFER

Post by lovison@algolsh.it »

Hello,
a month ago I filled out the form for support, but I received no response.
When you say
you should open a support ticket with our support department.
how do I open this??? I filled form on http://www.amyuni.com/en/support/techsupport.html ,
but I received no response.

I always have the problem on Win7 x64 API Error 122 ERROR_INSUFFICIENT_BUFFER.
I paid for the support and upgrade, but I still have the problem.

Please help me!
:( :(
Post Reply