KeNumberProcessors undefined

When I add KeNumberProcessors in my driver and use XP DDK (2600.1106), I get
“unresolved external symbol __imp__KeNumberProcessors”. I check “wdm.h”, it
is defined there. Anything I miss?

Thanks

Ta H.


Check out the coupons and bargains on MSN Offers!
http://shopping.msn.com/softcontent/softcontent.aspx?scmId=1418

It is certainly defined in, and used throughout XP. How exactly are you
building your driver?

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ta H.
Sent: Tuesday, January 27, 2004 10:53 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] KeNumberProcessors undefined

When I add KeNumberProcessors in my driver and use XP DDK
(2600.1106), I get “unresolved external symbol
__imp__KeNumberProcessors”. I check “wdm.h”, it is defined
there. Anything I miss?

Thanks

Ta H.


Check out the coupons and bargains on MSN Offers!
http://shopping.msn.com/softcontent/softcontent.aspx?scmId=1418


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

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

Fire the windbg, and look at symbols

x Nt!* — to see if it is there or not.
x Hal!*

There are other ways to find, off hand cant recall.

–prokash

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Ta H.
Sent: Tuesday, January 27, 2004 7:53 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] KeNumberProcessors undefined

When I add KeNumberProcessors in my driver and use XP DDK (2600.1106), I get
“unresolved external symbol __imp__KeNumberProcessors”. I check “wdm.h”, it
is defined there. Anything I miss?

Thanks

Ta H.


Check out the coupons and bargains on MSN Offers!
http://shopping.msn.com/softcontent/softcontent.aspx?scmId=1418


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

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

Hi Mark,

The following is partial code of my DriverEntry. I only add one line to
detect how many CPUs are out there. The driver is compiled via your
ddkbuild utility (VERSION 3.8.23). It is always fine until that line is
added.

Thanks

Ta H.

#include <wdm.h>
#include “driver.h”

/+++++++++++++ Function declarations
+++++++++++++++++++++++++++++++++++++++
/

/+++++++++++ Globals
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/

S32 mgNumberOfDevices = 0;
PDMA_ADAPTER mgDmaAdapter = NULL;

PHYSICAL_ADDRESS mgCommonBufPhys = {0,0};
U32 mgRequestedCommonBufferLength = DMA_BUFFER_SIZE;
U32 mgMaxSglTransferSize = 0x00100000;
U32 mgLogLevel = DEFAULT_LOG_LEVEL;

/---------- End of globals
-------------------------------------------------
/

NTSTATUS
DriverEntry(IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING
pRegistryPath)
{

DbgPrint(“[DriverEntry] XP - Num of CPU detected: %i\n”,
KeNumberProcessors);

}

>From: “Mark Roddy”
>Reply-To: “Windows System Software Devs Interest List”
>
>To: “Windows System Software Devs Interest List”
>Subject: RE: [ntdev] KeNumberProcessors undefined
>Date: Wed, 28 Jan 2004 07:56:57 -0500
>
>It is certainly defined in, and used throughout XP. How exactly are you
>building your driver?
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Ta H.
> > Sent: Tuesday, January 27, 2004 10:53 PM
> > To: Windows System Software Devs Interest List
> > Subject: [ntdev] KeNumberProcessors undefined
> >
> > When I add KeNumberProcessors in my driver and use XP DDK
> > (2600.1106), I get “unresolved external symbol
> > imp KeNumberProcessors”. I check “wdm.h”, it is defined
> > there. Anything I miss?
> >
> > Thanks
> >
> > Ta H.
> >
> >
> > Check out the coupons and bargains on MSN Offers!
> > http://shopping.msn.com/softcontent/softcontent.aspx?scmId=1418
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as:
> > xxxxx@hollistech.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@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com


Learn how to choose, serve, and enjoy wine at Wine @ MSN.
http://wine.msn.com/</wdm.h>

From Windows 2000 DDK:

extern PCCHAR KeNumberProcessors;

From Windows 2003 DDK:

extern NTSYSAPI CCHAR KeNumberProcessors;

Notice that it changed from a pointer to CCHAR to CCHAR

-----Original Message-----
From: Ta H. [mailto:xxxxx@hotmail.com]
Sent: Wednesday, January 28, 2004 2:06 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KeNumberProcessors undefined

Hi Mark,

The following is partial code of my DriverEntry. I only add
one line to
detect how many CPUs are out there. The driver is compiled via your
ddkbuild utility (VERSION 3.8.23). It is always fine until
that line is
added.

