2017-04-23 128 views
1

我已經創建了DLL的生產版本。在使用virustotal進行掃描時,我注意到報告調試信息的結果在文件中,如下所示。有人可以告訴我這是什麼調試信息,我該如何刪除它?該DLL是從使用Visual Studio社區2017構建的C++。DLL調試信息

在任何人給我一個通用的建議,它是一個很好的做法有調試信息,我想說,不,我不需要調試信息,也不希望任何人都可以獲得這個調試信息。

enter image description here

DUMPBIN /爲DLL頭如下:

PE signature found 

File Type: DLL 

FILE HEADER VALUES 
      14C machine (x86) 
       5 number of sections 
     58FBCD28 time date stamp Sat Apr 22 22:37:44 2017 
       0 file pointer to symbol table 
       0 number of symbols 
       E0 size of optional header 
      2102 characteristics 
        Executable 
        32 bit word machine 
        DLL 

OPTIONAL HEADER VALUES 
      10B magiC# (PE32) 
      14.10 linker version 
      10800 size of code 
      9800 size of initialized data 
       0 size of uninitialized data 
      2E64 entry point (10002E64) 
      1000 base of code 
      12000 base of data 
     10000000 image base (10000000 to 1001DFFF) 
      1000 section alignment 
      200 file alignment 
      6.00 operating system version 
      0.00 image version 
      6.00 subsystem version 
       0 Win32 version 
      1E000 size of image 
      400 size of headers 
       0 checksum 
       2 subsystem (Windows GUI) 
      140 DLL characteristics 
        Dynamic base 
        NX compatible 
      100000 size of stack reserve 
      1000 size of stack commit 
      100000 size of heap reserve 
      1000 size of heap commit 
       0 loader flags 
       10 number of directories 
      17E40 [  14C] RVA [size] of Export Directory 
      17F8C [  50] RVA [size] of Import Directory 
      1B000 [  1E0] RVA [size] of Resource Directory 
       0 [  0] RVA [size] of Exception Directory 
       0 [  0] RVA [size] of Certificates Directory 
      1C000 [ 11CC] RVA [size] of Base Relocation Directory 
      17780 [  38] RVA [size] of Debug Directory 
       0 [  0] RVA [size] of Architecture Directory 
       0 [  0] RVA [size] of Global Pointer Directory 
       0 [  0] RVA [size] of Thread Storage Directory 
      177B8 [  40] RVA [size] of Load Configuration Directory 
       0 [  0] RVA [size] of Bound Import Directory 
      12000 [  188] RVA [size] of Import Address Table Directory 
       0 [  0] RVA [size] of Delay Import Directory 
       0 [  0] RVA [size] of COM Descriptor Directory 
       0 [  0] RVA [size] of Reserved Directory 


SECTION HEADER #1 
    .text name 
    1069A virtual size 
    1000 virtual address (10001000 to 10011699) 
    10800 size of raw data 
    400 file pointer to raw data (00000400 to 00010BFF) 
     0 file pointer to relocation table 
     0 file pointer to line numbers 
     0 number of relocations 
     0 number of line numbers 
60000020 flags 
     Code 
     Execute Read 

SECTION HEADER #2 
    .rdata name 
    6834 virtual size 
    12000 virtual address (10012000 to 10018833) 
    6A00 size of raw data 
    10C00 file pointer to raw data (00010C00 to 000175FF) 
     0 file pointer to relocation table 
     0 file pointer to line numbers 
     0 number of relocations 
     0 number of line numbers 
40000040 flags 
     Initialized Data 
     Read Only 

    Debug Directories 

     Time Type  Size  RVA Pointer 
    -------- ------- -------- -------- -------- 
    58FBCD28 coffgrp  264 0001782C 1642C 4C544347 (LTCG) 
    58FBCD28 iltcg   0 00000000  0 

SECTION HEADER #3 
    .data name 
    1884 virtual size 
    19000 virtual address (10019000 to 1001A883) 
    800 size of raw data 
    17600 file pointer to raw data (00017600 to 00017DFF) 
     0 file pointer to relocation table 
     0 file pointer to line numbers 
     0 number of relocations 
     0 number of line numbers 
C0000040 flags 
     Initialized Data 
     Read Write 

SECTION HEADER #4 
    .rsrc name 
    1E0 virtual size 
    1B000 virtual address (1001B000 to 1001B1DF) 
    200 size of raw data 
    17E00 file pointer to raw data (00017E00 to 00017FFF) 
     0 file pointer to relocation table 
     0 file pointer to line numbers 
     0 number of relocations 
     0 number of line numbers 
40000040 flags 
     Initialized Data 
     Read Only 

SECTION HEADER #5 
    .reloc name 
    11CC virtual size 
    1C000 virtual address (1001C000 to 1001D1CB) 
    1200 size of raw data 
    18000 file pointer to raw data (00018000 to 000191FF) 
     0 file pointer to relocation table 
     0 file pointer to line numbers 
     0 number of relocations 
     0 number of line numbers 
42000040 flags 
     Initialized Data 
     Discardable 
     Read Only 

    Summary 

     2000 .data 
     7000 .rdata 
     2000 .reloc 
     1000 .rsrc 
     11000 .text 
+0

該文件的.rdata部分中的調試目錄正在用於與調試無關的信息。微軟不能真正修改數據目錄而不會破壞很多工具,所以這是解決方法。例如,配置文件引導的優化信息,看起來像這樣,大小是正確的。除此之外總是一個好主意,當你的程序在生產中崩潰時,你會得到一個小型轉儲。它沒有透露任何敏感的東西,所以沒有太多關於它的煩惱。 Dumpbin.exe /頭文件以查看。 –

+0

調試信息通常存儲在單獨的.pdb文件中,而不是可執行文件本身。在你的情況下,可執行文件可能有調試部分(你使用類似Explorer的套件進行探索)而不是調試信息。 – VTT

+0

@Hans Passant:我已經在上面添加了DUMPBIN輸出。假設我仍然想擺脫'調試'信息,這有可能嗎?首先,我不知道傾銷情況。如果有人給我發垃圾郵件,我不知道該怎麼處理,而且我沒有時間或傾向去了解它。其次,我的代碼很少會崩潰 - 這只是個人偏好,所以獲得轉儲的機會很小。我根本不需要傾銷和調試,因此我想刪除所有調試和無關信息的痕跡,以增加羅馬尼亞語和波蘭語腳本小子的樂趣。 – user118708

回答

1

爲了消除調試目錄完全添加/NOCOFFGRPINFO到鏈接器命令行下鏈接器/優化關閉鏈接時代碼生成(即下降/LTCG),默認情況下啓用VS2017中的發佈版本。

+0

感謝您的回答。前段時間我問過類似的問題,但沒有運氣。也許你也可以提供關於TLS目錄的線索? https://stackoverflow.com/questions/31690723/visual-studio-2015-2-new-sectionsin-exe-same-project – Jovibor