Loading a kernel-mode driver from a DLL

Let me explain my problem first. I have a VB6 application that my
employer wants to modify to all blowing the fuse on the JTAG interface.
The JTAG interface is connected to a PC via the parallel port. The PCs
have either Windows NT or XP on them. To accomplish the I/O access, I
have a kernel-mode driver from the sample drivers in the DDK
(genport/portio). We would like to load the driver from a DLL that is
called from the VB6 application. This is because we would like the
driver to load and unload rather than being a permanent service.
Trouble is, I have the full Visual Studio .NET suite and Visual Basic
6.0 at my disposal. Can a DLL created with VS.net be incorporated into
a VB6 application? OR, do I have to port the VB6 application to VB.net?

Thanks for any help,

Stacy

> Can a DLL created with VS.net be incorporated into a VB6 application?

Yes, with some (mostly reasonable) constraints. However, this has nothing
to do with device drivers. There are many resources on the web for learning
how to do this. If you have trouble finding them, send me mail off-list and
I’ll help you.

Why do you need a kernel-mode driver in order to access the parallel port?
The system already has a parallel port driver. Have you tried to use this
driver, and found it insufficient for your needs? Your app should be able
to open the parallel port directly, and communicate with the JTAG interface.

– arlie


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Stacy Meszaros
Sent: Tuesday, August 16, 2005 10:59 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Loading a kernel-mode driver from a DLL

Let me explain my problem first. I have a VB6 application that my employer
wants to modify to all blowing the fuse on the JTAG interface. The JTAG
interface is connected to a PC via the parallel port. The PCs have either
Windows NT or XP on them. To accomplish the I/O access, I have a
kernel-mode driver from the sample drivers in the DDK (genport/portio). We
would like to load the driver from a DLL that is called from the VB6
application. This is because we would like the driver to load and unload
rather than being a permanent service. Trouble is, I have the full Visual
Studio .NET suite and Visual Basic 6.0 at my disposal. Can a DLL created
with VS.net be incorporated into a VB6 application? OR, do I have to port
the VB6 application to VB.net?

Thanks for any help,

Stacy


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

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Porting to VB.NET is maybe the easiest solution

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: Stacy Meszaros
To: Windows System Software Devs Interest List
Sent: Tuesday, August 16, 2005 6:59 PM
Subject: [ntdev] Loading a kernel-mode driver from a DLL

Let me explain my problem first. I have a VB6 application that my employer wants to modify to all blowing the fuse on the JTAG interface. The JTAG interface is connected to a PC via the parallel port. The PCs have either Windows NT or XP on them. To accomplish the I/O access, I have a kernel-mode driver from the sample drivers in the DDK (genport/portio). We would like to load the driver from a DLL that is called from the VB6 application. This is because we would like the driver to load and unload rather than being a permanent service. Trouble is, I have the full Visual Studio .NET suite and Visual Basic 6.0 at my disposal. Can a DLL created with VS.net be incorporated into a VB6 application? OR, do I have to port the VB6 application to VB.net?

Thanks for any help,

Stacy


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

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Max may be right, but are you sure the built-in parallel port driver
doesn’t expose everything you need? Then you only need add the appropriate
code to your VB6 app and be done.

Phil

Philip D. Barila
Seagate Technology LLC
(720) 684-1842

“Maxim S.
Shatskih”
ft.com> “Windows System Software Devs
Sent by: Interest List”
bounce-217267-643
xxxxx@lists.osr.com cc
No Phone Info
Available Subject
Re: [ntdev] Loading a kernel-mode
driver from a DLL
08/16/2005 12:23
PM

Please respond to
“Windows System
Software Devs
Interest List”
com>

Porting to VB.NET is maybe the easiest solution

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Stacy Meszaros
To: Windows System Software Devs Interest List
Sent: Tuesday, August 16, 2005 6:59 PM
Subject: [ntdev] Loading a kernel-mode driver from a DLL

Let me explain my problem first. I have a VB6 application that my
employer wants to modify to all blowing the fuse on the JTAG interface.
The JTAG interface is connected to a PC via the parallel port. The PCs
have either Windows NT or XP on them. To accomplish the I/O access, I
have a kernel-mode driver from the sample drivers in the DDK
(genport/portio). We would like to load the driver from a DLL that is
called from the VB6 application. This is because we would like the driver
to load and unload rather than being a permanent service. Trouble is, I
have the full Visual Studio .NET suite and Visual Basic 6.0 at my
disposal. Can a DLL created with VS.net be incorporated into a VB6
application? OR, do I have to port the VB6 application to VB.net?

Thanks for any help,
Stacy

I am trying at this time to use the existing parallel port driver by
‘connecting’ to it with CreateFile and “LPT1:” as the filename. I have
already tried this in my VB application and it did not work (always read
0 bytes and crashed when writing 1 byte). Assuming that I may have a
parameter wrong, I am trying with a C console app. My current problem
is that the HANDLE, BYTE and DWORD types are not resolving (I must be
using the wrong .h) I’ve tried windows.h and winbase.h

Any ideas??

Stacy

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Philip D Barila
Sent: Tuesday, August 16, 2005 2:39 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Loading a kernel-mode driver from a DLL

Max may be right, but are you sure the built-in parallel port driver
doesn’t expose everything you need? Then you only need add the
appropriate
code to your VB6 app and be done.

Phil

Philip D. Barila
Seagate Technology LLC
(720) 684-1842

"Maxim S.

Shatskih"

To
ft.com> “Windows System Software Devs

Sent by: Interest List”

bounce-217267-643

xxxxx@lists.osr.com
cc
No Phone Info

Available
Subject
Re: [ntdev] Loading a kernel-mode

driver from a DLL

08/16/2005 12:23

PM

Please respond to

“Windows System

Software Devs

Interest List”


com>

Porting to VB.NET is maybe the easiest solution

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Stacy Meszaros
To: Windows System Software Devs Interest List
Sent: Tuesday, August 16, 2005 6:59 PM
Subject: [ntdev] Loading a kernel-mode driver from a DLL

Let me explain my problem first. I have a VB6 application that my
employer wants to modify to all blowing the fuse on the JTAG interface.
The JTAG interface is connected to a PC via the parallel port. The PCs
have either Windows NT or XP on them. To accomplish the I/O access, I
have a kernel-mode driver from the sample drivers in the DDK
(genport/portio). We would like to load the driver from a DLL that is
called from the VB6 application. This is because we would like the
driver
to load and unload rather than being a permanent service. Trouble is,
I
have the full Visual Studio .NET suite and Visual Basic 6.0 at my
disposal. Can a DLL created with VS.net be incorporated into a VB6
application? OR, do I have to port the VB6 application to VB.net?

Thanks for any help,
Stacy


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

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

Try searching for the MSCOMM control. Supposedly, it’s available in VB6 as
part of an OCX. I don’t do VB6, so I’m only restating what I saw in a few
minutes of trawling through the Current MSDN Library. It’s a bit slim on
Visual Studio 6 documentation these days, but the VB6 docs should tell you
what you need to know.

Phil

Philip D. Barila
Seagate Technology LLC
(720) 684-1842

