Re: Compilng and Linking Windows 2000 compatible driver with

Hi

Thanks a lot for your comprehensive answer.
Can you please instruct me the exact way how do I
configure the 2003 DDK to use the Windows 2000 Build
Environment?

Thanks

Alon

Subject: Re: Compilng and Linking Windows 2000
compatible driver with
DDK 2003
From: “Thomas F. Divine”
Date: Tue, 19 Apr 2005 14:11:32 -0400
X-Message-Number: 24

“Alon Elhanani” wrote in message
news:xxxxx@ntdev…
> Hi!
>
> I’m trying to compile my driver (running on Windows
> 2000, Windows XP SP1, SP2), with the new 2003 DDK.
> I have a missing function problem.
> First I had problem with “PsDereferencePrimaryToken”
> and “PsDereferenceImpersonationToken” which changed
> from Macros in Windows 2000 DDK to function in 2003
> DDK - My solution was to re-define the macro and
load
> these functions dynamically (with
> MmGetSystemRoutineAddress function)
> Now I still can not load my driver due to a missing
> “_alldvrm” function.
> I found a thread from the past regarding this issue
> but I still didn’t understand what is the solution
for
> the runtime problem - if any.
> Generally I was told that it is better to work with
> 2003 DDK - I will be happy to do so AL TOUGH my
driver
> should still be running on Windows 2000 machines
> I will be happy to know what are my options to do so
> (If any…)
>

Yes, it is certainly best to use the latest DDK.
Contrary to the
distant
path, these days each new DDK offers bug fixes to
(some) driver samples
and
enhanced compilers and tools (e.g., PreFast).

On the other hand, if your driver is to be built to
the “lowest common
denominator” (Windows 2000) you should use the Windows
2000 Build
Environment of the Windows Server 2003 DDK.

Using the latest Windows Server 2003 SP1 DDK you will
find functions
that
are deprecated or even removed based on the Build
Environment that you
select. For example, routines that are specified to be
“reserved for
system
use” in the Windows Server 2003 DDK will compile and
link if the
Windows XP
Build Environment is used, but are missing (using the
same DDK) if the
Windows Server 2003 build environment is used.

So, use 1.) the latest DDK and 2.) the 'lowest common
denominator"
Build
Environment from that DDK.

Good luck,

Thomas F. Divine, Windows DDK MVP
http://www.pcausa.com

__________________________________
Do you Yahoo!?
Plan great trips with Yahoo! Travel: Now over 17,000 guides!
http://travel.yahoo.com/p-travelguide

When you installed the DDK you got to choose the target environments. If
you choose Windows 2000 then the proper includes and libraries are loaded.
You should see on the start menu under the DDK entry for build environments
a “Windows 2000” build environment.


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

“Alon Elhanani” wrote in message news:xxxxx@ntdev…
> Hi
>
> Thanks a lot for your comprehensive answer.
> Can you please instruct me the exact way how do I
> configure the 2003 DDK to use the Windows 2000 Build
> Environment?
>
> Thanks
>
> Alon
>
> Subject: Re: Compilng and Linking Windows 2000
> compatible driver with
> DDK 2003
> From: “Thomas F. Divine”
> Date: Tue, 19 Apr 2005 14:11:32 -0400
> X-Message-Number: 24
>
>
> “Alon Elhanani” wrote in message
> news:xxxxx@ntdev…
>> Hi!
>>
>> I’m trying to compile my driver (running on Windows
>> 2000, Windows XP SP1, SP2), with the new 2003 DDK.
>> I have a missing function problem.
>> First I had problem with “PsDereferencePrimaryToken”
>> and “PsDereferenceImpersonationToken” which changed
>> from Macros in Windows 2000 DDK to function in 2003
>> DDK - My solution was to re-define the macro and
> load
>> these functions dynamically (with
>> MmGetSystemRoutineAddress function)
>> Now I still can not load my driver due to a missing
>> “_alldvrm” function.
>> I found a thread from the past regarding this issue
>> but I still didn’t understand what is the solution
> for
>> the runtime problem - if any.
>> Generally I was told that it is better to work with
>> 2003 DDK - I will be happy to do so AL TOUGH my
> driver
>> should still be running on Windows 2000 machines
>> I will be happy to know what are my options to do so
>> (If any…)
>>
>
> Yes, it is certainly best to use the latest DDK.
> Contrary to the
> distant
> path, these days each new DDK offers bug fixes to
> (some) driver samples
> and
> enhanced compilers and tools (e.g., PreFast).
>
> On the other hand, if your driver is to be built to
> the “lowest common
> denominator” (Windows 2000) you should use the Windows
> 2000 Build
> Environment of the Windows Server 2003 DDK.
>
> Using the latest Windows Server 2003 SP1 DDK you will
> find functions
> that
> are deprecated or even removed based on the Build
> Environment that you
> select. For example, routines that are specified to be
> “reserved for
> system
> use” in the Windows Server 2003 DDK will compile and
> link if the
> Windows XP
> Build Environment is used, but are missing (using the
> same DDK) if the
> Windows Server 2003 build environment is used.
>
> So, use 1.) the latest DDK and 2.) the 'lowest common
> denominator"
> Build
> Environment from that DDK.
>
> Good luck,
>
> Thomas F. Divine, Windows DDK MVP
> http://www.pcausa.com
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Plan great trips with Yahoo! Travel: Now over 17,000 guides!
> http://travel.yahoo.com/p-travelguide
>

Don Burn wrote:

When you installed the DDK you got to choose the target environments. If
you choose Windows 2000 then the proper includes and libraries are loaded.
You should see on the start menu under the DDK entry for build environments
a “Windows 2000” build environment.

As I learned from experience by advising someone else, if one is foolish
enough to purchase the DDK Suite, it ONLY installs the 2003
environments. I wasted half a week exchanging e-mails with a fellow in
Europe trying to get him to bring up the “Windows XP Checked Build
Environment”, before we finally figured out that he didn’t HAVE the
Windows 2000 or Windows XP build environments.

I finally had him fetch the non-Suite version, and we were all happy again.

xxxxx@lists.osr.com wrote on 04/20/2005 10:24:04 AM:

Don Burn wrote:

>When you installed the DDK you got to choose the target environments.
If
>you choose Windows 2000 then the proper includes and libraries are
loaded.
>You should see on the start menu under the DDK entry for build
environments
>a “Windows 2000” build environment.
>
>

As I learned from experience by advising someone else, if one is foolish

enough to purchase the DDK Suite, it ONLY installs the 2003
environments. I wasted half a week exchanging e-mails with a fellow in
Europe trying to get him to bring up the “Windows XP Checked Build
Environment”, before we finally figured out that he didn’t HAVE the
Windows 2000 or Windows XP build environments.

I finally had him fetch the non-Suite version, and we were all happy
again.

Are you saying that the DDK installer didn’t have the option to install
all the other environments? IIRC, and I may not, the default behavior in
the 3790 DDK was to only install the 2003 environments. It certainly
doesn’t install everything by default.

Phil

Philip D. Barila
Seagate Technology LLC
(720) 684-1842

Philip D Barila wrote:

Tim wrote:
>
> As I learned from experience by advising someone else, if one is
foolish
> enough to purchase the DDK Suite, it ONLY installs the 2003
> environments. I wasted half a week exchanging e-mails with a fellow in
> Europe trying to get him to bring up the “Windows XP Checked Build
> Environment”, before we finally figured out that he didn’t HAVE the
> Windows 2000 or Windows XP build environments.
>
> I finally had him fetch the non-Suite version, and we were all happy
again.

Are you saying that the DDK installer didn’t have the option to
install all the other environments? IIRC, and I may not, the default
behavior in the 3790 DDK was to only install the 2003 environments. It
certainly doesn’t install everything by default.

It is possible you are correct, but I don’t think there is even an
OPTION to enable or disable individual environments. The only options I
recall are which samples to install.

