I was testing on a customer's box this afternoon which has Windows Vista (He had home, but I am testing on a Business Edition with same results).
We make use of a .DLL that gets the Hardware ID of the computer. It's usage is very simple and the sample program I have created works. The Dll is This from AzSdk.
In fact, this works perfectly under Windows XP. However, for some strange reason, inside our project (way bigger), we get this exception:
Exception Type: System.DllNotFoundException
Exception Message: Unable to load DLL 'HardwareID.dll': Invalid access to memory location. (Exception from HRESULT: 0x800703E6)
Exception Target Site: GetHardwareID
I don't know what can be causing the problem, since I have full control over the folder. The project is a c#.net Windows Forms application and everything works fine, except the call for the external library.
I am declaring it like this: (note: it's not a COM library and it doesn't need to be registered).
[DllImport("HardwareID.dll")]
public static extern String GetHardwareID(bool HDD,
bool NIC, bool CPU, bool BIOS, string sRegistrationCode);
And then the calling code is quite simple:
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = GetHardwareID(cb_HDD.Checked,
cb_NIC.Checked,
cb_CPU.Checked,
cb_BIOS.Checked,
"*Registration Code*");
}
When you create a sample application, it works, but inside my projectit doesn't. Under XP works fine. Any ideas about what should I do in Vista to make this work?
As I've said, the folder and its sub-folders have Full Control for "Everybody".
UPDATE: I do not have Vista SP 1 installed.
UPDATE 2: I have installed Vista SP1 and now, with UAC disabled, not even the simple sample works!!! :( Damn Vista.
See Question&Answers more detail:
os