x64内联汇编调用API(需intel编译器,vc不支持x64内联汇编)

[cpp] view plain copy
 
 在CODE上查看代码片派生到我的代码片
  1. #include "stdafx.h"  
  2. #include <windows.h>  
  3.   
  4. STARTUPINFOW StartInfo  = {0};  
  5. PROCESS_INFORMATION pi = {0};  
  6. TCHAR szCommandLine[MAX_PATH] = TEXT("C:\Windows\NOTEPAD.EXE D:\parallel_studio_xe_2013_update4_for_windows.txt");  
  7.   
  8. int _tmain(int argc, _TCHAR* argv[])  
  9. {  
  10.     StartInfo .cb = sizeof(StartInfo);  
  11.   
  12.     __asm  
  13.     {  
  14.         sub rsp, 80  
  15.         lea rax, pi  
  16.         mov qword ptr [rsp+72], rax  
  17.         lea rax, StartInfo  
  18.         mov qword ptr [rsp+64], rax  
  19.         mov qword ptr [rsp+56], 0  
  20.         mov qword ptr [rsp+48], 0  
  21.         mov qword ptr [rsp+40], 0  
  22.         mov qword ptr [rsp+32], 0  
  23.         xor r9, r9  
  24.         xor r8, r8  
  25.         lea rax, szCommandLine  
  26.         mov rdx, rax  
  27.         xor rcx, rcx  
  28.         mov  rsi, qword ptr CreateProcessW  
  29.         call rsi  
  30.         add rsp, 80  
  31.     }  
  32.     //CreateProcess(0, szCommandLine, NULL, NULL, FALSE, 0, NULL, NULL, &StartInfo, &pi);  
  33.     return 0;  

http://blog.csdn.net/zwfgdlc/article/details/17467453

原文地址:https://www.cnblogs.com/findumars/p/6345023.html