【轉貼】罕為人知的無敵命令 ntsd


Recommended Posts

問:怎麼才能關掉一個用任務管理器關不了的進程?我前段時間發現我的機子埵h了一個進程,只要開機就在,我用任務管理器卻怎麼關也關不了

  答1:殺進程很容易,隨便找個工具都行。比如IceSword。關鍵是找到這個進程的啟動方式,不然下次重啟它又出來了。順便教大家一招狠的。其實用Windows自帶的工具就能殺大部分進程:

  c:\>ntsd -c q -p PID

  只有System、SMSS.EXE和CSRSS.EXE不能殺。前兩個是純內核態的,最後那個是Win32子系統,ntsd本身需要它。ntsd從2000開始就是系統自帶的用戶態調試工具。被調試器附著(attach)的進程會隨調試器一起退出,所以可以用來在命令行下終止進程。使用ntsd自動就獲得了debug許可權,從而能殺掉大部分的進程。ntsd會新開一個調試視窗,本來在純命令行下無法控制,但如果只是簡單的命令,比如退出(q),用-c參數從命令行傳遞就行了。NtsdNtsd 按照慣例也向軟體發展人員提供。只有系統開發人員使用此命令。有關詳細資訊,請參閱 NTSD 中所附的幫助檔。用法:開個cmd.exe視窗,輸入:

  ntsd -c q -p PID

  把最後那個PID,改成你要終止的進程的ID。如果你不知道進程的ID,任務管理器->進程選項卡->查看->選擇列->勾上"PID(進程識別字)",然後就能看見了。

  答2:xp下還有兩個好東東tasklist和tskill。tasklist能列出所有的進程,和相應的資訊。tskill能查殺進程,語法很簡單:tskill 程式名!!

參考資料:

NTSD 的幫助檔

-------------------------------------------------------------------------------------------------------

usage: ntsd [-?] [-2] [-d] [-g] [-G] [-myob] [-lines] [-n] [-o] [-s] [-v] [-w]

[-r BreakErrorLevel] [-t PrintErrorLevel]

[-hd] [-pd] [-pe] [-pt #] [-pv] [-x | -x{e|d|n|i} ]

[-- | -p pid | -pn name | command-line | -z CrashDmpFile]

[-zp CrashPageFile] [-premote transport] [-robp]

[-aDllName] [-c "command"] [-i ImagePath] [-y SymbolsPath]

[-clines #] [-srcpath SourcePath] [-QR \\machine] [-wake ]

[-remote transport:server=name,portid] [-server transport:portid]

[-ses] [-sfce] [-sicv] [-snul] [-noio] [-failinc] [-noshell]

where: -? displays this help text

command-line is the command to run under the debugger

-- is the same as -G -g -o -p -1 -d -pd

-aDllName sets the default extension DLL

-c executes the following debugger command

-clines number of lines of output history retrieved by a remote client

-failinc causes incomplete symbol and module loads to fail

-d sends all debugger output to kernel debugger via DbgPrint

-d cannot be used with debugger remoting

-d can only be used when the kernel debugger is enabled

-g ignores initial breakpoint in debuggee

-G ignores final breakpoint at process termination

-hd specifies that the debug heap should not be used

for created processes. This only works on Windows Whistler.

-o debugs all processes launched by debuggee

-p pid specifies the decimal process Id to attach to

-pd specifies that the debugger should automatically detach

-pe specifies that any attach should be to an existing debug port

-pn name specifies the name of the process to attach to

-pt # specifies the interrupt timeout

-pv specifies that any attach should be noninvasive

-r specifies the (0-3) error level to break on (SeeSetErrorLevel)

-robp allows breakpoints to be set in read-only memory

-t specifies the (0-3) error level to display (SeeSetErrorLevel)

-w specifies to debug 16 bit applications in a separate VDM

-x sets second-chance break on AV exceptions

-x{e|d|n|i} sets the break status for the specified event

-2 creates a separate console window for debuggee

-i ImagePath specifies the location of the executables that generated

the fault (see _NT_EXECUTABLE_IMAGE_PATH)

-lines requests that line number information be used if present

-myob ignores version mismatches in DBGHELP.DLL

-n enables verbose output from symbol handler

-noio disables all I/O for dedicated remoting servers

-noshell disables the .shell (!!) command

-QR <\\machine> queries for remote servers

-s disables lazy symbol loading

-ses enables strict symbol loading

-sfce fails critical errors encountered during file searching

-sicv ignores the CV record when symbol loading

-snul disables automatic symbol loading for unqualified names

-srcpath specifies the source search path

-v enables verbose output from debugger

-wake wakes up a sleeping debugger and exits

-y specifies the symbol search path (see _NT_SYMBOL_PATH)

-z specifies the name of a crash dump file to debug

-zp specifies the name of a page.dmp file

to use with a crash dump

-remote lets you connect to a debugger session started with -server

must be the first argument if present

transport: tcp | npipe | ssl | spipe | 1394 | com

name: machine name on which the debug server was created

portid: id of the port the debugger server was created on

for tcp use: port=

for npipe use: pipe=

for 1394 use: channel=

for com use: port=,baud=,

channel=

for ssl and spipe see the documentation

example: ... -remote npipe:server=yourmachine,pipe=foobar

-server creates a debugger session other people can connect to

must be the first argument if present

transport: tcp | npipe | ssl | spipe | 1394 | com

portid: id of the port remote users can connect to

for tcp use: port=

for npipe use: pipe=

for 1394 use: channel=

for com use: port=,baud=,

channel=

for ssl and spipe see the documentation

example: ... -server npipe:pipe=foobar

-premote transport specifies the process server to connect to

transport arguments are given as with remoting

Environment Variables:

_NT_SYMBOL_PATH=[Drive:][Path]

Specify symbol image path.

_NT_ALT_SYMBOL_PATH=[Drive:][Path]

Specify an alternate symbol image path.

_NT_DEBUGGER_EXTENSION_PATH=[Drive:][Path]

Specify a path which should be searched first for extensions dlls

_NT_EXECUTABLE_IMAGE_PATH=[Drive:][Path]

Specify executable image path.

_NT_SOURCE_PATH=[Drive:][Path]

Specify source file path.

_NT_DEBUG_LOG_FILE_OPEN=filename

If specified, all output will be written to this file from offset 0.

_NT_DEBUG_LOG_FILE_APPEND=filename

If specified, all output will be APPENDed to this file.

_NT_DEBUG_HISTORY_SIZE=size

Specifies the size of a server's output history in kilobytes

Control Keys:

Quit debugger

Break into Target

Force a break into debuggee (same as Ctrl-C)

Debug Current debugger

Toggle Verbose mode

Print version information

ntsd: exiting - press enter ---

-------------------------------------------------------------------------------------------------------

http://tech.ccidnet.com/pub/article/c1099_a183417_p1.html

鏈接文章
分享到其他網站

請登入後來留意見

在登入之後,您才能留意見



立即登入