00400000 | hinst= 004000000012fb8c 00000000/lparam = NULL
Windowname is "really? Really! ", This is the content to be changed.
Note that do not use Ctrl + F9 or Alt + F9 to return the result. Check the first record of the stack:Call to createmediawexa from reallyre.0057d7c4
In the Assembly window, press Ctrl + G and enter 0057d7c4. You can see:0057d797 |. 50 push eax;/lparam0057d798 |. 57 push EDI; | hinst0057d799 |. 8b53 5C mov edX, dword ptr [EBX
conventions are used by function callers and function bodies, program execution errors may occur and must be considered as part of the function declaration;
Ii. Common function call conventions;
Function call conventions in vc6;
Call Convention stack clearing parameter passing_ Cdecl the caller passes the stack from right to left_ Stdcall function is passed through Stack from right to left_ Fastcall: Use register (ECx, EDX) first, and then use StackT
Method 1
MoV eax, 0MoV EBX, 0MoV ECx, 0MoV edX, 0
Method 2
XOR eax, eaxXOR edX, EDXXOR ECx, ECxXOR edX, ECx
Method 3
Hmm... yep, here the stall is partially balanced by the non-change of the source argument (a work/branch avoided by the CPU), so in this specific case, the difference is minimized.
XOR eax, eaxXOR ECx, ECxMoV EBX, eaxMoV
access the corresponding memory at that time. What can eight binary bits Express? It can express all ASCII codes. That is to say, a memory unit can store an English character or number, while a Chinese character must be represented by a unicode code. That is to say, two memory units can hold a Chinese character. It is not hard to understand that the sixteen bits are two bytes. Of course, if there are sixteen bits, there must be thirty-two bits, sixty-fourteen bits, and so on. The thirty-two bit
. m_three =3;Testret. m_four =4;ReturnTestret;}
Disassembly code:
30 : Tagtest
Test
;
31 :
Test = Rerstruct ()
;
00401078
Lea Eax, [ebp-30h]; The ebp-30h address into the stack, the function of the struct value
00401_ B
Push Eax
00401_c
Call @ ILT +
0 (Rerstruct )(
00401005 ); Execute the function, at this time the copy of the struct return value is completed on the ebp-30h
00401081
Add ESP,
4. Balance the stack
00401084
MoV ECX, dword ptr [eax]
00401086
Mo
= 2;
int *P1 = a;
int *P2 = b;
Swap (P1, p2)
}
The function swap takes two pointer variables as arguments, and when main () calls swap, the pointer variable p1, the value of P2 (that is, the address of the variable A, b) is placed in the memory unit of the swap on the stack as the form parameter x and Y, in the same way that the value is passed. This can be seen from the following assembly code (note is added by the author):
: void Main ()
23: {
......
......
INT.: int a = 1
):), compiled as:
#APP
MOVL Foo,eax
#NO_APP
MOVL Eax,bar
The statement is a bit weird, but it's a good representation of how GCC works.
Take a piece of code in ARCH/I386/KERNEL/APM.C as an example, let's compare what happens before and after they compile:
Compiled Code of source program
__ASM__ (
"Pushl%%edi/n/t"
"Pushl%%ebp/n/t"
"Lcall%%cs:/n/t"
"SetC%%al/n/t"
"Addl%1,%2/n/t"
"Popl%%ebp/n/t"
"Popl%%edi/n/t"
: "=a" (EA), "=b" (EB),
"=c" (EC), "=d" (ed), "=s" (es)
: "A" (eax_in), "B" (e
The usage of "[]" has been described in "FAQ" and is cited as follows:
1, push DWORD ptr [024c1100] pressure stack 024c1100 value of two words2, CMP eax,[ebp+14] eax-ebp+14 valid value, does not retain the value, mainly looks at the sign bit3, CMP byte ptr [eax],46 byte type eax-46, see sign bit4, Lea eax,[edx-02] edx-02 valid value (an address value) to EAX5, MOV ecx,[
WaitForDebugEvent from MAGCT.0060F8B90012 BCBC 0012CD90 | pDebugEvent = 0012CD900012BCC0 000003E8 Timeout = 1000. MSLocate CD90 in the data window and check the OEP value.Next, disconnect: BP WriteProcessMemory
Now go to the code window Ctrl + G: 0060F8BFCtrl + f search command at the current location: or eax, 0FFFFFFF8Locate the first place at 0060FE8F, on which cmp dword ptr ss: [ebp-A34], 0 sets the breakpoint.
0060FE43 83BD CCF5FFFF 0> cmp dword ptr ss: [ebp-A34], 0// Down, Shift + F9 inter
again. Oh, it's done. I ran to the airspace of user32.dll. Let's take a look at the title bar of ollydbg: "[CPU-main thread, module-USER32], and ran to system airspace. The code shown in the ollydbg Disassembly window is as follows:
77d3213c 6a 0C push 0c77d3213e 68 a021d377 push user32.77d321a077d32143 E8 7864 feff call user32.77d185c0
What should I do? Don't worry. Let's press Alt + F9:
00401328 |. E8 a5000000 call crackhea.004013d2; key: Press F7.0040132d |. 3bc6 CMP eax, ESI; Comparison0040
. Currently, binary code in ELF format is the most commonly used. An executable program in the ELF format is generally divided into the following parts :. text ,. data and. BSS, where. text is a read-only code area ,. data is a readable and writable data area, while. BSS is a readable and writable data zone without initialization. Code and data zones are collectively called sections in elf. You can use other standard sections or add custom sections as needed.Section, but an elf executable progra
The switch and if-else statements are both conditions in the C language. In terms of syntax, the two functions are the same. If the switch can be completed, the switch can also be completed, however, their application scenarios are slightly different. If is mostly used in a single branch, switch is mainly used in the case of multiple branches.
Let's take a look at the C program and the Assembly Code Compiled with GCC.
/* $ Begin switch-C */Int switch_eg (int x){Int result = X;
Switch (x ){
Case
CPUID, Eax,ebx,ecx,edx stores the various characteristic information of the CPU. This information is what we commonly call CPU serial numbers.mov eax, 0//Get manufacturer InfoCpuidmov eax, 1//Get the serial number of the CPUCpuidThe following three functions are available for reference:[C-sharp]View Plaincopy
function Newcpuid: string;
Const
CPUINFO = ' CPU Manufacturer:%s serial number:%x ';
Var
S:ARRAY[0..19] of Char;
Mycpuid:intege
Linux-0.11 Memory Management module is the source of the more difficult to understand the part, now the author's personal understanding publishedFirst hair Linux-0.11 kernel memory management get_free_page () function analysisHave time to write other functions or files:)/* *author:davidlin *date:2014-11-11pm *email: [email protected] or [email protected] *world:the City of SZ , in China *ver:000.000.001 *history:editor time do 1) Linpeng 2014-11-11 Created this file! 2) */Here is the source code
the number of quotes mov esi, cmdline @@: LODSB cmp al, 0; Reach End JE @F cmp al, 34 Jne @B; no quotes continue to Loop Inc ECX; ecx+=1 jmp @B @@: Push ECX Storage count Value shr ecx, 1 shl ecx, 1; ecx-=ecx%2 pop eax; eax= count value cmp eax, Ecx JE @F; the number of quotes is even (matched) the next hop pop edi pop ESI mov eax, 3; return 3 ret @@: ; ------------------------------------------- ; The following code removes the (program's) path and file name; CmdLine only leav
, so it is necessary to control the format. For example:
Asm (movl % eax, % ebx );
Asm (xorl % ebx, % edx );
Asm (movl $0, _ booga );
In the above example, we changed the values of edx and ebx in the Assembly, but due to the special processing method of gcc, the Assembly file is first formed and then handed over to the gas for assembly, therefore, gas does not know that we have changed the values of
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.