detect if application running on virtual box

谁说胖子不能爱 提交于 2019-12-24 00:53:38

问题


I went thrrough some links in stackoverflow. But code given here doesnt work for virtual box. I have also tried redpill but thats not working too. my application will run on both linux and windows(preferably).
Please let me know if anyone has any solution.

Edit: Preet Sangha's link not working as well


回答1:


VBox 1.0 uses a different method. Check http://spth.virii.lu/eof2/articles/WarGame/vboxdetect.html




回答2:


from http://www.gedzac.com/rrlf.dr.eof.eZine/articles/WarGame/vboxdetect.html

Check if the pseudo-device \\.\VBoxMiniRdrDN exists in the system (you need CreateFile())

#include <windows.h>

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    if(CreateFile("\\\\.\\VBoxMiniRdrDN",GENERIC_READ,FILE_SHARE_READ,
        NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL) != INVALID_HANDLE_VALUE)
    {
        MessageBox(NULL,"VBox detected!","Warning",MB_OK|MB_ICONWARNING);
    }

    else
    {
        MessageBox(NULL,"Not inside VBox","Info",MB_OK|MB_ICONINFORMATION);
    }
}


来源:https://stackoverflow.com/questions/7499985/detect-if-application-running-on-virtual-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!