ida如何显示栈视图和改变局部变量类型

在显示函数时,多是如下显示:

 f_install_start proc near               ; CODE XREF: f_mainentry:loc_4021B6p
.text:00401EF9
.text:00401EF9                         String2         = byte ptr -468h
.text:00401EF9                         var_467         = byte ptr -467h
.text:00401EF9                         Filename        = byte ptr -364h
.text:00401EF9                         var_363         = byte ptr -363h
.text:00401EF9                         String          = byte ptr -260h
.text:00401EF9                         var_25F         = byte ptr -25Fh
.text:00401EF9                         FileName        = byte ptr -15Ch
.text:00401EF9                         Dst             = dword ptr -58h
.text:00401EF9                         var_2C          = dword ptr -2Ch
.text:00401EF9                         var_28          = word ptr -28h
.text:00401EF9                         ProcessInformation= _PROCESS_INFORMATION ptr -14h
.text:00401EF9                         NumberOfBytesWritten= dword ptr -4
.text:00401EF9
.text:00401EF9 55                                      push    ebp
.text:00401EFA 8B EC                                   mov     ebp, esp
.text:00401EFC 81 EC 68 04 00 00                       sub     esp, 468h
.text:00401F02 53                                      push    ebx
.text:00401F03 56                                      push    esi

.....

如果没有显示局部变量

.text:00401EF9                         String2         = byte ptr -468h
.text:00401EF9                         var_467         = byte ptr -467h
.text:00401EF9                         Filename        = byte ptr -364h
.text:00401EF9                         var_363         = byte ptr -363h
.text:00401EF9                         String          = byte ptr -260h
.text:00401EF9                         var_25F         = byte ptr -25Fh
.text:00401EF9                         FileName        = byte ptr -15Ch
.text:00401EF9                         Dst             = dword ptr -58h
.text:00401EF9                         var_2C          = dword ptr -2Ch
.text:00401EF9                         var_28          = word ptr -28h
.text:00401EF9                         ProcessInformation= _PROCESS_INFORMATION ptr -14h
.text:00401EF9                         NumberOfBytesWritten= dword ptr -4

,就不太好看了,这个怎么办呢?

可以在函数 f_install_start proc near 的地方,右键--》change functin。。。。---》然后就有了。

如何改变变量的类型?

看上面的String2的地址为:468h,Filename的地址为364h,中间差了104h,就是MAX_PATH=260的十六进制显示。假设

在后面的程序中,有验证了String2却是是String[MAX_PATH]类型的字符串数组,那么就可以改一下这个变量类型。如何改?

双击string2,到达stack视图模式;

-00000468 String2         db ?
-00000467 var_467         db ?
-00000466                 db ? ; undefined
-00000465                 db ? ; undefined
-00000464                 db ? ; undefined
-00000463                 db ? ; undefined
-00000462                 db ? ; undefined
-00000461                 db ? ; undefined
-00000460                 db ? ; undefined
-0000045F                 db ? ; undefined
-0000045E                 db ? ; undefined
-0000045D                 db ? ; undefined
-0000045C                 db ? ; undefined
-0000045B                 db ? ; undefined
-0000045A                 db ? ; undefined
-00000459                 db ? ; undefined
-00000458                 db ? ; undefined
-00000457                 db ? ; undefined
-00000456                 db ? ; undefined
-00000455                 db ? ; undefined
-00000454                 db ? ; undefined
-00000453                 db ? ; undefined

在该模式里右键string2-》Array--》然后弹出对话框,Array Size里面输入260。怎么样?var_467就自动消失了,也和后面的filename变量补上了。说明我们的判断是正确的。

 

如果变量是结构体变量,怎么显示呢?

双击该变量(如:该变量名为var_10),进入变量编辑模式。选取var_10变量,点击[编辑]->[结构体变量]菜单,在弹出的对话框中选择你的test结构,点击OK按钮,再在弹出的对话框上点击Yes即可。

posted @ 2012-07-16 12:00  keepfocus  阅读(2434)  评论(0编辑  收藏  举报