關於程序建立時在驅動下獲取命令列引數的問題

2021-09-09 06:39:43 字數 3065 閱讀 7382

robinh00d 2011-10-09 01:10:47

晚上在試**決某個問題的時候,嘗試在process callback下獲取命令列引數,但是在windbg下除錯的時候

1、先切換到目標程序

kd> .process /p 0x825da8d8

implicit process is now 825da8d8

2、再輸出peb結構體資訊

kd> dt _peb 0x7ffd3000

ntdll!_peb

+0x000 inheritedaddressspace : 0 ''

+0x001 readimagefileexecoptions : 0 ''

+0x002 beingdebugged : 0 ''

+0x003 sparebool : 0 ''

+0x004 mutant : 0xffffffff void

+0x008 imagebaseaddress : 0x00400000 void

+0x00c ldr : (null)

+0x010 processparameters : 0x00020000 _rtl_user_process_parameters

3、最後輸出命令列引數資訊

kd> dt _rtl_user_process_parameters 0x00020000

ntdll!_rtl_user_process_parameters

+0x000 maximumlength : 0x1000

+0x004 length : 0x748

+0x008 flags : 0

+0x00c debugflags : 0

+0x010 consolehandle : 0xfffffffe void

+0x014 consoleflags : 0

+0x018 standardinput : (null)

+0x01c standardoutput : 0x00010001 void

+0x020 standarderror : (null)

+0x024 currentdirectory : _curdir

+0x030 dllpath : _unicode_string "--- memory read error at address 0x00000498 ---"

+0x038 imagepathname : _unicode_string "--- memory read error at address 0x000005fc ---"

+0x040 commandline : _unicode_string "--- memory read error at address 0x0000065c ---"

+0x048 environment : 0x00010000 void

+0x04c startingx : 0

+0x050 startingy : 0

+0x054 countx : 0

+0x058 county : 0

+0x05c countcharsx : 0

+0x060 countcharsy : 0

+0x064 fillattribute : 0

+0x068 windowflags : 0x401

+0x06c showwindowflags : 1

+0x070 windowtitle : _unicode_string "--- memory read error at address 0x000006c4 ---"

+0x078 desktopinfo : _unicode_string "--- memory read error at address 0x00000724 ---"

+0x080 shellinfo : _unicode_string "--- memory read error at address 0x00000744 ---"

+0x088 runtimedata : _unicode_string ""

+0x090 currentdirectores : [32] _rtl_drive_letter_curdir

無法輸出命令列引數字串,開始誤以為是還未填充命令列引數,後來繼續用!peb

kd> !peb 0x7ffd3000

peb at 7ffd3000

inheritedaddressspace: no

readimagefileexecoptions: no

beingdebugged: no

imagebaseaddress: 00400000

ldr 00000000

*** unable to read ldr table at 00000000

subsystemdata: 00000000

processheap: 00000000

processparameters: 00020000

currentdirectory: '< name not readable >'

windowtitle: 'c:\program files\internet explorer\iexplore.exe'

imagefile: 'c:\program files\internet explorer\iexplore.exe'

commandline: '"c:\program files\internet explorer\iexplore.exe" '

dllpath: 'c:\program files\internet explorer;c:\windows\system32;c:\windows\system;c:\windows;.;c:\program files\internet explorer;;c:\windows\system32;c:\windows;c:\windows\system32\wbem'

environment: 00010000

缺可以顯示,最後發現是_rtl_user_process_parameters 結構體裡的unicode_string的buffer引數這時候儲存的是相對於結構體_rtl_user_process_parameters 的偏移。至此,問題解決。

在Linux Unix下建立程序

不同的作業系統採用不同的實現方式來建立程序。例如在unix系統中,每個程序都有唯一的程序識別號 pid 父程序利用fork系統呼叫來建立新程序。fork的返回值小於零,說明程序沒有建立成功 fork的返回值等於零,表示子程序正在執行 fork的返回值大於零,表示父程序還在執行。子程序被建立後,一般使...

關於在MOBILE下開啟其他程序

1.用createprocess 例如要開啟windows下的explorer 2.用shellexecuteex 還是開啟explorer shellexecuteinfo te memset te,0x00,sizeof shellexecuteinfo 清空記憶體的一定要加,不加會失敗的。te...

關於在windows下建立python虛擬環境

想著在windows下裝乙個新的環境,在終端試了一下 可以用 就記錄一下 虛擬環境建立工具 virtualenv 在你所需要的位置 建立你的虛擬環境的資料夾 演示在我的d盤建立了資料夾d env scrapy 在終端下進入此資料夾下,pip install virtualenv出現successfu...