Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ntstrsafe.h "No such file or directory in Wndows DDk 2600" ????

0 views
Skip to first unread message

Beginner to device driver

unread,
Mar 17, 2008, 6:04:09 AM3/17/08
to
I am a beginner to device driver

I hav Windows Xp Sp2 and I am using Windows DDK 2600.
My device driver source contains link to ntstrsafe.lib and and #define
<ntstrsafe.h>

But I am unable to find these files in the DDK 2600 ,
I get a compaliation error "No such file or directory"

Is there any equivalent header file and library in Windows DDK 2600 ?

Device driver built in Windows XP will it work on windows 2000 and
Windows 2003 ?

Please guide me

Johannes Passing

unread,
Mar 17, 2008, 6:40:31 AM3/17/08
to
> I hav Windows Xp Sp2 and I am using Windows DDK 2600.
> My device driver source contains link to ntstrsafe.lib and and #define
> <ntstrsafe.h>
DDK 2600 is outdated. Obtain the current WDK - it contains the ntstrsafe
files.

> Device driver built in Windows XP will it work on windows 2000 and
> Windows 2003 ?

A driver will not necessarily work on downlevel platforms. But this is
more a question of which APIs and build settings you use than which
DDK/WDK you use. Using appropriate build settings, you can build drivers
for OS releases older than the your DDK/WDK version.

--Johannes

--
Johannes Passing - http://int3.de/

Maxim S. Shatskih

unread,
Mar 17, 2008, 7:59:27 AM3/17/08
to
Forget DDK 2600, use WDK 6001 and the XP build env in it.

Drivers built by XP build env will _not_ generically work on w2k. To make a
w2k-compatible driver, use w2k build env.

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

"Beginner to device driver" <ranu...@gmail.com> wrote in message
news:45a9567e-40b2-48d0...@e6g2000prf.googlegroups.com...

Beginner to device driver

unread,
Mar 17, 2008, 9:38:50 AM3/17/08
to
Thanks for the information .....

On Mar 17, 4:59 pm, "Maxim S. Shatskih" <ma...@storagecraft.com>
wrote:


>     Forget DDK 2600, use WDK 6001 and the XP build env in it.
>
>     Drivers built by XP build env will _not_ generically work on w2k. To make a
> w2k-compatible driver, use w2k build env.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation

> ma...@storagecraft.comhttp://www.storagecraft.com
>
> "Beginner to device driver" <ranu2...@gmail.com> wrote in messagenews:45a9567e-40b2-48d0...@e6g2000prf.googlegroups.com...


>
>
>
> > I am a beginner to device driver
>
> > I hav Windows Xp Sp2 and I am  using Windows DDK 2600.
> > My device driver source contains link to ntstrsafe.lib and and #define
> > <ntstrsafe.h>
>
> > But I am unable to find these files in the DDK 2600 ,
> > I get a compaliation error "No such file or directory"
>
> > Is there any equivalent header file and library in Windows DDK 2600 ?
>
> > Device driver built in Windows XP will it work on windows 2000 and
> > Windows 2003 ?
>

> > Please guide me- Hide quoted text -
>
> - Show quoted text -

Ben Voigt [C++ MVP]

unread,
Mar 17, 2008, 12:33:54 PM3/17/08
to
Maxim S. Shatskih wrote:
> Forget DDK 2600, use WDK 6001 and the XP build env in it.
>
> Drivers built by XP build env will _not_ generically work on w2k.
> To make a w2k-compatible driver, use w2k build env.

But the w2k build env can be hosted on an XP OS.

Beginner to device driver

unread,
Mar 18, 2008, 5:45:52 AM3/18/08
to
Thanks for the response

OK now I understand using different build evnironment I can build
device drivers compatible with different OS .

Have some silly question

1) Wat about Vista ?

2) Do I need to make any changes in code to make the driver compatible
with different OS or use the same code with different environment ?

On Mar 17, 9:33 pm, "Ben Voigt [C++ MVP]" <r...@nospam.nospam> wrote:
> Maxim S. Shatskih wrote:
> >    Forget DDK 2600, use WDK 6001 and the XP build env in it.
>
> >    Drivers built by XP build env will _not_ generically work on w2k.
> > To make a w2k-compatible driver, use w2k build env.
>
> But the w2k build env can be hosted on an XP OS.
>
>
>
>
>

