在批处理文件中使用binplace.exe时出错

时间:2013-11-02 06:12:05

标签: windows batch-file

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

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

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

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

1 个答案:

答案 0 :(得分: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?

BTW,如果双击时仍然失败,请检查您的路径\ 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