Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //http://waleedassar.blogspot.com
- //http://www.twitter.com/waleedassar
- #include "stdafx.h"
- #include "windows.h"
- #include "stdio.h"
- #include "winioctl.h"
- #define IOCTL_STORAGE_QUERY_PROPERTY \
- CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
- void AllToUpper(unsigned char* str,unsigned long len)
- {
- for(unsigned long c=0;c<len;c++)
- {
- if(str[c]>='a' && str[c]<='z')
- {
- str[c]-=32;
- }
- }
- }
- unsigned char* ScanDataForString(unsigned char* data,unsigned long data_length,unsigned char* string2)
- {
- unsigned long string_length=(unsigned long)strlen((char*)string2);
- for(unsigned long i=0;i<=(data_length-string_length);i++)
- {
- if(strncmp((char*)(&data[i]),(char*)string2,string_length)==0) return &data[i];
- }
- return 0;
- }
- void main()
- {
- HANDLE hF=0;
- unsigned char name[0x100];
- for(unsigned long i=0;i<0xA;i++)
- {
- unsigned char x[0x2]={0};
- memset((void*)name,0,0x100);
- strcpy((char*)name,"\\\\.\\PhysicalDrive");
- x[0]=i+48;
- strcat((char*)name,(char*)(&x[0]));
- hF=CreateFile((char*)name,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,0,OPEN_EXISTING,0,0);
- if(hF!=INVALID_HANDLE_VALUE)
- {
- unsigned char inbuf[0xC]={0};
- unsigned char* outbuf=(unsigned char*)LocalAlloc(LMEM_ZEROINIT,0x3000);
- unsigned long ret=0;
- if(DeviceIoControl(hF,IOCTL_STORAGE_QUERY_PROPERTY,&inbuf[0],0xC,outbuf,0x3000,&ret,0))
- {
- AllToUpper(outbuf,0x3000);
- if(ScanDataForString(outbuf,0x3000,(unsigned char*)"VBOX") ||
- ScanDataForString(outbuf,0x3000,(unsigned char*)"VIRTUALBOX") )
- {
- MessageBox(0,"VirtualBox detected!","waliedassar",0);
- ExitProcess(0);
- }
- }
- LocalFree(outbuf);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement