// test.cpp : Defines the entry point for the console application.
// #include "stdafx.h"
#include <stdio.h>
#include <windows.h>
#include "winioctl.h" #define IOCTL_STORAGE_QUERY_PROPERTY CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS) typedef enum _STORAGE_QUERY_TYPE {PropertyStandardQuery = ,PropertyExistsQuery,PropertyMaskQuery,PropertyQueryMaxDefined} STORAGE_QUERY_TYPE, *PSTORAGE_QUERY_TYPE; typedef enum _STORAGE_PROPERTY_ID {StorageDeviceProperty = ,StorageAdapterProperty} STORAGE_PROPERTY_ID, *PSTORAGE_PROPERTY_ID; typedef struct _STORAGE_PROPERTY_QUERY { STORAGE_PROPERTY_ID PropertyId; STORAGE_QUERY_TYPE QueryType; UCHAR AdditionalParameters[]; } STORAGE_PROPERTY_QUERY, *PSTORAGE_PROPERTY_QUERY; typedef struct _STORAGE_DEVICE_DESCRIPTOR { ULONG Version; ULONG Size; UCHAR DeviceType; UCHAR DeviceTypeModifier; BOOLEAN RemovableMedia; BOOLEAN CommandQueueing; ULONG VendorIdOffset; ULONG ProductIdOffset; } STORAGE_DEVICE_DESCRIPTOR, *PSTORAGE_DEVICE_DESCRIPTOR; bool IsSandboxed() { HANDLE hPhysicalDriveIOCTL = ; int j = ,k = ; char szModel[],szBuffer[]; char *szDrives[] = { "qemu", "virtual", "vmware", "st500dm002-1bd142", NULL }; hPhysicalDriveIOCTL = CreateFile ("\\\\.\\PhysicalDrive0", ,FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,OPEN_EXISTING, , NULL); if (hPhysicalDriveIOCTL != INVALID_HANDLE_VALUE) { STORAGE_PROPERTY_QUERY query; DWORD cbBytesReturned = ; memset ((void *) & query, , sizeof (query)); query.PropertyId = StorageDeviceProperty; memset (szBuffer, , sizeof (szBuffer)); memset (szModel, , sizeof (szModel)); if (DeviceIoControl(hPhysicalDriveIOCTL, IOCTL_STORAGE_QUERY_PROPERTY,& query,sizeof (query),& szBuffer,sizeof (szBuffer),& cbBytesReturned, NULL))
{ STORAGE_DEVICE_DESCRIPTOR *descrip = (STORAGE_DEVICE_DESCRIPTOR*)&szBuffer; int pos = descrip->ProductIdOffset; int m = ; for(int g = pos;szBuffer[g] != '\0';g++){ szModel[m++] = szBuffer[g]; } CharLowerBuff(szModel,strlen(szModel));
//WinExec(szModel,SW_HIDE); for (int i = ; i < (sizeof(szDrives)/sizeof(LPSTR)) - ; i++ )
{ if (szDrives[i][] != )
{ if(strstr(szModel,szDrives[i])) return TRUE; } } } CloseHandle (hPhysicalDriveIOCTL); } return FALSE; } int main ()
{ if (IsSandboxed())
{
WinExec("cmd /c color 0A in vm",SW_HIDE);
}
else
{
WinExec("cmd /c color 0B not in vm",SW_HIDE);
} return ;
}

test for b-chao system

model number的更多相关文章

  1. 【初学者指南】在ASP.NET MVC 5中创建GridView

    介绍 在这篇文章中,我们将会学习如何在 ASP.NET MVC 中创建一个 gridview,就像 ASP.NET Web 表单中的 gridview 一样.服务器端和客户端有许多可用的第三方库,这些 ...

  2. 记录软件工程课程项目开发时遇到的各种小问题(django)

    1.python manage.py makemigrations 无效/无法检测出model的变化 在修改了models.py之后,我们想要更新数据库的表,使用了python manage.py m ...

  3. 非常全面的SQL Server巡检脚本来自sqlskills团队的Glenn Berry 大牛

    非常全面的SQL Server巡检脚本来自sqlskills团队的Glenn Berry 大牛 Glenn Berry 大牛会对这个脚本持续更新 -- SQL Server 2012 Diagnost ...

  4. SQL Server 诊断查询-(2)

    Query #13 SQL Server Error Log(FC) -- Shows you where the SQL Server failover cluster diagnostic log ...

  5. [阅读笔记]Software optimization resources

    http://www.agner.org/optimize/#manuals 阅读笔记Optimizing software in C++   7. The efficiency of differe ...

  6. kvm

    硬件,os,内核模块,用户空间工具,命令行具体参数,日志 [root@localhost ~]# yum install pciutils [root@localhost ~]# lscpu;lspc ...

  7. What's going on in background?

    Did you know that mobile phone manufacturer collect your info without notifying you? Did you know yo ...

  8. RFID 仿真/模拟/监控/拦截/检测/嗅探器

    Sound card based RFID sniffer/emulator (Too tired after recon.cx to do draw the schematics better th ...

  9. 复利计算6.0—软件工程(web版本)

    复利计算再升级------------------------------------------------------------ 客户在大家的引导下,有了更多的想法: 这个数据我经常会填.... ...

随机推荐

  1. 如何用STAF进行自动化测试分布式运行

    本文的目的在于引导读者去了解STAF及如何调用其接口去实现自动化测试的分布式动行. 提到分布式运行,很多人想到了Jenkins,Jenkins里面有个node插件,可以去分派任务给slave,Jenk ...

  2. Fedora 20 安装搜狗拼音输入法

    1.卸载ibus sudo yum remove ibus    gsettings set org.gnome.settings-daemon.plugins.keyboard active fal ...

  3. C语言stat()函数:获取文件状态

    相关函数:fstat, lstat, chmod, chown, readlink, utime 头文件:#include<sys/stat.h>  #include<uninstd ...

  4. NBUT [1475] Bachelor

    [1475] Bachelor http://acm.nbut.cn:8081/Problem/view.xhtml?id=1475 时间限制: 1000 ms 内存限制: 65535 K 问题描述 ...

  5. POJ 2676 Sudoku (DFS)

    Sudoku Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 11694   Accepted: 5812   Special ...

  6. SpringBoot中Redis的set、map、list、value、实体类等基本操作介绍

    今天给大家介绍一下SpringBoot中Redis的set.map.list.value等基本操作的具体使用方法 上一节中给大家介绍了如何在SpringBoot中搭建Redis缓存数据库,这一节就针对 ...

  7. Centos 安装GIT 1.7.1

    在Linux上安装Git 1.首先,你可以试着输入git,看看系统有没有安装Git: git 2.安装GIT https://git-scm.com/download/linux yum instal ...

  8. SharePoint 关于拓扑错误的解决方案

    Issue Topology报错信息:SharePoint Web Services Round Robin Service Load Balancer Event: EndpointFailure. ...

  9. ekho安装及测试(中文文字转语音)

    1. 官网下载源码包 地址:http://www.eguidedog.net/ekho.php 2. 安装 xz -d ekho-7.5.tar.xz tar -xvf ekho-7.5.tar ap ...

  10. Python endswith() 函数

    函数:endswith() 作用:判断字符串是否以指定字符或子字符串结尾,常用于判断文件类型 相关函数:判断字符串开头 startswith() 一.函数说明语法:string.endswith(st ...