I Killed My Printer, or Cannot Tame UniDrv on W2K!

I made a USB device containing a graphical LCD as one of its functions.
In firmware, I am exposing it as a standard USB printer - print a page
and it displays it.

I wrote a GPD file for Unidrv and testing it on W2K, which is my main
development machine (no attempts to run it under other OS yet). I
cannot get it straight and would appreciate a hand.

In the GPD file I did not refer a resource DLL, neither did I include
the GPD include file for unires.dll resources. All features and options
have a *Name but not an *rcName. The design tool checks the file ok,
but when I start the INF wizard, the wizard complains that it cannot
find a DLL by the name matching the GPD (for MYFILE.GPD it want a
MYFILE.DLL). I ignored the warning and installed the printer (I had
to select it manually and go through a “drivers for a different device”
warning - apparently my ID in the INF is wrong. Does it matter?)

The printer worked. I printed test pages from the installation wizard
(it was scaled down, but I could recognize the Windows logo ), Word
and Corel Draw. However, when I tried to look at the printer properties
through Control Panel/Printers, I got a dialog “The drivers for this
device are not installed. Install now?”. If I answer Yes and go through
a new install, the install ends in the properties dialog where I can see
printer properties, like resolution of 51 dpi etc and print a test page,
but as soon as I close it and try to go back, I get the same “not installed”
question. If I answer No, I get an MB_ERROR box telling “Not enough
resources to display” the property page.

Q1. How can I fix this? My hypothesis is that it does want a resource
DLL, however unreferred - the INF driver knows what it tells :slight_smile:

In the printer properties dialog that I see once after install, names
of PaperSize and Tray (these are required features, and I have one option
for each in the GPD) are all messed up - control characters and empty
boxen. *Names are ok, like in *Name: “Display” for the tray. Numbers
are fine - it reports the correct resolution in the dialog and correct
“paper” size to programs, only the string are corrupted. The file
did not contain a *CodePage attribute when I tested it (and I cannot
test anymore - I Killed My Printer. This will be a Q3), and was an
SBCS, not a Unicode file.

Q2: why no strings? I think I can work round this by creating a resource
DLL and placing strings there, but they are meaningless anyway, thus
unlocalizable, so I’d leave them in the GPD file if at all possible.
Another idea that the *CodePage attribute could be the culprit?

Now, I decided to clean after myself and repeat the install, and that
attempt appeared fatal. First, I deleted the ControlSet/Enum entry
under USB for my device. This is OK, as I do this always for USB
development, and it has never had ill effects. I removed oemNN.inf
and oemNN.PNF from %SystemRoot%\inf. And, the last step, which I
am not sure was as safe, I looked for my GPD file under system root
and found it in a directory %SystemRoot%\system32\spool\drivers\w32x86\3
Now, there were myfile.GPD and myfile.BUD (which appeared to be a DLL,
by the way). I deleted both and only these two. Obviously,
I deleted the printer from the Control Panel in the first place.

Now, even when I try to install the very same GPD/INF files that kind of
worked initially (I am completely sure that this is the right copy,
as I saved only one), past the “drivers for wrong device” question
but before and unfortunately instead of the “copying files” stage,
the New Hardware wizard jumps to the “Finish” page with an error
sounding like “Directory and file are malformed and unreadable” - not
literally, but definitely abusing conjunctions when lumping all
imaginable errors together :slight_smile: So, matter of fact, I cannot install my
printer any more even from the same INF/GPD pair. When I reconnect
the device, then the New Hardware Found wizard pops up again (and
fails again).

Q3: How do I unkill my printer?

I am sorry for a longish post, but I do not know what is important
and what is not.

TIA,

-kkm

You need to include unires.dll as a resource dll since it contains the
rcid’s for many of the standard names that you use within a GPD. Also,
it sounds like your INF is incorrectly specifying MYFILE.DLL as a
required file. You should modify this to make sure that only the files
that your driver needs are being installed. The reason for the error
when you go to printer properties is probably because the spooler cannot
locate the resource strings that you are mentioning within the GPD. You
should include unires.dll.

  • Ashwin

