Home All Groups Group Topic Archive Search About

Windows 7 dll import problem

Author
19 May 2009 9:29 AM
roidy
I`m importing a function from a dll using the following code:-

Declare Function MP4Read Lib "e:\libmp4v2.dll" (ByVal filename As String,
ByVal verbosity As UInteger) As UIntPtr

filehandle = MP4Read("test.mp4", 0)


This works perfectly in WinXP but when I move my project over to Windows 7
RC to test it I keep getting the following exception:-

DllNotFoundException was unhandled
Unable to load DLL 'e:\libmp4v2.dll': The application has failed to start
because its side-by-side configuration is incorrect. Please see the
application event log or use the command-line sxstrace.exe tool for more
detail. (Exception from HRESULT: 0x800736B1)

Now if I place the dll file in the same folder as the exacutable and use:-

Declare Function MP4Read Lib "libmp4v2.dll" (ByVal filename As String, ByVal
verbosity As UInteger) As UIntPtr

Then I get the following exception:-

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

It`s driving me crazy, both versions work fine in WinXp but not in Windows 7
RC.

Help please
Rob

Author
19 May 2009 9:37 AM
Cor Ligthert[MVP]
Roidy,

Windows 7 is a evaluation system.

The meaning is that you can see what it does and for Microsoft that you
report bugs or whatever to connect.

http://connect.microsoft.com

Thanks,

Cor


Show quoteHide quote
"roidy" <r*@nnnnnn.com> wrote in message
news:5_uQl.186330$y17.145629@newsfe11.ams2...
> I`m importing a function from a dll using the following code:-
>
> Declare Function MP4Read Lib "e:\libmp4v2.dll" (ByVal filename As String,
> ByVal verbosity As UInteger) As UIntPtr
>
> filehandle = MP4Read("test.mp4", 0)
>
>
> This works perfectly in WinXP but when I move my project over to Windows 7
> RC to test it I keep getting the following exception:-
>
> DllNotFoundException was unhandled
> Unable to load DLL 'e:\libmp4v2.dll': The application has failed to start
> because its side-by-side configuration is incorrect. Please see the
> application event log or use the command-line sxstrace.exe tool for more
> detail. (Exception from HRESULT: 0x800736B1)
>
> Now if I place the dll file in the same folder as the exacutable and use:-
>
> Declare Function MP4Read Lib "libmp4v2.dll" (ByVal filename As String,
> ByVal verbosity As UInteger) As UIntPtr
>
> Then I get the following exception:-
>
> DllNotFoundException was unhandled
> Unable to load DLL 'libmp4v2.dll': The specified module could not be
> found. (Exception from HRESULT: 0x8007007E)
>
> It`s driving me crazy, both versions work fine in WinXp but not in Windows
> 7 RC.
>
> Help please
> Rob
>
>
Author
19 May 2009 10:22 AM
Robert
Are you running a 32 bit version of your EXE on Win7?
Author
19 May 2009 12:03 PM
roidy
Yep it`s a 32bit exe and I`m running the 32bit version of Windows 7 RC.

Show quoteHide quote
"Robert" <robert@nospam.com> wrote in message
news:#XcQ8uG2JHA.3780@TK2MSFTNGP04.phx.gbl...
> Are you running a 32 bit version of your EXE on Win7?
Author
19 May 2009 1:17 PM
Mike
Loading DLLs under Windows can be problem is there are dependencies,
and with the SxS microsoft baloney, a lot of stuff is hidden.

Generally, with these type of erroneous messages says "it can' find
the dll" it is that it can't find a DEPENDENCY.  Unfortunately, it
doesn't always show what dependency failed to load only the top level
file.

If you don't have it already, download DEPENDS from MSDN and run your
application from within DEPENDS. It will 100% tell you the story of
your process needs, what is open, what is closed, what DLL is missing
or can't find that LIBMP4V2.DLL needs.

When you download, you can start it from the command line

    DEPENDS yourprogram.exe

or open it from within.  Then do START | PROFILE and  you will see
the stuff going on.  You might be able to see the RED-BOLD highlights
in the DLL list panel before your start profile to see if that is any
hint.

---



