Discussion:
parallel port addresses
(too old to reply)
zubeyir
2010-07-23 22:49:25 UTC
Permalink
Hi everybody,
i had written a driver uses inport() and outport() macros to write to
LPT1 . I use base address 378h and data port 378h + 400h, Driver is
working truely, But there is another PC HP compaq desktop . Driver
didnt work . I look from XP hardware manager , LPT1 io resource is at
EF00 - EF07. I had decided to use EF03h as ECP data port.Printer isnt
writing. Is there anyone to help me about true ECP register location
at this computer .
Maxim S. Shatskih
2010-07-24 20:58:08 UTC
Permalink
Post by zubeyir
i had written a driver uses inport() and outport() macros to write to
LPT1
You cannot do this reliably, the port is owned by parport.sys, and you can only send requests to parport.sys

Otherwise, you will have races with parport.sys and thus major issues.
--
Maxim S. Shatskih
Windows DDK MVP
***@storagecraft.com
http://www.storagecraft.com
zubeyir
2010-07-25 07:43:18 UTC
Permalink
On Jul 24, 11:58 pm, "Maxim S. Shatskih"
Post by Maxim S. Shatskih
i had written a driver uses inport() and outport() macros to write  to
LPT1
You cannot do this reliably, the port is owned by parport.sys, and you can only send requests to parport.sys
Otherwise, you will have races with parport.sys and thus major issues.
--
Maxim S. Shatskih
Windows DDK MVP
Thank you for answer .
The OS was XP SP1 and parallel port base address was 378h . I had used
import() and outport() macros and no problem . New computer HP Compaq
dx2420 and the os is XP SP3 , I use EF00 base address and EF03h data
port . What is the problem . Is it about registry or another things
you said . Please , tell me details .
Maxim S. Shatskih
2010-07-25 21:47:32 UTC
Permalink
Post by zubeyir
port . What is the problem . Is it about registry or another things
you said . Please , tell me details .
About things I said.

What you do is unreliable by definition. It is absolutely normal that this approach works on one machine and does not on another.
--
Maxim S. Shatskih
Windows DDK MVP
***@storagecraft.com
http://www.storagecraft.com
Maxim S. Shatskih
2010-07-26 09:39:33 UTC
Permalink
Post by zubeyir
The OS was XP SP1 and parallel port base address was 378h . I had used
import() and outport() macros and no problem .
Proper way of doing things like this these in proper OSes (like Windows or Linux or FreeBSD or MacOS):

a) look at the API to the OS-provided parallel port driver
b) if this API is enough for you - use it
c) otherwise, develop a _full replacement_ of the OS-provided driver. To install such full replacement to Windows, patch the ImagePath registry value, this will get rid of PnP (but not KMCS!) signature checks.