Thanks

Ta H.

#include <wdm.h>
> #include “driver.h”
>
> /+++++++++++++ Function declarations
> +++++++++++++++++++++++++++++++++++++++
/
>
> /+++++++++++ Globals
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/
>
> S32 mgNumberOfDevices = 0;
> PDMA_ADAPTER mgDmaAdapter = NULL;
>
> PHYSICAL_ADDRESS mgCommonBufPhys = {0,0};
> U32 mgRequestedCommonBufferLength = DMA_BUFFER_SIZE;
> U32 mgMaxSglTransferSize = 0x00100000;
> U32 mgLogLevel = DEFAULT_LOG_LEVEL;
>
>
> /---------- End of globals
> -------------------------------------------------
/
>
> NTSTATUS
> DriverEntry(IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING
> pRegistryPath)
> {
> …
> DbgPrint(“[DriverEntry] XP - Num of CPU detected: %i\n”,
> KeNumberProcessors);
> …
> }
>
> >From: “Mark Roddy”
> >Reply-To: “Windows System Software Devs Interest List”
> >
> >To: “Windows System Software Devs Interest List”
>
> >Subject: RE: [ntdev] KeNumberProcessors undefined
> >Date: Wed, 28 Jan 2004 07:56:57 -0500
> >
> >It is certainly defined in, and used throughout XP. How
> exactly are you
> >building your driver?
> >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com] On Behalf Of Ta H.
> > > Sent: Tuesday, January 27, 2004 10:53 PM
> > > To: Windows System Software Devs Interest List
> > > Subject: [ntdev] KeNumberProcessors undefined
> > >
> > > When I add KeNumberProcessors in my driver and use XP DDK
> > > (2600.1106), I get “unresolved external symbol
> > > imp KeNumberProcessors”. I check “wdm.h”, it is
> defined there.
> > > Anything I miss?
> > >
> > > Thanks
> > >
> > > Ta H.
> > >
> > >
> > > Check out the coupons and bargains on MSN Offers!
> > > http://shopping.msn.com/softcontent/softcontent.aspx?scmId=1418
> > >
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: xxxxx@hollistech.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@hotmail.com
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

> Learn how to choose, serve, and enjoy wine at Wine @ MSN.
> http://wine.msn.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@nsisoftware.com To
unsubscribe send a blank email to xxxxx@lists.osr.com</wdm.h>

Hi, Mark,

I used your DDKBUILD utility (VERSION 3.8.23) to build my driver. It is
always OK, but once I add that line, I have such a complaint from the
compiler. By the way, I still use VC++ 6 .0 to comiple the driver. Is it
OK?

Thanks

Ta H.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Ta H.
Sent: Tuesday, January 27, 2004 7:53 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] KeNumberProcessors undefined

When I add KeNumberProcessors in my driver and use XP DDK (2600.1106), I
get
“unresolved external symbol __imp__KeNumberProcessors”. I check “wdm.h”,
it
is defined there. Anything I miss?

Thanks

Ta H.


Check out the coupons and bargains on MSN Offers!
http://shopping.msn.com/softcontent/softcontent.aspx?scmId=1418


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

You are currently subscribed to ntdev as: xxxxx@garlic.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@hotmail.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Get a FREE online virus check for your PC here, from McAfee.
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

How do you think you are using VC 6.0? The DDKBUILD utility just invokes
the standard environment, using Visual Studio as a editor+. Unless you do
something special the DDK will use the compiler that comes with 2600.

Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting

----- Original Message -----
From: “Ta H.”
To: “Windows System Software Devs Interest List”
Sent: Thursday, January 29, 2004 6:44 PM
Subject: RE: [ntdev] KeNumberProcessors undefined

> Hi, Mark,
>
> I used your DDKBUILD utility (VERSION 3.8.23) to build my driver. It is
> always OK, but once I add that line, I have such a complaint from the
> compiler. By the way, I still use VC++ 6 .0 to comiple the driver. Is it
> OK?
>
> Thanks
>
> Ta H.
>
> >-----Original Message-----
> >From: xxxxx@lists.osr.com
> >[mailto:xxxxx@lists.osr.com]On Behalf Of Ta H.
> >Sent: Tuesday, January 27, 2004 7:53 PM
> >To: Windows System Software Devs Interest List
> >Subject: [ntdev] KeNumberProcessors undefined
> >
> >
> >When I add KeNumberProcessors in my driver and use XP DDK (2600.1106), I
> >get
> >“unresolved external symbol imp KeNumberProcessors”. I check “wdm.h”,
> >it
> >is defined there. Anything I miss?
> >
> >Thanks
> >
> >Ta H.
> >
> >
> >Check out the coupons and bargains on MSN Offers!
> >http://shopping.msn.com/softcontent/softcontent.aspx?scmId=1418
> >
> >
> >—
> >Questions? First check the Kernel Driver FAQ at
> >http://www.osronline.com/article.cfm?id=256
> >
> >You are currently subscribed to ntdev as: xxxxx@garlic.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@hotmail.com
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