It’s true that I, by habit, install everything, so it is possible there
was an option I missed. That would certainly be a more comforting
situation than the “free product includes less functionality than
expensive product” situation I was assuming.

Hi again!

I compiled my driver (Targeted to Windows 2000), using the Windows
2000 Build Environment of the Windows Server 2003 DDK.
It did solved my “PsDereferencePrimaryToken” linkage problem, BUT, I still
have a problem with __alldvrm: “unresolved external symbol __alldvrm
referenced in function…”
I know this function is for dividing of Large Integers, BUT I don’t
understand why it try to link to this function although I’m working with
Windows 2000 Env.
I looked in a filemon, and noticed that the compiler/linker looking for .h
files and .lib files only in the 2000 Env directories.
I searched in the Web and found out a thread that describes a BUG Microsoft
has with this issue, here is the link to the thread (just typed in Google
groups: alldvrm DDK):
http://groups-beta.google.com/group/comp.os.ms-windows.programmer.nt.kernel-mode/browse_frm/thread/ea5f8d6dd34b4333/d008e13f3c0c6ef6?q=alldvrm+DDK&rnum=1&hl=en#d008e13f3c0c6ef6

Please let me know if you know something about it, or else - is there a way
that I can compile and LINK my code with the 2003 DDK…
Best way to check this issue:

  1. Write a simple driver that does arithmetic operations on INT64 data types
    in his DriverEntry
  2. Try to compile (a release version) of this driver with 2003 DDK, when
    Windows 2000 Env is configured
  3. You’ll get this problem

Hope to get answers…

Thanks

Alon

“Alon Elhanani” wrote in message news:xxxxx@ntdev…
> Hi
>
> Thanks a lot for your comprehensive answer.
> Can you please instruct me the exact way how do I
> configure the 2003 DDK to use the Windows 2000 Build
> Environment?
>
> Thanks
>
> Alon
>
> Subject: Re: Compilng and Linking Windows 2000
> compatible driver with
> DDK 2003
> From: “Thomas F. Divine”
> Date: Tue, 19 Apr 2005 14:11:32 -0400
> X-Message-Number: 24
>
>
> “Alon Elhanani” wrote in message
> news:xxxxx@ntdev…
> > Hi!
> >
> > I’m trying to compile my driver (running on Windows
> > 2000, Windows XP SP1, SP2), with the new 2003 DDK.
> > I have a missing function problem.
> > First I had problem with “PsDereferencePrimaryToken”
> > and “PsDereferenceImpersonationToken” which changed
> > from Macros in Windows 2000 DDK to function in 2003
> > DDK - My solution was to re-define the macro and
> load
> > these functions dynamically (with
> > MmGetSystemRoutineAddress function)
> > Now I still can not load my driver due to a missing
> > “_alldvrm” function.
> > I found a thread from the past regarding this issue
> > but I still didn’t understand what is the solution
> for
> > the runtime problem - if any.
> > Generally I was told that it is better to work with
> > 2003 DDK - I will be happy to do so AL TOUGH my
> driver
> > should still be running on Windows 2000 machines
> > I will be happy to know what are my options to do so
> > (If any…)
> >
>
> Yes, it is certainly best to use the latest DDK.
> Contrary to the
> distant
> path, these days each new DDK offers bug fixes to
> (some) driver samples
> and
> enhanced compilers and tools (e.g., PreFast).
>
> On the other hand, if your driver is to be built to
> the “lowest common
> denominator” (Windows 2000) you should use the Windows
> 2000 Build
> Environment of the Windows Server 2003 DDK.
>
> Using the latest Windows Server 2003 SP1 DDK you will
> find functions
> that
> are deprecated or even removed based on the Build
> Environment that you
> select. For example, routines that are specified to be
> “reserved for
> system
> use” in the Windows Server 2003 DDK will compile and
> link if the
> Windows XP
> Build Environment is used, but are missing (using the
> same DDK) if the
> Windows Server 2003 build environment is used.
>
> So, use 1.) the latest DDK and 2.) the 'lowest common
> denominator"
> Build
> Environment from that DDK.
>
> Good luck,
>
> Thomas F. Divine, Windows DDK MVP
> http://www.pcausa.com
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Plan great trips with Yahoo! Travel: Now over 17,000 guides!
> http://travel.yahoo.com/p-travelguide
>

Use the run time library routines such as “RtlLargeIntegerDivide” and similar …

C.

----- Original Message -----
From: “Alon Elhanani”
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”
Sent: Tuesday, April 26, 2005 12:22 PM
Subject: Re:[ntdev] Compilng and Linking Windows 2000 compatible driver with

> Hi again!
>
> I compiled my driver (Targeted to Windows 2000), using the Windows
> 2000 Build Environment of the Windows Server 2003 DDK.
> It did solved my “PsDereferencePrimaryToken” linkage problem, BUT, I still
> have a problem with alldvrm: "unresolved external symbol alldvrm
> referenced in function…“
> I know this function is for dividing of Large Integers, BUT I don’t
> understand why it try to link to this function although I’m working with
> Windows 2000 Env.
> I looked in a filemon, and noticed that the compiler/linker looking for .h
> files and .lib files only in the 2000 Env directories.
> I searched in the Web and found out a thread that describes a BUG Microsoft
> has with this issue, here is the link to the thread (just typed in Google
> groups: alldvrm DDK):
>
http://groups-beta.google.com/group/comp.os.ms-windows.programmer.nt.kernel-mode/browse_frm/thread/ea5f8d6dd34b4333/d008e13f3c0c6ef6?q=alldvrm+DDK&rnum=1&hl=en#d008e13f3c0c6ef6
>
> Please let me know if you know something about it, or else - is there a way
> that I can compile and LINK my code with the 2003 DDK…
> Best way to check this issue:
> 1. Write a simple driver that does arithmetic operations on INT64 data types
> in his DriverEntry
> 2. Try to compile (a release version) of this driver with 2003 DDK, when
> Windows 2000 Env is configured
> 3. You’ll get this problem
>
> Hope to get answers…
>
> Thanks
>
> Alon
>
> “Alon Elhanani” wrote in message news:xxxxx@ntdev…
> > Hi
> >
> > Thanks a lot for your comprehensive answer.
> > Can you please instruct me the exact way how do I
> > configure the 2003 DDK to use the Windows 2000 Build
> > Environment?
> >
> > Thanks
> >
> > Alon
> >
> > Subject: Re: Compilng and Linking Windows 2000
> > compatible driver with
> > DDK 2003
> > From: “Thomas F. Divine”
> > Date: Tue, 19 Apr 2005 14:11:32 -0400
> > X-Message-Number: 24
> >
> >
> > “Alon Elhanani” wrote in message
> > news:xxxxx@ntdev…
> > > Hi!
> > >
> > > I’m trying to compile my driver (running on Windows
> > > 2000, Windows XP SP1, SP2), with the new 2003 DDK.
> > > I have a missing function problem.
> > > First I had problem with “PsDereferencePrimaryToken”
> > > and “PsDereferenceImpersonationToken” which changed
> > > from Macros in Windows 2000 DDK to function in 2003
> > > DDK - My solution was to re-define the macro and
> > load
> > > these functions dynamically (with
> > > MmGetSystemRoutineAddress function)
> > > Now I still can not load my driver due to a missing
> > > “_alldvrm” function.
> > > I found a thread from the past regarding this issue
> > > but I still didn’t understand what is the solution
> > for
> > > the runtime problem - if any.
> > > Generally I was told that it is better to work with
> > > 2003 DDK - I will be happy to do so AL TOUGH my
> > driver
> > > should still be running on Windows 2000 machines
> > > I will be happy to know what are my options to do so
> > > (If any…)
> > >
> >
> > Yes, it is certainly best to use the latest DDK.
> > Contrary to the
> > distant
> > path, these days each new DDK offers bug fixes to
> > (some) driver samples
> > and
> > enhanced compilers and tools (e.g., PreFast).
> >
> > On the other hand, if your driver is to be built to
> > the “lowest common
> > denominator” (Windows 2000) you should use the Windows
> > 2000 Build
> > Environment of the Windows Server 2003 DDK.
> >
> > Using the latest Windows Server 2003 SP1 DDK you will
> > find functions
> > that
> > are deprecated or even removed based on the Build
> > Environment that you
> > select. For example, routines that are specified to be
> > “reserved for
> > system
> > use” in the Windows Server 2003 DDK will compile and
> > link if the
> > Windows XP
> > Build Environment is used, but are missing (using the
> > same DDK) if the
> > Windows Server 2003 build environment is used.
> >
> > So, use 1.) the latest DDK and 2.) the 'lowest common
> > denominator”
> > Build
> > Environment from that DDK.
> >
> > Good luck,
> >
> > Thomas F. Divine, Windows DDK MVP
> > http://www.pcausa.com
> >
> >
> >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Plan great trips with Yahoo! Travel: Now over 17,000 guides!
> > http://travel.yahoo.com/p-travelguide
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@compaqnet.be
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Thanks, but some more questions:

  1. It’s is written in the DDK documentation that these functions are
    obsolete - what is the “trade of” of not using the compiler support?
  2. Does Microsoft aware of this bug in their DDK Environment?
  3. Is there an option to enable/disable for this optimization in a specific
    piece of code?