inport() and outport() can only be used reliably for your purpose in MS-DOS or the standalone bare-metal OS-less boot environment (but modern days people usually avoid them in favour of WinPE - better but requires the royalty - or specially tailored Linux - worse but free).
--
Maxim S. Shatskih
Windows DDK MVP
***@storagecraft.com
http://www.storagecraft.com
zubeyir
2010-07-31 13:53:13 UTC
Permalink
On Jul 26, 12:39 pm, "Maxim S. Shatskih"
Post by Maxim S. Shatskih
Post by zubeyir
The OS was XP SP1 and parallel port base address was 378h . I had used
import() and outport() macros and no problem .
a) look at the API to the OS-provided parallel port driver
b) if this API is enough for you - use it
c) otherwise, develop a _full replacement_ of the OS-provided driver. To install such full replacement to Windows, patch the ImagePath registry value, this will get rid of PnP (but not KMCS!) signature checks.
inport() and outport() can only be used reliably for your purpose in MS-DOS or the standalone bare-metal OS-less boot environment (but modern days people usually avoid them in favour of WinPE - better but requires the royalty - or specially tailored Linux - worse but free).
--
Maxim S. Shatskih
Windows DDK MVP
Thanks for your suggestions..
I decided to use parport.sys.
I use iogetdeviceobjectpointer function in my drivers driverentry
rutine, i use "\\Device\\Parallel0" and another time i use "\
\DevicesParallelPort0" to reach parport.sys . But i get blue-screen
always.At begin i create UNICODESTRING structure for device name ,of
course . Can you tell me about any mistakes i did. Please help me...
zubeyir
2010-08-01 00:53:04 UTC
Permalink
On Jul 26, 12:39 pm, "Maxim S. Shatskih"
Post by Maxim S. Shatskih
Post by zubeyir
The OS was XP SP1 and parallel port base address was 378h . I had used
import() and outport() macros and no problem .
a) look at the API to the OS-provided parallel port driver
b) if this API is enough for you - use it
c) otherwise, develop a _full replacement_ of the OS-provided driver. To install such full replacement to Windows, patch the ImagePath registry value, this will get rid of PnP (but not KMCS!) signature checks.
inport() and outport() can only be used reliably for your purpose in MS-DOS or the standalone bare-metal OS-less boot environment (but modern days people usually avoid them in favour of WinPE - better but requires the royalty - or specially tailored Linux - worse but free).
--
Maxim S. Shatskih
Windows DDK MVP
I think i must use "\Device\ParallelPort0" for parport.sys . i have hp
laserjet 1320 printer.it is bidirectional . is it a raw parallel
device ("\Device\Parallel0") or IEEE 1284 end-of-chain device ("Device
\Parallel0.4".
Maxim S. Shatskih
2010-08-01 06:21:57 UTC
Permalink
Post by zubeyir
I think i must use "\Device\ParallelPort0" for parport.sys . i have hp
laserjet 1320 printer.it is bidirectional
And what is the exact task you need to do to the printer?
--
Maxim S. Shatskih
Windows DDK MVP
***@storagecraft.com
http://www.storagecraft.com
zubeyir
2010-08-01 09:45:27 UTC
Permalink
On Aug 1, 9:21 am, "Maxim S. Shatskih"
Post by Maxim S. Shatskih
Post by zubeyir
I think i must use "\Device\ParallelPort0" for parport.sys . i have hp
laserjet 1320 printer.it is bidirectional
And what is the exact task you need to do to the printer?
--
Maxim S. Shatskih
Windows DDK MVP
Only printing.
Jonathan Wilson
2010-08-01 10:28:34 UTC
Permalink
Post by zubeyir
Only printing.
What are you doing that cant be done via a regular printer driver?
zubeyir
2010-08-01 10:40:10 UTC
Permalink
Post by Jonathan Wilson
Post by zubeyir
Only printing.
What are you doing that cant be done via a regular printer driver?
I want to print a simple text documan , in kernel-mode,from a kernel-
driver i had written
Maxim S. Shatskih
2010-08-02 10:15:07 UTC
Permalink
Post by zubeyir
I want to print a simple text documan , in kernel-mode,from a kernel-
driver i had written
Offload all of this to user-mode process which will call the standard GDI APIs.
--
Maxim S. Shatskih
Windows DDK MVP
***@storagecraft.com
http://www.storagecraft.com
zubeyir
2010-08-01 10:45:40 UTC
Permalink
Post by zubeyir
On Aug 1, 9:21 am, "Maxim S. Shatskih"
Post by Maxim S. Shatskih
Post by zubeyir
I think i must use "\Device\ParallelPort0" for parport.sys . i have hp
laserjet 1320 printer.it is bidirectional
And what is the exact task you need to do to the printer?
--
Maxim S. Shatskih
Windows DDK MVP
Only printing.
I am not professional . i dont try to develop a general commercial
software
i try to learn by doing somethings
Maxim S. Shatskih
2010-08-02 10:13:50 UTC
Permalink
Post by zubeyir
Only printing.
Then why not use the mainstream Windows API?

They are printer-independent after all.

More so: parallel port is dying, and most printers are USB now.
--
Maxim S. Shatskih
Windows DDK MVP
***@storagecraft.com
http://www.storagecraft.com
zubeyir
2010-08-01 01:13:10 UTC
Permalink
On Jul 26, 12:39 pm, "Maxim S. Shatskih"
Post by Maxim S. Shatskih
Post by zubeyir
The OS was XP SP1 and parallel port base address was 378h . I had used
import() and outport() macros and no problem .
a) look at the API to the OS-provided parallel port driver
b) if this API is enough for you - use it
c) otherwise, develop a _full replacement_ of the OS-provided driver. To install such full replacement to Windows, patch the ImagePath registry value, this will get rid of PnP (but not KMCS!) signature checks.
inport() and outport() can only be used reliably for your purpose in MS-DOS or the standalone bare-metal OS-less boot environment (but modern days people usually avoid them in favour of WinPE - better but requires the royalty - or specially tailored Linux - worse but free).
--
Maxim S. Shatskih
Windows DDK MVP
I read ddk . i think i must obtain pointers to FDO and PDO for
paralell port and parallel device . but what are device-names (can you
tell me) . lets go on . at second step , i must open the parallel port
with IRP_MJ_CREATE ( but which routine i must use ,
iobuildsycn..fsdrequest or iobuilddevicecontrolrequest) , later i must
use ioctl_internal_parallel_port_allocate , and later i could write to
pdo with io_mj_write and iocalldriver (with pdo pointer) and finally i
must use free port and , close fdo and pdo file objects handles .
Please tell me are those true .
Loading...