1

我想使用 binplace.exe 从符号文件中删除私有符号,我将以下命令保存到批处理文件 'parse.bat':binplace -a -x -s %_NTTREE%\stripped -n %_NTTREE%\full my-executable-file-name中。

问题是:当我执行parse.batfrom 命令行时,binplace可以正确生成剥离符号文件,但如果我parse.bat通过双击它执行,binplace则无法生成剥离符号文件,这是 binplace 使用-v选项的输出消息:

execute by double-click:
BINPLACE : warning GNA0293: Not a response file (-s)
BINPLACE : warning GNA0293: Not a response file (f:\SymbolServer\stripped)
BINPLACE : warning GNA0293: Not a response file (f:\SymbolServer\stripped)
BINPLACE : warning GNA0293: Not a response file (-n)
BINPLACE : warning GNA0293: Not a response file (f:\SymbolServer\full)
BINPLACE : warning GNA0293: Not a response file (f:\SymbolServer\full)
BINPLACE : warning GNA0293: Not a response file (f:\SymbolServer\SystemTool.exe)

BINPLACE : warning BNP0000: Looking at file SystemTool.exe
BINPLACE : warning BNP0000: Class bin Not found in Class Tables
BINPLACE : warning BNP0000: place f:\SymbolServer\SystemTool.exe in f:\SymbolServer\bin\SystemTool.exe
binplace f:\SymbolServer\SystemTool.exe
BINPLACE : warning BNP0000: copy f:\SymbolServer\SystemTool.exe to f:\SymbolServer\bin\SystemTool.exe
BINPLACE : warning BNP0000: No symbols to strip from f:\SymbolServer\bin\SystemTool.exe
BINPLACE : warning BNP1536: Public symbols being copied to f:\SymbolServer\stripped\bin\exe\.
BINPLACE : warning BNP0000: place f:\SymbolServer\SystemTool.pdb in f:\SymbolServer\stripped\bin\exe\SystemTool.pdb
BINPLACE : warning BNP2700: Unable to copy (f:\SymbolServer\SystemTool.pdb,f:\SymbolServer\stripped\bin\exe\SystemTool.pdb) 126
BINPLACE : warning BNP0000: place f:\SymbolServer\SystemTool.pdb in f:\SymbolServer\full\bin\exe\SystemTool.pdb
BINPLACE : warning GNA0127: Command line finished
Press any key to continue . . .

execute from command-line:
F:\SymbolServer>parse.bat
BINPLACE : warning GNA0293: Not a response file (-s)
BINPLACE : warning GNA0293: Not a response file (f:\SymbolServer\stripped)
BINPLACE : warning GNA0293: Not a response file (f:\SymbolServer\stripped)
BINPLACE : warning GNA0293: Not a response file (-n)
BINPLACE : warning GNA0293: Not a response file (f:\SymbolServer\full)
BINPLACE : warning GNA0293: Not a response file (f:\SymbolServer\full)
BINPLACE : warning GNA0293: Not a response file (f:\SymbolServer SystemTool.exe)

BINPLACE : warning BNP0000: Looking at file SystemTool.exe
BINPLACE : warning BNP0000: Class bin Not found in Class Tables
BINPLACE : warning BNP0000: place f:\SymbolServer\SystemTool.exe in f:\SymbolServer\bin\SystemTool.exe
binplace f:\SymbolServer\SystemTool.exe
BINPLACE : warning BNP0000: copy f:\SymbolServer\SystemTool.exe to f:\SymbolServer\bin\SystemTool.exe
BINPLACE : warning BNP0000: Symbols stripped from f:\SymbolServer\bin\SystemTool.exe into f:\SymbolServer\stripped\bin\exe\SystemTool.dbg
BINPLACE : warning BNP0000: place f:\SymbolServer\SystemTool.pdb in f:\SymbolServer\full\bin\exe\SystemTool.pdb
BINPLACE : warning GNA0127: Command line finished
Press any key to continue . . .

使用symchk,我确认SystemTool.exe只有私有符号,输出消息如下:

F:\SymbolServer>symchk /v SystemTool.exe /s .
[SYMCHK] Searching for symbols to F:\SymbolServer\SystemTool.exe in path .
DBGHELP: Symbol Search Path: .
[SYMCHK] Using search path "."
DBGHELP: No header for F:\SymbolServer\SystemTool.exe.  Searching for image on d
isk
DBGHELP: F:\SymbolServer\SystemTool.exe - OK
DBGHELP: SystemTool - private symbols & lines
         .\SystemTool.pdb
[SYMCHK] MODULE64 Info ----------------------
[SYMCHK] Struct size: 1672 bytes
[SYMCHK] Base: 0x00400000
[SYMCHK] Image size: 10293248 bytes
[SYMCHK] Date: 0x52395664
[SYMCHK] Checksum: 0x009cd39e
[SYMCHK] NumSyms: 0
[SYMCHK] SymType: SymPDB
[SYMCHK] ModName: SystemTool
[SYMCHK] ImageName: F:\SymbolServer\SystemTool.exe
[SYMCHK] LoadedImage: F:\SymbolServer\SystemTool.exe
[SYMCHK] PDB: ".\SystemTool.pdb"
[SYMCHK] CV: RSDS
[SYMCHK] CV DWORD: 0x53445352
[SYMCHK] CV Data:  D:\cwork\DriverLoader\Debug\SystemTool.pdb
[SYMCHK] PDB Sig:  0
[SYMCHK] PDB7 Sig: {444090A7-6BE8-4310-BD87-4ABCA3F8E8A9}
[SYMCHK] Age: 1
[SYMCHK] PDB Matched:  TRUE
[SYMCHK] DBG Matched:  TRUE
[SYMCHK] Line nubmers: TRUE
[SYMCHK] Global syms:  TRUE
[SYMCHK] Type Info:    TRUE
[SYMCHK] ------------------------------------
SymbolCheckVersion  0x00000002
Result              0x001f0001
DbgFilename
DbgTimeDateStamp    0x52395664
DbgSizeOfImage      0x009d1000
DbgChecksum         0x009cd39e
PdbFilename         F:\SymbolServer\SystemTool.pdb
PdbSignature        {444090A7-6BE8-4310-BD87-4ABCA3F8E8A9}
PdbDbiAge           0x00000001
[SYMCHK] [ 0x00000000 - 0x001f0001 ] Checked "F:\SymbolServer\SystemTool.exe"

SYMCHK: FAILED files = 0
SYMCHK: PASSED + IGNORED files = 1

谁能告诉我为什么以及如何解决它。

4

1 回答 1

1

这是对您的评论的回应,所以我可以粘贴代码。

您的代码设置了另一个变量 - 它在哪里使用?

尝试使用添加的pause命令,看看它在 cmd 提示符下和双击时是否相同。不要在其中添加任何其他内容。 It occurs to me that you may not have typed the batch file name at the command line - did you do that?

顺便说一句,如果双击时仍然失败,请检查您的 path\batchname 是否包含一个&字符,或者可能是一些%字符。

@echo off
set _NTTREE=f:\SymbolServer
set BINPLACE_PLACEFILE=%_NTTREE%\placefile.txt
binplace -a -x -v -s %_NTTREE%\stripped -n %_NTTREE%\full
pause
%_NTTREE%\SystemTool.exe
pause
于 2013-11-02T12:57:40.417 回答