Thanks

Alon

“Christiaan Ghijselinck” wrote in
message news:xxxxx@ntdev…
>
> Use the run time library routines such as “RtlLargeIntegerDivide” and
similar …
>
> C.
>
>
> ----- Original Message -----
> From: “Alon Elhanani”
> Newsgroups: ntdev
> To: “Windows System Software Devs Interest List”
> Sent: Tuesday, April 26, 2005 12:22 PM
> Subject: Re:[ntdev] Compilng and Linking Windows 2000 compatible driver
with
>
>
> > Hi again!
> >
> > I compiled my driver (Targeted to Windows 2000), using the Windows
> > 2000 Build Environment of the Windows Server 2003 DDK.
> > It did solved my “PsDereferencePrimaryToken” linkage problem, BUT, I
still
> > have a problem with alldvrm: "unresolved external symbol alldvrm
> > referenced in function…“
> > I know this function is for dividing of Large Integers, BUT I don’t
> > understand why it try to link to this function although I’m working with
> > Windows 2000 Env.
> > I looked in a filemon, and noticed that the compiler/linker looking for
.h
> > files and .lib files only in the 2000 Env directories.
> > I searched in the Web and found out a thread that describes a BUG
Microsoft
> > has with this issue, here is the link to the thread (just typed in
Google
> > groups: alldvrm DDK):
> >
>
http://groups-beta.google.com/group/comp.os.ms-windows.programmer.nt.kernel-mode/browse_frm/thread/ea5f8d6dd34b4333/d008e13f3c0c6ef6?q=alldvrm+DDK&rnum=1&hl=en#d008e13f3c0c6ef6
> >
> > Please let me know if you know something about it, or else - is there a
way
> > that I can compile and LINK my code with the 2003 DDK…
> > Best way to check this issue:
> > 1. Write a simple driver that does arithmetic operations on INT64 data
types
> > in his DriverEntry
> > 2. Try to compile (a release version) of this driver with 2003 DDK, when
> > Windows 2000 Env is configured
> > 3. You’ll get this problem
> >
> > Hope to get answers…
> >
> > Thanks
> >
> > Alon
> >
> > “Alon Elhanani” wrote in message news:xxxxx@ntdev…
> > > Hi
> > >
> > > Thanks a lot for your comprehensive answer.
> > > Can you please instruct me the exact way how do I
> > > configure the 2003 DDK to use the Windows 2000 Build
> > > Environment?
> > >
> > > Thanks
> > >
> > > Alon
> > >
> > > Subject: Re: Compilng and Linking Windows 2000
> > > compatible driver with
> > > DDK 2003
> > > From: “Thomas F. Divine”
> > > Date: Tue, 19 Apr 2005 14:11:32 -0400
> > > X-Message-Number: 24
> > >
> > >
> > > “Alon Elhanani” wrote in message
> > > news:xxxxx@ntdev…
> > > > Hi!
> > > >
> > > > I’m trying to compile my driver (running on Windows
> > > > 2000, Windows XP SP1, SP2), with the new 2003 DDK.
> > > > I have a missing function problem.
> > > > First I had problem with “PsDereferencePrimaryToken”
> > > > and “PsDereferenceImpersonationToken” which changed
> > > > from Macros in Windows 2000 DDK to function in 2003
> > > > DDK - My solution was to re-define the macro and
> > > load
> > > > these functions dynamically (with
> > > > MmGetSystemRoutineAddress function)
> > > > Now I still can not load my driver due to a missing
> > > > “_alldvrm” function.
> > > > I found a thread from the past regarding this issue
> > > > but I still didn’t understand what is the solution
> > > for
> > > > the runtime problem - if any.
> > > > Generally I was told that it is better to work with
> > > > 2003 DDK - I will be happy to do so AL TOUGH my
> > > driver
> > > > should still be running on Windows 2000 machines
> > > > I will be happy to know what are my options to do so
> > > > (If any…)
> > > >
> > >
> > > Yes, it is certainly best to use the latest DDK.
> > > Contrary to the
> > > distant
> > > path, these days each new DDK offers bug fixes to
> > > (some) driver samples
> > > and
> > > enhanced compilers and tools (e.g., PreFast).
> > >
> > > On the other hand, if your driver is to be built to
> > > the “lowest common
> > > denominator” (Windows 2000) you should use the Windows
> > > 2000 Build
> > > Environment of the Windows Server 2003 DDK.
> > >
> > > Using the latest Windows Server 2003 SP1 DDK you will
> > > find functions
> > > that
> > > are deprecated or even removed based on the Build
> > > Environment that you
> > > select. For example, routines that are specified to be
> > > “reserved for
> > > system
> > > use” in the Windows Server 2003 DDK will compile and
> > > link if the
> > > Windows XP
> > > Build Environment is used, but are missing (using the
> > > same DDK) if the
> > > Windows Server 2003 build environment is used.
> > >
> > > So, use 1.) the latest DDK and 2.) the 'lowest common
> > > denominator”
> > > Build
> > > Environment from that DDK.
> > >
> > > Good luck,
> > >
> > > Thomas F. Divine, Windows DDK MVP
> > > http://www.pcausa.com
> > >
> > >
> > >
> > >
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > Plan great trips with Yahoo! Travel: Now over 17,000 guides!
> > > http://travel.yahoo.com/p-travelguide
> > >
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as:
xxxxx@compaqnet.be
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>

> Thanks, but some more questions:

  1. It’s is written in the DDK documentation that these functions are
    obsolete - what is the “trade of” of not using the compiler support?
  2. Does Microsoft aware of this bug in their DDK Environment?

I am not sure if it is a bug ! But after all, I personally have no problem with for example this :

LONGLONG _A = 5 ;
LONGLONG _B = 3 ;
LONGLONG _Q ;
LONGLONG _REM ;

_Q = _A / _B ;
_REM = _A % _B ;

Are you sure you use the correct compiler version and linker and libraries ?
Always use the “official” DDK BUILD utility and environment in the first place.

  1. Is there an option to enable/disable for this optimization in a specific
    piece of code?

I am not aware of such an option

Note : do not mail me using my personal E-mail address from this forum : if questions are asked here,
it remains the intention that everyone may read them.

Thanks

Alon