“Stacy Meszaros”
ch.com> To
Sent by: “Windows System Software Devs
bounce-217273-643 Interest List”
xxxxx@lists.osr.com
No Phone Info cc
Available
Subject
RE: [ntdev] Loading a kernel-mode
08/16/2005 01:00 driver from a DLL
PM

Please respond to
“Windows System
Software Devs
Interest List”
com>

I am trying at this time to use the existing parallel port driver by
‘connecting’ to it with CreateFile and “LPT1:” as the filename. I have
already tried this in my VB application and it did not work (always read
0 bytes and crashed when writing 1 byte). Assuming that I may have a
parameter wrong, I am trying with a C console app. My current problem
is that the HANDLE, BYTE and DWORD types are not resolving (I must be
using the wrong .h) I’ve tried windows.h and winbase.h

Any ideas??

Stacy

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Philip D Barila
Sent: Tuesday, August 16, 2005 2:39 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Loading a kernel-mode driver from a DLL

Max may be right, but are you sure the built-in parallel port driver
doesn’t expose everything you need? Then you only need add the
appropriate
code to your VB6 app and be done.

Phil

Philip D. Barila
Seagate Technology LLC
(720) 684-1842

“Maxim S.

Shatskih”

To
ft.com> “Windows System Software Devs

Sent by: Interest List”

bounce-217267-643

xxxxx@lists.osr.com
cc
No Phone Info

Available
Subject
Re: [ntdev] Loading a kernel-mode

driver from a DLL

08/16/2005 12:23

PM

Please respond to

“Windows System

Software Devs

Interest List”


com>

Porting to VB.NET is maybe the easiest solution

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Stacy Meszaros
To: Windows System Software Devs Interest List
Sent: Tuesday, August 16, 2005 6:59 PM
Subject: [ntdev] Loading a kernel-mode driver from a DLL

Let me explain my problem first. I have a VB6 application that my
employer wants to modify to all blowing the fuse on the JTAG interface.
The JTAG interface is connected to a PC via the parallel port. The PCs
have either Windows NT or XP on them. To accomplish the I/O access, I
have a kernel-mode driver from the sample drivers in the DDK
(genport/portio). We would like to load the driver from a DLL that is
called from the VB6 application. This is because we would like the
driver
to load and unload rather than being a permanent service. Trouble is,
I
have the full Visual Studio .NET suite and Visual Basic 6.0 at my
disposal. Can a DLL created with VS.net be incorporated into a VB6
application? OR, do I have to port the VB6 application to VB.net?

Thanks for any help,
Stacy


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

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


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

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

OK - here’s is what I have discovered when trying to use the existing
parallel port driver, after sorting out my problem with header files (learn
something new every day - I needed to add my header files to stdafx.h which
was created by the .net wizard). Anyway, I can’t read/write the I/O port
using the existing driver. What happens is that the console application I
wrote to try to quickly test this hangs, have to CTRL-C out of it. I had
been wary of trying this approach since I have already called into the
genport sample driver from my VB6 application and that works nicely. Also,
I don’t know what ports the existing driver is actually writing and reading
(the printer ports assigned to this driver are 378 to 37F and 778 to 77f)
So I am back to using the genport driver supplied by the DDK and my original
problem of creating a DLL to install/uninstall and load/unload the driver.
Is this possible?? Can I install and uninstall a driver from a DLL written
under VS.net and further, can I access said DLL from a VB6 application? I
should explain that the sole purpose for exploring this driver/DLL/VB6
application approach is that we only want the driver to be installed and
loaded if it is needed by the VB6 application.

Thanks again,
Stacy
“Stacy Meszaros” wrote in message
news:xxxxx@ntdev…
I am trying at this time to use the existing parallel port driver by
‘connecting’ to it with CreateFile and “LPT1:” as the filename. I have
already tried this in my VB application and it did not work (always read
0 bytes and crashed when writing 1 byte). Assuming that I may have a
parameter wrong, I am trying with a C console app. My current problem
is that the HANDLE, BYTE and DWORD types are not resolving (I must be
using the wrong .h) I’ve tried windows.h and winbase.h

Any ideas??

Stacy

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Philip D Barila
Sent: Tuesday, August 16, 2005 2:39 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Loading a kernel-mode driver from a DLL

Max may be right, but are you sure the built-in parallel port driver
doesn’t expose everything you need? Then you only need add the
appropriate
code to your VB6 app and be done.

Phil

Philip D. Barila
Seagate Technology LLC
(720) 684-1842

“Maxim S.

Shatskih”

To
ft.com> “Windows System Software Devs

Sent by: Interest List”

bounce-217267-643

xxxxx@lists.osr.com
cc
No Phone Info

Available
Subject
Re: [ntdev] Loading a kernel-mode

driver from a DLL

08/16/2005 12:23

PM

Please respond to

“Windows System

Software Devs

Interest List”


com>

Porting to VB.NET is maybe the easiest solution

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Stacy Meszaros
To: Windows System Software Devs Interest List
Sent: Tuesday, August 16, 2005 6:59 PM
Subject: [ntdev] Loading a kernel-mode driver from a DLL

Let me explain my problem first. I have a VB6 application that my
employer wants to modify to all blowing the fuse on the JTAG interface.
The JTAG interface is connected to a PC via the parallel port. The PCs
have either Windows NT or XP on them. To accomplish the I/O access, I
have a kernel-mode driver from the sample drivers in the DDK
(genport/portio). We would like to load the driver from a DLL that is
called from the VB6 application. This is because we would like the
driver
to load and unload rather than being a permanent service. Trouble is,
I
have the full Visual Studio .NET suite and Visual Basic 6.0 at my
disposal. Can a DLL created with VS.net be incorporated into a VB6
application? OR, do I have to port the VB6 application to VB.net?

Thanks for any help,
Stacy


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

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

Stacy,

You can create a DLL from VS.Net that doesn’t use the CLR (Common Language
Runtime). You pick Win32 application and under application settings select
DLL. This you could easily call from your VB6 application. It doesn’t need
to use the .Net framework.

As far as loading/unloading a driver from this DLL, I really can’t speak to
that specifically.

Thanks,
Paul


Paul Benware
Director of Client Development

KoolSpan Inc.
11134 Stephalee Lane
North Bethesda, MD 20852
TELE: 1-301-468-9434
DIRECT: 1-301-560-4531
FAX: 1-301-576-6341
CELL: 1-585-739-0441
www.koolspan.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Stacy
Sent: Tuesday, August 16, 2005 4:17 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Loading a kernel-mode driver from a DLL

OK - here’s is what I have discovered when trying to use the existing
parallel port driver, after sorting out my problem with header files (learn
something new every day - I needed to add my header files to stdafx.h which
was created by the .net wizard). Anyway, I can’t read/write the I/O port
using the existing driver. What happens is that the console application I
wrote to try to quickly test this hangs, have to CTRL-C out of it. I had
been wary of trying this approach since I have already called into the
genport sample driver from my VB6 application and that works nicely. Also,
I don’t know what ports the existing driver is actually writing and reading
(the printer ports assigned to this driver are 378 to 37F and 778 to 77f)
So I am back to using the genport driver supplied by the DDK and my original

problem of creating a DLL to install/uninstall and load/unload the driver.
Is this possible?? Can I install and uninstall a driver from a DLL written
under VS.net and further, can I access said DLL from a VB6 application? I
should explain that the sole purpose for exploring this driver/DLL/VB6
application approach is that we only want the driver to be installed and
loaded if it is needed by the VB6 application.

