Will a 32bit driver compiled for the 64bit o/s always work? If there is a chance it won’t, what problems am I looking for?
Microsoft has a whole section of the WDK documentation on this see
http://msdn.microsoft.com/en-us/library/aa489627.aspx
–
Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
wrote in message news:xxxxx@ntdev…
>
> Will a 32bit driver compiled for the 64bit o/s always work? If there is a
> chance it won’t, what problems am I looking for?
>
>
> Information from ESET NOD32 Antivirus, version of virus
> signature database 4694 (20091216)
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
Information from ESET NOD32 Antivirus, version of virus signature database 4694 (20091216)
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
There is a whole 64 bit guideline section on whdc
http://www.microsoft.com/whdc/driver/64bitguide.mspx
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Wednesday, December 16, 2009 10:32 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Converting 32bit Driver.
Will a 32bit driver compiled for the 64bit o/s always work? If there is a chance it won’t, what problems am I looking for?
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Hey thanks.
This is only to save a bit of time. Just two questions.
If I wrote two 32bit compatible libs, do I need to edit them if I wanted to include them in the 64bit driver? I assume there would be no difference and I would have to edit those too.
Also should I recompile the new 64bit driver as a winxp 32bit driver would it work on WinXP?
The answer to both your first question and your second question is the same - on a 32 bit system, everything used in a driver has to be 32 bit, on a 64 bit system, everything has to be 64 bit.
That being said, in my opinion, you would do well to read the docs that Don and Doron referenced. You won’t be saving yourself anytime by not doing so.
Good luck,
mm
I am reading.
What I was curious about, since this is DDK and I have only limited access to a 64bit os at the moment while my computer is down. Is can I test the 64bit driver (as long as the code has been compiled for the 32bit o/s.) on a 32bit o/s? Its only because I know I can’t always do it the otherway around.
Anyway, thankyou, yes I am reading.
Another way of asking that same question, I think, is “can one set of source code work on both 32-bit and 64-bit systems.” And the answer is yes.
Will the same CODE PATHS be executed? Not necessarily. Will the structure alignment be the same? No.
So, it’s not really “testing your 64-bit driver” it’s testing your “64-bit capable when compiled for 64-bit, 32-bit driver”…
Peter
OSR
A well written driver will work in either environment depending on how it is
compiled. If you compile with /W4 and use PreFast doing this for both 32
and 64 bit you will find a lot of the problems before testing.
–
Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
wrote in message news:xxxxx@ntdev…
>I am reading.
>
> What I was curious about, since this is DDK and I have only limited access
> to a 64bit os at the moment while my computer is down. Is can I test the
> 64bit driver (as long as the code has been compiled for the 32bit o/s.) on
> a 32bit o/s? Its only because I know I can’t always do it the otherway
> around.
>
> Anyway, thankyou, yes I am reading.
>
>
> Information from ESET NOD32 Antivirus, version of virus
> signature database 4694 (20091216)
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
Information from ESET NOD32 Antivirus, version of virus signature database 4694 (20091216)
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
xxxxx@hotmail.com wrote:
What I was curious about, since this is DDK and I have only limited access to a 64bit os at the moment while my computer is down. Is can I test the 64bit driver (as long as the code has been compiled for the 32bit o/s.) on a 32bit o/s? Its only because I know I can’t always do it the otherway around.
The question doesn’t mean anything. If your driver has been compiled
for a 32-bit system, then it is a 32-bit driver. You can certainly do
most of your debugging in a 32-bit world, if that’s where you’re
comfortable, but you’ll want to do your testing in 64-bit as well.
Typically, you use the exact same source code to produce the two
binaries, but a 32-bit system requires 32-bit driver binaries, and a
64-bit system requires 64-bit driver binaries.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Thankyou.
I do understand that. My question was about my code, because if I compile it as 32bit it works fine but if I compile it for 64bit and test it on a 64bit o/s it doesn’t.
Anyway I am reading the stuff Doron kindly sent so I’ll be back if I have any questions.
and thanks for the good luck MM. I’ll need it.
> Will a 32bit driver compiled for the 64bit o/s always work? If there is a chance it won’t, what problems
am I looking for?
I think there were guidelines in MSDN Library.
Pointers no more fit ULONG, they require ULONG_PTR. Also, the size_t datatype is 64bit on x64, this includes the pointer difference.
Proper use of size_t instead of ULONG everywhere gets rid of most of these problems.
Also, if the IOCTL structures contain handles or pointers, then the driver must be aware of whether the calling process is 32bit or 64bit.
–
Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com
> Also should I recompile the new 64bit driver as a winxp 32bit driver would it work on WinXP?
After you will clean up the source according to x64 guidelines, you will be able to build both 32 and 64 bit versions from the very same source.
–
Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com
Thankyou very much Maxim that was the answer I thought. Thankyou.
Ok. I’ve done all that but the driver still doesn’t load. So I began stripping it of everything and this is what I ended up with.
#include <ntddk.h>
NTSTATUS DriverEntry (IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING pRegistryPath)
{
DbgPrint(“DriverEntry Entered.\n”);
DbgPrint(“Built %s %s\n”, DATE , TIME );
return STATUS_SUCCESS;
}
—
Yes it is that simple. I haven’t tried compiling this for a 32bit machine because I strongly believe it will work, anyways I compiled this for both Vista x86 and Vista ia64, neither work. After I load them manually via the ‘manual’ part of the hardware wizard I get the errors.
(Please note these have been translated from German.)
In the device Installation, a mistake appeared.
Driver is not planned for this platform.
My SOURCES file is this.
TARGETNAME = DriverName
TARGETPATH = obj
TARGETTYPE = DRIVER
INCLUDES = $(BASEDIR)\src\storage\inc;$(BASEDIR)\inc
TARGETLIBS = $(DDK_LIB_PATH)\scsiport.lib <br> $(DDK_LIB_PATH)\ntoskrnl.lib <br> $(DDK_LIB_PATH)\ntstrsafe.lib
SOURCES = MyDriver.c
Is there anything I am doing wrong? Please can someone point it out.
Thanks.</ntddk.h>
I am using the following to INF install.
[Version]
Signature = “$Windows NT$”
Class = SCSIAdapter
ClassGUID = {4D36E97B-E325-11CE-BFC1-08002BE10318}
Provider = %MADE_BY%
DriverVer = 10/10/2006,1.0
CatalogFile = DriverName.cat
[DestinationDirs]
DefaultDestDir = 12 ; system32/drivers
[SourceDisksNames]
1 = %DISKNAME%
[SourceDisksFiles]
DriverName.sys = 1
[Manufacturer]
%MADE_BY% = Models,NTamd64
[Models.NTamd64]
%DriverName.DeviceDesc% = DriverName, root\DriverNameVD ; hardware id
[DriverName]
CopyFiles = @DriverName.sys
LogConfig = DriverName.LogConfig
[DriverName.LogConfig]
ConfigPriority = DESIRED
[DriverName.Services]
AddService = DriverName, 0x00000002, DriverNameService
[DriverNameService]
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 0 ; SERVICE_ERROR_IGNORE
LoadOrderGroup = SCSI Miniport
ServiceBinary = %12%\DriverName.sys
AddReg = DriverName_AddReg
[DriverName_AddReg]
HKR,“Parameters\PnpInterface”, “1”, 0x00010001, 0x00000001
HKR,“NumberOfDrives”, 0x00010001, 0x00000001
HKLM,“SYSTEM\CurrentControlSet\Services\DriverName\Drives\1”, “Path”, 0x00020000,“”
HKLM,“SYSTEM\CurrentControlSet\Services\DriverName\Drives\2”, “Path”, 0x00020000,“”
HKLM,“SYSTEM\CurrentControlSet\Services\DriverName\Drives\3”, “Path”, 0x00020000,“”
HKLM,“SYSTEM\CurrentControlSet\Services\DriverName\Drives\4”, “Path”, 0x00020000,“”
HKLM,“SYSTEM\CurrentControlSet\Services\DriverName\Drives\5”, “Path”, 0x00020000,“”
HKLM,“SYSTEM\CurrentControlSet\Services\DriverName\Drives\6”, “Path”, 0x00020000,“”
HKLM,“SYSTEM\CurrentControlSet\Services\DriverName\Drives\7”, “Path”, 0x00020000,“”
HKLM,“SYSTEM\CurrentControlSet\Services\DriverName\Drives\8”, “Path”, 0x00020000,“”
[Strings]
DriverName.DeviceDesc = “DriverName Virtual Drive Adapter”
MADE_BY = “MADEBY”
DISKNAME = “Install Disk”
Hello,
try building for x64 instead of ia64 and load. then see what happens.
thanks,
–rc
On Thu, Dec 17, 2009 at 7:03 AM, wrote:
> Thankyou very much Maxim that was the answer I thought. Thankyou.
>
> Ok. I’ve done all that but the driver still doesn’t load. So I began stripping it of everything and this is what I ended up with.
>
> —
> #include <ntddk.h>
>
> NTSTATUS DriverEntry (IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING pRegistryPath)
> {
> DbgPrint(“DriverEntry Entered.\n”);
> DbgPrint(“Built %s %s\n”, DATE , TIME );
>
> return STATUS_SUCCESS;
> }
>
> —
>
> Yes it is that simple. I haven’t tried compiling this for a 32bit machine because I strongly believe it will work, anyways I compiled this for both Vista x86 and Vista ia64, neither work. After I load them manually via the ‘manual’ part of the hardware wizard I get the errors.
> (Please note these have been translated from German.)
>
> In the device Installation, a mistake appeared.
>
> Driver is not planned for this platform.
>
> My SOURCES file is this.
>
> TARGETNAME = DriverName
> TARGETPATH = obj
> TARGETTYPE = DRIVER
> INCLUDES = $(BASEDIR)\src\storage\inc;$(BASEDIR)\inc
>
> TARGETLIBS = $(DDK_LIB_PATH)\scsiport.lib <br>> $(DDK_LIB_PATH)\ntoskrnl.lib <br>> $(DDK_LIB_PATH)\ntstrsafe.lib
>
> SOURCES = MyDriver.c
>
> Is there anything I am doing wrong? Please can someone point it out.
>
> Thanks.
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
></ntddk.h>
I forgot to say as well. I have code 39 if I include the catalog file. (I borrowed a license from a company and so Drivers and everything are properly signed so that isn’t an issue.)
Thanks Rajnish.
I had meant to say x64 not x86. I was thinking x86 at the time because it works fine on Vista 32bit.
Could I be missing the WDF Libraries?
If so how would I know that I need them and I was missing them?
xxxxx@hotmail.com wrote:
Thankyou very much Maxim that was the answer I thought. Thankyou.
Ok. I’ve done all that but the driver still doesn’t load. So I began stripping it of everything and this is what I ended up with.
…
Yes it is that simple. I haven’t tried compiling this for a 32bit machine because I strongly believe it will work, anyways I compiled this for both Vista x86 and Vista ia64, neither work. After I load them manually via the ‘manual’ part of the hardware wizard I get the errors.
(Please note these have been translated from German.)In the device Installation, a mistake appeared.
Driver is not planned for this platform.
The “Vista x86” environment builds a 32-bit driver. The “Vista ia64”
environment builds a 64-bit driver for Itanium systems. The odds are
vanishingly low that you actually have an Itanium processor. If you are
running Vista 64-bit or Windows 7 64-bit, then you want the “amd64” or
“x64” environment.
Also note that 64-bit drivers must be digitally signed with an approved
code-signing certificate, or else they will not load. You can override
this at boot time by turning off the driver signing requirement, or by
attaching a kernel debugger.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
You’ve set STARTTYPE to demand start. Are you executing “NET START
” from a command line?
Gary G. Little
H (952) 223-1349
C (952) 454-4629
xxxxx@comcast.net
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@hotmail.com
Sent: Thursday, December 17, 2009 10:17 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Converting 32bit Driver.
I am using the following to INF install.
[Version]
Signature = “$Windows NT$”
Class = SCSIAdapter
ClassGUID = {4D36E97B-E325-11CE-BFC1-08002BE10318}
Provider = %MADE_BY%
DriverVer = 10/10/2006,1.0
CatalogFile = DriverName.cat
[DestinationDirs]
DefaultDestDir = 12 ; system32/drivers
[SourceDisksNames]
1 = %DISKNAME%
[SourceDisksFiles]
DriverName.sys = 1
[Manufacturer]
%MADE_BY% = Models,NTamd64
[Models.NTamd64]
%DriverName.DeviceDesc% = DriverName, root\DriverNameVD ; hardware id
[DriverName]
CopyFiles = @DriverName.sys
LogConfig = DriverName.LogConfig
[DriverName.LogConfig]
ConfigPriority = DESIRED
[DriverName.Services]
AddService = DriverName, 0x00000002, DriverNameService
[DriverNameService]
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 0 ; SERVICE_ERROR_IGNORE
LoadOrderGroup = SCSI Miniport
ServiceBinary = %12%\DriverName.sys
AddReg = DriverName_AddReg
[DriverName_AddReg]
HKR,“Parameters\PnpInterface”, “1”, 0x00010001, 0x00000001
HKR,“NumberOfDrives”, 0x00010001, 0x00000001
HKLM,“SYSTEM\CurrentControlSet\Services\DriverName\Drives\1”, “Path”,
0x00020000,“”
HKLM,“SYSTEM\CurrentControlSet\Services\DriverName\Drives\2”, “Path”,
0x00020000,“”
HKLM,“SYSTEM\CurrentControlSet\Services\DriverName\Drives\3”, “Path”,
0x00020000,“”
HKLM,“SYSTEM\CurrentControlSet\Services\DriverName\Drives\4”, “Path”,
0x00020000,“”
HKLM,“SYSTEM\CurrentControlSet\Services\DriverName\Drives\5”, “Path”,
0x00020000,“”
HKLM,“SYSTEM\CurrentControlSet\Services\DriverName\Drives\6”, “Path”,
0x00020000,“”
HKLM,“SYSTEM\CurrentControlSet\Services\DriverName\Drives\7”, “Path”,
0x00020000,“”
HKLM,“SYSTEM\CurrentControlSet\Services\DriverName\Drives\8”, “Path”,
0x00020000,“”
[Strings]
DriverName.DeviceDesc = “DriverName Virtual Drive Adapter”
MADE_BY = “MADEBY”
DISKNAME = “Install Disk”
—
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
Information from ESET Smart Security, version of virus signature
database 4696 (20091217)
The message was checked by ESET Smart Security.
http://www.eset.com
Information from ESET Smart Security, version of virus signature
database 4696 (20091217)
The message was checked by ESET Smart Security.
http://www.eset.com