G
Guest
I am attempting to use an API (CxApiOem.dll) that has a large number of
defines and complicated structs. It's just too much hassle to attempt
to use DLLImport to make the desired API calls. Instead, I created a
managed C++ DLL (OneBoxAPI.dll) that wraps the desired API calls in a
manner which is easy to call from C#. This way I can use the header
files that are part of the API for all the defines and structs.
I am having a problem using the managed C++ DLL. When the DLL is
located in a directory which has a long path (> approx 80 char), then
the DLL fails to load. If I move everything to a place where the path
to the DLL is much shorter, then without recompiling or anything, it
loads just fine and everything works as expected. Below you can see
the output from Visual Studio while running my app in debug mode.
Anybody have any ideas as to why the path length appears to cause an
access violation when loading the managed C++ DLL?
//------------------------------------------------------------------------
// Fails to load OneBoxAPI.dll when in dir with long path
//------------------------------------------------------------------------
'Import Wizard.exe': Loaded 'C:\Documents and Settings\eusbmat\My
Documents\Visual Stuido Projects\Import Wizard\bin\Debug\OneBoxAPI.dll',
Symbols loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\msvcr71d.dll', Symbols loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\CxApiOem.dll', No symbols
loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\version.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\lz32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\AT_WAVE.DLL', No symbols
loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\msacm32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\winmm.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\msvcp71.dll', Symbols loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\Dcp32.dll', No symbols loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\mmdrv.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\mmdrv.dll'
First-chance exception at 0x7463656a in Import Wizard.exe: 0xC0000005:
Access violation reading location 0x7463656a.
'Import Wizard.exe': Unloaded 'C:\Documents and Settings\eusbmat\My
Documents\Visual Stuido Projects\Import Wizard\bin\Debug\OneBoxAPI.dll'
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\CxApiOem.dll'
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\Dcp32.dll'
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\AT_WAVE.DLL'
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\msvcp71.dll'
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\msacm32.dll'
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\winmm.dll'
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\version.dll'
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\lz32.dll'
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\msvcr71d.dll'
//------------------------------------------------------------------------
// Move Visual Studio Projects directory to C: and then it loads just fine
//------------------------------------------------------------------------
'Import Wizard.exe': Loaded 'C:\Visual Stuido Projects\Import
Wizard\bin\Debug\OneBoxAPI.dll', Symbols loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\msvcr71d.dll', Symbols loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\CxApiOem.dll', No symbols
loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\version.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\lz32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\AT_WAVE.DLL', No symbols
loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\msacm32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\winmm.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\msvcp71.dll', Symbols loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\Dcp32.dll', No symbols loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\mmdrv.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\mmdrv.dll'
'Import Wizard.exe': Loaded 'C:\WINNT\system32\NETAPI32.DLL', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\secur32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\ntdsapi.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\dnsapi.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\wsock32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\ws2_32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\ws2help.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\wldap32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\netrap.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\samlib.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'c:\visual stuido projects\import
wizard\bin\debug\oneboxapi.dll', Symbols loaded.
OneBox session created.
Initializing OneBox session
'Import Wizard.exe': Loaded 'C:\WINNT\system32\rnr20.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\iphlpapi.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\icmp.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\mprapi.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\activeds.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\adsldpc.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\rtutils.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\setupapi.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\USERENV.DLL', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\rasapi32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\RASMAN.DLL', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\tapi32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\dhcpcsvc.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\winrnr.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\rasadhlp.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\msafd.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\wshtcpip.dll', Cannot find or
open a required DBG file.
defines and complicated structs. It's just too much hassle to attempt
to use DLLImport to make the desired API calls. Instead, I created a
managed C++ DLL (OneBoxAPI.dll) that wraps the desired API calls in a
manner which is easy to call from C#. This way I can use the header
files that are part of the API for all the defines and structs.
I am having a problem using the managed C++ DLL. When the DLL is
located in a directory which has a long path (> approx 80 char), then
the DLL fails to load. If I move everything to a place where the path
to the DLL is much shorter, then without recompiling or anything, it
loads just fine and everything works as expected. Below you can see
the output from Visual Studio while running my app in debug mode.
Anybody have any ideas as to why the path length appears to cause an
access violation when loading the managed C++ DLL?
//------------------------------------------------------------------------
// Fails to load OneBoxAPI.dll when in dir with long path
//------------------------------------------------------------------------
'Import Wizard.exe': Loaded 'C:\Documents and Settings\eusbmat\My
Documents\Visual Stuido Projects\Import Wizard\bin\Debug\OneBoxAPI.dll',
Symbols loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\msvcr71d.dll', Symbols loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\CxApiOem.dll', No symbols
loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\version.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\lz32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\AT_WAVE.DLL', No symbols
loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\msacm32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\winmm.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\msvcp71.dll', Symbols loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\Dcp32.dll', No symbols loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\mmdrv.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\mmdrv.dll'
First-chance exception at 0x7463656a in Import Wizard.exe: 0xC0000005:
Access violation reading location 0x7463656a.
'Import Wizard.exe': Unloaded 'C:\Documents and Settings\eusbmat\My
Documents\Visual Stuido Projects\Import Wizard\bin\Debug\OneBoxAPI.dll'
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\CxApiOem.dll'
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\Dcp32.dll'
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\AT_WAVE.DLL'
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\msvcp71.dll'
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\msacm32.dll'
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\winmm.dll'
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\version.dll'
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\lz32.dll'
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\msvcr71d.dll'
//------------------------------------------------------------------------
// Move Visual Studio Projects directory to C: and then it loads just fine
//------------------------------------------------------------------------
'Import Wizard.exe': Loaded 'C:\Visual Stuido Projects\Import
Wizard\bin\Debug\OneBoxAPI.dll', Symbols loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\msvcr71d.dll', Symbols loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\CxApiOem.dll', No symbols
loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\version.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\lz32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\AT_WAVE.DLL', No symbols
loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\msacm32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\winmm.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\msvcp71.dll', Symbols loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\Dcp32.dll', No symbols loaded.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\mmdrv.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Unloaded 'C:\WINNT\system32\mmdrv.dll'
'Import Wizard.exe': Loaded 'C:\WINNT\system32\NETAPI32.DLL', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\secur32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\ntdsapi.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\dnsapi.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\wsock32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\ws2_32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\ws2help.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\wldap32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\netrap.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\samlib.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'c:\visual stuido projects\import
wizard\bin\debug\oneboxapi.dll', Symbols loaded.
OneBox session created.
Initializing OneBox session
'Import Wizard.exe': Loaded 'C:\WINNT\system32\rnr20.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\iphlpapi.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\icmp.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\mprapi.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\activeds.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\adsldpc.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\rtutils.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\setupapi.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\USERENV.DLL', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\rasapi32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\RASMAN.DLL', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\tapi32.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\dhcpcsvc.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\winrnr.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\rasadhlp.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\msafd.dll', Cannot find or
open a required DBG file.
'Import Wizard.exe': Loaded 'C:\WINNT\system32\wshtcpip.dll', Cannot find or
open a required DBG file.