Thanks again,
Stacy
“Stacy Meszaros” wrote in message
news:xxxxx@ntdev…
I am trying at this time to use the existing parallel port driver by
‘connecting’ to it with CreateFile and “LPT1:” as the filename. I have
already tried this in my VB application and it did not work (always read
0 bytes and crashed when writing 1 byte). Assuming that I may have a
parameter wrong, I am trying with a C console app. My current problem
is that the HANDLE, BYTE and DWORD types are not resolving (I must be
using the wrong .h) I’ve tried windows.h and winbase.h

Any ideas??

Stacy

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Philip D Barila
Sent: Tuesday, August 16, 2005 2:39 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Loading a kernel-mode driver from a DLL

Max may be right, but are you sure the built-in parallel port driver
doesn’t expose everything you need? Then you only need add the
appropriate
code to your VB6 app and be done.

Phil

Philip D. Barila
Seagate Technology LLC
(720) 684-1842

“Maxim S.

Shatskih”

To
ft.com> “Windows System Software Devs

Sent by: Interest List”

bounce-217267-643

xxxxx@lists.osr.com
cc
No Phone Info

Available
Subject
Re: [ntdev] Loading a kernel-mode

driver from a DLL

08/16/2005 12:23

PM

Please respond to

“Windows System

Software Devs

Interest List”


com>

Porting to VB.NET is maybe the easiest solution

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Stacy Meszaros
To: Windows System Software Devs Interest List
Sent: Tuesday, August 16, 2005 6:59 PM
Subject: [ntdev] Loading a kernel-mode driver from a DLL

Let me explain my problem first. I have a VB6 application that my
employer wants to modify to all blowing the fuse on the JTAG interface.
The JTAG interface is connected to a PC via the parallel port. The PCs
have either Windows NT or XP on them. To accomplish the I/O access, I
have a kernel-mode driver from the sample drivers in the DDK
(genport/portio). We would like to load the driver from a DLL that is
called from the VB6 application. This is because we would like the
driver
to load and unload rather than being a permanent service. Trouble is,
I
have the full Visual Studio .NET suite and Visual Basic 6.0 at my
disposal. Can a DLL created with VS.net be incorporated into a VB6
application? OR, do I have to port the VB6 application to VB.net?

Thanks for any help,
Stacy


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

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


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

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

<windows.h> is the correct header file. Please post the compiler’s error
message, verbatim.

– arlie

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Stacy Meszaros
Sent: Tuesday, August 16, 2005 3:01 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Loading a kernel-mode driver from a DLL

I am trying at this time to use the existing parallel port driver by
‘connecting’ to it with CreateFile and “LPT1:” as the filename. I have
already tried this in my VB application and it did not work (always read 0
bytes and crashed when writing 1 byte). Assuming that I may have a
parameter wrong, I am trying with a C console app. My current problem is
that the HANDLE, BYTE and DWORD types are not resolving (I must be using the
wrong .h) I’ve tried windows.h and winbase.h

Any ideas??

Stacy</windows.h>

-----Original Message-----
Hello,

Try this code for loading and unloading device driver (any) in your DLL.
http://www.codeproject.com/system/tdriver.asp

Most of the on-demand dynamic loading of device driver use CreateService
API. You can look into this direction for more input. Google it for more
information.

http://www.beyondlogic.org/porttalk/porttalk.htm This could also give you
some insight into IO port access.

You can create the DLL using Win32 Dynamic Link Library application
framework or any VB.NET
Hope this helps.

Regards,
Sivakumar Jayapal

To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Loading a kernel-mode driver from a DLL

OK - here’s is what I have discovered when trying to use the existing
parallel port driver, after sorting out my problem with header files (learn
something new every day - I needed to add my header files to stdafx.h which
was created by the .net wizard). Anyway, I can’t read/write the I/O port
using the existing driver. What happens is that the console application I
wrote to try to quickly test this hangs, have to CTRL-C out of it. I had
been wary of trying this approach since I have already called into the
genport sample driver from my VB6 application and that works nicely. Also,
I don’t know what ports the existing driver is actually writing and reading
(the printer ports assigned to this driver are 378 to 37F and 778 to 77f)
So I am back to using the genport driver supplied by the DDK and my original

problem of creating a DLL to install/uninstall and load/unload the driver.
Is this possible?? Can I install and uninstall a driver from a DLL written
under VS.net and further, can I access said DLL from a VB6 application? I
should explain that the sole purpose for exploring this driver/DLL/VB6
application approach is that we only want the driver to be installed and
loaded if it is needed by the VB6 application.

Thanks again,
Stacy
“Stacy Meszaros” wrote in message
news:xxxxx@ntdev…
I am trying at this time to use the existing parallel port driver by
‘connecting’ to it with CreateFile and “LPT1:” as the filename. I have
already tried this in my VB application and it did not work (always read
0 bytes and crashed when writing 1 byte). Assuming that I may have a
parameter wrong, I am trying with a C console app. My current problem
is that the HANDLE, BYTE and DWORD types are not resolving (I must be
using the wrong .h) I’ve tried windows.h and winbase.h

Any ideas??

Stacy

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Philip D Barila
Sent: Tuesday, August 16, 2005 2:39 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Loading a kernel-mode driver from a DLL

Max may be right, but are you sure the built-in parallel port driver
doesn’t expose everything you need? Then you only need add the
appropriate
code to your VB6 app and be done.

Phil

Philip D. Barila
Seagate Technology LLC
(720) 684-1842

“Maxim S.

Shatskih”

To
ft.com> “Windows System Software Devs

Sent by: Interest List”

bounce-217267-643

xxxxx@lists.osr.com
cc
No Phone Info

Available
Subject
Re: [ntdev] Loading a kernel-mode

driver from a DLL

08/16/2005 12:23

PM

Please respond to

“Windows System

Software Devs

Interest List”


com>

Porting to VB.NET is maybe the easiest solution

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Stacy Meszaros
To: Windows System Software Devs Interest List
Sent: Tuesday, August 16, 2005 6:59 PM
Subject: [ntdev] Loading a kernel-mode driver from a DLL

Let me explain my problem first. I have a VB6 application that my
employer wants to modify to all blowing the fuse on the JTAG interface.
The JTAG interface is connected to a PC via the parallel port. The PCs
have either Windows NT or XP on them. To accomplish the I/O access, I
have a kernel-mode driver from the sample drivers in the DDK
(genport/portio). We would like to load the driver from a DLL that is
called from the VB6 application. This is because we would like the
driver
to load and unload rather than being a permanent service. Trouble is,
I
have the full Visual Studio .NET suite and Visual Basic 6.0 at my
disposal. Can a DLL created with VS.net be incorporated into a VB6
application? OR, do I have to port the VB6 application to VB.net?

Thanks for any help,
Stacy


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

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


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

You are currently subscribed to ntdev as: xxxxx@hcltech.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
DISCLAIMER
This message and any attachment(s) contained here are information that is confidential, proprietary to HCL Technologies
and its customers. Contents may be privileged or otherwise protected by law. The information is solely intended for the
individual or the entity it is addressed to. If you are not the intended recipient of this message, you are not authorized to
read, forward, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error,
please notify the sender immediately by return e-mail and delete it from your computer

