Main Menu

KB#01164-Error 12 opening device or printer alias line on Windows platforms.

Title:

Error 12 opening device or printer alias line on Windows platforms.

Description:

Vista and other recent Windows platforms are failing on the low level api call required to open devices directly using the device name or via printer alias line. 

Sample printer alias line: 

ALIAS LP LPT1 "Local Printer" CR,SPCOLS=60 

In Vpro5: 

>open(1)"LP" 

!ERROR=12 (Missing or duplicate file) 

>open(1)"LPT1" 

!ERROR=12 (Missing or duplicate file) 

This error also occurs opening Comm ports and UNC names. 

ALIAS LP //server/printer "network printer on USB" CR,CPCOLS=60 



Resolution:

Add the mode O_CREATE to file open or alias line: 

open(1,mode="O_CREATE")"LPT1" 

via the alias line: 

ALIAS LP LPT1 "Local printer" CR,O_CREATE,SPCOLS=70 

ALIAS LP //server/printer "network USB printer" CR,O_CREATE,SPCOLS=70 

Note: 

1) Under Vista, 2008 Server and Windows 7 using the net use command to capture a local LPTx port to a network UNC shared printer may require the addition of the USER and PASSWORD being passed: 

NET USE LPT1 \\server\printer /user:user_name password /persistent:yes 

2) Under Windows 7, on some network configurations the user may also need to be a member of the Print Operators group.

3) On Windows systems that do not have physical parallel devices NET USE will not work.  In that case use the UNC device name as mentioned above.



Last Modified: 04/27/2010 Product: Visual PRO/5 Operating System: Windows Vista

BASIS structures five components of their technology into the BBx Generations.

  Google+ View BASIS LinkedIN Profile Visit our Twitter Feed Check out our Facebook Public Profile Click to View the BASIS youTube channel