Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by bulk88 (Priest)
on Dec 05, 2012 at 19:26 UTC ( #1007371=note: print w/ replies, xml ) Need Help??


in reply to Re^9: 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

Skip Dynaloader, do it the simpler way.

use Win32; my $ret = Win32::LoadLibrary('C:\Perl\site\lib\auto\blah\foo.dll'); print "ret=$ret glr=".Win32::GetLastError()."\n";
What happens with Dependency Walker and without Dependency Walker when running the above script?

0xc000007b is STATUS_INVALID_IMAGE_FORMAT, which maps to ERROR_BAD_EXE_FORMAT which is "%1 is not a valid Win32 application.".

You can also read http://code.google.com/searchframe#S3vzerue4i0/trunk/reactos/lib/rtl/image.c&q=LdrRelocateImageWithBias%20package:reactos-mirror\.googlecode\.com&l=433 to give you some ideas on what happened.


Comment on Re^10: if Digest::SHA1 loaded Can't load LibXML/LibXML.dll Invalid access to memory location
Download Code
Replies are listed 'Best First'.
Re^11: if Digest::SHA1 loaded Can't load LibXML/LibXML.dll Invalid access to memory location
by Anonymous Monk on Dec 06, 2012 at 13:39 UTC

    Same messsage :)

    $ perl badcrabs.txt ret=1849688064 glr=2 $ perl -MDigest::SHA1 badcrabs.txt ret=0 glr=193

    In depends.exe its now

    LDR: LdrRelocateImageWithBias() failed 0xc000007b
    LDR: OldBase     : 6E400000
    LDR: NewBase     : 00A90000
    LDR: Diff        : 0xffffffff92690000
    LDR: NextOffset  : 00CC9F90
    LDR: *NextOffset : 0x302e
    LDR: SizeOfBlock : 0x5c
    

    Compared to -MDigest::SHA1 -MXML::LibXML

    LDR: LdrRelocateImageWithBias() failed 0xc000007b
    LDR: OldBase     : 6E400000
    LDR: NewBase     : 010A0000
    LDR: Diff        : 0xffffffff92ca0000
    LDR: NextOffset  : 012D9F90
    LDR: *NextOffset : 0x302e
    LDR: SizeOfBlock : 0x5c

    Apparently LdrRelocate... errors happen ( Weird problem loading a dll with win32 LoadLibrary() function ) commonly with cygwin , and they recommend using some "rebaseall" shell script, and I saw they do some rebase-ing for MakeMaker/cygwin

    So I look through my dlls $ perl -lne " chomp; print; print qx{objdump -x $_ |grep ImageBase }; " dlls.txt and both Digest/SHA1/SHA1.dll and auto/XML/LibXML/LibXML.dll share ImageBase 6e400000

    Not sure if this is a problem but http://www.sourceware.org/ml/cygwin-apps/2011-07/msg00002.html / http://www.sourceware.org/ml/cygwin/2010-07/msg00258.html / perl5140delta suggests this collision is the problem , so I'll need to rebase, so I try that with the default rebase-2.4.2 address

     perl -pi.orig -e " s{^(LDDLFLAGS = )}{$1 -Wl,--image-base=0x70000000 }; " Makefile

    and it worked!!!!!

    *whew*

    So from time to time I'll have to rebase a few dlls if I stick with this old OS

        GCC created a relocation entry http://source.winehq.org/source/include/winnt.h#L3027 for an relocation type unknown to 32 bit x86 windows. Which is the rogue entry, I don't know since I dont have the DLL, you do. You can try a "dumpbin /relocations" and post the contents, or analyze them yourself.

        What would I be looking for? objdump doesn't list any unknown types, without -s its

        339 ABSOLUTE 44811 HIGHLOW
        about ~2MB worth of text

        With -s its

        494 ABSOLUTE 75652 HIGHLOW

        I could send you the dlls (if you know a no-hassle service), but rebasing seems to have fixed it, or was that just coincidence?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (13)
As of 2015-07-31 18:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (280 votes), past polls