“Christiaan Ghijselinck” wrote in
> message news:xxxxx@ntdev…
> >
> > Use the run time library routines such as “RtlLargeIntegerDivide” and
> similar …
> >
> > C.
> >
> >
> > ----- Original Message -----
> > From: “Alon Elhanani”
> > Newsgroups: ntdev
> > To: “Windows System Software Devs Interest List”
> > Sent: Tuesday, April 26, 2005 12:22 PM
> > Subject: Re:[ntdev] Compilng and Linking Windows 2000 compatible driver
> with
> >
> >
> > > Hi again!
> > >
> > > I compiled my driver (Targeted to Windows 2000), using the Windows
> > > 2000 Build Environment of the Windows Server 2003 DDK.
> > > It did solved my “PsDereferencePrimaryToken” linkage problem, BUT, I
> still
> > > have a problem with alldvrm: "unresolved external symbol alldvrm
> > > referenced in function…“
> > > I know this function is for dividing of Large Integers, BUT I don’t
> > > understand why it try to link to this function although I’m working with
> > > Windows 2000 Env.
> > > I looked in a filemon, and noticed that the compiler/linker looking for
> .h
> > > files and .lib files only in the 2000 Env directories.
> > > I searched in the Web and found out a thread that describes a BUG
> Microsoft
> > > has with this issue, here is the link to the thread (just typed in
> Google
> > > groups: alldvrm DDK):
> > >
> >
>
http://groups-beta.google.com/group/comp.os.ms-windows.programmer.nt.kernel-mode/browse_frm/thread/ea5f8d6dd34b4333/d008e13f3c0c6ef6?q=alldvrm+DDK&rnum=1&hl=en#d008e13f3c0c6ef6
> > >
> > > Please let me know if you know something about it, or else - is there a
> way
> > > that I can compile and LINK my code with the 2003 DDK…
> > > Best way to check this issue:
> > > 1. Write a simple driver that does arithmetic operations on INT64 data
> types
> > > in his DriverEntry
> > > 2. Try to compile (a release version) of this driver with 2003 DDK, when
> > > Windows 2000 Env is configured
> > > 3. You’ll get this problem
> > >
> > > Hope to get answers…
> > >
> > > Thanks
> > >
> > > Alon
> > >
> > > “Alon Elhanani” wrote in message news:xxxxx@ntdev…
> > > > Hi
> > > >
> > > > Thanks a lot for your comprehensive answer.
> > > > Can you please instruct me the exact way how do I
> > > > configure the 2003 DDK to use the Windows 2000 Build
> > > > Environment?
> > > >
> > > > Thanks
> > > >
> > > > Alon
> > > >
> > > > Subject: Re: Compilng and Linking Windows 2000
> > > > compatible driver with
> > > > DDK 2003
> > > > From: “Thomas F. Divine”
> > > > Date: Tue, 19 Apr 2005 14:11:32 -0400
> > > > X-Message-Number: 24
> > > >
> > > >
> > > > “Alon Elhanani” wrote in message
> > > > news:xxxxx@ntdev…
> > > > > Hi!
> > > > >
> > > > > I’m trying to compile my driver (running on Windows
> > > > > 2000, Windows XP SP1, SP2), with the new 2003 DDK.
> > > > > I have a missing function problem.
> > > > > First I had problem with “PsDereferencePrimaryToken”
> > > > > and “PsDereferenceImpersonationToken” which changed
> > > > > from Macros in Windows 2000 DDK to function in 2003
> > > > > DDK - My solution was to re-define the macro and
> > > > load
> > > > > these functions dynamically (with
> > > > > MmGetSystemRoutineAddress function)
> > > > > Now I still can not load my driver due to a missing
> > > > > “_alldvrm” function.
> > > > > I found a thread from the past regarding this issue
> > > > > but I still didn’t understand what is the solution
> > > > for
> > > > > the runtime problem - if any.
> > > > > Generally I was told that it is better to work with
> > > > > 2003 DDK - I will be happy to do so AL TOUGH my
> > > > driver
> > > > > should still be running on Windows 2000 machines
> > > > > I will be happy to know what are my options to do so
> > > > > (If any…)
> > > > >
> > > >
> > > > Yes, it is certainly best to use the latest DDK.
> > > > Contrary to the
> > > > distant
> > > > path, these days each new DDK offers bug fixes to
> > > > (some) driver samples
> > > > and
> > > > enhanced compilers and tools (e.g., PreFast).
> > > >
> > > > On the other hand, if your driver is to be built to
> > > > the “lowest common
> > > > denominator” (Windows 2000) you should use the Windows
> > > > 2000 Build
> > > > Environment of the Windows Server 2003 DDK.
> > > >
> > > > Using the latest Windows Server 2003 SP1 DDK you will
> > > > find functions
> > > > that
> > > > are deprecated or even removed based on the Build
> > > > Environment that you
> > > > select. For example, routines that are specified to be
> > > > “reserved for
> > > > system
> > > > use” in the Windows Server 2003 DDK will compile and
> > > > link if the
> > > > Windows XP
> > > > Build Environment is used, but are missing (using the
> > > > same DDK) if the
> > > > Windows Server 2003 build environment is used.
> > > >
> > > > So, use 1.) the latest DDK and 2.) the 'lowest common
> > > > denominator”
> > > > Build
> > > > Environment from that DDK.
> > > >
> > > > Good luck,
> > > >
> > > > Thomas F. Divine, Windows DDK MVP
> > > > http://www.pcausa.com
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > __________________________________
> > > > Do you Yahoo!?
> > > > Plan great trips with Yahoo! Travel: Now over 17,000 guides!
> > > > http://travel.yahoo.com/p-travelguide
> > > >
> > >
> > >
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as:
> xxxxx@compaqnet.be
> > > 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@compaqnet.be
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Hi!

I tried your code in it worked OK.
BUT - I have for you code that I beleive will not link even for you
Please insert the following code to your example and let me know the
results…(I get the “error LNK2001: unresolved external symbol __alldvrm”)

// converts nano second to microsecond and “round of”
#define NS_TO_MS(hns) (INT64)((hns)/10000i64 +
((((hns)%10000i64)>(10000i64/2))?1:0))
UINT func1( UINT32 Param )

{

INT64 Var1 = Param ;

UINT Var2 = (UINT)NS_TO_MS(Var1) ;

return Var2 ;

}

Thanks

Alon

