获取当前进程的寄存器内容

/*
 * =====================================================================================
 *
 *       Filename:  ASM-1.cpp
 *      Environment:    
 *    Description:  C++内联汇编实验二
 *
 *        Version:  1.0
 *        Created:  2013/10/30 21:24:15
 *         Author:  yuliyang
 *
 *             Mail:  wzyuliyang911@gmail.com
 *             Blog:  http://www.cnblogs.com/yuliyang
 *
 * =====================================================================================
 */

// ASM-1.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <iostream>
#include <Windows.h>
#include <stdio.h>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    DWORD32 c1,a1,b1;
    
    __asm   
    {   
        mov   c1 ,ecx;
        mov   a1 ,eax;
        mov   b1 ,ebx;
        
    }  
    /*printf("ECX的内容是:%X\n",c1);
    printf("%X\n",c1>>24);
    printf("EAX的内容是:%X\n",a1);
    printf("%X\n",a1>>24);
    printf("EBX的内容是:%X\n",b1);
    printf("%X\n",b1>>24);*/
    char a[30];
    sprintf(a,"%X,%X,%X",c1,a1,b1);
    MessageBox(NULL,a,"寄存器内容",0);
    return 0;
}
posted @ 2013-11-05 17:29  小菜鸟_yang  阅读(267)  评论(0编辑  收藏  举报