> > "Beginner to device driver" <ranu2...@gmail.com> wrote in message


> >news:45a9567e-40b2-48d0...@e6g2000prf.googlegroups.com...
> >> I am a beginner to device driver
>
> >> I hav Windows Xp Sp2 and I am  using Windows DDK 2600.
> >> My device driver source contains link to ntstrsafe.lib and and
> >> #define <ntstrsafe.h>
>
> >> But I am unable to find these files in the DDK 2600 ,
> >> I get a compaliation error "No such file or directory"
>
> >> Is there any equivalent header file and library in Windows DDK 2600 ?
>
> >> Device driver built in Windows XP will it work on windows 2000 and
> >> Windows 2003 ?
>

Maxim S. Shatskih

unread,
Mar 18, 2008, 6:58:48 AM3/18/08
to
>1) Wat about Vista ?

Most w2k/XP drivers run on Vista unchanged, the only major new thing in Vista
kernel land is NDIS6. NDIS5 miniports and IMs will run, but thru wrappers and
thus slower.

>2) Do I need to make any changes in code to make the driver compatible
>with different OS or use the same code with different environment ?

Build to the oldest API using the oldest build env - namely w2k. This will
work.

If you really want to use later features, you have 2 ways:

- discover the features in runtime by RtlIsNtDdiVersionAvailable (the modern
proper GetVersion call) and MmGetSystemRoutineAddress.
- use the new features under the NTDDI_VERSION macro and rebuild the code using
different build envs - so, the SYS file built by w2k build env will be for w2k
only, the SYS file built by XP build env will be for XP only, and so on.

Advantage of way 1 - single binary for all OSes. Advantage of way 2 - more
proper use of the new kernel features.

Beginner to device driver

unread,
Mar 19, 2008, 3:22:16 AM3/19/08
to
thanks for the information

Well I downloaded Windows Vista WDK 6000 as I couldn find a separate
WDK for XP .

Shall I install Windows Vista WDK 6000 in XP and build drivers ? Will
it work fine ?

Or I need to install this in Windows vista only ?


On Mar 18, 3:58 pm, "Maxim S. Shatskih" <ma...@storagecraft.com>
wrote:

Maxim S. Shatskih

unread,
Mar 19, 2008, 6:42:30 AM3/19/08
to
>Well I downloaded Windows Vista WDK 6000 as I couldn find a separate
>WDK for XP .

WDK 6000 is a bit obsolete too, use 6001 (the Server 2008 WDK).

>Shall I install Windows Vista WDK 6000 in XP and build drivers ? Will
>it work fine ?

Yes. It can be installed from XP up and requires .NET 2.0 (provided on the same
disc).

It has several build envs - for w2k/XP/WNET aka 2003/WLH aka Vista or 2008 -
and for several CPU types - x86, x64, amd64.

So, it works from XP up, and can build from w2k up.

Beginner to device driver

unread,
Mar 19, 2008, 8:58:38 AM3/19/08
to
Thanks for the information
:)

On Mar 19, 3:42 pm, "Maxim S. Shatskih" <ma...@storagecraft.com>
wrote:

Beginner to device driver

unread,
Mar 19, 2008, 9:43:04 AM3/19/08
to
Thanks for the help I was able to build the device driver
and to some extent I was able to debug ... using Windows Debugger

and VMware image

I just put some DbgBreakPoints in code and tried to debug it and I got
following error

"

Debugger is not using correct symbols
In order for this command to work properly symbol path should point
to .pdb files that have full type information"

I downloaded WindowsXP-SP2-Symbols where do I need to install this ?
in local machine or vmware image ?

and hw do i link to .pdb files ?


On Mar 19, 5:58 pm, Beginner to device driver <ranu2...@gmail.com>
wrote:

> > ma...@storagecraft.comhttp://www.storagecraft.com- Hide quoted text -

Don Burn

unread,
Mar 19, 2008, 9:49:55 AM3/19/08
to
You install the symbols where Windbg runs, but you will still probably get
complaints since if any hotfixes are applied to the test environment the
symbols will be wrong. Most of us use the Microsoft symbol server see
http://www.microsoft.com/whdc/DevTools/Debugging/debugstart.mspx which will
download to a cache on your computer the symbols for your test environment.