Why not? Use CreateService to install.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Stacy”
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”
Sent: Wednesday, August 17, 2005 12:16 AM
Subject: Re:[ntdev] Loading a kernel-mode driver from a DLL

> OK - here’s is what I have discovered when trying to use the existing
> parallel port driver, after sorting out my problem with header files (learn
> something new every day - I needed to add my header files to stdafx.h which
> was created by the .net wizard). Anyway, I can’t read/write the I/O port
> using the existing driver. What happens is that the console application I
> wrote to try to quickly test this hangs, have to CTRL-C out of it. I had
> been wary of trying this approach since I have already called into the
> genport sample driver from my VB6 application and that works nicely. Also,
> I don’t know what ports the existing driver is actually writing and reading
> (the printer ports assigned to this driver are 378 to 37F and 778 to 77f)
> So I am back to using the genport driver supplied by the DDK and my original
> problem of creating a DLL to install/uninstall and load/unload the driver.
> Is this possible?? Can I install and uninstall a driver from a DLL written
> under VS.net and further, can I access said DLL from a VB6 application? I
> should explain that the sole purpose for exploring this driver/DLL/VB6
> application approach is that we only want the driver to be installed and
> loaded if it is needed by the VB6 application.
>
> Thanks again,
> Stacy
> “Stacy Meszaros” wrote in message
> news:xxxxx@ntdev…
> I am trying at this time to use the existing parallel port driver by
> ‘connecting’ to it with CreateFile and “LPT1:” as the filename. I have
> already tried this in my VB application and it did not work (always read
> 0 bytes and crashed when writing 1 byte). Assuming that I may have a
> parameter wrong, I am trying with a C console app. My current problem
> is that the HANDLE, BYTE and DWORD types are not resolving (I must be
> using the wrong .h) I’ve tried windows.h and winbase.h
>
> Any ideas??
>
> Stacy
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Philip D Barila
> Sent: Tuesday, August 16, 2005 2:39 PM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Loading a kernel-mode driver from a DLL
>
> Max may be right, but are you sure the built-in parallel port driver
> doesn’t expose everything you need? Then you only need add the
> appropriate
> code to your VB6 app and be done.
>
> Phil
>
> Philip D. Barila
> Seagate Technology LLC
> (720) 684-1842
>
>
>
>
> “Maxim S.
>
> Shatskih”
>
> > To
> ft.com> “Windows System Software Devs
>
> Sent by: Interest List”
>
> bounce-217267-643
>
> xxxxx@lists.osr.com
> cc
> No Phone Info
>
> Available
> Subject
> Re: [ntdev] Loading a kernel-mode
>
> driver from a DLL
>
> 08/16/2005 12:23
>
> PM
>
>
>
>
>
> Please respond to
>
> “Windows System
>
> Software Devs
>
> Interest List”
>
> >
> com>
>
>
>
>
>
>
>
>
>
> Porting to VB.NET is maybe the easiest solution
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
> ----- Original Message -----
> From: Stacy Meszaros
> To: Windows System Software Devs Interest List
> Sent: Tuesday, August 16, 2005 6:59 PM
> Subject: [ntdev] Loading a kernel-mode driver from a DLL
>
> Let me explain my problem first. I have a VB6 application that my
> employer wants to modify to all blowing the fuse on the JTAG interface.
> The JTAG interface is connected to a PC via the parallel port. The PCs
> have either Windows NT or XP on them. To accomplish the I/O access, I
> have a kernel-mode driver from the sample drivers in the DDK
> (genport/portio). We would like to load the driver from a DLL that is
> called from the VB6 application. This is because we would like the
> driver
> to load and unload rather than being a permanent service. Trouble is,
> I
> have the full Visual Studio .NET suite and Visual Basic 6.0 at my
> disposal. Can a DLL created with VS.net be incorporated into a VB6
> application? OR, do I have to port the VB6 application to VB.net?
>
> Thanks for any help,
> Stacy
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@sensorswitch.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

Yes, I am attempting to install the driver with OpenSCManager,
CreateService, OpenService, StartService and then CreateFile. The driver is
the genport.sys sample driver from the Microsoft DDK. This sample driver
comes with a setup file genport.inf (I am not at all sure how to use that
file when loading a driver programmatically).

The OpenSCManager, CreateService and OpenService calls all return
successfully. My driver name is genport, the path is
\\windows\system32\drivers\genport.sys

The problem is with the StartService call, which returns error # 53
(ERROR_BAD_NETPATH)

Any help would be so greatly appreciated,
Stacy
“Maxim S. Shatskih” wrote in message
news:xxxxx@ntdev…
> Why not? Use CreateService to install.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> ----- Original Message -----
> From: “Stacy”
> Newsgroups: ntdev
> To: “Windows System Software Devs Interest List”
> Sent: Wednesday, August 17, 2005 12:16 AM
> Subject: Re:[ntdev] Loading a kernel-mode driver from a DLL
>
>
>> OK - here’s is what I have discovered when trying to use the existing
>> parallel port driver, after sorting out my problem with header files
>> (learn
>> something new every day - I needed to add my header files to stdafx.h
>> which
>> was created by the .net wizard). Anyway, I can’t read/write the I/O port
>> using the existing driver. What happens is that the console application
>> I
>> wrote to try to quickly test this hangs, have to CTRL-C out of it. I had
>> been wary of trying this approach since I have already called into the
>> genport sample driver from my VB6 application and that works nicely.
>> Also,
>> I don’t know what ports the existing driver is actually writing and
>> reading
>> (the printer ports assigned to this driver are 378 to 37F and 778 to 77f)
>> So I am back to using the genport driver supplied by the DDK and my
>> original
>> problem of creating a DLL to install/uninstall and load/unload the
>> driver.
>> Is this possible?? Can I install and uninstall a driver from a DLL
>> written
>> under VS.net and further, can I access said DLL from a VB6 application?
>> I
>> should explain that the sole purpose for exploring this driver/DLL/VB6
>> application approach is that we only want the driver to be installed and
>> loaded if it is needed by the VB6 application.
>>
>> Thanks again,
>> Stacy
>> “Stacy Meszaros” wrote in message
>> news:xxxxx@ntdev…
>> I am trying at this time to use the existing parallel port driver by
>> ‘connecting’ to it with CreateFile and “LPT1:” as the filename. I have
>> already tried this in my VB application and it did not work (always read
>> 0 bytes and crashed when writing 1 byte). Assuming that I may have a
>> parameter wrong, I am trying with a C console app. My current problem
>> is that the HANDLE, BYTE and DWORD types are not resolving (I must be
>> using the wrong .h) I’ve tried windows.h and winbase.h
>>
>> Any ideas??
>>
>> Stacy
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Philip D Barila
>> Sent: Tuesday, August 16, 2005 2:39 PM
>> To: Windows System Software Devs Interest List
>> Subject: Re: [ntdev] Loading a kernel-mode driver from a DLL
>>
>> Max may be right, but are you sure the built-in parallel port driver
>> doesn’t expose everything you need? Then you only need add the
>> appropriate
>> code to your VB6 app and be done.
>>
>> Phil
>>
>> Philip D. Barila
>> Seagate Technology LLC
>> (720) 684-1842
>>
>>
>>
>>
>> “Maxim S.
>>
>> Shatskih”
>>
>> >> To
>> ft.com> “Windows System Software Devs
>>
>> Sent by: Interest List”
>>
>> bounce-217267-643
>>
>> xxxxx@lists.osr.com
>> cc
>> No Phone Info
>>
>> Available
>> Subject
>> Re: [ntdev] Loading a kernel-mode
>>
>> driver from a DLL
>>
>> 08/16/2005 12:23
>>
>> PM
>>
>>
>>
>>
>>
>> Please respond to
>>
>> “Windows System
>>
>> Software Devs
>>
>> Interest List”
>>
>> >>
>> com>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Porting to VB.NET is maybe the easiest solution
>>
>> Maxim Shatskih, Windows DDK MVP
>> StorageCraft Corporation
>> xxxxx@storagecraft.com
>> http://www.storagecraft.com
>> ----- Original Message -----
>> From: Stacy Meszaros
>> To: Windows System Software Devs Interest List
>> Sent: Tuesday, August 16, 2005 6:59 PM
>> Subject: [ntdev] Loading a kernel-mode driver from a DLL
>>
>> Let me explain my problem first. I have a VB6 application that my
>> employer wants to modify to all blowing the fuse on the JTAG interface.
>> The JTAG interface is connected to a PC via the parallel port. The PCs
>> have either Windows NT or XP on them. To accomplish the I/O access, I
>> have a kernel-mode driver from the sample drivers in the DDK
>> (genport/portio). We would like to load the driver from a DLL that is
>> called from the VB6 application. This is because we would like the
>> driver
>> to load and unload rather than being a permanent service. Trouble is,
>> I
>> have the full Visual Studio .NET suite and Visual Basic 6.0 at my
>> disposal. Can a DLL created with VS.net be incorporated into a VB6
>> application? OR, do I have to port the VB6 application to VB.net?
>>
>> Thanks for any help,
>> Stacy
>>
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
>> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: xxxxx@sensorswitch.com
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>>
>>
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