“Christiaan Ghijselinck” wrote in
message news:xxxxx@ntdev…
>
>
>
> > Thanks, but some more questions:
> > 1. It’s is written in the DDK documentation that these functions are
> > obsolete - what is the “trade of” of not using the compiler support?
> > 2. Does Microsoft aware of this bug in their DDK Environment?
>
> I am not sure if it is a bug ! But after all, I personally have no
problem with for example this :
>
> LONGLONG _A = 5 ;
> LONGLONG _B = 3 ;
> LONGLONG _Q ;
> LONGLONG _REM ;
>
> _Q = _A / _B ;
> _REM = _A % _B ;
>
> Are you sure you use the correct compiler version and linker and libraries
?
> Always use the “official” DDK BUILD utility and environment in the first
place.
>
>
> > 3. Is there an option to enable/disable for this optimization in a
specific
> > piece of code?
>
> I am not aware of such an option
>
>
> Note : do not mail me using my personal E-mail address from this forum :
if questions are asked here,
> it remains the intention that everyone may read them.
>
>
> >
> > Thanks
> >
> > Alon
> >
> > “Christiaan Ghijselinck” wrote in
> > message news:xxxxx@ntdev…
> > >
> > > Use the run time library routines such as “RtlLargeIntegerDivide” and
> > similar …
> > >
> > > C.
> > >
> > >
> > > ----- Original Message -----
> > > From: “Alon Elhanani”
> > > Newsgroups: ntdev
> > > To: “Windows System Software Devs Interest List”
> > > Sent: Tuesday, April 26, 2005 12:22 PM
> > > Subject: Re:[ntdev] Compilng and Linking Windows 2000 compatible
driver
> > with
> > >
> > >
> > > > Hi again!
> > > >
> > > > I compiled my driver (Targeted to Windows 2000), using the Windows
> > > > 2000 Build Environment of the Windows Server 2003 DDK.
> > > > It did solved my “PsDereferencePrimaryToken” linkage problem, BUT, I
> > still
> > > > have a problem with alldvrm: "unresolved external symbol alldvrm
> > > > referenced in function…“
> > > > I know this function is for dividing of Large Integers, BUT I don’t
> > > > understand why it try to link to this function although I’m working
with
> > > > Windows 2000 Env.
> > > > I looked in a filemon, and noticed that the compiler/linker looking
for
> > .h
> > > > files and .lib files only in the 2000 Env directories.
> > > > I searched in the Web and found out a thread that describes a BUG
> > Microsoft
> > > > has with this issue, here is the link to the thread (just typed in
> > Google
> > > > groups: alldvrm DDK):
> > > >
> > >
> >
>
http://groups-beta.google.com/group/comp.os.ms-windows.programmer.nt.kernel-mode/browse_frm/thread/ea5f8d6dd34b4333/d008e13f3c0c6ef6?q=alldvrm+DDK&rnum=1&hl=en#d008e13f3c0c6ef6
> > > >
> > > > Please let me know if you know something about it, or else - is
there a
> > way
> > > > that I can compile and LINK my code with the 2003 DDK…
> > > > Best way to check this issue:
> > > > 1. Write a simple driver that does arithmetic operations on INT64
data
> > types
> > > > in his DriverEntry
> > > > 2. Try to compile (a release version) of this driver with 2003 DDK,
when
> > > > Windows 2000 Env is configured
> > > > 3. You’ll get this problem
> > > >
> > > > Hope to get answers…
> > > >
> > > > Thanks
> > > >
> > > > Alon
> > > >
> > > > “Alon Elhanani” wrote in message
news:xxxxx@ntdev…
> > > > > Hi
> > > > >
> > > > > Thanks a lot for your comprehensive answer.
> > > > > Can you please instruct me the exact way how do I
> > > > > configure the 2003 DDK to use the Windows 2000 Build
> > > > > Environment?
> > > > >
> > > > > Thanks
> > > > >
> > > > > Alon
> > > > >
> > > > > Subject: Re: Compilng and Linking Windows 2000
> > > > > compatible driver with
> > > > > DDK 2003
> > > > > From: “Thomas F. Divine”
> > > > > Date: Tue, 19 Apr 2005 14:11:32 -0400
> > > > > X-Message-Number: 24
> > > > >
> > > > >
> > > > > “Alon Elhanani” wrote in message
> > > > > news:xxxxx@ntdev…
> > > > > > Hi!
> > > > > >
> > > > > > I’m trying to compile my driver (running on Windows
> > > > > > 2000, Windows XP SP1, SP2), with the new 2003 DDK.
> > > > > > I have a missing function problem.
> > > > > > First I had problem with “PsDereferencePrimaryToken”
> > > > > > and “PsDereferenceImpersonationToken” which changed
> > > > > > from Macros in Windows 2000 DDK to function in 2003
> > > > > > DDK - My solution was to re-define the macro and
> > > > > load
> > > > > > these functions dynamically (with
> > > > > > MmGetSystemRoutineAddress function)
> > > > > > Now I still can not load my driver due to a missing
> > > > > > “_alldvrm” function.
> > > > > > I found a thread from the past regarding this issue
> > > > > > but I still didn’t understand what is the solution
> > > > > for
> > > > > > the runtime problem - if any.
> > > > > > Generally I was told that it is better to work with
> > > > > > 2003 DDK - I will be happy to do so AL TOUGH my
> > > > > driver
> > > > > > should still be running on Windows 2000 machines
> > > > > > I will be happy to know what are my options to do so
> > > > > > (If any…)
> > > > > >
> > > > >
> > > > > Yes, it is certainly best to use the latest DDK.
> > > > > Contrary to the
> > > > > distant
> > > > > path, these days each new DDK offers bug fixes to
> > > > > (some) driver samples
> > > > > and
> > > > > enhanced compilers and tools (e.g., PreFast).
> > > > >
> > > > > On the other hand, if your driver is to be built to
> > > > > the “lowest common
> > > > > denominator” (Windows 2000) you should use the Windows
> > > > > 2000 Build
> > > > > Environment of the Windows Server 2003 DDK.
> > > > >
> > > > > Using the latest Windows Server 2003 SP1 DDK you will
> > > > > find functions
> > > > > that
> > > > > are deprecated or even removed based on the Build
> > > > > Environment that you
> > > > > select. For example, routines that are specified to be
> > > > > “reserved for
> > > > > system
> > > > > use” in the Windows Server 2003 DDK will compile and
> > > > > link if the
> > > > > Windows XP
> > > > > Build Environment is used, but are missing (using the
> > > > > same DDK) if the
> > > > > Windows Server 2003 build environment is used.
> > > > >
> > > > > So, use 1.) the latest DDK and 2.) the 'lowest common
> > > > > denominator”
> > > > > Build
> > > > > Environment from that DDK.
> > > > >
> > > > > Good luck,
> > > > >
> > > > > Thomas F. Divine, Windows DDK MVP
> > > > > http://www.pcausa.com
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > __________________________________
> > > > > Do you Yahoo!?
> > > > > Plan great trips with Yahoo! Travel: Now over 17,000 guides!
> > > > > http://travel.yahoo.com/p-travelguide
> > > > >
> > > >
> > > >
> > > >
> > > > —
> > > > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> > > >
> > > > You are currently subscribed to ntdev as:
> > xxxxx@compaqnet.be
> > > > 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@compaqnet.be
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>

NO problems at my front :slight_smile: and NO linking errors !

I used the 2600 DDK version ; target XP

PUBLIC _func1@4
EXTRN __alldvrm:NEAR
; Function compile flags: /Ogsy
; File f:\winddk\2600\src\storage\ramdis~1.1\sys_53~1.2\ramdisk.c
; COMDAT _func1@4
_TEXT SEGMENT
tv131 = -8
_Param$ = 8
xxxxx@4 PROC NEAR ; COMDAT

; 58 : {

00000 55 push ebp
00001 8b ec mov ebp, esp
00003 51 push ecx
00004 51 push ecx

; 59 :
; 60 : INT64 Var1 = Param ;

00005 8b 45 08 mov eax, DWORD PTR _Param$[ebp]
00008 53 push ebx
00009 33 c9 xor ecx, ecx

; 61 :
; 62 : UINT Var2 = (UINT)NS_TO_MS(Var1) ;

0000b 51 push ecx
0000c 68 10 27 00 00 push 10000 ; 00002710H
00011 51 push ecx
00012 50 push eax
00013 e8 00 00 00 00 call __alldvrm
00018 85 db test ebx, ebx
0001a 89 55 fc mov DWORD PTR tv131[ebp+4], edx
0001d 5b pop ebx
0001e 7c 0f jl SHORT $L15685
00020 7f 08 jg SHORT $L15688
00022 81 f9 88 13 00
00 cmp ecx, 5000 ; 00001388H
00028 76 05 jbe SHORT $L15685
$L15688:
0002a 33 c9 xor ecx, ecx
0002c 41 inc ecx
0002d eb 02 jmp SHORT $L15686
$L15685:
0002f 33 c9 xor ecx, ecx
$L15686:
00031 03 c1 add eax, ecx

; 63 :
; 64 : return Var2 ;
; 65 :
; 66 : }

----- Original Message -----
From: “Alon Elhanani”
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”
Sent: Tuesday, April 26, 2005 7:05 PM
Subject: Re:[ntdev] Re:Re:Compilng and Linking Windows 2000 compatible driver with

