Cannot find decorated function name in dll

五迷三道 提交于 2020-01-06 08:24:14

问题


I created a dll project in Visual Studio 2013

After compiling, I run

dumpbin /symbols DLLTest.dll

via cmd.exe in the directory where the dll is located, but I only get the summary

I ran

 dumpbin /all DLLTest.dll 

(with the text output option) but I could not find the decorated function name in the output (I searched for int and getSomeNum that should be part of the decorated name in the output dump).

I also tried to find a way in VS2013 to enter /FAs into the compiler options, but I was unable to find the compiler options in the C/C++ property pages of the project.

I would appreciate any help to identify the decorated function names.

EDIT: Thanks for the pointer, Jester. I have modified the original code

However, after recompilation bumpbin is still not showing any decorated name (with the /symbols option).


回答1:


Try dumpbin /exports DLLTest.dll. I've tried myself:

> type dlltest.cpp
#include <windows.h>

BOOL WINAPI DllMain(HINSTANCE hInst, DWORD fdwReason, LPVOID lpvReserved)
{
    switch (fdwReason)
    {
    case DLL_PROCESS_ATTACH:
    case DLL_PROCESS_DETACH:
    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
        break;
    }
    return TRUE;
}

__declspec(dllexport) int getSomeNum(int a);
__declspec(dllexport) int getSomeNum2();

__declspec(dllexport) int getSomeNum(int a)
{
    return 2 * a;
}

__declspec(dllexport) int getSomeNum2()
{
    return 5;
}
> cl /LD dlltest.cpp
dlltest.cpp
Microsoft (R) Incremental Linker Version 12.00.30501.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:dlltest.dll 
/dll 
/implib:dlltest.lib 
dlltest.obj 
   dlltest.lib 라이브러리 및 dlltest.exp 개체를 생성하고 있습니다.
> dumpbin /exports dlltest.dll
Microsoft (R) COFF/PE Dumper Version 12.00.30501.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file dlltest.dll

File Type: DLL

  Section contains the following exports for dlltest.dll

    00000000 characteristics
    53C91AAE time date stamp Fri Jul 18 22:01:34 2014
        0.00 version
           1 ordinal base
           2 number of functions
           2 number of names

    ordinal hint RVA      name

          1    0 00001030 ?getSomeNum2@@YAHXZ
          2    1 00001020 ?getSomeNum@@YAHH@Z

  Summary

        3000 .data
        5000 .rdata
        1000 .reloc
        B000 .text


来源:https://stackoverflow.com/questions/24825141/cannot-find-decorated-function-name-in-dll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!