GenPort is a PNP driver, so this will not work. You are going to have to
use the PNP API’s. Take a look at the DevCon sample in the DDK, this has
the ability to install a driver, you will need to abstract this to a DLL.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply

“Stacy” wrote in message news:xxxxx@ntdev…
> Yes, I am attempting to install the driver with OpenSCManager,
> CreateService, OpenService, StartService and then CreateFile. The driver
> is the genport.sys sample driver from the Microsoft DDK. This sample
> driver comes with a setup file genport.inf (I am not at all sure how to
> use that file when loading a driver programmatically).
>
> The OpenSCManager, CreateService and OpenService calls all return
> successfully. My driver name is genport, the path is
> \\windows\system32\drivers\genport.sys
>
> The problem is with the StartService call, which returns error # 53
> (ERROR_BAD_NETPATH)
>
> Any help would be so greatly appreciated,
> Stacy
> “Maxim S. Shatskih” wrote in message
> news:xxxxx@ntdev…
>> Why not? Use CreateService to install.
>>
>> Maxim Shatskih, Windows DDK MVP
>> StorageCraft Corporation
>> xxxxx@storagecraft.com
>> http://www.storagecraft.com
>>
>> ----- Original Message -----
>> From: “Stacy”
>> Newsgroups: ntdev
>> To: “Windows System Software Devs Interest List”
>> Sent: Wednesday, August 17, 2005 12:16 AM
>> Subject: Re:[ntdev] Loading a kernel-mode driver from a DLL
>>
>>
>>> OK - here’s is what I have discovered when trying to use the existing
>>> parallel port driver, after sorting out my problem with header files
>>> (learn
>>> something new every day - I needed to add my header files to stdafx.h
>>> which
>>> was created by the .net wizard). Anyway, I can’t read/write the I/O
>>> port
>>> using the existing driver. What happens is that the console application
>>> I
>>> wrote to try to quickly test this hangs, have to CTRL-C out of it. I
>>> had
>>> been wary of trying this approach since I have already called into the
>>> genport sample driver from my VB6 application and that works nicely.
>>> Also,
>>> I don’t know what ports the existing driver is actually writing and
>>> reading
>>> (the printer ports assigned to this driver are 378 to 37F and 778 to
>>> 77f)
>>> So I am back to using the genport driver supplied by the DDK and my
>>> original
>>> problem of creating a DLL to install/uninstall and load/unload the
>>> driver.
>>> Is this possible?? Can I install and uninstall a driver from a DLL
>>> written
>>> under VS.net and further, can I access said DLL from a VB6 application?
>>> I
>>> should explain that the sole purpose for exploring this driver/DLL/VB6
>>> application approach is that we only want the driver to be installed and
>>> loaded if it is needed by the VB6 application.
>>>
>>> Thanks again,
>>> Stacy
>>> “Stacy Meszaros” wrote in message
>>> news:xxxxx@ntdev…
>>> I am trying at this time to use the existing parallel port driver by
>>> ‘connecting’ to it with CreateFile and “LPT1:” as the filename. I have
>>> already tried this in my VB application and it did not work (always read
>>> 0 bytes and crashed when writing 1 byte). Assuming that I may have a
>>> parameter wrong, I am trying with a C console app. My current problem
>>> is that the HANDLE, BYTE and DWORD types are not resolving (I must be
>>> using the wrong .h) I’ve tried windows.h and winbase.h
>>>
>>> Any ideas??
>>>
>>> Stacy
>>>
>>> -----Original Message-----
>>> From: xxxxx@lists.osr.com
>>> [mailto:xxxxx@lists.osr.com] On Behalf Of Philip D Barila
>>> Sent: Tuesday, August 16, 2005 2:39 PM
>>> To: Windows System Software Devs Interest List
>>> Subject: Re: [ntdev] Loading a kernel-mode driver from a DLL
>>>
>>> Max may be right, but are you sure the built-in parallel port driver
>>> doesn’t expose everything you need? Then you only need add the
>>> appropriate
>>> code to your VB6 app and be done.
>>>
>>> Phil
>>>
>>> Philip D. Barila
>>> Seagate Technology LLC
>>> (720) 684-1842
>>>
>>>
>>>
>>>
>>> “Maxim S.
>>>
>>> Shatskih”
>>>
>>> >>> To
>>> ft.com> “Windows System Software Devs
>>>
>>> Sent by: Interest List”
>>>
>>> bounce-217267-643
>>>
>>> xxxxx@lists.osr.com
>>> cc
>>> No Phone Info
>>>
>>> Available
>>> Subject
>>> Re: [ntdev] Loading a kernel-mode
>>>
>>> driver from a DLL
>>>
>>> 08/16/2005 12:23
>>>
>>> PM
>>>
>>>
>>>
>>>
>>>
>>> Please respond to
>>>
>>> “Windows System
>>>
>>> Software Devs
>>>
>>> Interest List”
>>>
>>> >>>
>>> com>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Porting to VB.NET is maybe the easiest solution
>>>
>>> Maxim Shatskih, Windows DDK MVP
>>> StorageCraft Corporation
>>> xxxxx@storagecraft.com
>>> http://www.storagecraft.com
>>> ----- Original Message -----
>>> From: Stacy Meszaros
>>> To: Windows System Software Devs Interest List
>>> Sent: Tuesday, August 16, 2005 6:59 PM
>>> Subject: [ntdev] Loading a kernel-mode driver from a DLL
>>>
>>> Let me explain my problem first. I have a VB6 application that my
>>> employer wants to modify to all blowing the fuse on the JTAG interface.
>>> The JTAG interface is connected to a PC via the parallel port. The PCs
>>> have either Windows NT or XP on them. To accomplish the I/O access, I
>>> have a kernel-mode driver from the sample drivers in the DDK
>>> (genport/portio). We would like to load the driver from a DLL that is
>>> called from the VB6 application. This is because we would like the
>>> driver
>>> to load and unload rather than being a permanent service. Trouble is,
>>> I
>>> have the full Visual Studio .NET suite and Visual Basic 6.0 at my
>>> disposal. Can a DLL created with VS.net be incorporated into a VB6
>>> application? OR, do I have to port the VB6 application to VB.net?
>>>
>>> Thanks for any help,
>>> Stacy
>>>
>>>
>>>
>>> —
>>> Questions? First check the Kernel Driver FAQ at
>>> http://www.osronline.com/article.cfm?id=256
>>>
>>> You are currently subscribed to ntdev as: xxxxx@sensorswitch.com
>>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>>
>>>
>>>
>>>
>>>
>>> —
>>> Questions? First check the Kernel Driver FAQ at
>> http://www.osronline.com/article.cfm?id=256
>>>
>>> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
>>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>>
>
>
>