--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

"Beginner to device driver" <ranu...@gmail.com> wrote in message

news:60bc0156-524e-4790...@s13g2000prd.googlegroups.com...

Maxim S. Shatskih

unread,
Mar 19, 2008, 9:50:07 AM3/19/08
to
Read about .symfix command in WinDbg docs and use it to download the
symbols from MS.

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

"Beginner to device driver" <ranu...@gmail.com> wrote in message
news:60bc0156-524e-4790...@s13g2000prd.googlegroups.com...

Beginner to device driver

unread,
Mar 20, 2008, 5:45:29 AM3/20/08
to
Thanks guys for helping me out in debugging :)

well I was trying to debug 1 scenario where in

I have an application that does DeviceIoControl to write data to usb
device (which fails)

DeviceIOControl is internally taken care by device driver ...

As soon I as call DeviceIocontrol I want to start debugging device
driver or display DbgPrint() coments

Is it possible?

Thanks again for helping me out

On Mar 19, 6:50 pm, "Maxim S. Shatskih" <ma...@storagecraft.com>
wrote:


>     Read about .symfix command in WinDbg docs and use it to download the
> symbols from MS.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation

> ma...@storagecraft.comhttp://www.storagecraft.com
>
> "Beginner to device driver" <ranu2...@gmail.com> wrote in messagenews:60bc0156-524e-4790...@s13g2000prd.googlegroups.com...

> > > ma...@storagecraft.comhttp://www.storagecraft.com-Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -

Maxim S. Shatskih

unread,
Mar 20, 2008, 7:00:42 AM3/20/08
to
>Is it possible?

Is this your driver which you have just built? yes, surely.

Beginner to device driver

unread,
Mar 20, 2008, 9:08:05 AM3/20/08
to
No I didn build this driver ... M just tryign to debug it and fix some
of the issues


On Mar 20, 4:00 pm, "Maxim S. Shatskih" <ma...@storagecraft.com>
wrote:

Beginner to device driver

unread,
Mar 21, 2008, 6:06:44 AM3/21/08
to
When I start the device driver from command prompt I get error 1058
and while debugging i observed that it enters into driverentry and
then unloads ...

unable to resolve y is this happening ...

the strange thing is that

This happns only in Japanese Xp ..


On Mar 20, 6:08 pm, Beginner to device driver <ranu2...@gmail.com>
wrote:

> > ma...@storagecraft.comhttp://www.storagecraft.com- Hide quoted text -

Tim Roberts

unread,
Mar 22, 2008, 9:43:14 PM3/22/08
to
Beginner to device driver <ranu...@gmail.com> wrote:
>
>When I start the device driver from command prompt I get error 1058
>and while debugging i observed that it enters into driverentry and
>then unloads ...

Well, what does your DriverEntry do, and what does it return?
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Beginner to device driver

unread,
Mar 24, 2008, 1:51:56 AM3/24/08
to
My driverentry does only this


// ****** set up the dispatch table ******

for (index=0, dispatch=driverObject->MajorFunction ;
index <= IRP_MJ_MAXIMUM_FUNCTION ;
index++, dispatch++)
{
*dispatch = DispatchAny;

}


driverObject->DriverUnload = DriverUnload;
driverObject->DriverExtension->AddDevice=AddDevice;
driverObject->MajorFunction[IRP_MJ_CREATE] = DriverOpen;
driverObject->MajorFunction[IRP_MJ_CLOSE] = DriverClose;
driverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
DriverIoControl;
driverObject->MajorFunction[IRP_MJ_PNP] = DriverPnp;
driverObject->MajorFunction[IRP_MJ_POWER] = DriverPower;

return STATUS_SUCCESS;


AddDevice takes care of creating filter device object.

Bug check analysis is as follow:

*******************************************************************************
*
*
* Bugcheck
Analysis *
*
*
*******************************************************************************

Unknown bugcheck code (0)
Unknown bugcheck description
Arguments:
Arg1: 00000000
Arg2: 00000000
Arg3: 00000000
Arg4: 00000000

Debugging Details:
------------------

PROCESS_NAME: Idle

