// 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. 树莓派进阶之路 (023) - Windows下用串行连接控制树莓派(转)

    转载:http://shumeipai.nxez.com/2014/05/04/under-windows-serial-connection-control-raspberry-pi.html 在没 ...

  2. 【Oracle】Oracle中dump函数的用法

    一.函数标准格式: DUMP(expr[,return_fmt[,start_position][,length]]) 基本参数时4个,最少可以填的参数是0个.当完全没有参数时,直接返回null.另外 ...

  3. Git 打标签(分布式版本控制系统)

    前言 像其他版本控制系统(VCS)一样,Git 可以给历史中的某一个提交打上标签,以示重要.比较有代表性的是人们会使用这个功能来标记发布结点(v1.0 等等). 1.列出标签 在 Git 中列出已有的 ...

  4. VC CListCtrl 第一列列宽自适应

    原文链接: http://www.cnblogs.com/sephil/archive/2011/04/03/2004384.html 今天用VC写工具的时候用到CListView,并且ListCtr ...

  5. PowerShell 批量签入SharePoint Document Library中的文件

    由于某个文档库设置了编辑前签出功能,导致批量导入文件时这些文件默认的状态都被签出了.如果手动签入则费时费力,故利用PowerShell来实现批量签入Document Library中的文件. Reso ...

  6. Cross compiling coreutils and generate the manpages

    When we cross compiling coreutils, there is an problem of generating man pages, because the source s ...

  7. PHP发送HEAD方法请求

    HEAD方法在99%的web服务中支持(不完全统计,默认都是HEAD.POST.GET,除了某些极其特殊的应用会限制HEAD方法),HEAD方法有很多用途,比如探测网页的状态(HTTP头部信息,404 ...

  8. Java – Display all ZoneId and its UTC offset

    package com.mkyong.date; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.Z ...

  9. Zephir入门 —— 语法篇

    概述 Zephir的语法跟PHP很相似,所以这里不会把官网的文档照搬过来翻译一遍,而是会把一些Zephir相较于PHP比较特别的语法挑出来讲一下.如果想要要完整学习Zephir的语法,没有比官网的文档 ...

  10. redis 3.2.3的源码安装

    Install necessary packages On CentOS : yum install wget make gcc tcl On CentOS yum install wget make ...