> Hi!
>
> I tried your code in it worked OK.
> BUT - I have for you code that I beleive will not link even for you
> Please insert the following code to your example and let me know the
> results…(I get the “error LNK2001: unresolved external symbol __alldvrm”)
>
> // converts nano second to microsecond and “round of”
> #define NS_TO_MS(hns) (INT64)((hns)/10000i64 +
> ((((hns)%10000i64)>(10000i64/2))?1:0))
> UINT func1( UINT32 Param )
>
> {
>
> INT64 Var1 = Param ;
>
> UINT Var2 = (UINT)NS_TO_MS(Var1) ;
>
> return Var2 ;
>
> }
>
>
>
> Thanks
>
> Alon
>
> “Christiaan Ghijselinck” wrote in
> message news:xxxxx@ntdev…
> >
> >
> >
> > > Thanks, but some more questions:
> > > 1. It’s is written in the DDK documentation that these functions are
> > > obsolete - what is the “trade of” of not using the compiler support?
> > > 2. Does Microsoft aware of this bug in their DDK Environment?
> >
> > I am not sure if it is a bug ! But after all, I personally have no
> problem with for example this :
> >
> > LONGLONG A = 5 ;
> > LONGLONG B = 3 ;
> > LONGLONG Q ;
> > LONGLONG REM ;
> >
> > Q = A / B ;
> > REM = A % B ;
> >
> > Are you sure you use the correct compiler version and linker and libraries
> ?
> > Always use the “official” DDK BUILD utility and environment in the first
> place.
> >
> >
> > > 3. Is there an option to enable/disable for this optimization in a
> specific
> > > piece of code?
> >
> > I am not aware of such an option
> >
> >
> > Note : do not mail me using my personal E-mail address from this forum :
> if questions are asked here,
> > it remains the intention that everyone may read them.
> >
> >
> > >
> > > Thanks
> > >
> > > Alon
> > >
> > > “Christiaan Ghijselinck” wrote in
> > > message news:xxxxx@ntdev…
> > > >
> > > > Use the run time library routines such as “RtlLargeIntegerDivide” and
> > > similar …
> > > >
> > > > C.
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: “Alon Elhanani”
> > > > Newsgroups: ntdev
> > > > To: “Windows System Software Devs Interest List”
> > > > Sent: Tuesday, April 26, 2005 12:22 PM
> > > > Subject: Re:[ntdev] Compilng and Linking Windows 2000 compatible
> driver
> > > with
> > > >
> > > >
> > > > > Hi again!
> > > > >
> > > > > I compiled my driver (Targeted to Windows 2000), using the Windows
> > > > > 2000 Build Environment of the Windows Server 2003 DDK.
> > > > > It did solved my “PsDereferencePrimaryToken” linkage problem, BUT, I
> > > still
> > > > > have a problem with__alldvrm: “unresolved external symbol __alldvrm
> > > > > referenced in function…”
> > > > > I know this function is for dividing of Large Integers, BUT I don’t
> > > > > understand why it try to link to this function although I’m working
> with
> > > > > Windows 2000 Env.
> > > > > I looked in a filemon, and noticed that the compiler/linker looking
> for
> > > .h
> > > > > files and .lib files only in the 2000 Env directories.
> > > > > I searched in the Web and found out a thread that describes a BUG
> > > Microsoft
> > > > > has with this issue, here is the link to the thread (just typed in
> > > Google
> > > > > groups: alldvrm DDK):
> > > > >
> > > >
> > >
> >
>
http://groups-beta.google.com/group/comp.os.ms-windows.programmer.nt.kernel-mode/browse_frm/thread/ea5f8d6dd34b4333/d008e13f3c0c6ef6?q=alldvrm+DDK&rnum=1&hl=en#d008e13f3c0c6ef6
> > > > >
> > > > > Please let me know if you know something about it, or else - is
> there a
> > > way
> > > > > that I can compile and LINK my code with the 2003 DDK…
> > > > > Best way to check this issue:
> > > > > 1. Write a simple driver that does arithmetic operations on INT64
> data
> > > types
> > > > > in his DriverEntry
> > > > > 2. Try to compile (a release version) of this driver with 2003 DDK,
> when
> > > > > Windows 2000 Env is configured
> > > > > 3. You’ll get this problem
> > > > >
> > > > > Hope to get answers…
> > > > >
> > > > > Thanks
> > > > >
> > > > > Alon
> > > > >
> > > > > “Alon Elhanani” wrote in message
> news:xxxxx@ntdev…
> > > > > > Hi
> > > > > >
> > > > > > Thanks a lot for your comprehensive answer.
> > > > > > Can you please instruct me the exact way how do I
> > > > > > configure the 2003 DDK to use the Windows 2000 Build
> > > > > > Environment?
> > > > > >
> > > > > > Thanks
> > > > > >
> > > > > > Alon
> > > > > >
> > > > > > Subject: Re: Compilng and Linking Windows 2000
> > > > > > compatible driver with
> > > > > > DDK 2003
> > > > > > From: “Thomas F. Divine”
> > > > > > Date: Tue, 19 Apr 2005 14:11:32 -0400
> > > > > > X-Message-Number: 24
> > > > > >
> > > > > >
> > > > > > “Alon Elhanani” wrote in message
> > > > > > news:xxxxx@ntdev…
> > > > > > > Hi!
> > > > > > >
> > > > > > > I’m trying to compile my driver (running on Windows
> > > > > > > 2000, Windows XP SP1, SP2), with the new 2003 DDK.
> > > > > > > I have a missing function problem.
> > > > > > > First I had problem with “PsDereferencePrimaryToken”
> > > > > > > and “PsDereferenceImpersonationToken” which changed
> > > > > > > from Macros in Windows 2000 DDK to function in 2003
> > > > > > > DDK - My solution was to re-define the macro and
> > > > > > load
> > > > > > > these functions dynamically (with
> > > > > > > MmGetSystemRoutineAddress function)
> > > > > > > Now I still can not load my driver due to a missing
> > > > > > > "alldvrm" function.
> > > > > > > I found a thread from the past regarding this issue
> > > > > > > but I still didn’t understand what is the solution
> > > > > > for
> > > > > > > the runtime problem - if any.
> > > > > > > Generally I was told that it is better to work with
> > > > > > > 2003 DDK - I will be happy to do so AL TOUGH my
> > > > > > driver
> > > > > > > should still be running on Windows 2000 machines
> > > > > > > I will be happy to know what are my options to do so
> > > > > > > (If any…)
> > > > > > >
> > > > > >
> > > > > > Yes, it is certainly best to use the latest DDK.
> > > > > > Contrary to the
> > > > > > distant
> > > > > > path, these days each new DDK offers bug fixes to
> > > > > > (some) driver samples
> > > > > > and
> > > > > > enhanced compilers and tools (e.g., PreFast).
> > > > > >
> > > > > > On the other hand, if your driver is to be built to
> > > > > > the “lowest common
> > > > > > denominator” (Windows 2000) you should use the Windows
> > > > > > 2000 Build
> > > > > > Environment of the Windows Server 2003 DDK.
> > > > > >
> > > > > > Using the latest Windows Server 2003 SP1 DDK you will
> > > > > > find functions
> > > > > > that
> > > > > > are deprecated or even removed based on the Build
> > > > > > Environment that you
> > > > > > select. For example, routines that are specified to be
> > > > > > “reserved for
> > > > > > system
> > > > > > use” in the Windows Server 2003 DDK will compile and
> > > > > > link if the
> > > > > > Windows XP
> > > > > > Build Environment is used, but are missing (using the
> > > > > > same DDK) if the
> > > > > > Windows Server 2003 build environment is used.
> > > > > >
> > > > > > So, use 1.) the latest DDK and 2.) the 'lowest common
> > > > > > denominator"
> > > > > > Build
> > > > > > Environment from that DDK.
> > > > > >
> > > > > > Good luck,
> > > > > >
> > > > > > Thomas F. Divine, Windows DDK MVP
> > > > > > http://www.pcausa.com
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
_______________________
> > > > > > Do you Yahoo!?
> > > > > > Plan great trips with Yahoo! Travel: Now over 17,000 guides!
> > > > > > http://travel.yahoo.com/p-travelguide
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > —
> > > > > Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256
> > > > >
> > > > > You are currently subscribed to ntdev as:
> > > xxxxx@compaqnet.be
> > > > > 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@compaqnet.be
> > > 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@compaqnet.be
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Alon Elhanani wrote:

