I remember writing a HOOK API article (C/C ++ HOOK API (in-depth analysis of the principle-loadlibrarya). The main principle of this article is to construct a code byte, modify the first 16 bytes of the loadlibrarya function, and then jump to the custom function. When you call a normal function, unhook it again. In this way, when you call a function again, the unhook and hook operations appear too frequent. Moreover, the hook and unhook were designed as thiscall at the time. Therefore, maintaini
{2002.8.5 kingron}
{Source: Source string}
{Sub: Sub string}
{Return: Count}
{Ex: strsubcount ('abccdcd', 'bc') = 2}
Function strsubcount (const source, Sub: string): integer;
VaR
Buf: string;
I: integer;
Len: integer;
Begin
Result: = 0;
Buf: = source;
I: = pos (sub, Buf );
Len: = length (sub );
While I Begin
INC (result );
Delete (BUF, 1, I + len-1 );
I: = pos (sub, Buf );
End;
End; {strsubcount}
{The following function returns the position after the specified position of substr in S}{Example:
KiInterruptTemplate .. That's it... The KiInterruptTemplate code is in ntoskrnl/ke/i386/Traps. s ....
. Func KiInterruptTemplate_ KiInterruptTemplate:
/* Enter interrupt trap */INT_PROLOG kit_a, kit_t, DoPushFakeErrorCode
_ KiInterruptTemplate2ndDispatch:/* Dummy code, will be replaced by the address of the KINTERRUPT */Mov edi, 0
_ KiInterruptTemplateObject:/* The jump instruction address will be replaced with the actual address of the function to b
corresponding to the main function is as follows
123456789101112131415161718192021222324252627282930313233343536
7: int main()8: {00401020 push ebp // ebp初始为0018FF84h压栈,压栈后esp = 0018FF48h - 4 = 0018FF44h00401021 mov ebp,esp // ebp保存栈顶0,ebp=esp=0018FF44h00401023 sub esp,48h // esp -= 48h开辟了一段栈空间,留待后面保存局部变量,此时esp=0018FF44h-48h=0018FEFCh00401026 push ebx 00401027 push esi00401028 push edi // ebx、esi和
program, and no other auxiliary components. To control the register of passed parameters, you can extract the generic gadgets in the program initialization function.Enter Objdump–d./vul to observe the _libc_csu_init () function.There are two accessories available:Accessories 14005f0: 4c 89 ea mov %R13,%RDX 4005f3: 4c 89 f6 mov %R14,%RSI 4005f6: 44 89 ff mov %R15d,%EDI 4005f9: 41 ff 14 dc
Debug versionESP stack top pointerEBP holds stack pointer Empty program: Int main () { 00411360 push ebp, press into EBP 00411361 mov ebp,esp; EBP = ESP, keep esp, wait for function call to resume, ESP is definitely used in a function call. 00411363 Sub esp,0c0h; esp-=0c0h (192); Leave temporary storage for the function ; put the values in other pointers or registers into the stack to use them in the function. 00411369 push ebx; Press into EBX 0041136A push esi, press into ESI 0041136B pu
From [wenjuliu25]: HelloWorld disassembly Analysis
Lab environment:Visual c ++ 6.0
Objective: To analyze the memory allocation of a simple c program during program execution using assembly language
/******* Mymain. cpp *********/
1: # include
2: int main ()
3 :{
4: int x = 1;
5: printf ("Hello Canney \ n ");
6: return0;
7 :}
/******* Mymain. asm *********/
1: # include
2: int main ()
3 :{
00410950 push ebp
00410951 mov ebp, esp
00410953 sub ESP, 44 h // ESP = esp-0x40, allocate stack space t
CPU switches from user mode to privileged mode, then jump to the kernel code to execute the exception handling program.In the "B INT" command, the value 0x80 is a parameter. In exception handling, the parameter determines how to handle the problem. In the Linux kernel, an int 0x80 exception is called a system call.The values of C eax and EBX registers are two parameters passed to the system call. The value of eax is the system call number, 1 indicates _ exit call, and EBX indicates the paramete
;//////////////////////////////; First get the relocation difference
Call rebaseRebase:Pop EBP;Sub EBP, offset rebase;; Get the kernel32.dll's base address; By peb direct access; Place in here not routine; Because we need it afterAssume FS: nothing;
MoV eax, FS: [30 h]; PTR _ TebMoV eax, [eax + 0ch]; PTR _ peb_ldr_dataMoV eax, [eax + 1ch]; list_entry ininitializationordermodulelist. flinkMoV eax, [eax]; flink's flinkMoV eax, [eax + 08 h]; The Kernel32's base addressMoV [EBP + dwbase], eax;MoV EC
about some personal opinions. Next, we will conduct some small tests and explain them in assembly language. You can do it together.
(1) Char name [] and char * Name
1:2: void process()3: {00401020 push ebp00401021 mov ebp,esp00401023 sub esp,4Ch00401026 push ebx00401027 push esi00401028 push edi00401029 lea edi,[ebp-4Ch]0040102C mov ecx,13h00401031 mov eax,0C
the arguments of the constructor, and is initialized with 1, which omits a step, speeds up the operation, and achieves the same effect. Note: In the above assembly, Visual Studio compiler optimizations have been turned off, indicating that this approach has been used as a general method of Visual Studio, rather than as a vs-perceived optimization tool.Initialize 3:classtest ct3 = Ct1Classtest ct3 = ct1;//Copy Initialization00b09538 Lea Eax,[ct1]00b0953e push EAX00b0953f Lea ECX,[CT3]00b09545 ca
asCall before eip=0x00401363 (next eip=0x00401368)After call EIP=0X0040100A,ESP=0X0012FEF4Then the call ends, and the last RET instruction of the __CDECL convention function pops the top of the stack to the EIP pointereip=0x00401368 Esp=0x0012fef8Then add esp,0xc, here 0xc=12 that is 3 DWORD is the number of front push (pop to pop to a register, add directly modify the top position of the stack, reduce the stack size)To this, the stack and EIP revert to the state before the call.Then we go insi
:
8063A8B2 7573 jne nt! Dbgkpsetprocessdebugobject+0xd1 (8063a927)
The first function: Dbgkpsetprocessdebugobject (note that EDI+0BCH is the location of the debugport, which says the position is 0XBC), and is set when the debugger attaches the process DebugPort[CPP]View Plaincopy
Kd> # BCH Nt! Dbgkpsetprocessdebugobject
Nt! DBGKPSETPROCESSDEBUGOBJECT+0X56:
8063A8AC 399fbc000000 cmp DWORD ptr [
Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->Public Static Vector3 Foo (vector3 V, Float Radius){Matrix;Matrix. createtranslation ( Ref V, Out A ); Matrix B=Matrix. createtranslation (v ); Matrix. Multiply (RefA,RefB,OutA ); Vector3 F1=B. forward; Vector3 F2;F2.x=B. m31;F2.y=B. M32;F2.z=B. M33; Vector3 F3;Vector3.add (RefF1,RefF2,OutF3 );Vector3.transform (RefF3,RefA,OutF1 );ReturnF1;} Test 2 is the focus of this Article. To facilitate the discussion, we div
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.