Nếu menu item không tồn tại, giá trị trả về sẽ là 0xFFFFFFFF... 03.2 Dialog Boxes =========== CreateDialogIndirectParamA / CreateDialogIndirectParamW Hàm CreateDialogIndirectParamA có nh
Trang 1T _Single Step one instruction
TASK Display windows task list
THREAD Display thread information
U _Un-Assemblers instructions
VER _SoftICE Version
WATCH Add watch
WHAT _Identify the type of expression
WMSG _Display windows messages
X Return to host debugger or program
Những lệnh cấp cao :
CPU _Display CPU register information
GDT _Display global descriptor table
GENINT Generate an interrupt
HEAP Display windows global heap
LHEAP _Display windows local heap
IDT _Display interrupt descriptor table
I, IB, IW, ID Input data from I/O Port
O OB, OW, OD Output data form I/O Port
LDT _Display local descriptor table
MAP32 _Display 32Bit section map
MAPV86 Display v86 memory map
PAGE Display page table information
PCI Display PCI device information
PEEK Read from physical address
PHYS Display all virtual addresses for physical address POKE Write to physical address
PROC Display process information
QUERY Display process virtual address space map TSS _Display task state segment
STACK _Display call stack
VCALL _Display VxD calls
VM Display virtual machine information VXD _Display windows VxD map
XFRAME Display active exeption frames
Mode Control :
FAULTS Enable/Disable SoftIce fault trapping I1HERE Direct INT1 to SoftICE
I3HERE Direct INT3 to SoftICE
Trang 2SET _Change an internal variable
ZAP _Zap embedded INT1 or INT3
Những lệnh chỉnh sửa :
ALTKEY _Set key sequence to invoke window
ANSWER Auto-answer and redirect console to modem CODE _Display insctruction bytes in code window COLOR Display/Set screen colors
DEX Display/Assign window data expression DIAL Redirect console to modem
FKEY Display/Set function keys
LINES _Set/Display number of lines on screen MACRO Define a named macro command
PAUSE _Control display scroll mode
PRN _Set printer output port
SERIAL Redirect console
TABS Set/Display tab setting
Window Commands :
. _ Locate current instruction
EC Enable/Disable code window
WC _Toggle code window
WD _Toggle data window
WF _Toggle float point stack window
WL _ Toggle locals window
WR _Toggle register window
WW _Toggle watch window
Window Control :
ALTSCR Change to alternate display
CLS _Clear window
FLASH _Restore screen during P and T
RS Restore program screen
Symbole / Source Commands :
EXP _Display export symbols
FILE Change/Display current source file
LOCALS Display locals currently in scope
SRC _Toggle between source, mixed & code SS Search source module for string
Trang 3SYMLOC _Relocate symbol base
TAB _Select/Remove symbol table
TYPES _List all types, or display type defination
Back Trace Commands :
SHOW _Display from backtrace buffer
TRACE Enter backtrace simulation mode
XT Step in trace simulation mode
XP Program step in trace simulation mode XG Go to address in trace simulation mode XRSET _Reset backtrace history buffer
Special Operators :
. _Preceding a decimal number specifies a line number
$ Preceding an address specifies SEGMENT addressing
# Preceding an address specifies SELECTOR
@ Preceding an address
The_lighthouse(REA)
(típ theo)
PHẦN 3 : Breakpoint và Win API Details
03.1 Crippled Programs
================
EnableMenuItem
Hàm EnableMenuItem có nhiệm vụ enable, disable, hay gray 1 item nào đó trong menu
Code:
BOOL EnableMenuItem(
HMENU hMenu, _// handle of menu
UINT uIDEnableItem, // menu item to enable, disable, or gray UINT uEnable // menu item flags
);
Returns
Giá trị trả về sẽ chỉ rõ trạng thái trước đó của menu item (đó là MF_DISABLED, MF_ENABLED hay MF_GRAYED) Nếu menu item không tồn tại, giá trị trả về
sẽ là 0xFFFFFFFF
Trang 4EnableWindow
Hàm EnableWindow có nhiệm vụ enable hoặc disable chuột và bàn phím input vào specified window hoặc control Khi input bị disable, window không thể nhận input như click chuột và gõ phím Khi input enable, window nhận tất cả input
Code:
BOOL EnableWindow(
HWND hWnd, // handle of window
BOOL bEnable _// flag for enabling or disabling input
);
Returns
Nếu window đã bị disable, giá trị trả về là TRUE, ngược lại giá trị trả về là
FALSE Để biết thông tin về lỗi, chúng ta dùng lệnh GetLastError
03.2 Dialog Boxes
===========
CreateDialogIndirectParamA / CreateDialogIndirectParamW
Hàm CreateDialogIndirectParamA có nhiệm vụ tạo ra modeless dialog box từ dialog box template trong memory Trước khi display dialog box, function sẽ pass program-defined value vào dialog box procedure giống như thông số Iparam của WM_INITDIALOG message Chương trình có thể sử dụng giá trị này để initialize (chạy) dialog box controls
Code:
HWND CreateDialogIndirectParam(
HINSTANCE hInstance, // handle of application instance LPCDLGTEMPLATE lpTemplate, // address of dialog box template HWND hWndParent, // handle of owner window
DLGPROC lpDialogFunc, _// address of dialog box procedure LPARAM lParamInit _// initialization value
);
Returns
Nếu function succeed (tạm dịch là hoàn thành), giá trị trả về là handle của dialog box Còn nếu function fail (không hoàn thành), giá trị trả về là NULL, giá trị là 0xFFFFFFFF
CreateDialogParamA / CreateDialogParamW
Hàm CreateDialogParamA có nhiệm vụ tạo ra modeless dialog box từ dialog box template resource Trước khi display dialog box, function sẽ pass program-defined value vào dialog box procedure giống như thông số Iparam của
Trang 5WM_INITDIALOG message Chương trình có thể sử dụng giá trị này để initialize dialog box controls
Code:
HWND CreateDialogParam(
HINSTANCE hInstance, // handle of application instance
LPCTSTR lpTemplateName, _// identifies dialog box
template
HWND hWndParent, _ // handle of owner window
DLGPROC lpDialogFunc, _// address of dialog box procedure LPARAM dwInitParam // initialization value
);
Returns
Nếu window bị disable, giá trị trả về là TRUE, ngược lại giá trị trả về là FALSE
Để biết thông tin về lỗi, chúng ta dùng lệnh GetLastError
DialogBox
Hàm DialogBox có nhiệm vụ tạo ra modal dialog box từ dialog box template
resource DialogBox không return control cho đến khi specified callback function kết thúc modal dialog box bằng cách gọi EndDialog
Code:
int DialogBox(
HANDLE hInstance, // handle of application instance LPCTSTR lpTemplate, _// identifies dialog box template HWND hWndParent, _// handle of owner window
DLGPROC lpDialogFunc // address of dialog box procedure );
Returns
Nếu function hoàn thành, giá trị trả về là thông số nResult trong lệnh call
EndDialog được dùng để kết thúc dialog box Nếu function không hoàn thành, giá trị trả về là -1
DialogBoxIndirect
Hàm DialogBoxIndirect có nhiệm vụ tạo ra modal dialog box từ dialog box
template trong memory
Code:
int DialogBoxIndirect(
HANDLE hInstance, _// handle of application instance