whorsfall
asked on
Using 32 Drivers / Libraries from C# in 64 Bit Windows?
Hi,
I am trying to determine the risks profile of doing the following:
I want to write a C# 3.5 .NET application that calls some 32 Bit code
using PInvoke. I really want to find out what are the risks
and hidden gotchas in doing this. (This is for a Data Acquition
card). So I assume there would be a software driver for the card.
From what I can see is I would need to know all the
function prototypes for the DllImport of everything
I need to call and have to define them all.
http://msdn.microsoft.com/en-us/magazine/cc164123.aspx
Ok here are my questions:
1. Are the any other issues I should be concerned about?
2. Would there be any issues with this working under 64 Bit
Windows. I would like to target Vista 64 Bit and Windows 7?
3. Is the hardware model different between Windows Vista 32 and
Windows 7 x64? (I assume it would be). In other words can
a 32 bit driver be made to work under 64 bit.
Hi. These are complex questions so I am going to award maximun
points for the best answer on this.
BTW: URL to the Card so you have some context information:
Advantech PCI-1712
http://www.advantech.com.tw/products/1-MS-s-12-bit-16-ch-PCI-Multifunction-Cards/mod_1-2MLGXI.aspx
Thanks,
Ward.
I am trying to determine the risks profile of doing the following:
I want to write a C# 3.5 .NET application that calls some 32 Bit code
using PInvoke. I really want to find out what are the risks
and hidden gotchas in doing this. (This is for a Data Acquition
card). So I assume there would be a software driver for the card.
From what I can see is I would need to know all the
function prototypes for the DllImport of everything
I need to call and have to define them all.
http://msdn.microsoft.com/en-us/magazine/cc164123.aspx
Ok here are my questions:
1. Are the any other issues I should be concerned about?
2. Would there be any issues with this working under 64 Bit
Windows. I would like to target Vista 64 Bit and Windows 7?
3. Is the hardware model different between Windows Vista 32 and
Windows 7 x64? (I assume it would be). In other words can
a 32 bit driver be made to work under 64 bit.
Hi. These are complex questions so I am going to award maximun
points for the best answer on this.
BTW: URL to the Card so you have some context information:
Advantech PCI-1712
http://www.advantech.com.tw/products/1-MS-s-12-bit-16-ch-PCI-Multifunction-Cards/mod_1-2MLGXI.aspx
Thanks,
Ward.
ASKER
Hi,
Thanks that was great.
Had some other quick questions:
1. Was I correct about the PInvoke about having to know all the declarations before I call the Lib file? Is there anyway I can get something to scan the file to generate them automatically?
2. Is it only Drivers that can access the hardware directly to talk to harware directly I assume it can only go through a Windows driver, or can C# code manipulate it directly. (I am trying to understand the dividing line here).
Thanks,
Ward
Thanks that was great.
Had some other quick questions:
1. Was I correct about the PInvoke about having to know all the declarations before I call the Lib file? Is there anyway I can get something to scan the file to generate them automatically?
2. Is it only Drivers that can access the hardware directly to talk to harware directly I assume it can only go through a Windows driver, or can C# code manipulate it directly. (I am trying to understand the dividing line here).
Thanks,
Ward
ASKER
Oops forgot to ask:
1. Would a 32 Bit Windows driver work on 32 bit Windows 7?
2. Would a 64-bit Windows driver work on 65-bit Windows 7?
I have tried to search but cant see any clear info if they are compatible at this level.
Thanks,
Ward
1. Would a 32 Bit Windows driver work on 32 bit Windows 7?
2. Would a 64-bit Windows driver work on 65-bit Windows 7?
I have tried to search but cant see any clear info if they are compatible at this level.
Thanks,
Ward
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Cool,
Awsome info.
Sorry I did not phrase my last two questions correctly (event though you gave me great info :))
I meant to say - out of general curiosity:
1. Would a 32 Bit "Vista" (x86) Windows driver work on 32-bit (x86) Windows 7?
2. Would a 64-bit "Vista" (x64) Windows driver work on 64-bit (x64) Windows 7?
In other words assuming what you said about the 32/64 bit strucutre is the driver model the same, as I would understand that there are some specific Windows 7 features that might not be avaiable though as it would not be a native driver.
Thanks,
Ward
Awsome info.
Sorry I did not phrase my last two questions correctly (event though you gave me great info :))
I meant to say - out of general curiosity:
1. Would a 32 Bit "Vista" (x86) Windows driver work on 32-bit (x86) Windows 7?
2. Would a 64-bit "Vista" (x64) Windows driver work on 64-bit (x64) Windows 7?
In other words assuming what you said about the 32/64 bit strucutre is the driver model the same, as I would understand that there are some specific Windows 7 features that might not be avaiable though as it would not be a native driver.
Thanks,
Ward
Ah yes... there normally isn't much of a difference between Vista and Win7. So, if you can find a Vista x64 driver, the chances are that they'd work fine in Win7 x64.
That's correct... if there is any difference, it might just be a missing feature.
That's correct... if there is any difference, it might just be a missing feature.
ASKER
Awsome - points well earned big thanks :)
Normally the way it works is... you install a 64-bit driver, and then have a 3rd-party DLL that provides access to the driver. Typically both the driver and the DLL are either both 32-bit or both 64-bit. Then your application uses P/Invoke-style calls to the DLL... again both your applicaiton and the DLL are both 32-bit or both 64-bit.
So, unless they've got a 64-bit driver, you're stuck... as you can NOT install a 32-bit device driver in a 64-bit Windows OS.