I have the following development workstation: Windows XP Pro, VC++6.0, DDK
2600.1106 (installed in C:\DDK\WINDDK\2600.1106), Platform SDK February
2003.



As a confirmation that all of the above components are installed correctly,
I compiled one of the sample projects (oemps) by doing the following:

1.. Opened an XP checked build window via the start menu.
2.. Navigated to "C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps".
3.. Typed "build -cef"
4.. The kernel mode driver KOEMPS.DLL was built and placed in
"C:\DDK\WINDDK\2600.1106\src\print\oemdll\i386".


My goal is to generate a random number in PSCommand method of
"C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps\command.cpp"

1.. Using the VC6.0 IDE, I added the following to the pscommand method:
LARGE_INTEGER time;

ULONG seed; // seed value should be a global or in device
extension

ULONG rand; // random value



KeQuerySystemTime(&time); // only do first time or in init code!

seed = (ULONG) time;

rand = RtlRandom(&seed); // get random number

2.. I Opened an XP checked build window via the start menu.
3.. Navigated to "C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps".
4.. Typed "build -cef".


Command.cpp failed to compile because KeQuerySystemTime and RtlRandom were
'undeclared identifiers'. Because these two api's are defined in ntddk.h, I
added '#include <ntddk.h>' to command.cpp. The compile failed because it
could not find ntddk.h. I then changed the line to '#include <
C:\DDK\WINDDK\2600.1106\inc\ddk\wxp\ntddk.h>'. The compile failed again
because I had several redefinition errors.



How do I get api's defined in NTDDK.H to compile in this (oemps) Microsoft
provided sample project?

Re: Basic kernel mode driver question. by Gary

Gary
Fri Feb 27 08:27:18 CST 2004

Explicitly calling out the path when you include NTDDK won't define the path
for the plethora of files that NTDDK includes. You need to add the path to
your SOURCES file.

--
Gary G. Little
Seagate Technologies, LLC

"Michael Pierce" <Michael.Pierce@_RE_MOVE_tentechnologies.com> wrote in
message news:UFH%b.85878$n62.73054@twister.nyroc.rr.com...
> I have the following development workstation: Windows XP Pro, VC++6.0,
DDK
> 2600.1106 (installed in C:\DDK\WINDDK\2600.1106), Platform SDK February
> 2003.
>
>
>
> As a confirmation that all of the above components are installed
correctly,
> I compiled one of the sample projects (oemps) by doing the following:
>
> 1.. Opened an XP checked build window via the start menu.
> 2.. Navigated to "C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps".
> 3.. Typed "build -cef"
> 4.. The kernel mode driver KOEMPS.DLL was built and placed in
> "C:\DDK\WINDDK\2600.1106\src\print\oemdll\i386".
>
>
> My goal is to generate a random number in PSCommand method of
> "C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps\command.cpp"
>
> 1.. Using the VC6.0 IDE, I added the following to the pscommand method:
> LARGE_INTEGER time;
>
> ULONG seed; // seed value should be a global or in device
> extension
>
> ULONG rand; // random value
>
>
>
> KeQuerySystemTime(&time); // only do first time or in init code!
>
> seed = (ULONG) time;
>
> rand = RtlRandom(&seed); // get random number
>
> 2.. I Opened an XP checked build window via the start menu.
> 3.. Navigated to "C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps".
> 4.. Typed "build -cef".
>
>
> Command.cpp failed to compile because KeQuerySystemTime and RtlRandom were
> 'undeclared identifiers'. Because these two api's are defined in ntddk.h,
I
> added '#include <ntddk.h>' to command.cpp. The compile failed because it
> could not find ntddk.h. I then changed the line to '#include <
> C:\DDK\WINDDK\2600.1106\inc\ddk\wxp\ntddk.h>'. The compile failed again
> because I had several redefinition errors.
>
>
>
> How do I get api's defined in NTDDK.H to compile in this (oemps) Microsoft
> provided sample project?
>
>



Re: Basic kernel mode driver question. by Michael

Michael
Fri Feb 27 08:36:44 CST 2004

The point I think that is getting missed is that when ntddk is explicitely
included, I get several XXX redefinition compiler errors. I'm not so sure I
am supposed to explicitely include ntddk anywhere. Have you or anyone you
know ever built a MS DDK sample project that included api's that are
definned in ntddk?