> Get a FREE online virus check for your PC here, from McAfee.
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@acm.org
> To unsubscribe send a blank email to xxxxx@lists.osr.com

I don’t know…So probably you are right!

From: “Don Burn”
>Reply-To: “Windows System Software Devs Interest List”
>
>To: “Windows System Software Devs Interest List”
>Subject: Re: [ntdev] KeNumberProcessors undefined
>Date: Thu, 29 Jan 2004 19:12:13 -0500
>
>How do you think you are using VC 6.0? The DDKBUILD utility just invokes
>the standard environment, using Visual Studio as a editor+. Unless you do
>something special the DDK will use the compiler that comes with 2600.
>
>Don Burn (MVP, Windows DDK)
>Windows 2k/XP/2k3 Filesystem and Driver Consulting
>
>----- Original Message -----
>From: “Ta H.”
>To: “Windows System Software Devs Interest List”
>Sent: Thursday, January 29, 2004 6:44 PM
>Subject: RE: [ntdev] KeNumberProcessors undefined
>
>
> > Hi, Mark,
> >
> > I used your DDKBUILD utility (VERSION 3.8.23) to build my driver. It is
> > always OK, but once I add that line, I have such a complaint from the
> > compiler. By the way, I still use VC++ 6 .0 to comiple the driver. Is
>it
> > OK?
> >
> > Thanks
> >
> > Ta H.
> >
> > >-----Original Message-----
> > >From: xxxxx@lists.osr.com
> > >[mailto:xxxxx@lists.osr.com]On Behalf Of Ta H.
> > >Sent: Tuesday, January 27, 2004 7:53 PM
> > >To: Windows System Software Devs Interest List
> > >Subject: [ntdev] KeNumberProcessors undefined
> > >
> > >
> > >When I add KeNumberProcessors in my driver and use XP DDK (2600.1106),
>I
> > >get
> > >“unresolved external symbol imp KeNumberProcessors”. I check
>“wdm.h”,
> > >it
> > >is defined there. Anything I miss?
> > >
> > >Thanks
> > >
> > >Ta H.
> > >
> > >
> > >Check out the coupons and bargains on MSN Offers!
> > >http://shopping.msn.com/softcontent/softcontent.aspx?scmId=1418
> > >
> > >
> > >—
> > >Questions? First check the Kernel Driver FAQ at
> > >http://www.osronline.com/article.cfm?id=256
> > >
> > >You are currently subscribed to ntdev as: xxxxx@garlic.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@hotmail.com
> > >To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >

> > Get a FREE online virus check for your PC here, from McAfee.
> > http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@acm.org
> > 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@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com

_________________________________________________________________
Scope out the new MSN Plus Internet Software — optimizes dial-up to the max!
http://join.msn.com/?pgmarket=en-us&amp;page=byoa/plus&amp;ST=1

You are using visual studio 6 as an IDE, but the driver is built using the
XP DDK and its compilation tools. That is the point of DDKBUILD.

=====================
Mark Roddy

-----Original Message-----
From: Ta H. [mailto:xxxxx@hotmail.com]
Sent: Thursday, January 29, 2004 7:42 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] KeNumberProcessors undefined

I don’t know…So probably you are right!

