Вы могли бы P / Invoke KernelIoControl, чтобы получить имя модели устройства и посмотреть, если это говорит вам, является ли это эмулятором.
[DllImport("coredll", SetLastError = true)]
public static extern bool KernelIoControl([In] uint IoControlCode,
[In] byte[] InputBuffer,
[In] uint InputBufferSize,
[In, Out] byte[] OutputBuffer,
[In] uint OutputBufferSize,
[Out] out uint BytesReturned);
public const int ERROR_INSUFFICIENT_BUFFER = 0x7A;
public const int SPI_GETOEMINFO = 258;
public const Int32 FILE_DEVICE_HAL = 0x00000101;
public const Int32 FILE_ANY_ACCESS = 0x0;
public const Int32 METHOD_BUFFERED = 0x0;
private static uint CTL_CODE(uint DeviceType, uint Function, uint Method,
uint Access)
{
return ((DeviceType << 16) | (Access << 14) | (Function << 2) | Method);
}
public static uint IOCTL_HAL_GET_DEVICE_INFO = CTL_CODE(FILE_DEVICE_HAL, 1,
METHOD_BUFFERED, FILE_ANY_ACCESS);
public static string GetDeviceModelName()
{
byte[] inputBuffer = BitConverter.GetBytes(SPI_GETOEMINFO);
byte[] outputBuffer = new byte[256];
uint bytesReturned = 0;
// call KernelIoControl with IOCTL_HAL_GET_DEVICE_INFO parameter
bool retVal = false;
try
{
retVal = KernelIoControl(IOCTL_HAL_GET_DEVICE_INFO,
inputBuffer, (uint)inputBuffer.Length, outputBuffer,
(uint)outputBuffer.Length, out bytesReturned);
}
catch
{
}
// if not succeeded, then try the last step again, now with increased buffer size
if (!retVal)
{
int error = Marshal.GetLastWin32Error();
// if the buffer size is incorrect, adjust it and call function again.
if (error == ERROR_INSUFFICIENT_BUFFER)
{
int buffSize = BitConverter.ToInt32(outputBuffer, 0);
outputBuffer = new byte[buffSize];
BitConverter.GetBytes(buffSize).CopyTo(outputBuffer, 0);
retVal = KernelIoControl(IOCTL_HAL_GET_DEVICE_INFO,
inputBuffer, (uint)inputBuffer.Length, outputBuffer,
(uint)outputBuffer.Length, out bytesReturned);
}
}
// extract the model name
string modelNameStr = null;
if (retVal)
{
modelNameStr = System.Text.Encoding.Unicode.GetString(outputBuffer, 0,
outputBuffer.Length).Replace("\0","");
}
return modelNameStr;
}