"Gary G. Little" <gary.g.little.nospam@seagate.com> wrote in message
news:atI%b.25305$zp.14217@newssvr24.news.prodigy.com...
> Explicitly calling out the path when you include NTDDK won't define the
path
> for the plethora of files that NTDDK includes. You need to add the path to
> your SOURCES file.
>
> --
> Gary G. Little
> Seagate Technologies, LLC
>
> "Michael Pierce" <Michael.Pierce@_RE_MOVE_tentechnologies.com> wrote in
> message news:UFH%b.85878$n62.73054@twister.nyroc.rr.com...
> > I have the following development workstation: Windows XP Pro, VC++6.0,
> DDK
> > 2600.1106 (installed in C:\DDK\WINDDK\2600.1106), Platform SDK February
> > 2003.
> >
> >
> >
> > As a confirmation that all of the above components are installed
> correctly,
> > I compiled one of the sample projects (oemps) by doing the following:
> >
> > 1.. Opened an XP checked build window via the start menu.
> > 2.. Navigated to "C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps".
> > 3.. Typed "build -cef"
> > 4.. The kernel mode driver KOEMPS.DLL was built and placed in
> > "C:\DDK\WINDDK\2600.1106\src\print\oemdll\i386".
> >
> >
> > My goal is to generate a random number in PSCommand method of
> > "C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps\command.cpp"
> >
> > 1.. Using the VC6.0 IDE, I added the following to the pscommand
method:
> > LARGE_INTEGER time;
> >
> > ULONG seed; // seed value should be a global or in device
> > extension
> >
> > ULONG rand; // random value
> >
> >
> >
> > KeQuerySystemTime(&time); // only do first time or in init code!
> >
> > seed = (ULONG) time;
> >
> > rand = RtlRandom(&seed); // get random number
> >
> > 2.. I Opened an XP checked build window via the start menu.
> > 3.. Navigated to "C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps".
> > 4.. Typed "build -cef".
> >
> >
> > Command.cpp failed to compile because KeQuerySystemTime and RtlRandom
were
> > 'undeclared identifiers'. Because these two api's are defined in
ntddk.h,
> I
> > added '#include <ntddk.h>' to command.cpp. The compile failed because
it
> > could not find ntddk.h. I then changed the line to '#include <
> > C:\DDK\WINDDK\2600.1106\inc\ddk\wxp\ntddk.h>'. The compile failed again
> > because I had several redefinition errors.
> >
> >
> >
> > How do I get api's defined in NTDDK.H to compile in this (oemps)
Microsoft
> > provided sample project?
> >
> >
>
>



Re: Basic kernel mode driver question. by Don

Don
Fri Feb 27 08:52:04 CST 2004

Actually, looking at the piece of code in question (I'm not a printer guy so
bear with me), this appears to be a user space DLL. If that is the case,
then use srand, rand and GetSystemTime.


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

"Gary G. Little" <gary.g.little.nospam@seagate.com> wrote in message
news:atI%b.25305$zp.14217@newssvr24.news.prodigy.com...
> Explicitly calling out the path when you include NTDDK won't define the
path
> for the plethora of files that NTDDK includes. You need to add the path to
> your SOURCES file.
>
> --
> Gary G. Little
> Seagate Technologies, LLC
>
> "Michael Pierce" <Michael.Pierce@_RE_MOVE_tentechnologies.com> wrote in
> message news:UFH%b.85878$n62.73054@twister.nyroc.rr.com...
> > I have the following development workstation: Windows XP Pro, VC++6.0,
> DDK
> > 2600.1106 (installed in C:\DDK\WINDDK\2600.1106), Platform SDK February
> > 2003.
> >
> >
> >
> > As a confirmation that all of the above components are installed
> correctly,
> > I compiled one of the sample projects (oemps) by doing the following:
> >
> > 1.. Opened an XP checked build window via the start menu.
> > 2.. Navigated to "C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps".
> > 3.. Typed "build -cef"
> > 4.. The kernel mode driver KOEMPS.DLL was built and placed in
> > "C:\DDK\WINDDK\2600.1106\src\print\oemdll\i386".
> >
> >
> > My goal is to generate a random number in PSCommand method of
> > "C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps\command.cpp"
> >
> > 1.. Using the VC6.0 IDE, I added the following to the pscommand
method:
> > LARGE_INTEGER time;
> >
> > ULONG seed; // seed value should be a global or in device
> > extension
> >
> > ULONG rand; // random value
> >
> >
> >
> > KeQuerySystemTime(&time); // only do first time or in init code!
> >
> > seed = (ULONG) time;
> >
> > rand = RtlRandom(&seed); // get random number
> >
> > 2.. I Opened an XP checked build window via the start menu.
> > 3.. Navigated to "C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps".
> > 4.. Typed "build -cef".
> >
> >
> > Command.cpp failed to compile because KeQuerySystemTime and RtlRandom
were
> > 'undeclared identifiers'. Because these two api's are defined in
ntddk.h,
> I
> > added '#include <ntddk.h>' to command.cpp. The compile failed because
it
> > could not find ntddk.h. I then changed the line to '#include <
> > C:\DDK\WINDDK\2600.1106\inc\ddk\wxp\ntddk.h>'. The compile failed again
> > because I had several redefinition errors.
> >
> >
> >
> > How do I get api's defined in NTDDK.H to compile in this (oemps)
Microsoft
> > provided sample project?
> >
> >
>
>



