views:

523

answers:

2

[DllImport("DoSomething.dll", EntryPoint = "something_dump", SetLastError = true)] private static extern void something_dump(IntPtr dumper);

When I run this DLLImport on XP machines it works fine but on vista I recieve the exception:

Unable to load DLL 'DoSomething.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

On both machines its located in the Windows/System32 directory, but for some reason vista doesn't load it.

And when I fully qualify the path on the vista machine ...DllImport("C:\WINDOWS\system32\DoSomething.dll"... It works!

Do I actually have to tell the DLLImport function on the vista machine to look in the system32 directory?

A: 

The problem is someone was coping the dll to the current solutions output directory... The problem being they didn't copy the dll's dependencies to the output directory... So somehow XP could resolve those dependences and Vista would fail. (The dll is the exact same on both os’s)

Solution: Remove the coping of system dll's to the current solutions output directory...

Will
A: 

Place you Dll into "document settings\administrator\" this path to work.

Make note you need to place all supporting files example .ino or .txt files support to that dll also.

It will work fine.

All the best.

Regards, Prasath

Prasath