Hi,

Can someone tell me which .lib file I need to link against when calling the
ZwDeviceIoControl?

Thanks,
Prasanna

RE: ZwDeviceIoControl by AntonBassov

AntonBassov
Tue Mar 13 16:46:33 CDT 2007

> Can someone tell me which .lib file I need to link against when calling the
> ZwDeviceIoControl?

If you do it from the kernel mode you should link to ntoskrnl.lib. If you do
it from the user mode, then you have to get the address of
ZwDeviceIoControlFile() with GetProcAddress()

Anton Bassov

"Prasanna Padmanabhan" wrote:

> Hi,
>
> Can someone tell me which .lib file I need to link against when calling the
> ZwDeviceIoControl?
>
> Thanks,
> Prasanna
>
>
>
>

Re: ZwDeviceIoControl by Prasanna

Prasanna
Wed Mar 14 08:44:05 CDT 2007

I tried that but the problem is during runtime, the driver looks for
ntoskrnl.dll (instead of .exe) which does not exist.
"Anton Bassov" <AntonBassov@discussions.microsoft.com> wrote in message
news:831FB089-DA15-4CB1-A600-9727111FD142@microsoft.com...
>> Can someone tell me which .lib file I need to link against when calling
>> the
>> ZwDeviceIoControl?
>
> If you do it from the kernel mode you should link to ntoskrnl.lib. If you
> do
> it from the user mode, then you have to get the address of
> ZwDeviceIoControlFile() with GetProcAddress()
>
> Anton Bassov
>
> "Prasanna Padmanabhan" wrote:
>
>> Hi,
>>
>> Can someone tell me which .lib file I need to link against when calling
>> the
>> ZwDeviceIoControl?
>>
>> Thanks,
>> Prasanna
>>
>>
>>
>>



Re: ZwDeviceIoControl by AntonBassov

AntonBassov
Wed Mar 14 10:21:18 CDT 2007

> I tried that but the problem is during runtime, the driver looks for
> ntoskrnl.dll (instead of .exe) which does not exist.

You tried what??? Judging from the statement that you were doing it at the
run time, you were trying to call it from the user mode, right? In such case,
you should specify ntdll.dll as you target library in GetModuleHandle() call
when you get the handle to be passed to GetProcAddress() - user-mode code
links to ntdll.dll and not to ntoskrnl.exe.....

Anton Bassov


"Prasanna Padmanabhan" wrote:

> I tried that but the problem is during runtime, the driver looks for
> ntoskrnl.dll (instead of .exe) which does not exist.
> "Anton Bassov" <AntonBassov@discussions.microsoft.com> wrote in message
> news:831FB089-DA15-4CB1-A600-9727111FD142@microsoft.com...
> >> Can someone tell me which .lib file I need to link against when calling
> >> the
> >> ZwDeviceIoControl?
> >
> > If you do it from the kernel mode you should link to ntoskrnl.lib. If you
> > do
> > it from the user mode, then you have to get the address of
> > ZwDeviceIoControlFile() with GetProcAddress()
> >
> > Anton Bassov
> >
> > "Prasanna Padmanabhan" wrote:
> >
> >> Hi,
> >>
> >> Can someone tell me which .lib file I need to link against when calling
> >> the
> >> ZwDeviceIoControl?
> >>
> >> Thanks,
> >> Prasanna
> >>
> >>
> >>
> >>
>
>
>

Re: ZwDeviceIoControl by Maxim

Maxim
Mon Mar 26 05:32:59 CDT 2007

To use ZwDeviceIoControlFile from user mode, use GetProcAddres
(GetModuleHandle("ntdll"), "ZwDeviceIoControlFile").

No LIBs I think.

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

"Prasanna Padmanabhan" <prasannap@citrixnospamtolerated.com> wrote in message
news:e7XDJqaZHHA.4668@TK2MSFTNGP04.phx.gbl...
> Hi,
>
> Can someone tell me which .lib file I need to link against when calling the
> ZwDeviceIoControl?
>
> Thanks,
> Prasanna
>
>
>