Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^13: if Digest::SHA1 loaded Can't load LibXML/LibXML.dll Invalid access to memory location

by syphilis (Canon)
on Dec 06, 2012 at 01:03 UTC ( #1007441=note: print w/ replies, xml ) Need Help??


in reply to Re^12: if Digest::SHA1 loaded Can't load LibXML/LibXML.dll Invalid access to memory location
in thread if Digest::SHA1 loaded Can't load LibXML/LibXML.dll Invalid access to memory location

Win32::LoadLibrary returns a handle for both

Yep - just checked, and Win32::LoadLibrary loads them both just fine for me, too.
Which means ... what ... it's a DynaLoader bug ?

For my check, I ran this script (as per the one you posted earlier in this thread):

use warnings; use strict; use Win32; my $ret = Win32::LoadLibrary('C:\sisyphusion\PLplot_broken.dll'); print "ret=$ret glr=".Win32::GetLastError()."\n"; $ret = Win32::LoadLibrary('C:\sisyphusion\PLplot_ok.dll'); print "ret=$ret glr=".Win32::GetLastError()."\n";
and that produced the following output:
ret=1647050752 glr=0 ret=1659895808 glr=0
It's not just 5.8.9 where this happens, but also 5.8.8, 5.14.0. 5.16.0 (and perhaps other perls as well).

Cheers,
Rob


Comment on Re^13: if Digest::SHA1 loaded Can't load LibXML/LibXML.dll Invalid access to memory location
Select or Download Code
Re^14: if Digest::SHA1 loaded Can't load LibXML/LibXML.dll Invalid access to memory location
by bulk88 (Priest) on Dec 06, 2012 at 03:55 UTC
      I got "Can't load PDL::Core module at C:/sperl/589/perl/lib/DynaLoader.pm line 249." ... with broken dll.

      I get that, too - with *both* broken dll *and* ok dll
      With the ok dll:
      C:\>pmver PDL::Graphics::PLplot 0.61 C:\>perl -MDynaLoader -e"@PDL::Graphics::PLplot::ISA = ('DynaLoader'); + DynaLoader::bootstrap('PDL::Graphics::PLplot');" Can't load PDL::Core module at C:/MinGW/perl589/lib/DynaLoader.pm line + 249.
      Then switch to the broken dll:
      C:\>pmver PDL::Graphics::PLplot Can't load 'C:/MinGW/perl589/site/lib/auto/PDL/Graphics/PLplot/PLplot. +dll' for module PDL::Graphics::PLplot: load_file:%1 is not a valid Wi +n32 application at C: /MinGW/perl589/lib/DynaLoader.pm line 226. at -e line 1 Compilation failed in require at -e line 1. C:\>perl -MDynaLoader -e"@PDL::Graphics::PLplot::ISA = ('DynaLoader'); + DynaLoader::bootstrap('PDL::Graphics::PLplot ');" Can't load PDL::Core module at C:/MinGW/perl589/lib/DynaLoader.pm line + 249.
      I don't know what to make of that - the PDL::Graphics::PLplot module is fine so long as I use the ok dll.
      Doesn't this merely demonstrate that PDL::Graphics::PLplot has a dependency on PDL::Core ?

      Cheers,
      Rob
        The only difference I can see between the 2 DLLs is the base address, as mentioned before. If you use MS's rebase, and set the base address in broken DLL to 0x62F00000 (base address of the good one) what happens? Have you tried using Dependency Walker on the broken DLL? IDK what pmver is. What is the difference between the 2 DLLs in your experience, compiler flag wise? Since the only different is the base address, it sounds like there is a collision with something that isn't relocatable, or the DLL isn't relocatable for some unknown reason (unknown reloc type entry for example) even though it has reloc info. Also, Dynaloader uses perlhost.h/vdir to possibly change the path, so its not always the path that Dynaloader is reporting exactly. I know you said if you change the file the not a win32 application happens. If you look at http://support.microsoft.com/kb/113996 you will notice many different NTSTATUS codes map to ERROR_BAD_EXE_FORMAT. Using a C debugger to look at the EAX return value of LdrLoadDll in LoadLibraryExW. That will be the native status code. To figure out if relocation failed, set a breakpoint right before "/DynaLoader.pm line 226" (I use system("pause");), run the perl process until the PLPlot load attemp, then use VMMap or MemMapView and look at the address space, and see if there is anything at or near 622c0000 to 0x625D7200 (last section 0x625ce000 + last section length 0x9200 = 0x625D7200 ), then hit space to unfreeze it, and see if it fails with not a valid application.

        edit:When boot of PLplot is called, PLPlot's DLL is fully loaded, and the LoadLibrary returned a while ago. "Can't load PDL::Core module" is a croak call in PLplot's boot, so using Dynaloader for broken and ok DLLS, in isolation, is fine. But the PLplot PM file use/load/requires something else, this something else is causing the problem that later causes the bootstrap/LoadLibrary to fail for broken PLplot dll.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007441]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2014-09-21 22:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (176 votes), past polls