roidy wrote:
Show quoteHide quote
> I`m importing a function from a dll using the following code:-
>
> Declare Function MP4Read Lib "e:\libmp4v2.dll" (ByVal filename As
> String, ByVal verbosity As UInteger) As UIntPtr
>
> filehandle = MP4Read("test.mp4", 0)
>
>
> This works perfectly in WinXP but when I move my project over to Windows
> 7 RC to test it I keep getting the following exception:-
>
> DllNotFoundException was unhandled
> Unable to load DLL 'e:\libmp4v2.dll': The application has failed to
> start because its side-by-side configuration is incorrect. Please see
> the application event log or use the command-line sxstrace.exe tool for
> more detail. (Exception from HRESULT: 0x800736B1)
>
> Now if I place the dll file in the same folder as the exacutable and use:-
>
> Declare Function MP4Read Lib "libmp4v2.dll" (ByVal filename As String,
> ByVal verbosity As UInteger) As UIntPtr
>
> Then I get the following exception:-
>
> DllNotFoundException was unhandled
> Unable to load DLL 'libmp4v2.dll': The specified module could not be
> found. (Exception from HRESULT: 0x8007007E)
>
> It`s driving me crazy, both versions work fine in WinXp but not in
> Windows 7 RC.
>
> Help please
> Rob
>
>
Author
19 May 2009 3:04 PM
roidy
Thanks Mike,

When I open the program in Dependency Walker I get the following:-

Warning: At least one module has an unresolved import due to a missing
export function in a delay-load dependent module.

and a red box by the side of the following 2 dll`s:-

IEFRAME.DLL
SHLWAPI.DLL

both of which I have in Windows/System32 and my executable directorys.

Then when I profile the exe I get the following log:-

-------------------------------------------------------------------------------
Starting profile on 19/05/2009 at 15:57:46

Operating System: Microsoft Windows NT/2000/XP/2003/Vista based Ultimate
(32-bit), version 6.01.7100
Program Executable: c:\users\roidy\documents\visual studio
2008\projects\sample_libmp4v2\sample_libmp4v2\bin\debug\SAMPLE_LIBMP4V2.EXE
Program Arguments:
Starting Directory: C:\Users\roidy\Documents\Visual Studio
2008\Projects\sample_libmp4v2\sample_libmp4v2\bin\Debug\
Search Path:
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program
Files\QuickTime\QTSystem\;C:\Program Files\Microsoft SQL
Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\

Options Selected:
     Simulate ShellExecute by inserting any App Paths directories into the
PATH environment variable.
     Log DllMain calls for process attach and process detach messages.
     Hook the process to gather more detailed dependency information.
     Log LoadLibrary function calls.
     Log GetProcAddress function calls.
     Log debug output messages.
     Automatically open and profile child processes.
--------------------------------------------------------------------------------

Started "SAMPLE_LIBMP4V2.EXE" (process 0xA9C) at address 0x012A0000.
Successfully hooked module.
Loaded "NTDLL.DLL" at address 0x77C20000.  Successfully hooked module.
Loaded "MSCOREE.DLL" at address 0x716B0000.  Successfully hooked module.
Loaded "KERNEL32.DLL" at address 0x761F0000.  Successfully hooked module.
Loaded "KERNELBASE.DLL" at address 0x75E40000.  Successfully hooked module.
DllMain(0x75E40000, DLL_PROCESS_ATTACH, 0x00000000) in "KERNELBASE.DLL"
called.
DllMain(0x75E40000, DLL_PROCESS_ATTACH, 0x00000000) in "KERNELBASE.DLL"
returned 1 (0x1).
DllMain(0x761F0000, DLL_PROCESS_ATTACH, 0x00000000) in "KERNEL32.DLL"
called.
DllMain(0x761F0000, DLL_PROCESS_ATTACH, 0x00000000) in "KERNEL32.DLL"
returned 1 (0x1).
Injected "DEPENDS.DLL" at address 0x08370000.
DllMain(0x716B0000, DLL_PROCESS_ATTACH, 0x00000000) in "MSCOREE.DLL" called.
DllMain(0x08370000, DLL_PROCESS_ATTACH, 0x00000000) in "DEPENDS.DLL" called.
DllMain(0x08370000, DLL_PROCESS_ATTACH, 0x00000000) in "DEPENDS.DLL"
returned 1 (0x1).
GetProcAddress(0x761F0000 [KERNEL32.DLL], "FlsAlloc") called from
"MSCOREE.DLL" at address 0x716B6079 and returned 0x7624867D.

STATUS_STACK_BUFFER_OVERRUN encountered
Entrypoint reached. All implicit modules have been loaded.
Exited "SAMPLE_LIBMP4V2.EXE" (process 0xA9C) with code -1073740791
(0xC0000409).
--------------------------------------------------------------------------------------

It`s got me stumped......