Re: Basic kernel mode driver question. by Michael

Michael
Fri Feb 27 08:57:30 CST 2004

Actually it is kernel mode.

"Don Burn" <burn@stopspam.acm.org> wrote in message
news:103umdd7v2r7sb4@corp.supernews.com...
> Actually, looking at the piece of code in question (I'm not a printer guy
so
> bear with me), this appears to be a user space DLL. If that is the case,
> then use srand, rand and GetSystemTime.
>
>
> --
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Remove StopSpam from the email to reply
>
> "Gary G. Little" <gary.g.little.nospam@seagate.com> wrote in message
> news:atI%b.25305$zp.14217@newssvr24.news.prodigy.com...
> > Explicitly calling out the path when you include NTDDK won't define the
> path
> > for the plethora of files that NTDDK includes. You need to add the path
to
> > your SOURCES file.
> >
> > --
> > Gary G. Little
> > Seagate Technologies, LLC
> >
> > "Michael Pierce" <Michael.Pierce@_RE_MOVE_tentechnologies.com> wrote in
> > message news:UFH%b.85878$n62.73054@twister.nyroc.rr.com...
> > > I have the following development workstation: Windows XP Pro,
VC++6.0,
> > DDK
> > > 2600.1106 (installed in C:\DDK\WINDDK\2600.1106), Platform SDK
February
> > > 2003.
> > >
> > >
> > >
> > > As a confirmation that all of the above components are installed
> > correctly,
> > > I compiled one of the sample projects (oemps) by doing the following:
> > >
> > > 1.. Opened an XP checked build window via the start menu.
> > > 2.. Navigated to "C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps".
> > > 3.. Typed "build -cef"
> > > 4.. The kernel mode driver KOEMPS.DLL was built and placed in
> > > "C:\DDK\WINDDK\2600.1106\src\print\oemdll\i386".
> > >
> > >
> > > My goal is to generate a random number in PSCommand method of
> > > "C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps\command.cpp"
> > >
> > > 1.. Using the VC6.0 IDE, I added the following to the pscommand
> method:
> > > LARGE_INTEGER time;
> > >
> > > ULONG seed; // seed value should be a global or in device
> > > extension
> > >
> > > ULONG rand; // random value
> > >
> > >
> > >
> > > KeQuerySystemTime(&time); // only do first time or in init code!
> > >
> > > seed = (ULONG) time;
> > >
> > > rand = RtlRandom(&seed); // get random number
> > >
> > > 2.. I Opened an XP checked build window via the start menu.
> > > 3.. Navigated to "C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps".
> > > 4.. Typed "build -cef".
> > >
> > >
> > > Command.cpp failed to compile because KeQuerySystemTime and RtlRandom
> were
> > > 'undeclared identifiers'. Because these two api's are defined in
> ntddk.h,
> > I
> > > added '#include <ntddk.h>' to command.cpp. The compile failed because
> it
> > > could not find ntddk.h. I then changed the line to '#include <
> > > C:\DDK\WINDDK\2600.1106\inc\ddk\wxp\ntddk.h>'. The compile failed
again
> > > because I had several redefinition errors.
> > >
> > >
> > >
> > > How do I get api's defined in NTDDK.H to compile in this (oemps)
> Microsoft
> > > provided sample project?
> > >
> > >
> >
> >
>
>



Re: Basic kernel mode driver question. by Gary

Gary
Fri Feb 27 16:44:52 CST 2004

I'll say it again ...

Some subsystems such as WDM do NOT use NTDDK, but may include header files
that NTDDK includes. So if you include WDM AND NTDDK ... oops collisions.
Speculating, I would say you have a main header that you include for printer
subsystem work that no doubt includes files included by NTDDK. Again ...
collision when you explicitly include them both.