Stacy,

The driver path should be something like
“\SystemRoot\System32\Drivers\genport.sys” (or, in C notation)
“\SystemRoot\System32\Drivers\genport.sys” )

The “\” in the name is being interpreted as the start of a UNC path.
Clearly there is not machine named “Windows” from which you wish to load the
driver from!

The error is exactly correct: What you have said is the path to the image
file for the driver is a “bad network path” since it does not exist. The
problem is that the image path should be a ‘local’ path.

Good Luck,
Dave Cattley
Consulting Engineer
Systems Software Development

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Stacy
Sent: Wednesday, August 31, 2005 10:09 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Re:Loading a kernel-mode driver from a DLL

Yes, I am attempting to install the driver with OpenSCManager,
CreateService, OpenService, StartService and then CreateFile. The driver is

the genport.sys sample driver from the Microsoft DDK. This sample driver
comes with a setup file genport.inf (I am not at all sure how to use that
file when loading a driver programmatically).

The OpenSCManager, CreateService and OpenService calls all return
successfully. My driver name is genport, the path is
\\windows\system32\drivers\genport.sys

The problem is with the StartService call, which returns error # 53
(ERROR_BAD_NETPATH)

Any help would be so greatly appreciated,
Stacy
“Maxim S. Shatskih” wrote in message
news:xxxxx@ntdev…
> Why not? Use CreateService to install.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> ----- Original Message -----
> From: “Stacy”
> Newsgroups: ntdev
> To: “Windows System Software Devs Interest List”
> Sent: Wednesday, August 17, 2005 12:16 AM
> Subject: Re:[ntdev] Loading a kernel-mode driver from a DLL
>
>
>> OK - here’s is what I have discovered when trying to use the existing
>> parallel port driver, after sorting out my problem with header files
>> (learn
>> something new every day - I needed to add my header files to stdafx.h
>> which
>> was created by the .net wizard). Anyway, I can’t read/write the I/O port
>> using the existing driver. What happens is that the console application
>> I
>> wrote to try to quickly test this hangs, have to CTRL-C out of it. I had
>> been wary of trying this approach since I have already called into the
>> genport sample driver from my VB6 application and that works nicely.
>> Also,
>> I don’t know what ports the existing driver is actually writing and
>> reading
>> (the printer ports assigned to this driver are 378 to 37F and 778 to 77f)
>> So I am back to using the genport driver supplied by the DDK and my
>> original
>> problem of creating a DLL to install/uninstall and load/unload the
>> driver.
>> Is this possible?? Can I install and uninstall a driver from a DLL
>> written
>> under VS.net and further, can I access said DLL from a VB6 application?
>> I
>> should explain that the sole purpose for exploring this driver/DLL/VB6
>> application approach is that we only want the driver to be installed and
>> loaded if it is needed by the VB6 application.
>>
>> Thanks again,
>> Stacy
>> “Stacy Meszaros” wrote in message
>> news:xxxxx@ntdev…
>> I am trying at this time to use the existing parallel port driver by
>> ‘connecting’ to it with CreateFile and “LPT1:” as the filename. I have
>> already tried this in my VB application and it did not work (always read
>> 0 bytes and crashed when writing 1 byte). Assuming that I may have a
>> parameter wrong, I am trying with a C console app. My current problem
>> is that the HANDLE, BYTE and DWORD types are not resolving (I must be
>> using the wrong .h) I’ve tried windows.h and winbase.h
>>
>> Any ideas??
>>
>> Stacy
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Philip D Barila
>> Sent: Tuesday, August 16, 2005 2:39 PM
>> To: Windows System Software Devs Interest List
>> Subject: Re: [ntdev] Loading a kernel-mode driver from a DLL
>>
>> Max may be right, but are you sure the built-in parallel port driver
>> doesn’t expose everything you need? Then you only need add the
>> appropriate
>> code to your VB6 app and be done.
>>
>> Phil
>>
>> Philip D. Barila
>> Seagate Technology LLC
>> (720) 684-1842
>>
>>
>>
>>
>> “Maxim S.
>>
>> Shatskih”
>>
>> >> To
>> ft.com> “Windows System Software Devs
>>
>> Sent by: Interest List”
>>
>> bounce-217267-643
>>
>> xxxxx@lists.osr.com
>> cc
>> No Phone Info
>>
>> Available
>> Subject
>> Re: [ntdev] Loading a kernel-mode
>>
>> driver from a DLL
>>
>> 08/16/2005 12:23
>>
>> PM
>>
>>
>>
>>
>>
>> Please respond to
>>
>> “Windows System
>>
>> Software Devs
>>
>> Interest List”
>>
>> >>
>> com>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Porting to VB.NET is maybe the easiest solution
>>
>> Maxim Shatskih, Windows DDK MVP
>> StorageCraft Corporation
>> xxxxx@storagecraft.com
>> http://www.storagecraft.com
>> ----- Original Message -----
>> From: Stacy Meszaros
>> To: Windows System Software Devs Interest List
>> Sent: Tuesday, August 16, 2005 6:59 PM
>> Subject: [ntdev] Loading a kernel-mode driver from a DLL
>>
>> Let me explain my problem first. I have a VB6 application that my
>> employer wants to modify to all blowing the fuse on the JTAG interface.
>> The JTAG interface is connected to a PC via the parallel port. The PCs
>> have either Windows NT or XP on them. To accomplish the I/O access, I
>> have a kernel-mode driver from the sample drivers in the DDK
>> (genport/portio). We would like to load the driver from a DLL that is
>> called from the VB6 application. This is because we would like the
>> driver
>> to load and unload rather than being a permanent service. Trouble is,
>> I
>> have the full Visual Studio .NET suite and Visual Basic 6.0 at my
>> disposal. Can a DLL created with VS.net be incorporated into a VB6
>> application? OR, do I have to port the VB6 application to VB.net?
>>
>> Thanks for any help,
>> Stacy
>>
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
>> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: xxxxx@sensorswitch.com
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>>
>>
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>


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

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