Rob


Show quoteHide quote
"Mike" <unkn***@unknown.tv> wrote in message
news:OKKqqQI2JHA.3676@TK2MSFTNGP06.phx.gbl...
> Loading DLLs under Windows can be problem is there are dependencies, and
> with the SxS microsoft baloney, a lot of stuff is hidden.
>
> Generally, with these type of erroneous messages says "it can' find the
> dll" it is that it can't find a DEPENDENCY.  Unfortunately, it doesn't
> always show what dependency failed to load only the top level file.
>
> If you don't have it already, download DEPENDS from MSDN and run your
> application from within DEPENDS. It will 100% tell you the story of your
> process needs, what is open, what is closed, what DLL is missing or can't
> find that LIBMP4V2.DLL needs.
>
> When you download, you can start it from the command line
>
>    DEPENDS yourprogram.exe
>
> or open it from within.  Then do START | PROFILE and  you will see the
> stuff going on.  You might be able to see the RED-BOLD highlights in the
> DLL list panel before your start profile to see if that is any hint.
>
> ---
>
>
>
> roidy wrote:
>> I`m importing a function from a dll using the following code:-
>>
>> Declare Function MP4Read Lib "e:\libmp4v2.dll" (ByVal filename As String,
>> ByVal verbosity As UInteger) As UIntPtr
>>
>> filehandle = MP4Read("test.mp4", 0)
>>
>>
>> This works perfectly in WinXP but when I move my project over to Windows
>> 7 RC to test it I keep getting the following exception:-
>>
>> DllNotFoundException was unhandled
>> Unable to load DLL 'e:\libmp4v2.dll': The application has failed to start
>> because its side-by-side configuration is incorrect. Please see the
>> application event log or use the command-line sxstrace.exe tool for more
>> detail. (Exception from HRESULT: 0x800736B1)
>>
>> Now if I place the dll file in the same folder as the exacutable and
>> use:-
>>
>> Declare Function MP4Read Lib "libmp4v2.dll" (ByVal filename As String,
>> ByVal verbosity As UInteger) As UIntPtr
>>
>> Then I get the following exception:-
>>
>> DllNotFoundException was unhandled
>> Unable to load DLL 'libmp4v2.dll': The specified module could not be
>> found. (Exception from HRESULT: 0x8007007E)
>>
>> It`s driving me crazy, both versions work fine in WinXp but not in
>> Windows 7 RC.
>>
>> Help please
>> Rob
>>
>>
Author
19 May 2009 4:02 PM
roidy
Well I recompiled the dll file from source in Windows 7 and now it
works..... Go figure.....

Thanks for the help

Rob
Author
19 May 2009 4:09 PM
Mike
roidy wrote:
> Well I recompiled the dll file from source in Windows 7 and now it
> works..... Go figure.....
>
> Thanks for the help

Good.  I was going  to say that a the STACK OVERFLOW was not good and
there was something not right with the DLL. I was going to suggest to
turn on all the profile check boxes to see more loading details of
MSCOREE.DLL.

--
Author
19 May 2009 4:34 PM
roidy
I just hope that the version of the dll compiled in Windows 7 will work in
WinXP. But I can't test it just yet as my XP machine is currently in bits
awaiting new parts..........


Show quoteHide quote
"Mike" <unkn***@unknown.tv> wrote in message
news:OcHTMxJ2JHA.1416@TK2MSFTNGP04.phx.gbl...
> roidy wrote:
>> Well I recompiled the dll file from source in Windows 7 and now it
>> works..... Go figure.....
>>
>> Thanks for the help
>
> Good.  I was going  to say that a the STACK OVERFLOW was not good and
> there was something not right with the DLL. I was going to suggest to turn
> on all the profile check boxes to see more loading details of MSCOREE.DLL.
>
> --
>
Author
19 May 2009 5:09 PM
Mike
roidy wrote:
> I just hope that the version of the dll compiled in Windows 7 will work
> in WinXP. But I can't test it just yet as my XP machine is currently in
> bits awaiting new parts..........

Use DEPENDS to get list of DEPENDENCIES for the LIBMP4V2.DLL.  You can
  also get the implicit loads using DUMPBIN.

      DUMPBIN /DEPENDENTS LIBMP4V2.DLL

I wrote a command line version of DEPENDS called LDEPENDS.ZIP

      ftp://ftp.santronics.com/wildcat/tools

and I use to quickly see what is needed by EXE and DLLs.  It doesn't
work well with SxS baloney (but DEPENDS does)