Hi!

I tried your code in it worked OK.
BUT - I have for you code that I beleive will not link even for you
Please insert the following code to your example and let me know the
results…(I get the “error LNK2001: unresolved external symbol __alldvrm”)

// converts nano second to microsecond and “round of”
#define NS_TO_MS(hns) (INT64)((hns)/10000i64 +
((((hns)%10000i64)>(10000i64/2))?1:0))
UINT func1( UINT32 Param )
{
INT64 Var1 = Param ;
UINT Var2 = (UINT)NS_TO_MS(Var1) ;
return Var2 ;
}

Right. This works in a debug build, because the compiler calls __alldiv
and __allrem separately, and those ARE defined in the W2K version of
libcntpr.lib. It’s only when you turn on optimizations that the VC++7.1
compiler calls the more efficient __alldvrm to do both operations at once.

One rather icky solution would be to copy lib\wxp\i386\libcntpr.lib over
the top of lib\w2k\i386\libcntpr.lib. libcntpr contains only the
run-time library routines, so there shouldn’t be any version issues.
However, I have not tried this…


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Christiaan - Did you suceess to build a free build of the driver?? I’m
trying to use Windows Server 2003 DDK (3790) - Release version (free)
anyway, it looks to me that the overriding of the lib of XP over the 2K is
not such good/safe solution…
So I go back to my original questions:

  1. Does Microsoft aware of this problem? Any reponse from them? I don’t ask
    for too much - Only compile a Windows 2000 targeted Driver with the recent
    DDK with all of it’s tools and enhacments…
  2. Any other safer solution than overrding libs? maybe disable optimization
    for a specific section of code? any other idea??

Thanks

Alon

“Tim Roberts” wrote in message news:xxxxx@ntdev…
> Alon Elhanani wrote:
>
> >Hi!
> >
> >I tried your code in it worked OK.
> >BUT - I have for you code that I beleive will not link even for you
> >Please insert the following code to your example and let me know the
> >results…(I get the “error LNK2001: unresolved external symbol
__alldvrm”)
> >
> >// converts nano second to microsecond and “round of”
> >#define NS_TO_MS(hns) (INT64)((hns)/10000i64 +
> >((((hns)%10000i64)>(10000i64/2))?1:0))
> >UINT func1( UINT32 Param )
> >{
> >INT64 Var1 = Param ;
> >UINT Var2 = (UINT)NS_TO_MS(Var1) ;
> >return Var2 ;
> >}
> >
> >
>
> Right. This works in a debug build, because the compiler calls__alldiv
> and allrem separately, and those ARE defined in the W2K version of
> libcntpr.lib. It’s only when you turn on optimizations that the VC++7.1
> compiler calls the more efficient
alldvrm to do both operations at once.
>
> One rather icky solution would be to copy lib\wxp\i386\libcntpr.lib over
> the top of lib\w2k\i386\libcntpr.lib. libcntpr contains only the
> run-time library routines, so there shouldn’t be any version issues.
> However, I have not tried this…
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>

>

One rather icky solution would be to copy lib\wxp\i386\libcntpr.lib over
the top of lib\w2k\i386\libcntpr.lib. libcntpr contains only the
run-time library routines, so there shouldn’t be any version issues.
However, I have not tried this…

Not recommended I think … A better way would be to extract the OBJ file
( assume alldvrm.obj ) from the XP lib , and put it back into a private lib with
custom name, then add the library to the TARGETLIBS in the SOURCES
file. And even then , one has to reverse engineer if the __Alldrvm procedure
is really stand alone , thus not calling other sub procedures.

Christiaan


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


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

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

Yes, with target “xp”. You may find the result here :

http://users.skynet.be/mysoft/RAMDISK.SYS.zip

To build , I start “DRVBUILD.bat RamDisk free F:\WINDDK\3790” , but that is
just a wrapper for %BASEDIR%\bin\setenv.bat and build.exe ( via _build.bat )

Your code is added in ramdisk.c , just before DriverEntry. The assembly output
is generated in \SYS\objfre_wnet_x86\i386\ramdisk.cod. See also \SYS\Ramdisk.log

Christiaan

----- Original Message -----
From: “Alon Elhanani”
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”
Sent: Tuesday, April 26, 2005 8:48 PM
Subject: Re:[ntdev] Re:Re:Compilng and Linking Windows 2000 compatible driver with

> Christiaan - Did you suceess to build a free build of the driver?? I’m
> trying to use Windows Server 2003 DDK (3790) - Release version (free)
> anyway, it looks to me that the overriding of the lib of XP over the 2K is
> not such good/safe solution…
> So I go back to my original questions:
> 1. Does Microsoft aware of this problem? Any reponse from them? I don’t ask
> for too much - Only compile a Windows 2000 targeted Driver with the recent
> DDK with all of it’s tools and enhacments…
> 2. Any other safer solution than overrding libs? maybe disable optimization
> for a specific section of code? any other idea??
>
> Thanks
>
> Alon
>
> “Tim Roberts” wrote in message news:xxxxx@ntdev…
> > Alon Elhanani wrote:
> >
> > >Hi!
> > >
> > >I tried your code in it worked OK.
> > >BUT - I have for you code that I beleive will not link even for you
> > >Please insert the following code to your example and let me know the
> > >results…(I get the “error LNK2001: unresolved external symbol
> __alldvrm”)
> > >
> > >// converts nano second to microsecond and “round of”
> > >#define NS_TO_MS(hns) (INT64)((hns)/10000i64 +
> > >((((hns)%10000i64)>(10000i64/2))?1:0))
> > >UINT func1( UINT32 Param )
> > >{
> > >INT64 Var1 = Param ;
> > >UINT Var2 = (UINT)NS_TO_MS(Var1) ;
> > >return Var2 ;
> > >}
> > >
> > >
> >
> > Right. This works in a debug build, because the compiler calls__alldiv
> > and allrem separately, and those ARE defined in the W2K version of
> > libcntpr.lib. It’s only when you turn on optimizations that the VC++7.1
> > compiler calls the more efficient
alldvrm to do both operations at once.
> >
> > One rather icky solution would be to copy lib\wxp\i386\libcntpr.lib over
> > the top of lib\w2k\i386\libcntpr.lib. libcntpr contains only the
> > run-time library routines, so there shouldn’t be any version issues.
> > However, I have not tried this…
> >
> > –
> > Tim Roberts, xxxxx@probo.com
> > Providenza & Boekelheide, Inc.
> >
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@compaqnet.be
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Christiaan Ghijselinck wrote:

>One rather icky solution would be to copy lib\wxp\i386\libcntpr.lib over
>the top of lib\w2k\i386\libcntpr.lib. libcntpr contains only the
>run-time library routines, so there shouldn’t be any version issues.
>However, I have not tried this…
>
Not recommended I think …

No, but we’re talking about working around a bug here.

A better way would be to extract the OBJ file
( assume alldvrm.obj ) from the XP lib , and put it back into a private lib with
custom name, then add the library to the TARGETLIBS in the SOURCES
file. And even then , one has to reverse engineer if the __Alldrvm procedure
is really stand alone , thus not calling other sub procedures.

No, it stands very much alone… I was going to just cut-and-paste the
MASM code, but it’s 60 or 70 instructions and I lost interest.

