Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (346.77 KB, 10 trang )
<span class='text_page_counter'>(1)</span><div class='page_container' data-page=1>
•
–
• Hides low-level details, Less time, Slow Speed and Large Size
–
• Speed up critical sections of code, Access nonstandard hardware
devices, Write platform-specific code, Extend the HLL's
capabilities
•
• is a name that has been placed in a module’s object file in such a
way that the linker can make the name available to other
program modules.
•
• rules or characteristics regarding the naming of variables and
•
• Refers to the low-level details about how procedures are called
• Registers that must be preserved by procedures.
• How arguments are passed to procedures?
• The order in which arguments are passed by calling programs to
procedures.
–
• <b>AddTwo(5, 6)</b><b> last to 1st.</b>
<b>push 6</b>
<b>push 5</b>
<b>call AddTwo</b>
• Saves EBP, ESP and access parameters using EBP.
• <b>ret 8 ; clean up the stack</b>
• <b>_</b><i>name</i>@<i><b>nn</b></i>
–
<b>push 6</b> <b>; Second Argument</b>
<b>add esp,8 ; clean up the stack</b>
•
<b>__asm </b><i><b>statement</b></i>
<b>__asm {</b>
<b> </b><i><b>statement-1</b></i>
<i><b> statement-2</b></i>
<i><b> ...</b></i>
<i><b> statement-n</b></i>
•
•
–
•
–
<b>using namespace std;</b>
<b>{</b>
<b>const int BUFSIZE = 2000;</b>
<b>char buffer[BUFSIZE];</b>
<b>unsigned int count; </b>
<b>unsigned char encryptCode;</b>
<b>cout << "Encryption code [0-255]? ";</b>
<b>cin >> encryptCode;</b>
<b>ifstream infile( "plain1.txt", ios::binary );</b>
<b>ofstream outfile( "cipher1.txt", ios::binary );</b>
<b>cout << “ENCODING“<< endl;</b>
<b>while (!infile.eof() )</b>
<b>{</b>
<b>infile.read(buffer, BUFSIZE);</b>
<b>count = infile.gcount();</b>
<b>TranslateBuffer(buffer, count, encryptCode);</b>
<b>outfile.write(buffer, count);</b>
<b>}</b>
<b> return 0;</b>
<b>}</b>
<b>movzx eax,byte ptr [ebp+FFFFF7FBh] </b>
<b>push eax </b>
<b>mov ecx,dword ptr [ebp+FFFFF804h] </b>
<b>push ecx </b>
<b>lea edx,[ebp+FFFFF810h] </b>
<b>push edx </b>
<b> unsigned count, unsigned char eChar )</b>
<b>{</b>
<b>__asm {</b>
<b>mov esi,buf</b>
<b>mov ecx,count</b>
<b>mov al,eChar</b>
<b>L1:</b>
<b>xor [esi],al</b>
<b>inc esi</b>
<b>loop L1</b>
<b>} // asm</b>
<b>}</b>
<b>push ebp </b>
<b>mov ebp,esp </b>
<b>sub esp,0C0h </b>
<b>push ebx </b>
<b>push esi </b>
<b>lea edi,[ebp+FFFFFF40h] </b>
<b>mov ecx,30h </b>
<b>mov eax,0CCCCCCCCh </b>
<b>rep stos dword ptr es:[edi] </b>
<b>pop edi </b>
<b>pop esi </b>
<b>pop ebx </b>
<b>add esp,0C0h </b>
<b>cmp ebp,esp </b>
<b>call 00C8147E </b>
<b>mov esp,ebp </b>
<b>pop ebp </b>
<b>ret </b>
•
•
•
–
–
•
•