Dave,

Thanks for the help - does this mean that you don’t agree with the
response that said - and I quote “GenPort is a PNP driver, so this will
not work. You are going to have to use the PNP API’s”

I have been trying to load the driver using the DevCon utility and
getting nowhere, so your news makes me hopeful. When I try to install
the driver with DevCon, it either loads with unknown device or loads as
the correct device and driver, but assigns a different address. I want
to use the same addresses that the ECP Printer Port is using (In my case
378,379 and 37A) I was able to do this a few weeks ago by installing the
driver through the Device Manager, but I need to be able to install,
start, stop and remove the driver from a DLL.

Thanks,
Stacy

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of David R. Cattley
Sent: Wednesday, August 31, 2005 12:14 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Re:Loading a kernel-mode driver from a DLL

Stacy,

The driver path should be something like
“\SystemRoot\System32\Drivers\genport.sys” (or, in C notation)
“\SystemRoot\System32\Drivers\genport.sys” )

The “\” in the name is being interpreted as the start of a UNC path.
Clearly there is not machine named “Windows” from which you wish to load
the
driver from!

The error is exactly correct: What you have said is the path to the
image
file for the driver is a “bad network path” since it does not exist.
The
problem is that the image path should be a ‘local’ path.

Good Luck,
Dave Cattley
Consulting Engineer
Systems Software Development

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Stacy
Sent: Wednesday, August 31, 2005 10:09 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Re:Loading a kernel-mode driver from a DLL

Yes, I am attempting to install the driver with OpenSCManager,
CreateService, OpenService, StartService and then CreateFile. The
driver is

the genport.sys sample driver from the Microsoft DDK. This sample
driver
comes with a setup file genport.inf (I am not at all sure how to use
that
file when loading a driver programmatically).

The OpenSCManager, CreateService and OpenService calls all return
successfully. My driver name is genport, the path is
\\windows\system32\drivers\genport.sys

The problem is with the StartService call, which returns error # 53
(ERROR_BAD_NETPATH)

Any help would be so greatly appreciated,
Stacy
“Maxim S. Shatskih” wrote in message
news:xxxxx@ntdev…
> Why not? Use CreateService to install.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> ----- Original Message -----
> From: “Stacy”
> Newsgroups: ntdev
> To: “Windows System Software Devs Interest List”
> Sent: Wednesday, August 17, 2005 12:16 AM
> Subject: Re:[ntdev] Loading a kernel-mode driver from a DLL
>
>
>> OK - here’s is what I have discovered when trying to use the existing
>> parallel port driver, after sorting out my problem with header files
>> (learn
>> something new every day - I needed to add my header files to stdafx.h

>> which
>> was created by the .net wizard). Anyway, I can’t read/write the I/O
port
>> using the existing driver. What happens is that the console
application
>> I
>> wrote to try to quickly test this hangs, have to CTRL-C out of it. I
had
>> been wary of trying this approach since I have already called into
the
>> genport sample driver from my VB6 application and that works nicely.
>> Also,
>> I don’t know what ports the existing driver is actually writing and
>> reading
>> (the printer ports assigned to this driver are 378 to 37F and 778 to
77f)
>> So I am back to using the genport driver supplied by the DDK and my
>> original
>> problem of creating a DLL to install/uninstall and load/unload the
>> driver.
>> Is this possible?? Can I install and uninstall a driver from a DLL
>> written
>> under VS.net and further, can I access said DLL from a VB6
application?
>> I
>> should explain that the sole purpose for exploring this
driver/DLL/VB6
>> application approach is that we only want the driver to be installed
and
>> loaded if it is needed by the VB6 application.
>>
>> Thanks again,
>> Stacy
>> “Stacy Meszaros” wrote in message
>> news:xxxxx@ntdev…
>> I am trying at this time to use the existing parallel port driver by
>> ‘connecting’ to it with CreateFile and “LPT1:” as the filename. I
have
>> already tried this in my VB application and it did not work (always
read
>> 0 bytes and crashed when writing 1 byte). Assuming that I may have a
>> parameter wrong, I am trying with a C console app. My current
problem
>> is that the HANDLE, BYTE and DWORD types are not resolving (I must be
>> using the wrong .h) I’ve tried windows.h and winbase.h
>>
>> Any ideas??
>>
>> Stacy
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Philip D
Barila
>> Sent: Tuesday, August 16, 2005 2:39 PM
>> To: Windows System Software Devs Interest List
>> Subject: Re: [ntdev] Loading a kernel-mode driver from a DLL
>>
>> Max may be right, but are you sure the built-in parallel port driver
>> doesn’t expose everything you need? Then you only need add the
>> appropriate
>> code to your VB6 app and be done.
>>
>> Phil
>>
>> Philip D. Barila
>> Seagate Technology LLC
>> (720) 684-1842
>>
>>
>>
>>
>> “Maxim S.
>>
>> Shatskih”
>>
>> >> To
>> ft.com> “Windows System Software Devs
>>
>> Sent by: Interest List”
>>
>> bounce-217267-643
>>
>> xxxxx@lists.osr.com
>> cc
>> No Phone Info
>>
>> Available
>> Subject
>> Re: [ntdev] Loading a
kernel-mode
>>
>> driver from a DLL
>>
>> 08/16/2005 12:23
>>
>> PM
>>
>>
>>
>>
>>
>> Please respond to
>>
>> “Windows System
>>
>> Software Devs
>>
>> Interest List”
>>
>> >>
>> com>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Porting to VB.NET is maybe the easiest solution
>>
>> Maxim Shatskih, Windows DDK MVP
>> StorageCraft Corporation
>> xxxxx@storagecraft.com
>> http://www.storagecraft.com
>> ----- Original Message -----
>> From: Stacy Meszaros
>> To: Windows System Software Devs Interest List
>> Sent: Tuesday, August 16, 2005 6:59 PM
>> Subject: [ntdev] Loading a kernel-mode driver from a DLL
>>
>> Let me explain my problem first. I have a VB6 application that my
>> employer wants to modify to all blowing the fuse on the JTAG
interface.
>> The JTAG interface is connected to a PC via the parallel port. The
PCs
>> have either Windows NT or XP on them. To accomplish the I/O access,
I
>> have a kernel-mode driver from the sample drivers in the DDK
>> (genport/portio). We would like to load the driver from a DLL that
is
>> called from the VB6 application. This is because we would like the
>> driver
>> to load and unload rather than being a permanent service. Trouble
is,
>> I
>> have the full Visual Studio .NET suite and Visual Basic 6.0 at my
>> disposal. Can a DLL created with VS.net be incorporated into a VB6
>> application? OR, do I have to port the VB6 application to VB.net?
>>
>> Thanks for any help,
>> Stacy
>>
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
>> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: xxxxx@sensorswitch.com
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>>
>>
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>


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

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


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

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

Stacy,