This posting is provided “AS IS” with no warranties, and confers no
rights.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Kirill ‘Big K’
Katsnelson
Sent: Wednesday, September 03, 2003 7:48 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] I Killed My Printer, or Cannot Tame UniDrv on W2K!

I made a USB device containing a graphical LCD as one of its functions.
In firmware, I am exposing it as a standard USB printer - print a page
and it displays it.

I wrote a GPD file for Unidrv and testing it on W2K, which is my main
development machine (no attempts to run it under other OS yet). I
cannot get it straight and would appreciate a hand.

In the GPD file I did not refer a resource DLL, neither did I include
the GPD include file for unires.dll resources. All features and options
have a *Name but not an *rcName. The design tool checks the file ok,
but when I start the INF wizard, the wizard complains that it cannot
find a DLL by the name matching the GPD (for MYFILE.GPD it want a
MYFILE.DLL). I ignored the warning and installed the printer (I had to
select it manually and go through a “drivers for a different device”
warning - apparently my ID in the INF is wrong. Does it matter?)

The printer worked. I printed test pages from the installation wizard
(it was scaled down, but I could recognize the Windows logo ), Word
and Corel Draw. However, when I tried to look at the printer properties
through Control Panel/Printers, I got a dialog “The drivers for this
device are not installed. Install now?”. If I answer Yes and go
through a new install, the install ends in the properties dialog where I
can see printer properties, like resolution of 51 dpi etc and print a
test page, but as soon as I close it and try to go back, I get the same
“not installed” question. If I answer No, I get an MB_ERROR box telling
“Not enough resources to display” the property page.

Q1. How can I fix this? My hypothesis is that it does want a resource
DLL, however unreferred - the INF driver knows what it tells :slight_smile:

In the printer properties dialog that I see once after install, names of
PaperSize and Tray (these are required features, and I have one option
for each in the GPD) are all messed up - control characters and empty
boxen. *Names are ok, like in *Name: “Display” for the tray. Numbers
are fine - it reports the correct resolution in the dialog and correct
“paper” size to programs, only the string are corrupted. The file did
not contain a *CodePage attribute when I tested it (and I cannot test
anymore - I Killed My Printer. This will be a Q3), and was an SBCS, not
a Unicode file.

Q2: why no strings? I think I can work round this by creating a
resource DLL and placing strings there, but they are meaningless anyway,
thus unlocalizable, so I’d leave them in the GPD file if at all
possible. Another idea that the *CodePage attribute could be the
culprit?

Now, I decided to clean after myself and repeat the install, and that
attempt appeared fatal. First, I deleted the ControlSet/Enum entry
under USB for my device. This is OK, as I do this always for USB
development, and it has never had ill effects. I removed oemNN.inf and
oemNN.PNF from %SystemRoot%\inf. And, the last step, which I am not
sure was as safe, I looked for my GPD file under system root and found
it in a directory %SystemRoot%\system32\spool\drivers\w32x86\3
Now, there were myfile.GPD and myfile.BUD (which appeared to be a DLL,
by the way). I deleted both and only these two. Obviously, I deleted
the printer from the Control Panel in the first place.

Now, even when I try to install the very same GPD/INF files that kind of
worked initially (I am completely sure that this is the right copy, as I
saved only one), past the “drivers for wrong device” question but before
and unfortunately instead of the “copying files” stage, the New Hardware
wizard jumps to the “Finish” page with an error sounding like “Directory
and file are malformed and unreadable” - not literally, but definitely
abusing conjunctions when lumping all imaginable errors together :slight_smile: So,
matter of fact, I cannot install my printer any more even from the same
INF/GPD pair. When I reconnect the device, then the New Hardware Found
wizard pops up again (and fails again).

Q3: How do I unkill my printer?

I am sorry for a longish post, but I do not know what is important and
what is not.

TIA,

-kkm


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com