obvious. First, you must write code for every API function that you are interested in. Second, you cannot HOOK all the API functions, due to the lack of complete API call sequence for reference, some small actions may be missed during log analysis.Another idea is to use the debugging technology to set breakpoints in advance at the entrances of all introduced DLL functions, and obtain parameters through stack information during debugging. Both IDA pro and OllyDbg can be used for dynamic debuggin
% instead of D.36 call _ Test37. Push eax; assume that the address of push eax is XXX.38 push offset sztextfmt39 call printf40 add ESP, 841 RET42_main endp43end _ main4445; /**///////////////////////////////////// //// // The stack changes are described below46
The first thing to understand is that the operation of the stack segment SS can only use ESP or EBP registers, other registers eax ebx edx and so o
Document directory
1. Function Parameters
3. Reference
This article is based on Win32 compilation.1. Function Parameters
The growth direction of function stack is opposite to that of address, from high address to low address. ESP points to the top of the function stack, and EBP points to the bottom of the function stack.
Sub esp xxx pushes memory blocks of XXX length into the stack
Add
all the API functions, due to the lack of complete API call sequence for reference, some small actions may be missed during log analysis.Another idea is to use the debugging technology to set breakpoints in advance at the entrances of all introduced DLL functions, and obtain parameters through stack information during debugging. Both Ida pro and ollydbg can be used for dynamic debugging and provide script/plug-in functions. During my meeting in Beijing last week, I used the waking time to write
Source program in c ++:
Copy codeThe Code is as follows: class X {
Private:
Int I;
};
Int main (){X x;}
The preceding class X does not define the constructor and only has an int I.
The assembler is as follows:
Copy codeCode:; 7: int main (){
Push ebp; ebp is a register that always points to the stack bottom of a function call stack. As the base address, the offset is used to access the variables on the call stack, but no variables need to be accessed here, so it does not workMov ebp and
source programs in C + +:
Copy Code code as follows:
Class X {
Private
int i;
};
int main () {x x;}
The class X above does not have a constructor defined, just an int i.
The following is an assembler:
Copy Code code as follows:
; 7:int Main () {
Push EBP;EBP is a register that always points to the bottom of a function call stack and, as the base address, accesses the variable on the call stack with an offset, but there are no variables to acc
double-click the corresponding code.0040EA92. E8 99F9FFFF CALL Ultra_MP.0040E4300040EA97. 83C4 08 add esp, 80040EA9A. 85C0 test eax, EAX0040EA9C 75 2B jnz short Ultra_MP.0040EAC90040EA9E. 6A 40 PUSH 400040EAA0. 68 E49D4100 PUSH Ultra_MP.00419DE4; sorry0040EAA5. 68 C09D4100 PUSH Ultra_MP.00419DC0; Invalid user name or register codeWe choose to run the software at the breakpoint at ea92, enter the user name "Hokkien" in the registration box, and enter
// exit the subfunction
Http://hi.baidu.com/donghongchen/blog/item/486ac300e96dc4027bec2c80.html
Http://my.oschina.net/orion/blog/15879The following is the assembly code for calling the test (INT P1, int P2) function according to the call Convention _ stdcall.Suppose that the pre-function Stack pointer ESP is NNPush P2; parameter 2 into the stack, ESP-= 4 h, esp
3.3 x86 Command System3.3. 1 data transmission instructions
1. General transfer commands(1) mov commandFormat: mov DST, SRCFunction: Send the content of the source operand SRC to the destination operand DST.(2) movsx signed extended transfer command (after 386)Format: movsx DST, SRCFunction: (DST) compliant with the extension (SRC)(3) movzx transfer instruction with zero extension (after 386)Format: movzx DST, SRCFunction: (DST) Zero-Scaling (SRC)Example 3.25 movzx dx, Al; 816Example 3.26 movzx
the original BP value.RET//exit child function
http://my.oschina.net/orion/blog/15879The following is the assembly code for calling function test (int p1,int p2) by calling convention __stdcall; Assume that the stack pointer esp is NN before executing the functionPush P2 parameter 2 in stack, ESP = 4h, esp = nn-4hPush p1 parameter 1 in stack,
results are as follows: One of the first two cases overflowed, and only the third was normal. And then we'll look at their assembly code, which is the assembler code I disassembled with Objdump: 1 intMainintArgc,char *argv[])2 {3 8048394: - Push%EBP4 8048395: theE5mov%ESP,%EBP5 8048397: theE4 F8 and$0xfffffff8,%esp6804839a: theEc - Sub$0x30,%esp7Long Muln =203879;8804839d: C7 - - 0c the1cGenevamovl $0x31c6
caches.Iv. Types of registersThe early x86 CPU had only 8 registers, and each had a different purpose. Now there are more than 100 registers, all become general-purpose registers, not specifically used, but the names of the early registers are preserved.
EAX
EBX
Ecx
EDX
Edi
Esi
Ebp
Esp
Of the above 8 registers, the first seven are universal. ESP registers have a sp
Before starting the installation, first describe the difference between the mysql-5.6.4 and the lower version in the installation, from the mysql-5.5, mysql source code installation began to use cmake, so when we configure the installation directory. /configure -- perfix = /..... there will be some differences from the previous ones, which we will mention later.
Related reading: MySQL 5.6.4 M7 released
I. Decompress mysql-5.6.4-
code from when it starts. In fact, all software can start from when it starts.Check with RegMon and FileMon and find a registry key named Key1, which contains a long mess of characters. You can use bpx RegQueryValueExA as a breakpoint and track it. However, this plug-in reads too many registry keys, and the SoftICE conditional breakpoint is not very good (I use bpx RegQueryValueExA if * (esp 8) = 'key1' for resumable upload without interruption), so
calls the _ rtc_check_2_to_1 @ 4 function to check whether there is any data truncation problem. The result is placed in Al, finally, put Al in Ch. _ Rtc_check_2_to_1 @ 4 as the name suggests, it is to check that the data of two bytes is converted into one byte (short is two bytes, char is a byte), the Code is as follows:
_ Rtc_check_2_to_1:00411900 push EBP00411901 mov EBP, ESP00411903 push EBX00411904 mov EBX, ECx00411906 mov eax, EBX00411908 and eax, 0ff00h0041190d je _ rtc_check_2_
. Start with EIP pointing at 19 lines, EBP esp in 0 position (01234 on the right is set for convenient analysis) 2.PUSHL%ebp, the EBP value stack 3.movl%esp,%ebp, Assign ESP value to EBP 4.subl $4,%esp, move esp down one grid 5.movl $33, (%
This article will analyze the running process of C program on IA-32 system pc through compiler generated assembly code.Experimental environment: GCC 4.8.2Memory structure of C language programC code is as followsint g(int x){ return x + 1;}int f(int x){ return g(x);}int main(void){ return f(2) + 3;}Compile gcc -S -O0 -o main.s main.c -m32 The assembly file using the Compile command, as followsg: pushl %ebp movl %esp, %ebp movl
What is the code after this code Disassembly?
# Include
Long test (int a, int B){A = a + 3;B = B + 5;Return a + B;}
Int main (int argc, char * argv []){Printf ("% d", test (10, 90 ));Return 0;}
Let's look at an overview.
16: int main (int argc, char * argv [])17 :{00401070 push ebp00401071 mov ebp, esp00401073 sub esp, 40 h00401076 push ebx00401077 push esi00401078 push edi00401079 lea edi, [ebp-40h]00401_c mov ecx, 10 h00401081 mov eax, 0 CCCCCCCCh0
one time.
The next step is to find the longest ordered substring. Because the correct sequence is from small to large, the examples are started from the last one. Find the longest ordered sub-String Length MI after each number (including itself), and then find the maximum value in the most Mi, that is, the solution. View the following sequence:
No.
1 2 3 4 5 6 7 8 9 10
Sequence
5 8 3 7 6 1 9 2 10 4
AlgorithmThe procedure is as follows:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.