Since you quoted me I am going to reply. The version of GenPort you
are using is a PNP driver. You will be able to load the driver with the
Services API’s but that will not help you since these API’s will not
interact with the PNP manager, so the driver will not properly start. You
need to, do the following:

  1. Unload the system supplied driver for the parport
  2. Load yours using the code from devcon.

I suspect you problem with DevCon where you got the wrong ports is either
due to a bad INF file, or to the presence of system driver which already
took the resources.

Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply

“Stacy Meszaros” wrote in message
news:xxxxx@ntdev…
Dave,

Thanks for the help - does this mean that you don’t agree with the
response that said - and I quote “GenPort is a PNP driver, so this will
not work. You are going to have to use the PNP API’s”

I have been trying to load the driver using the DevCon utility and
getting nowhere, so your news makes me hopeful. When I try to install
the driver with DevCon, it either loads with unknown device or loads as
the correct device and driver, but assigns a different address. I want
to use the same addresses that the ECP Printer Port is using (In my case
378,379 and 37A) I was able to do this a few weeks ago by installing the
driver through the Device Manager, but I need to be able to install,
start, stop and remove the driver from a DLL.

Thanks,
Stacy

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of David R. Cattley
Sent: Wednesday, August 31, 2005 12:14 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Re:Loading a kernel-mode driver from a DLL

Stacy,

The driver path should be something like
“\SystemRoot\System32\Drivers\genport.sys” (or, in C notation)
“\SystemRoot\System32\Drivers\genport.sys” )

The “\” in the name is being interpreted as the start of a UNC path.
Clearly there is not machine named “Windows” from which you wish to load
the
driver from!

The error is exactly correct: What you have said is the path to the
image
file for the driver is a “bad network path” since it does not exist.
The
problem is that the image path should be a ‘local’ path.

Good Luck,
Dave Cattley
Consulting Engineer
Systems Software Development

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Stacy
Sent: Wednesday, August 31, 2005 10:09 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Re:Loading a kernel-mode driver from a DLL

Yes, I am attempting to install the driver with OpenSCManager,
CreateService, OpenService, StartService and then CreateFile. The
driver is

the genport.sys sample driver from the Microsoft DDK. This sample
driver
comes with a setup file genport.inf (I am not at all sure how to use
that
file when loading a driver programmatically).

The OpenSCManager, CreateService and OpenService calls all return
successfully. My driver name is genport, the path is
\\windows\system32\drivers\genport.sys

The problem is with the StartService call, which returns error # 53
(ERROR_BAD_NETPATH)

Any help would be so greatly appreciated,
Stacy
“Maxim S. Shatskih” wrote in message
news:xxxxx@ntdev…
> Why not? Use CreateService to install.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> ----- Original Message -----
> From: “Stacy”
> Newsgroups: ntdev
> To: “Windows System Software Devs Interest List”
> Sent: Wednesday, August 17, 2005 12:16 AM
> Subject: Re:[ntdev] Loading a kernel-mode driver from a DLL
>
>
>> OK - here’s is what I have discovered when trying to use the existing
>> parallel port driver, after sorting out my problem with header files
>> (learn
>> something new every day - I needed to add my header files to stdafx.h

>> which
>> was created by the .net wizard). Anyway, I can’t read/write the I/O
port
>> using the existing driver. What happens is that the console
application
>> I
>> wrote to try to quickly test this hangs, have to CTRL-C out of it. I
had
>> been wary of trying this approach since I have already called into
the
>> genport sample driver from my VB6 application and that works nicely.
>> Also,
>> I don’t know what ports the existing driver is actually writing and
>> reading
>> (the printer ports assigned to this driver are 378 to 37F and 778 to
77f)
>> So I am back to using the genport driver supplied by the DDK and my
>> original
>> problem of creating a DLL to install/uninstall and load/unload the
>> driver.
>> Is this possible?? Can I install and uninstall a driver from a DLL
>> written
>> under VS.net and further, can I access said DLL from a VB6
application?
>> I
>> should explain that the sole purpose for exploring this
driver/DLL/VB6
>> application approach is that we only want the driver to be installed
and
>> loaded if it is needed by the VB6 application.
>>
>> Thanks again,
>> Stacy
>> “Stacy Meszaros” wrote in message
>> news:xxxxx@ntdev…
>> I am trying at this time to use the existing parallel port driver by
>> ‘connecting’ to it with CreateFile and “LPT1:” as the filename. I
have
>> already tried this in my VB application and it did not work (always
read
>> 0 bytes and crashed when writing 1 byte). Assuming that I may have a
>> parameter wrong, I am trying with a C console app. My current
problem
>> is that the HANDLE, BYTE and DWORD types are not resolving (I must be
>> using the wrong .h) I’ve tried windows.h and winbase.h
>>
>> Any ideas??
>>
>> Stacy
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Philip D
Barila
>> Sent: Tuesday, August 16, 2005 2:39 PM
>> To: Windows System Software Devs Interest List
>> Subject: Re: [ntdev] Loading a kernel-mode driver from a DLL
>>
>> Max may be right, but are you sure the built-in parallel port driver
>> doesn’t expose everything you need? Then you only need add the
>> appropriate
>> code to your VB6 app and be done.
>>
>> Phil
>>
>> Philip D. Barila
>> Seagate Technology LLC
>> (720) 684-1842
>>
>>
>>
>>
>> “Maxim S.
>>
>> Shatskih”
>>
>> >> To
>> ft.com> “Windows System Software Devs
>>
>> Sent by: Interest List”
>>
>> bounce-217267-643
>>
>> xxxxx@lists.osr.com
>> cc
>> No Phone Info
>>
>> Available
>> Subject
>> Re: [ntdev] Loading a
kernel-mode
>>
>> driver from a DLL
>>
>> 08/16/2005 12:23
>>
>> PM
>>
>>
>>
>>
>>
>> Please respond to
>>
>> “Windows System
>>
>> Software Devs
>>
>> Interest List”
>>
>> >>
>> com>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Porting to VB.NET is maybe the easiest solution
>>
>> Maxim Shatskih, Windows DDK MVP
>> StorageCraft Corporation
>> xxxxx@storagecraft.com
>> http://www.storagecraft.com
>> ----- Original Message -----
>> From: Stacy Meszaros
>> To: Windows System Software Devs Interest List
>> Sent: Tuesday, August 16, 2005 6:59 PM
>> Subject: [ntdev] Loading a kernel-mode driver from a DLL
>>
>> Let me explain my problem first. I have a VB6 application that my
>> employer wants to modify to all blowing the fuse on the JTAG
interface.
>> The JTAG interface is connected to a PC via the parallel port. The
PCs
>> have either Windows NT or XP on them. To accomplish the I/O access,
I
>> have a kernel-mode driver from the sample drivers in the DDK
>> (genport/portio). We would like to load the driver from a DLL that
is
>> called from the VB6 application. This is because we would like the
>> driver
>> to load and unload rather than being a permanent service. Trouble
is,
>> I
>> have the full Visual Studio .NET suite and Visual Basic 6.0 at my
>> disposal. Can a DLL created with VS.net be incorporated into a VB6
>> application? OR, do I have to port the VB6 application to VB.net?
>>
>> Thanks for any help,
>> Stacy
>>
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
>> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: xxxxx@sensorswitch.com
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>>
>>
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>


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

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


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

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