Hi,
The definition of KeNumberProcessors has changed from pointer in win2k to CCHAR in winxp and above. However, an article in http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndevice/html/keynumproc.asp explains that drivers that were build for win2k that are dereferencing the variable will continue to work without re-compilation in winxp.
I checked it myself and it really worked.
When I tried to compile in XP DDK, I notice a compilation error when dereferencing KeNumberProcessors and after fixing i,t it worked as well (On XP machines obviously).
Can someone please explain how come the Win2K driver works flawlessly in WinXp although it still dereference a pointer that is actually not a pointer at all.
Thanks,
Eran.
Eran Borovik wrote:
Hi,
The definition of KeNumberProcessors has changed from pointer in win2k
to CCHAR in winxp and above. However, an article in
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndevice/html/keynumproc.asp
explains that drivers that were build for win2k that are dereferencing
the variable will continue to work without re-compilation in winxp.
I checked it myself and it really worked.
When I tried to compile in XP DDK, I notice a compilation error when
dereferencing KeNumberProcessors and after fixing i,t it worked as
well (On XP machines obviously).
Can someone please explain how come the Win2K driver works flawlessly
in WinXp although it still dereference a pointer that is actually not
a pointer at all.
It’s obvious that the w2k drivers are calling a different function than
those compiled for XP.
Thanks,
Eran.
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag
argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com
–
Ignorance more frequently begets confidence than does knowledge.
— Charles Darwin
–
This message was scanned for spam and viruses by BitDefender.
For more information please visit http://www.bitdefender.com/
Take a look at the definitions:
Win2k: extern PCCHAR KeNumberProcessors;
WinXP: extern NTSYSAPI CCHAR KeNumberProcessors;
The Win2k version is an extern that is probably resolved in the library to
the exported actual value. The WinXP referes to the export since:
#define DECLSPEC_IMPORT __declspec(dllimport)
#define NTSYSAPI DECLSPEC_IMPORT
–
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply
“Eran Borovik” wrote in message news:xxxxx@ntdev…
Hi,
The definition of KeNumberProcessors has changed from pointer in win2k to
CCHAR in winxp and above. However, an article in
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndevice/html/keynumproc.asp
explains that drivers that were build for win2k that are dereferencing the
variable will continue to work without re-compilation in winxp.
I checked it myself and it really worked.
When I tried to compile in XP DDK, I notice a compilation error when
dereferencing KeNumberProcessors and after fixing i,t it worked as well (On
XP machines obviously).
Can someone please explain how come the Win2K driver works flawlessly in
WinXp although it still dereference a pointer that is actually not a pointer
at all.
Thanks,
Eran.
Hi,
I checked KeNumberProcessors in ntddk.h and it is a variable and not a
function. This variable has the same name but it is declared differently in
winxp DDK and in win2k DDK.
Eran.
“Andrei Zlate-Podani” wrote in message
news:xxxxx@ntdev…
> Eran Borovik wrote:
>
>> Hi,
>>
>> The definition of KeNumberProcessors has changed from pointer in win2k to
>> CCHAR in winxp and above. However, an article in
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndevice/html/keynumproc.asp
>> explains that drivers that were build for win2k that are dereferencing
>> the variable will continue to work without re-compilation in winxp.
>>
>> I checked it myself and it really worked.
>>
>> When I tried to compile in XP DDK, I notice a compilation error when
>> dereferencing KeNumberProcessors and after fixing i,t it worked as well
>> (On XP machines obviously).
>>
>> Can someone please explain how come the Win2K driver works flawlessly in
>> WinXp although it still dereference a pointer that is actually not a
>> pointer at all.
>>
> It’s obvious that the w2k drivers are calling a different function than
> those compiled for XP.
>
>> Thanks,
>>
>> Eran.
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
>> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: unknown lmsubst tag argument:
>> ‘’
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>>------------------------------------------------------------------------
>>
>>
>>
>
>
> –
> Ignorance more frequently begets confidence than does knowledge.
> — Charles Darwin
>
>
>
> –
> This message was scanned for spam and viruses by BitDefender.
> For more information please visit http://www.bitdefender.com/
>
>
Eran Borovik wrote:
Hi,
I checked KeNumberProcessors in ntddk.h and it is a variable and not a
function. This variable has the same name but it is declared differently in
winxp DDK and in win2k DDK.
Hi,
I apologize, I didn’t check my affirmation first.
Andrei
Eran.
“Andrei Zlate-Podani” wrote in message
>news:xxxxx@ntdev…
>
>
>>Eran Borovik wrote:
>>
>>
>>
>>>Hi,
>>>
>>>The definition of KeNumberProcessors has changed from pointer in win2k to
>>>CCHAR in winxp and above. However, an article in
>>>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndevice/html/keynumproc.asp
>>>explains that drivers that were build for win2k that are dereferencing
>>>the variable will continue to work without re-compilation in winxp.
>>>
>>>I checked it myself and it really worked.
>>>
>>>When I tried to compile in XP DDK, I notice a compilation error when
>>>dereferencing KeNumberProcessors and after fixing i,t it worked as well
>>>(On XP machines obviously).
>>>
>>>Can someone please explain how come the Win2K driver works flawlessly in
>>>WinXp although it still dereference a pointer that is actually not a
>>>pointer at all.
>>>
>>>
>>>
>>It’s obvious that the w2k drivers are calling a different function than
>>those compiled for XP.
>>
>>
>>
>>>Thanks,
>>>
>>>Eran.
>>>
>>>
>>>—
>>>Questions? First check the Kernel Driver FAQ at
>>>http://www.osronline.com/article.cfm?id=256
>>>
>>>You are currently subscribed to ntdev as: unknown lmsubst tag argument:
>>>‘’
>>>To unsubscribe send a blank email to xxxxx@lists.osr.com
>>>
>>>------------------------------------------------------------------------
>>>
>>>
>>>
>>>
>>>
>>–
>>Ignorance more frequently begets confidence than does knowledge.
>>— Charles Darwin
>>
>>
>>
>>–
>>This message was scanned for spam and viruses by BitDefender.
>>For more information please visit http://www.bitdefender.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@bitdefender.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
–
Ignorance more frequently begets confidence than does knowledge.
— Charles Darwin
–
This message was scanned for spam and viruses by BitDefender.
For more information please visit http://www.bitdefender.com/
Andrei Zlate-Podani wrote:
Eran Borovik wrote:
>
> The definition of KeNumberProcessors has changed from pointer in
> win2k to CCHAR in winxp and above. However, an article in
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndevice/html/keynumproc.asp
> explains that drivers that were build for win2k that are
> dereferencing the variable will continue to work without
> re-compilation in winxp.
>
> I checked it myself and it really worked.
>
> When I tried to compile in XP DDK, I notice a compilation error when
> dereferencing KeNumberProcessors and after fixing i,t it worked as
> well (On XP machines obviously).
>
> Can someone please explain how come the Win2K driver works flawlessly
> in WinXp although it still dereference a pointer that is actually not
> a pointer at all.
>
It’s obvious that the w2k drivers are calling a different function
than those compiled for XP.
How is it obvious? First of all, it’s not a function at all. It’s a
piece of data. Next, we’re not talking about relinking an old driver
with new libraries. We’re talking about a DLL export here. There is
only one export called “KeNumberProcessors” from ntoskrnl.exe. A driver
BINARY linked with the Win2k libraries that expects to dereference
KeNumberProcessors works when run on WinXP, as does a driver BINARY
linked with the WinXP libraries that expects to load a single byte from
the same export.
I thought maybe ntoskrnl.lib in the XP libraries actually points to a
different entry point in ntoskrnl.exe, but I just checked, and that’s
not the case.
Indeed, the only way I can see for this to work is if the
KeNumberOfProcessors still contains an address, but the low-order byte
is set to the number of processors. So, for example,
KeNumberOfProcessors might contain 80424001 on a one-processor system
(and that address also contains a 1), but contain 80424004 on a
four-processor system (and that address ALSO contains a 4).
I don’t have a debugger set up right now to check this, but I assume
someone will.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.