>From: “Don Burn”
> >Reply-To: “Windows System Software Devs Interest List”
> >
> >To: “Windows System Software Devs Interest List”
>
> >Subject: Re: [ntdev] KeNumberProcessors undefined
> >Date: Thu, 29 Jan 2004 19:12:13 -0500
> >
> >How do you think you are using VC 6.0? The DDKBUILD utility just
> >invokes the standard environment, using Visual Studio as a editor+.
> >Unless you do something special the DDK will use the
> compiler that comes with 2600.
> >
> >Don Burn (MVP, Windows DDK)
> >Windows 2k/XP/2k3 Filesystem and Driver Consulting
> >
> >----- Original Message -----
> >From: “Ta H.”
> >To: “Windows System Software Devs Interest List”
>
> >Sent: Thursday, January 29, 2004 6:44 PM
> >Subject: RE: [ntdev] KeNumberProcessors undefined
> >
> >
> > > Hi, Mark,
> > >
> > > I used your DDKBUILD utility (VERSION 3.8.23) to build my
> driver.
> > > It is always OK, but once I add that line, I have such a
> complaint
> > > from the compiler. By the way, I still use VC++ 6 .0 to
> comiple the
> > > driver. Is
> >it
> > > OK?
> > >
> > > Thanks
> > >
> > > Ta H.
> > >
> > > >-----Original Message-----
> > > >From: xxxxx@lists.osr.com
> > > >[mailto:xxxxx@lists.osr.com]On Behalf Of Ta H.
> > > >Sent: Tuesday, January 27, 2004 7:53 PM
> > > >To: Windows System Software Devs Interest List
> > > >Subject: [ntdev] KeNumberProcessors undefined
> > > >
> > > >
> > > >When I add KeNumberProcessors in my driver and use XP DDK
> > > >(2600.1106),
> >I
> > > >get
> > > >“unresolved external symbol imp KeNumberProcessors”. I check
> >“wdm.h”,
> > > >it
> > > >is defined there. Anything I miss?
> > > >
> > > >Thanks
> > > >
> > > >Ta H.
> > > >
> > > >
> > > >Check out the coupons and bargains on MSN Offers!
> > > >http://shopping.msn.com/softcontent/softcontent.aspx?scmId=1418
> > > >
> > > >
> > > >—
> > > >Questions? First check the Kernel Driver FAQ at
> > > >http://www.osronline.com/article.cfm?id=256
> > > >
> > > >You are currently subscribed to ntdev as: xxxxx@garlic.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@hotmail.com To
> > > >unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > >

> > > Get a FREE online virus check for your PC here, from McAfee.
> > > http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> > >
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> >http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: xxxxx@acm.org 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@hotmail.com To
> >unsubscribe send a blank email to xxxxx@lists.osr.com
>
> _________________________________________________________________
> Scope out the new MSN Plus Internet Software - optimizes
> dial-up to the max!
> http://join.msn.com/?pgmarket=en-us&amp;page=byoa/plus&amp;ST=1
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@stratus.com To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>

It’s worth jumping in at this point to mention that KeNumberProcessors is
problematic in its usage, for two reasons:

  1. Using it assumes that the number of processors will always be the same.
    This assumption may be broken as early as Longhorn.

  2. Using it often assumes that the processors are consecutively numbered.
    This assumption will be broken around the same time.

There currently isn’t any notification mechanism in place that will let you
know when the number of processors changes. That will come along with
processor addition or removal.

But the second problem is one that you can plan for today, by using
KeQueryActiveProcessors instead of KeNumberProcessors. It will give you the
active processor bitmask, allowing you to structure your code in ways that
will tolerate a sparse mask.


Jake Oshins
Windows Base Kernel Team

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

“Ta H.” wrote in message news:xxxxx@ntdev…
> Hi, Mark,
>
> I used your DDKBUILD utility (VERSION 3.8.23) to build my driver. It is
> always OK, but once I add that line, I have such a complaint from the
> compiler. By the way, I still use VC++ 6 .0 to comiple the driver. Is it
> OK?
>
> Thanks
>
> Ta H.
>
> >-----Original Message-----
> >From: xxxxx@lists.osr.com
> >[mailto:xxxxx@lists.osr.com]On Behalf Of Ta H.
> >Sent: Tuesday, January 27, 2004 7:53 PM
> >To: Windows System Software Devs Interest List
> >Subject: [ntdev] KeNumberProcessors undefined
> >
> >
> >When I add KeNumberProcessors in my driver and use XP DDK (2600.1106), I
> >get
> >“unresolved external symbol imp KeNumberProcessors”. I check “wdm.h”,
> >it
> >is defined there. Anything I miss?
> >
> >Thanks
> >
> >Ta H.
> >
> >
> >Check out the coupons and bargains on MSN Offers!
> >http://shopping.msn.com/softcontent/softcontent.aspx?scmId=1418
> >
> >
> >—
> >Questions? First check the Kernel Driver FAQ at
> >http://www.osronline.com/article.cfm?id=256
> >
> >You are currently subscribed to ntdev as: xxxxx@garlic.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@hotmail.com
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

> Get a FREE online virus check for your PC here, from McAfee.
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
>