For example, for us, WCSRV2.DLL is the our DLL for WIN32 and for .NET
  DLLIMPORTING.  For this solid 12 year old WIN32 version, LDEPENDS shows:

  D:\wc63>ldepends wcsrv2.dll
  Module: [wcsrv2.dll]
   + rpcrt4.dll
   + wsock32.dll
   + msvcrt.dll
   + mfc42.dll
   + kernel32.dll
   + user32.dll
   + advapi32.dll
   + ole32.dll

This is solid code for all WIN32 compatiable Windows OSes, but that
was compiled with VS98.

Now when its compiled using VS2005:

  G:\wc7beta>ldepends wcsrv2.dll
  Module: [wcsrv2.dll]
   + rpcrt4.dll
   + wsock32.dll
   + mfc80d.dll
   + msvcr80d.dll
   + kernel32.dll
   + user32.dll
   + advapi32.dll
   + ole32.dll
   + oleaut32.dll

   **** report ****
   MFC80D.DLL                      LoadLibrary() Error: 126
   MSVCR80D.dll                    LoadLibrary() Error: 126

So there are more dependencies that uses 8.0 dlls files and these are
trying to load or aliased with SxS.  Ldepends has a problem finding
SxS stuff, but when the EXE or DLL is loaded for real, the OS loader
(and DEPENDS) knows whats to do.

So your goal is to see what RTL (run time libraries) you want to use.
   If you compile with VS200x then you will bring more libraries that
are for that compiler version RTL.

What I would do is find the minimum required for LIBMP3V2.DLL and
stick with it.  But then again if you are compiling the main
application for .NET, then most likely you will need 8.0 (VS2005) or
9.0 (VS2008) files anyway.

--


Show quoteHide quote
> "Mike" <unkn***@unknown.tv> wrote in message
> news:OcHTMxJ2JHA.1416@TK2MSFTNGP04.phx.gbl...
>> roidy wrote:
>>> Well I recompiled the dll file from source in Windows 7 and now it
>>> works..... Go figure.....
>>>
>>> Thanks for the help
>>
>> Good.  I was going  to say that a the STACK OVERFLOW was not good and
>> there was something not right with the DLL. I was going to suggest to
>> turn on all the profile check boxes to see more loading details of
>> MSCOREE.DLL.
>>
>> --
>>
Author
19 May 2009 6:11 PM
roidy
That's the thing, it`s not a problem with the version of VS used as both
versions of the dll file were compiled using Visual C Express 2008 the only
difference was one was compiled in WinXp and the other in Windows 7. It`s
just the version compiled under WinXp wouldn`t work in Windows 7.

Rob

