CSDN博客

img uuty

alert7写的检测linux是否运行在VMWARE中的一个程序

发表于2004/10/17 12:34:00  1259人阅读

分类: 摘抄

/* * gcc -Wall -o checkVM checkVM.c * check linux OS in VMare ? * by alert7 * */ #include #include struct idtr { unsigned short limit; unsigned int base; } __attribute__ ((packed)); unsigned int get_addr_idt() { struct idtr idtr; asm("sidt %0" : "=m" (idtr)); return idtr.base; } int main(int argc, char ** argv) { unsigned int ptr_idt; ptr_idt=get_addr_idt(); printf("IDT Addr %p /n",ptr_idt); if ( (ptr_idt>>24)==0xc0) printf("Real Linux/n"); else printf("Maybe in VMare/n"); return 0; }
阅读全文
0 0

相关文章推荐

img
取 消
img