Why does MSVC 2010 32bit project link to 64bit kernel32.dll?

前端 未结 3 789
慢半拍i
慢半拍i 2021-01-17 17:57

I have a Win32 (32bit) DLL project which builds and links without error. The DLL fails to load into a 32bit process. Using DependencyWalker, I see that the DLL is 32bit but

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-17 18:14

    Check out the dependency website FAQ. http://www.dependencywalker.com/faq.html

    Q.Will Dependency Walker work with 64-bit modules?
    

    you need use the x86 version for the 32bit modules, x64 for the 64bit modules. It means you need have 2 copy in the 64bit OS and use them accordingly.

    you can use the windows registry to create the context menu in order to save your trouble like this.

    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\dllfile\shell]
    
    [HKEY_CLASSES_ROOT\dllfile\shell\View Dependencies]
    
    [HKEY_CLASSES_ROOT\dllfile\shell\View Dependencies\command]
    @="\\\\psf\\Public\\Library\\DEPE~K17\\depends.exe /dde"
    
    [HKEY_CLASSES_ROOT\dllfile\shell\View Dependencies\ddeexec]
    @="[open(\"%1\")]"
    
    [HKEY_CLASSES_ROOT\dllfile\shell\View Dependencies(32bit)]
    
    [HKEY_CLASSES_ROOT\dllfile\shell\View Dependencies(32bit)\command]
    @="\\\\psf\\Public\\Library\\DEPE~K17\\x86\\depends.exe /dde"
    
    [HKEY_CLASSES_ROOT\dllfile\shell\View Dependencies(32bit)\ddeexec]
    @="[open(\"%1\")]"
    
    [HKEY_CLASSES_ROOT\exefile\shell]
    
    [HKEY_CLASSES_ROOT\exefile\shell\View Dependencies]
    
    [HKEY_CLASSES_ROOT\exefile\shell\View Dependencies\command]
    @="\\\\psf\\Public\\Library\\DEPE~K17\\depends.exe /dde"
    
    [HKEY_CLASSES_ROOT\exefile\shell\View Dependencies\ddeexec]
    @="[open(\"%1\")]"
    
    [HKEY_CLASSES_ROOT\exefile\shell\View Dependencies(32bit)]
    
    [HKEY_CLASSES_ROOT\exefile\shell\View Dependencies(32bit)\command]
    @="\\\\psf\\Public\\Library\\DEPE~K17\\x86\\depends.exe /dde"
    
    [HKEY_CLASSES_ROOT\exefile\shell\View Dependencies(32bit)\ddeexec]
    @="[open(\"%1\")]"
    

提交回复
热议问题