I've got an DLL, which currently runs in user-mode, that I want to turn into
an export-driver (kernel-mode DLL). The DLL uses IOCTL as interface to a
device driver (SYS). Is it possible to use IOCTL within kernel-mode, too?
If yes, which headers do I need and which TARGETLIBS do I need to specify in
DDK's "sources" file?
If no, do you know any mechanism that can partly reuse existing IOCTL code?

Thanks,
Wolfgang

Re: IOCTL within Kernel-Mode? by Philip

Philip
Thu Dec 09 02:39:25 CST 2004

Internal IOCTLS do exist. If you have it, Oney's WDM book, second edition,
has a section on the technique starting on page 494. It involves the
functions IoBuildDeviceIoControlRequest and IoCallDriver. You'll need to
create an event object to pass to the former function and then wait on after
the latter. The standard wdm.h/ntddk.h and corresponding libraries are
needed.

"Wolfgang" <wolferlh@hotmail.com> wrote in message
news:8559F525-5DDC-45A2-8E51-EF804A994F8C@microsoft.com...
> I've got an DLL, which currently runs in user-mode, that I want to turn
into
> an export-driver (kernel-mode DLL). The DLL uses IOCTL as interface to a
> device driver (SYS). Is it possible to use IOCTL within kernel-mode, too?
> If yes, which headers do I need and which TARGETLIBS do I need to specify
in
> DDK's "sources" file?
> If no, do you know any mechanism that can partly reuse existing IOCTL
code?
>
> Thanks,
> Wolfgang



Re: IOCTL within Kernel-Mode? by wolferlh

wolferlh
Thu Dec 09 03:49:06 CST 2004

Thank you very much!
That will help me a lot.

Wolfgang


"Philip F. Garofalo" wrote:

> Internal IOCTLS do exist. If you have it, Oney's WDM book, second edition,
> has a section on the technique starting on page 494. It involves the
> functions IoBuildDeviceIoControlRequest and IoCallDriver. You'll need to
> create an event object to pass to the former function and then wait on after
> the latter. The standard wdm.h/ntddk.h and corresponding libraries are
> needed.
>
> "Wolfgang" <wolferlh@hotmail.com> wrote in message
> news:8559F525-5DDC-45A2-8E51-EF804A994F8C@microsoft.com...
> > I've got an DLL, which currently runs in user-mode, that I want to turn
> into
> > an export-driver (kernel-mode DLL). The DLL uses IOCTL as interface to a
> > device driver (SYS). Is it possible to use IOCTL within kernel-mode, too?
> > If yes, which headers do I need and which TARGETLIBS do I need to specify
> in
> > DDK's "sources" file?
> > If no, do you know any mechanism that can partly reuse existing IOCTL
> code?
> >
> > Thanks,
> > Wolfgang
>
>
>

Re: IOCTL within Kernel-Mode? by James

James
Thu Dec 09 19:09:56 CST 2004

It is true that IOCTLs can be issued from kernel space. I suspect, however,
that your DLL has other code that is not suitable to kernel space; Open
won't work, for example. If you're using C++, new isn't likely to work. So
look carefully at your code, not merely the part that is concerned with
IOCTLs.

--
James Antognini
Windows DDK Support

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

"Wolfgang" <wolferlh@hotmail.com> wrote in message
news:A10F7F32-6483-4FA6-8FD4-61BC2F1DF53F@microsoft.com...
> Thank you very much!
> That will help me a lot.
>
> Wolfgang
>
>
> "Philip F. Garofalo" wrote:
>
>> Internal IOCTLS do exist. If you have it, Oney's WDM book, second
>> edition,
>> has a section on the technique starting on page 494. It involves the
>> functions IoBuildDeviceIoControlRequest and IoCallDriver. You'll need to
>> create an event object to pass to the former function and then wait on
>> after
>> the latter. The standard wdm.h/ntddk.h and corresponding libraries are
>> needed.
>>
>> "Wolfgang" <wolferlh@hotmail.com> wrote in message
>> news:8559F525-5DDC-45A2-8E51-EF804A994F8C@microsoft.com...
>> > I've got an DLL, which currently runs in user-mode, that I want to turn
>> into
>> > an export-driver (kernel-mode DLL). The DLL uses IOCTL as interface to
>> > a
>> > device driver (SYS). Is it possible to use IOCTL within kernel-mode,
>> > too?
>> > If yes, which headers do I need and which TARGETLIBS do I need to
>> > specify
>> in
>> > DDK's "sources" file?
>> > If no, do you know any mechanism that can partly reuse existing IOCTL
>> code?
>> >
>> > Thanks,
>> > Wolfgang
>>
>>
>>