FAULTING_IP:
nt!RtlpBreakWithStatusInstruction+0
80528da8 cc int 3

EXCEPTION_RECORD: ffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 80528da8 (nt!RtlpBreakWithStatusInstruction)
ExceptionCode: 80000003 (Break instruction exception)
ExceptionFlags: 00000000
NumberParameters: 3
Parameter[0]: 00000000
Parameter[1]: 8054bf4c
Parameter[2]: 000003f8

ERROR_CODE: (NTSTATUS) 0x80000003 - {EXCEPTION} Breakpoint A
breakpoint has been reached.

DEFAULT_BUCKET_ID: DRIVER_FAULT

BUGCHECK_STR: 0x0

STACK_TEXT:
8054adac 8054226d 00000001 81fa8e02 00000030 nt!
RtlpBreakWithStatusInstruction
8054adac f873c062 00000001 81fa8e02 00000030 nt!KeUpdateSystemTime
+0x165
8054ae50 80542cc0 00000000 0000000e 00000000 intelppm!AcpiC1Idle+0x12
8054ae54 00000000 0000000e 00000000 00000000 nt!KiIdleLoop+0x10


STACK_COMMAND: kb

FOLLOWUP_IP:
nt!RtlpBreakWithStatusInstruction+0
80528da8 cc int 3

SYMBOL_STACK_INDEX: 0

SYMBOL_NAME: nt!RtlpBreakWithStatusInstruction+0

FOLLOWUP_NAME: MachineOwner

MODULE_NAME: nt

IMAGE_NAME: ntkrnlpa.exe

DEBUG_FLR_IMAGE_TIMESTAMP: 41107b0c

BUCKET_ID: MANUAL_BREAKIN

Followup: MachineOwner
---------


On Mar 23, 6:43 am, Tim Roberts <t...@probo.com> wrote:


> Beginner to device driver <ranu2...@gmail.com> wrote:
>
>
>
> >When I start the device driver from command prompt I get error 1058
> >and while debugging i observed that it enters into driverentry and
> >then unloads ...
>
> Well, what does your DriverEntry do, and what does it return?
> --

> Tim Roberts, t...@probo.com
> Providenza & Boekelheide, Inc.

Tim Roberts

unread,
Mar 27, 2008, 8:41:43 PM3/27/08
to
Beginner to device driver <ranu...@gmail.com> wrote:

>My driverentry does only this
>
>
> // ****** set up the dispatch table ******
>
> for (index=0, dispatch=driverObject->MajorFunction ;
> index <= IRP_MJ_MAXIMUM_FUNCTION ;
> index++, dispatch++)
> {
> *dispatch = DispatchAny;
> }
>
> driverObject->DriverUnload = DriverUnload;
> driverObject->DriverExtension->AddDevice=AddDevice;
> driverObject->MajorFunction[IRP_MJ_CREATE] = DriverOpen;
> driverObject->MajorFunction[IRP_MJ_CLOSE] = DriverClose;
> driverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
>DriverIoControl;
> driverObject->MajorFunction[IRP_MJ_PNP] = DriverPnp;
> driverObject->MajorFunction[IRP_MJ_POWER] = DriverPower;
>
> return STATUS_SUCCESS;

This is a PnP driver. You said you were starting it from the command line.
How were you doing that?

Beginner to device driver

unread,
Apr 4, 2008, 6:10:31 AM4/4/08
to
I first tried with sc command ... as I was not know that pnp drivers
cannot be started through command promt

but I even tried with code using StartService api call ,even then I
face the same problem .....


On Mar 28, 5:41 am, Tim Roberts <t...@probo.com> wrote:

> Tim Roberts, t...@probo.com
> Providenza & Boekelheide, Inc.- Hide quoted text -

Tim Roberts

unread,
Apr 5, 2008, 6:03:22 PM4/5/08
to
Beginner to device driver <ranu...@gmail.com> wrote:
>
>I first tried with sc command ... as I was not know that pnp drivers
>cannot be started through command promt
>
>but I even tried with code using StartService api call ,even then I
>face the same problem .....

Right. The "sc" command is just a way to access the StartService API. PnP
drivers cannot be started as services. They must be loaded by PnP when
some bus driver enumerates them.

What kind of a driver is this?

0 new messages