The object file is lldvrm.obj. The unsigned version is ulldvrm.obj.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

>

The object file is lldvrm.obj. The unsigned version is ulldvrm.obj.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

… and to make the job complete :

B:\>F:\WINDDK\3790\bin\x86\lib.exe libc.lib /LIST
Microsoft (R) Library Manager Version 7.10.2179
Copyright (C) Microsoft Corporation. All rights reserved.

obj\i386\ullshr.obj
obj\i386\ullrem.obj
obj\i386\ulldvrm.obj
obj\i386\ulldiv.obj
obj\i386\llshr.obj
obj\i386\llshl.obj
obj\i386\llrem.obj
obj\i386\llmul.obj
obj\i386\lldvrm.obj
obj\i386\lldiv.obj

B:\>F:\WINDDK\3790\bin\x86\lib.exe libc.lib /EXTRACT:obj\i386\llddvrm.obj
Microsoft (R) Library Manager Version 7.10.2179
Copyright (C) Microsoft Corporation. All rights reserved.

B:\>F:\WINDDK\3790\bin\x86\link.exe -lib /OUT:lldvrm.lib lldvrm.obj
Microsoft (R) Library Manager Version 7.10.2179
Copyright (C) Microsoft Corporation. All rights reserved.

B:\>dir *.lib
Volume in drive B is RAMDriv
Volume Serial Number is 1234-ABCD

Directory of B:\

03/05/2003 08:52p 2,714,294 libc.lib
04/26/2005 09:10p 2,568 lldvrm.lib
2 File(s) 2,716,862 bytes
0 Dir(s) 174,848,512 bytes free

Well, with all the answers/suggestions, I really lost you somehow…
I think I saw the following options:

  1. Use RtlLargeIntegerXXX fucntions (which are obsolete
  2. Use the XP/2003 Libs instead the 2K
  3. Use the obj’s (how?)
  4. Report about the problem Microsoft (any way to check if they already
    have it reported??)
  5. Other idea?

Which one is the best to your opinion?
Option 3 - I’m not sure I got you how to do it…

Thanks

Alon

“Christiaan Ghijselinck” wrote in
message news:xxxxx@ntdev…
>
> >
> > The object file is lldvrm.obj. The unsigned version is ulldvrm.obj.
> >
> > –
> > Tim Roberts, xxxxx@probo.com
> > Providenza & Boekelheide, Inc.
> >
>
> … and to make the job complete :
>
> B:>F:\WINDDK\3790\bin\x86\lib.exe libc.lib /LIST
> Microsoft (R) Library Manager Version 7.10.2179
> Copyright (C) Microsoft Corporation. All rights reserved.
> …
> obj\i386\ullshr.obj
> obj\i386\ullrem.obj
> obj\i386\ulldvrm.obj
> obj\i386\ulldiv.obj
> obj\i386\llshr.obj
> obj\i386\llshl.obj
> obj\i386\llrem.obj
> obj\i386\llmul.obj
> obj\i386\lldvrm.obj
> obj\i386\lldiv.obj
> …
>
> B:>F:\WINDDK\3790\bin\x86\lib.exe libc.lib /EXTRACT:obj\i386\llddvrm.obj
> Microsoft (R) Library Manager Version 7.10.2179
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> B:>F:\WINDDK\3790\bin\x86\link.exe -lib /OUT:lldvrm.lib lldvrm.obj
> Microsoft (R) Library Manager Version 7.10.2179
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> B:>dir *.lib
> Volume in drive B is RAMDriv
> Volume Serial Number is 1234-ABCD
>
> Directory of B:<br>>
> 03/05/2003 08:52p 2,714,294 libc.lib
> 04/26/2005 09:10p 2,568 lldvrm.lib
> 2 File(s) 2,716,862 bytes
> 0 Dir(s) 174,848,512 bytes free
>
>
>

Alon Elhanani wrote:

Well, with all the answers/suggestions, I really lost you somehow…
I think I saw the following options:

  1. Use RtlLargeIntegerXXX fucntions (which are obsolete
  2. Use the XP/2003 Libs instead the 2K
  3. Use the obj’s (how?)

Christiaan’s instructions show you how to extract the necessary routines
to a separate library, called lldvrm.lib. All you have to do is add
that library to your list of TARGETLIBS in your SOURCES file.

  1. Report about the problem Microsoft (any way to check if they already
    have it reported??)

Microsoft is extremely unlikely to do anything official about this.
Windows 2000 is practically an antique by this point.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Are you building a driver? If it was me, I would just copy the int64.lib from either WNET or WXP to the W2K directory in the ddk. This is only a static library and has no imports. Ought to be pretty darned safe. The only things in this library are the 64 bit arithmetic routines and I don’t think that math is any different on W2K than it is on WXP or WNET. Save the old one in W2K if you want to.

As an alternative, can you target the particular kind of driver you're building to WNET or XP instead of W2K? That will also solve this problem.
Jerry.
xxxxx@lists.osr.com wrote: -----

>To: "Windows System Software Devs Interest List"
>
>From: "Alon Elhanani"
>Sent by: xxxxx@lists.osr.com
>Date: 04/26/2005 07:03PM
>Subject: Re:[ntdev] Compilng and Linking Windows 2000 compatible
>driver with
>
>Well, with all the answers/suggestions, I really lost you somehow...
>I think I saw the following options:
>1. Use RtlLargeIntegerXXX fucntions (which are obsolete
>2. Use the XP/2003 Libs instead the 2K
>3. Use the obj's (how?)
>4. Report about the problem Microsoft (any way to check if they
>already
>have it reported??)
>5. Other idea?
>
>Which one is the best to your opinion?
>Option 3 - I'm not sure I got you how to do it...
>
>Thanks
>
>Alon
>
>"Christiaan Ghijselinck" wrote in
>message news:xxxxx@ntdev...
>>
>> >
>> > The object file is lldvrm.obj. The unsigned version is
>ulldvrm.obj.
>> >
>> > --
>> > Tim Roberts, xxxxx@probo.com
>> > Providenza & Boekelheide, Inc.
>> >
>>
>> ... and to make the job complete :
>>
>>B:\>F:\WINDDK\3790\bin\x86\lib.exe libc.lib /LIST
>> Microsoft (R) Library Manager Version 7.10.2179
>> Copyright (C) Microsoft Corporation. All rights reserved.
>> .......
>> obj\i386\ullshr.obj
>> obj\i386\ullrem.obj
>> obj\i386\ulldvrm.obj
>> obj\i386\ulldiv.obj
>> obj\i386\llshr.obj
>> obj\i386\llshl.obj
>> obj\i386\llrem.obj
>> obj\i386\llmul.obj
>> obj\i386\lldvrm.obj
>> obj\i386\lldiv.obj
>> .......
>>
>>B:\>F:\WINDDK\3790\bin\x86\lib.exe libc.lib
>/EXTRACT:obj\i386\llddvrm.obj
>> Microsoft (R) Library Manager Version 7.10.2179
>> Copyright (C) Microsoft Corporation. All rights reserved.
>>
>>B:\>F:\WINDDK\3790\bin\x86\link.exe -lib /OUT:lldvrm.lib
>lldvrm.obj
>> Microsoft (R) Library Manager Version 7.10.2179
>> Copyright (C) Microsoft Corporation. All rights reserved.
>>
>>B:\>dir *.lib
>> Volume in drive B is RAMDriv
>> Volume Serial Number is 1234-ABCD
>>
>> Directory of B:\
>>
>> 03/05/2003 08:52p 2,714,294 libc.lib
>> 04/26/2005 09:10p 2,568 lldvrm.lib
>> 2 File(s) 2,716,862 bytes
>> 0 Dir(s) 174,848,512 bytes free
>>
>>
>>
>
>
>
>---
>Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@attotech.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com