Show quoteHide quote
"Mike" <unkn***@unknown.tv> wrote in message
news:eDBxPSK2JHA.4632@TK2MSFTNGP02.phx.gbl...
> roidy wrote:
>> I just hope that the version of the dll compiled in Windows 7 will work
>> in WinXP. But I can't test it just yet as my XP machine is currently in
>> bits awaiting new parts..........
>
> Use DEPENDS to get list of DEPENDENCIES for the LIBMP4V2.DLL.  You can
> also get the implicit loads using DUMPBIN.
>
>      DUMPBIN /DEPENDENTS LIBMP4V2.DLL
>
> I wrote a command line version of DEPENDS called LDEPENDS.ZIP
>
>      ftp://ftp.santronics.com/wildcat/tools
>
> and I use to quickly see what is needed by EXE and DLLs.  It doesn't work
> well with SxS baloney (but DEPENDS does)
>
> For example, for us, WCSRV2.DLL is the our DLL for WIN32 and for .NET
> DLLIMPORTING.  For this solid 12 year old WIN32 version, LDEPENDS shows:
>
>  D:\wc63>ldepends wcsrv2.dll
>  Module: [wcsrv2.dll]
>   + rpcrt4.dll
>   + wsock32.dll
>   + msvcrt.dll
>   + mfc42.dll
>   + kernel32.dll
>   + user32.dll
>   + advapi32.dll
>   + ole32.dll
>
> This is solid code for all WIN32 compatiable Windows OSes, but that was
> compiled with VS98.
>
> Now when its compiled using VS2005:
>
>  G:\wc7beta>ldepends wcsrv2.dll
>  Module: [wcsrv2.dll]
>   + rpcrt4.dll
>   + wsock32.dll
>   + mfc80d.dll
>   + msvcr80d.dll
>   + kernel32.dll
>   + user32.dll
>   + advapi32.dll
>   + ole32.dll
>   + oleaut32.dll
>
>   **** report ****
>   MFC80D.DLL                      LoadLibrary() Error: 126
>   MSVCR80D.dll                    LoadLibrary() Error: 126
>
> So there are more dependencies that uses 8.0 dlls files and these are
> trying to load or aliased with SxS.  Ldepends has a problem finding SxS
> stuff, but when the EXE or DLL is loaded for real, the OS loader (and
> DEPENDS) knows whats to do.
>
> So your goal is to see what RTL (run time libraries) you want to use. If
> you compile with VS200x then you will bring more libraries that are for
> that compiler version RTL.
>
> What I would do is find the minimum required for LIBMP3V2.DLL and stick
> with it.  But then again if you are compiling the main application for
> .NET, then most likely you will need 8.0 (VS2005) or 9.0 (VS2008) files
> anyway.
>
> --
>
>
>> "Mike" <unkn***@unknown.tv> wrote in message
>> news:OcHTMxJ2JHA.1416@TK2MSFTNGP04.phx.gbl...
>>> roidy wrote:
>>>> Well I recompiled the dll file from source in Windows 7 and now it
>>>> works..... Go figure.....
>>>>
>>>> Thanks for the help
>>>
>>> Good.  I was going  to say that a the STACK OVERFLOW was not good and
>>> there was something not right with the DLL. I was going to suggest to
>>> turn on all the profile check boxes to see more loading details of
>>> MSCOREE.DLL.
>>>
>>> --
>>>
Author
19 May 2009 8:05 PM
Mike
roidy wrote:
> That's the thing, it`s not a problem with the version of VS used as both
> versions of the dll file were compiled using Visual C Express 2008 the
> only difference was one was compiled in WinXp and the other in Windows
> 7. It`s just the version compiled under WinXp wouldn`t work in Windows 7.

Sounds like the original issue you saw:

    DllNotFoundException was unhandled
    Unable to load DLL 'e:\libmp4v2.dll': The application has failed to
    start because its side-by-side configuration is incorrect. Please
    see the application event log or use the command-line sxstrace.exe
    tool for more detail. (Exception from HRESULT: 0x800736B1)

is related.  In others words,  the SxS needed for XP are not matching
the requirements for Windows 7.   Did you do the SXSTRACE as it
suggested?  What did it say?

---
Author
20 May 2009 12:14 AM
Mike
roidy wrote:
> That's the thing, it`s not a problem with the version of VS used as both
> versions of the dll file were compiled using Visual C Express 2008 the
> only difference was one was compiled in WinXp and the other in Windows
> 7. It`s just the version compiled under WinXp wouldn`t work in Windows 7.
>

Roidy, where did you get the source code for libmp4v2?  Which one are
you using? I found

     libmp4v2-1.5.0.1.tar.bz2
     mp4v2-2.0-20090110.tar.bz2

I already have support for libmp3 in our product, so I might as well
add libmp4 and see the kinds of stuff you are seeing.

PS: I am currently being reminded why I didn't like VS200x and avoided
it for so long. It is terribly slow at compiling and its been nearly 5
minutes for this MP4V2 solution. :)

--
Author
20 May 2009 9:44 AM
roidy
I`m  using mp4v2-2.0-20090110.tar.bz2 but after looking at the project page
just now  I see there is a newer version available.

mp4v2-2.0-20090515.tar.bz2

Rob

Show quoteHide quote
"Mike" <unkn***@unknown.tv> wrote in message
news:O1eP3$N2JHA.5816@TK2MSFTNGP02.phx.gbl...
> roidy wrote:
>> That's the thing, it`s not a problem with the version of VS used as both
>> versions of the dll file were compiled using Visual C Express 2008 the
>> only difference was one was compiled in WinXp and the other in Windows 7.
>> It`s just the version compiled under WinXp wouldn`t work in Windows 7.
>>
>
> Roidy, where did you get the source code for libmp4v2?  Which one are you
> using? I found
>
>     libmp4v2-1.5.0.1.tar.bz2
>     mp4v2-2.0-20090110.tar.bz2
> I already have support for libmp3 in our product, so I might as well add
> libmp4 and see the kinds of stuff you are seeing.
>
> PS: I am currently being reminded why I didn't like VS200x and avoided it
> for so long. It is terribly slow at compiling and its been nearly 5
> minutes for this MP4V2 solution. :)
>
> --