The logic is rather simple: NTDDK is not found if you just include it, but
you get redef's if you manage to force it's inclusion by explicitly calling
out it's path. Again ... you CANNOT DO THAT!!!!.

What you can do is define a lateral edge by building a source module that
exports functionality and includes NTDDK. Damn ... I think I said that.

--
Gary G. Little
Seagate Technologies, LLC

"Michael Pierce" <Michael.Pierce@_RE_MOVE_tentechnologies.com> wrote in
message news:uVI%b.85895$n62.31582@twister.nyroc.rr.com...
> Actually it is kernel mode.
>
> "Don Burn" <burn@stopspam.acm.org> wrote in message
> news:103umdd7v2r7sb4@corp.supernews.com...
> > Actually, looking at the piece of code in question (I'm not a printer
guy
> so
> > bear with me), this appears to be a user space DLL. If that is the
case,
> > then use srand, rand and GetSystemTime.
> >
> >
> > --
> > Don Burn (MVP, Windows DDK)
> > Windows 2k/XP/2k3 Filesystem and Driver Consulting
> > Remove StopSpam from the email to reply
> >
> > "Gary G. Little" <gary.g.little.nospam@seagate.com> wrote in message
> > news:atI%b.25305$zp.14217@newssvr24.news.prodigy.com...
> > > Explicitly calling out the path when you include NTDDK won't define
the
> > path
> > > for the plethora of files that NTDDK includes. You need to add the
path
> to
> > > your SOURCES file.
> > >
> > > --
> > > Gary G. Little
> > > Seagate Technologies, LLC
> > >
> > > "Michael Pierce" <Michael.Pierce@_RE_MOVE_tentechnologies.com> wrote
in
> > > message news:UFH%b.85878$n62.73054@twister.nyroc.rr.com...
> > > > I have the following development workstation: Windows XP Pro,
> VC++6.0,
> > > DDK
> > > > 2600.1106 (installed in C:\DDK\WINDDK\2600.1106), Platform SDK
> February
> > > > 2003.
> > > >
> > > >
> > > >
> > > > As a confirmation that all of the above components are installed
> > > correctly,
> > > > I compiled one of the sample projects (oemps) by doing the
following:
> > > >
> > > > 1.. Opened an XP checked build window via the start menu.
> > > > 2.. Navigated to "C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps".
> > > > 3.. Typed "build -cef"
> > > > 4.. The kernel mode driver KOEMPS.DLL was built and placed in
> > > > "C:\DDK\WINDDK\2600.1106\src\print\oemdll\i386".
> > > >
> > > >
> > > > My goal is to generate a random number in PSCommand method of
> > > > "C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps\command.cpp"
> > > >
> > > > 1.. Using the VC6.0 IDE, I added the following to the pscommand
> > method:
> > > > LARGE_INTEGER time;
> > > >
> > > > ULONG seed; // seed value should be a global or in
device
> > > > extension
> > > >
> > > > ULONG rand; // random value
> > > >
> > > >
> > > >
> > > > KeQuerySystemTime(&time); // only do first time or in init code!
> > > >
> > > > seed = (ULONG) time;
> > > >
> > > > rand = RtlRandom(&seed); // get random number
> > > >
> > > > 2.. I Opened an XP checked build window via the start menu.
> > > > 3.. Navigated to "C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps".
> > > > 4.. Typed "build -cef".
> > > >
> > > >
> > > > Command.cpp failed to compile because KeQuerySystemTime and
RtlRandom
> > were
> > > > 'undeclared identifiers'. Because these two api's are defined in
> > ntddk.h,
> > > I
> > > > added '#include <ntddk.h>' to command.cpp. The compile failed
because
> > it
> > > > could not find ntddk.h. I then changed the line to '#include <
> > > > C:\DDK\WINDDK\2600.1106\inc\ddk\wxp\ntddk.h>'. The compile failed
> again
> > > > because I had several redefinition errors.
> > > >
> > > >
> > > >
> > > > How do I get api's defined in NTDDK.H to compile in this (oemps)
> > Microsoft
> > > > provided sample project?
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Re: Basic kernel mode driver question. by Maxim

Maxim
Sat Feb 28 11:28:56 CST 2004

> 2.. Navigated to "C:\DDK\WINDDK\2600.1106\src\print\oemdll\oemps".

Sorry, but this is not a _kernel_ driver. This is a user-mode DLL, just use
Win32 APIs in it and not the kernel ones.

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