Merge branch 'master' into pnpentity-wmi

This commit is contained in:
Graham Sutherland
2019-04-13 21:41:11 +01:00
committed by GitHub
20 changed files with 1270 additions and 25 deletions
+3
View File
@@ -62,6 +62,9 @@ bld/
# Visual C++ Solution
*.VC.db
# NuGet packages
packages/
# Alkhaser log file
log.txt
+7
View File
@@ -1,3 +1,10 @@
#### 0.78
- Add README and CHANGELOG to VS solution file.
- Delete compiled binaries from repository.
- Ignores NuGet packages directory from git.
- Fix false positive in VirtualBox BIOS serial number WMI check thanks to @gsuberland
#### 0.77
- Add a gitattributes to normalize line endings.
- Update VMDriverServices routine thanks to @hfiref0x
+5 -2
View File
@@ -1,4 +1,4 @@
## Al-Khaser v0.76
## Al-Khaser v0.78
![Logo](https://www.mindmeister.com/files/avatars/0035/8332/original/avatar.jpg)
@@ -26,7 +26,9 @@ It performs a bunch of common malware tricks with the goal of seeing if you stay
## Download
You can download the latest release here: [x86](https://github.com/LordNoteworthy/al-khaser/blob/master/al-khaser_x86.exe?raw=true) | [x64](https://github.com/LordNoteworthy/al-khaser/blob/master/al-khaser_x64.exe?raw=true).
~~You can download the latest release here: [x86](https://github.com/LordNoteworthy/al-khaser/blob/master/al-khaser_x86.exe?raw=true) | [x64](https://github.com/LordNoteworthy/al-khaser/blob/master/al-khaser_x64.exe?raw=true).~~
**Sorry, binaries have been removed for now as they were triggering Google's Safe Browsing heuristics.**
## Possible uses
@@ -309,6 +311,7 @@ Please, if you encounter any of the anti-analysis tricks which you have seen in
- [gsuberland](https://twitter.com/gsuberland): Graham Sutherland
- [hFireF0x](https://github.com/hfiref0x): hfiref0x
Pull requests welcome. Please read the [Developer Guidelines](https://github.com/LordNoteworthy/al-khaser/wiki/Developer-Guidelines) on our wiki if you wish to contribute to the project.
## References
- An Anti-Reverse Engineering Guide By Josh Jackson.
+442
View File
@@ -0,0 +1,442 @@
#include "pch.h"
int main()
{
printf("Dumping data for all disks.\n");
printf("\n");
for (int driveNumber = 0; driveNumber < 16; driveNumber++)
{
char deviceNameBuffer[64] = { 0 };
sprintf_s(deviceNameBuffer, "\\\\.\\PhysicalDrive%d", driveNumber);
HANDLE diskHandle = CreateFileA(
deviceNameBuffer,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
0,
OPEN_EXISTING,
0,
0
);
if (diskHandle == INVALID_HANDLE_VALUE)
{
printf("====================\n");
printf("ERROR: Failed to open handle to %s. Last error: %d\n", deviceNameBuffer, GetLastError());
printf("====================\n");
continue;
}
const unsigned int IdentifyBufferSize = 512;
const BYTE IdentifyCommandID = 0xEC;
unsigned char Buffer[IdentifyBufferSize + sizeof(ATA_PASS_THROUGH_EX)] = { 0 };
ATA_PASS_THROUGH_EX & pte = *reinterpret_cast<ATA_PASS_THROUGH_EX*>(Buffer);
pte.Length = sizeof(pte);
pte.TimeOutValue = 10;
pte.DataTransferLength = 512;
pte.DataBufferOffset = sizeof(ATA_PASS_THROUGH_EX);
IDEREGS* regs = (IDEREGS*)pte.CurrentTaskFile;
regs->bCommandReg = IdentifyCommandID;
regs->bSectorCountReg = 1;
pte.AtaFlags = ATA_FLAGS_DATA_IN | ATA_FLAGS_DRDY_REQUIRED;
DWORD br = 0;
BOOL ioctlSuccess = DeviceIoControl(
diskHandle,
IOCTL_ATA_PASS_THROUGH,
&pte,
sizeof(Buffer),
&pte,
sizeof(Buffer),
&br,
0
);
if (!ioctlSuccess)
{
printf("====================\n");
printf("ATA pass through IOCTL failed for drive %s. Last error: %d\n", deviceNameBuffer, GetLastError());
printf("====================\n");
CloseHandle(diskHandle);
continue;
}
IDENTIFY_DEVICE_DATA *idd = reinterpret_cast<IDENTIFY_DEVICE_DATA*>(Buffer + sizeof(ATA_PASS_THROUGH_EX));
printf("\n");
printf("====================\n");
printf("BEGIN IDENTIFY_DEVICE_DATA for %s\n", deviceNameBuffer);
printf("====================\n");
printf("GeneralConfiguration.Reserved1 = %hu\n", idd->GeneralConfiguration.Reserved1);
printf("GeneralConfiguration.Retired3 = %hu\n", idd->GeneralConfiguration.Retired3);
printf("GeneralConfiguration.ResponseIncomplete = %hu\n", idd->GeneralConfiguration.ResponseIncomplete);
printf("GeneralConfiguration.Retired2 = %hu\n", idd->GeneralConfiguration.Retired2);
printf("GeneralConfiguration.FixedDevice = %hu\n", idd->GeneralConfiguration.FixedDevice);
printf("GeneralConfiguration.RemovableMedia = %hu\n", idd->GeneralConfiguration.RemovableMedia);
printf("GeneralConfiguration.Retired1 = %hu\n", idd->GeneralConfiguration.Retired1);
printf("GeneralConfiguration.DeviceType = %hu\n", idd->GeneralConfiguration.DeviceType);
printf("NumCylinders = %hu\n", idd->NumCylinders);
printf("ReservedWord2 = %hu\n", idd->ReservedWord2);
printf("NumHeads = %hu\n", idd->NumHeads);
printf("Retired1[0] = %hu\n", idd->Retired1[0]);
printf("Retired1[1] = %hu\n", idd->Retired1[1]);
printf("NumSectorsPerTrack = %hu\n", idd->NumSectorsPerTrack);
printf("VendorUnique1[0] = %hu\n", idd->VendorUnique1[0]);
printf("VendorUnique1[1] = %hu\n", idd->VendorUnique1[1]);
printf("VendorUnique1[2] = %hu\n", idd->VendorUnique1[2]);
printf("SerialNumber = \"%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\"\n", idd->SerialNumber[1], idd->SerialNumber[0], idd->SerialNumber[3], idd->SerialNumber[2], idd->SerialNumber[5], idd->SerialNumber[4], idd->SerialNumber[7], idd->SerialNumber[6], idd->SerialNumber[9], idd->SerialNumber[8], idd->SerialNumber[11], idd->SerialNumber[10], idd->SerialNumber[13], idd->SerialNumber[12], idd->SerialNumber[15], idd->SerialNumber[14], idd->SerialNumber[17], idd->SerialNumber[16], idd->SerialNumber[19], idd->SerialNumber[18]);
printf("Retired2[0] = %hu\n", idd->Retired2[0]);
printf("Retired2[1] = %hu\n", idd->Retired2[1]);
printf("Obsolete1 = %hu\n", idd->Obsolete1);
printf("FirmwareRevision = \"%c%c%c%c%c%c%c%c\"\n", idd->FirmwareRevision[1], idd->FirmwareRevision[0], idd->FirmwareRevision[3], idd->FirmwareRevision[2], idd->FirmwareRevision[5], idd->FirmwareRevision[4], idd->FirmwareRevision[7], idd->FirmwareRevision[6]);
printf("ModelNumber = \"%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\"\n", idd->ModelNumber[1], idd->ModelNumber[0], idd->ModelNumber[3], idd->ModelNumber[2], idd->ModelNumber[5], idd->ModelNumber[4], idd->ModelNumber[7], idd->ModelNumber[6], idd->ModelNumber[9], idd->ModelNumber[8], idd->ModelNumber[11], idd->ModelNumber[10], idd->ModelNumber[13], idd->ModelNumber[12], idd->ModelNumber[15], idd->ModelNumber[14], idd->ModelNumber[17], idd->ModelNumber[16], idd->ModelNumber[19], idd->ModelNumber[18], idd->ModelNumber[21], idd->ModelNumber[20], idd->ModelNumber[23], idd->ModelNumber[22], idd->ModelNumber[25], idd->ModelNumber[24], idd->ModelNumber[27], idd->ModelNumber[26], idd->ModelNumber[29], idd->ModelNumber[28], idd->ModelNumber[31], idd->ModelNumber[30], idd->ModelNumber[33], idd->ModelNumber[32], idd->ModelNumber[35], idd->ModelNumber[34], idd->ModelNumber[37], idd->ModelNumber[36], idd->ModelNumber[39], idd->ModelNumber[38]);
printf("MaximumBlockTransfer = %d\n", idd->MaximumBlockTransfer);
printf("VendorUnique2 = %d\n", idd->VendorUnique2);
printf("ReservedWord48 = %hu\n", idd->ReservedWord48);
printf("Capabilities.ReservedByte49 = %d\n", idd->Capabilities.ReservedByte49);
printf("Capabilities.DmaSupported = %d\n", idd->Capabilities.DmaSupported);
printf("Capabilities.LbaSupported = %d\n", idd->Capabilities.LbaSupported);
printf("Capabilities.IordyDisable = %d\n", idd->Capabilities.IordyDisable);
printf("Capabilities.IordySupported = %d\n", idd->Capabilities.IordySupported);
printf("Capabilities.Reserved1 = %d\n", idd->Capabilities.Reserved1);
printf("Capabilities.StandybyTimerSupport = %d\n", idd->Capabilities.StandybyTimerSupport);
printf("Capabilities.Reserved2 = %d\n", idd->Capabilities.Reserved2);
printf("Capabilities.ReservedWord50 = %hu\n", idd->Capabilities.ReservedWord50);
printf("ObsoleteWords51[0] = %hu\n", idd->ObsoleteWords51[0]);
printf("ObsoleteWords51[1] = %hu\n", idd->ObsoleteWords51[1]);
printf("TranslationFieldsValid = %hu\n", idd->TranslationFieldsValid);
printf("Reserved3 = %hu\n", idd->Reserved3);
printf("NumberOfCurrentCylinders = %hu\n", idd->NumberOfCurrentCylinders);
printf("NumberOfCurrentHeads = %hu\n", idd->NumberOfCurrentHeads);
printf("CurrentSectorsPerTrack = %hu\n", idd->CurrentSectorsPerTrack);
printf("CurrentSectorCapacity = %lu\n", idd->CurrentSectorCapacity);
printf("CurrentMultiSectorSetting = %d\n", idd->CurrentMultiSectorSetting);
printf("MultiSectorSettingValid = %d\n", idd->MultiSectorSettingValid);
printf("ReservedByte59 = %d\n", idd->ReservedByte59);
printf("UserAddressableSectors = %lu\n", idd->UserAddressableSectors);
printf("ObsoleteWord62 = %hu\n", idd->ObsoleteWord62);
printf("MultiWordDMASupport = %hu\n", idd->MultiWordDMASupport);
printf("MultiWordDMAActive = %hu\n", idd->MultiWordDMAActive);
printf("AdvancedPIOModes = %hu\n", idd->AdvancedPIOModes);
printf("ReservedByte64 = %hu\n", idd->ReservedByte64);
printf("MinimumMWXferCycleTime = %hu\n", idd->MinimumMWXferCycleTime);
printf("RecommendedMWXferCycleTime = %hu\n", idd->RecommendedMWXferCycleTime);
printf("MinimumPIOCycleTime = %hu\n", idd->MinimumPIOCycleTime);
printf("MinimumPIOCycleTimeIORDY = %hu\n", idd->MinimumPIOCycleTimeIORDY);
printf("ReservedWords69[0] = %hu\n", idd->ReservedWords69[0]);
printf("ReservedWords69[1] = %hu\n", idd->ReservedWords69[1]);
printf("ReservedWords69[2] = %hu\n", idd->ReservedWords69[2]);
printf("ReservedWords69[3] = %hu\n", idd->ReservedWords69[3]);
printf("ReservedWords69[4] = %hu\n", idd->ReservedWords69[4]);
printf("ReservedWords69[5] = %hu\n", idd->ReservedWords69[5]);
printf("QueueDepth = %hu\n", idd->QueueDepth);
printf("ReservedWord75 = %hu\n", idd->ReservedWord75);
printf("ReservedWords76[0] = %hu\n", idd->ReservedWords76[0]);
printf("ReservedWords76[1] = %hu\n", idd->ReservedWords76[1]);
printf("ReservedWords76[2] = %hu\n", idd->ReservedWords76[2]);
printf("ReservedWords76[3] = %hu\n", idd->ReservedWords76[3]);
printf("MajorRevision = %hu\n", idd->MajorRevision);
printf("MinorRevision = %hu\n", idd->MinorRevision);
printf("CommandSetSupport.SmartCommands = %hu\n", idd->CommandSetSupport.SmartCommands);
printf("CommandSetSupport.SecurityMode = %hu\n", idd->CommandSetSupport.SecurityMode);
printf("CommandSetSupport.RemovableMediaFeature = %hu\n", idd->CommandSetSupport.RemovableMediaFeature);
printf("CommandSetSupport.PowerManagement = %hu\n", idd->CommandSetSupport.PowerManagement);
printf("CommandSetSupport.Reserved1 = %hu\n", idd->CommandSetSupport.Reserved1);
printf("CommandSetSupport.WriteCache = %hu\n", idd->CommandSetSupport.WriteCache);
printf("CommandSetSupport.LookAhead = %hu\n", idd->CommandSetSupport.LookAhead);
printf("CommandSetSupport.ReleaseInterrupt = %hu\n", idd->CommandSetSupport.ReleaseInterrupt);
printf("CommandSetSupport.ServiceInterrupt = %hu\n", idd->CommandSetSupport.ServiceInterrupt);
printf("CommandSetSupport.DeviceReset = %hu\n", idd->CommandSetSupport.DeviceReset);
printf("CommandSetSupport.HostProtectedArea = %hu\n", idd->CommandSetSupport.HostProtectedArea);
printf("CommandSetSupport.Obsolete1 = %hu\n", idd->CommandSetSupport.Obsolete1);
printf("CommandSetSupport.WriteBuffer = %hu\n", idd->CommandSetSupport.WriteBuffer);
printf("CommandSetSupport.ReadBuffer = %hu\n", idd->CommandSetSupport.ReadBuffer);
printf("CommandSetSupport.Nop = %hu\n", idd->CommandSetSupport.Nop);
printf("CommandSetSupport.Obsolete2 = %hu\n", idd->CommandSetSupport.Obsolete2);
printf("CommandSetSupport.DownloadMicrocode = %hu\n", idd->CommandSetSupport.DownloadMicrocode);
printf("CommandSetSupport.DmaQueued = %hu\n", idd->CommandSetSupport.DmaQueued);
printf("CommandSetSupport.Cfa = %hu\n", idd->CommandSetSupport.Cfa);
printf("CommandSetSupport.AdvancedPm = %hu\n", idd->CommandSetSupport.AdvancedPm);
printf("CommandSetSupport.Msn = %hu\n", idd->CommandSetSupport.Msn);
printf("CommandSetSupport.PowerUpInStandby = %hu\n", idd->CommandSetSupport.PowerUpInStandby);
printf("CommandSetSupport.ManualPowerUp = %hu\n", idd->CommandSetSupport.ManualPowerUp);
printf("CommandSetSupport.Reserved2 = %hu\n", idd->CommandSetSupport.Reserved2);
printf("CommandSetSupport.SetMax = %hu\n", idd->CommandSetSupport.SetMax);
printf("CommandSetSupport.Acoustics = %hu\n", idd->CommandSetSupport.Acoustics);
printf("CommandSetSupport.BigLba = %hu\n", idd->CommandSetSupport.BigLba);
printf("CommandSetSupport.DeviceConfigOverlay = %hu\n", idd->CommandSetSupport.DeviceConfigOverlay);
printf("CommandSetSupport.FlushCache = %hu\n", idd->CommandSetSupport.FlushCache);
printf("CommandSetSupport.FlushCacheExt = %hu\n", idd->CommandSetSupport.FlushCacheExt);
printf("CommandSetSupport.Resrved3 = %hu\n", idd->CommandSetSupport.Resrved3);
printf("CommandSetSupport.SmartErrorLog = %hu\n", idd->CommandSetSupport.SmartErrorLog);
printf("CommandSetSupport.SmartSelfTest = %hu\n", idd->CommandSetSupport.SmartSelfTest);
printf("CommandSetSupport.MediaSerialNumber = %hu\n", idd->CommandSetSupport.MediaSerialNumber);
printf("CommandSetSupport.MediaCardPassThrough = %hu\n", idd->CommandSetSupport.MediaCardPassThrough);
printf("CommandSetSupport.StreamingFeature = %hu\n", idd->CommandSetSupport.StreamingFeature);
printf("CommandSetSupport.GpLogging = %hu\n", idd->CommandSetSupport.GpLogging);
printf("CommandSetSupport.WriteFua = %hu\n", idd->CommandSetSupport.WriteFua);
printf("CommandSetSupport.WriteQueuedFua = %hu\n", idd->CommandSetSupport.WriteQueuedFua);
printf("CommandSetSupport.WWN64Bit = %hu\n", idd->CommandSetSupport.WWN64Bit);
printf("CommandSetSupport.URGReadStream = %hu\n", idd->CommandSetSupport.URGReadStream);
printf("CommandSetSupport.URGWriteStream = %hu\n", idd->CommandSetSupport.URGWriteStream);
printf("CommandSetSupport.ReservedForTechReport = %hu\n", idd->CommandSetSupport.ReservedForTechReport);
printf("CommandSetSupport.IdleWithUnloadFeature = %hu\n", idd->CommandSetSupport.IdleWithUnloadFeature);
printf("CommandSetSupport.Reserved4 = %hu\n", idd->CommandSetSupport.Reserved4);
printf("CommandSetActive.SmartCommands = %hu\n", idd->CommandSetActive.SmartCommands);
printf("CommandSetActive.SecurityMode = %hu\n", idd->CommandSetActive.SecurityMode);
printf("CommandSetActive.RemovableMediaFeature = %hu\n", idd->CommandSetActive.RemovableMediaFeature);
printf("CommandSetActive.PowerManagement = %hu\n", idd->CommandSetActive.PowerManagement);
printf("CommandSetActive.Reserved1 = %hu\n", idd->CommandSetActive.Reserved1);
printf("CommandSetActive.WriteCache = %hu\n", idd->CommandSetActive.WriteCache);
printf("CommandSetActive.LookAhead = %hu\n", idd->CommandSetActive.LookAhead);
printf("CommandSetActive.ReleaseInterrupt = %hu\n", idd->CommandSetActive.ReleaseInterrupt);
printf("CommandSetActive.ServiceInterrupt = %hu\n", idd->CommandSetActive.ServiceInterrupt);
printf("CommandSetActive.DeviceReset = %hu\n", idd->CommandSetActive.DeviceReset);
printf("CommandSetActive.HostProtectedArea = %hu\n", idd->CommandSetActive.HostProtectedArea);
printf("CommandSetActive.Obsolete1 = %hu\n", idd->CommandSetActive.Obsolete1);
printf("CommandSetActive.WriteBuffer = %hu\n", idd->CommandSetActive.WriteBuffer);
printf("CommandSetActive.ReadBuffer = %hu\n", idd->CommandSetActive.ReadBuffer);
printf("CommandSetActive.Nop = %hu\n", idd->CommandSetActive.Nop);
printf("CommandSetActive.Obsolete2 = %hu\n", idd->CommandSetActive.Obsolete2);
printf("CommandSetActive.DownloadMicrocode = %hu\n", idd->CommandSetActive.DownloadMicrocode);
printf("CommandSetActive.DmaQueued = %hu\n", idd->CommandSetActive.DmaQueued);
printf("CommandSetActive.Cfa = %hu\n", idd->CommandSetActive.Cfa);
printf("CommandSetActive.AdvancedPm = %hu\n", idd->CommandSetActive.AdvancedPm);
printf("CommandSetActive.Msn = %hu\n", idd->CommandSetActive.Msn);
printf("CommandSetActive.PowerUpInStandby = %hu\n", idd->CommandSetActive.PowerUpInStandby);
printf("CommandSetActive.ManualPowerUp = %hu\n", idd->CommandSetActive.ManualPowerUp);
printf("CommandSetActive.Reserved2 = %hu\n", idd->CommandSetActive.Reserved2);
printf("CommandSetActive.SetMax = %hu\n", idd->CommandSetActive.SetMax);
printf("CommandSetActive.Acoustics = %hu\n", idd->CommandSetActive.Acoustics);
printf("CommandSetActive.BigLba = %hu\n", idd->CommandSetActive.BigLba);
printf("CommandSetActive.DeviceConfigOverlay = %hu\n", idd->CommandSetActive.DeviceConfigOverlay);
printf("CommandSetActive.FlushCache = %hu\n", idd->CommandSetActive.FlushCache);
printf("CommandSetActive.FlushCacheExt = %hu\n", idd->CommandSetActive.FlushCacheExt);
printf("CommandSetActive.Resrved3 = %hu\n", idd->CommandSetActive.Resrved3);
printf("CommandSetActive.SmartErrorLog = %hu\n", idd->CommandSetActive.SmartErrorLog);
printf("CommandSetActive.SmartSelfTest = %hu\n", idd->CommandSetActive.SmartSelfTest);
printf("CommandSetActive.MediaSerialNumber = %hu\n", idd->CommandSetActive.MediaSerialNumber);
printf("CommandSetActive.MediaCardPassThrough = %hu\n", idd->CommandSetActive.MediaCardPassThrough);
printf("CommandSetActive.StreamingFeature = %hu\n", idd->CommandSetActive.StreamingFeature);
printf("CommandSetActive.GpLogging = %hu\n", idd->CommandSetActive.GpLogging);
printf("CommandSetActive.WriteFua = %hu\n", idd->CommandSetActive.WriteFua);
printf("CommandSetActive.WriteQueuedFua = %hu\n", idd->CommandSetActive.WriteQueuedFua);
printf("CommandSetActive.WWN64Bit = %hu\n", idd->CommandSetActive.WWN64Bit);
printf("CommandSetActive.URGReadStream = %hu\n", idd->CommandSetActive.URGReadStream);
printf("CommandSetActive.URGWriteStream = %hu\n", idd->CommandSetActive.URGWriteStream);
printf("CommandSetActive.ReservedForTechReport = %hu\n", idd->CommandSetActive.ReservedForTechReport);
printf("CommandSetActive.IdleWithUnloadFeature = %hu\n", idd->CommandSetActive.IdleWithUnloadFeature);
printf("CommandSetActive.Reserved4 = %hu\n", idd->CommandSetActive.Reserved4);
printf("UltraDMASupport = %hu\n", idd->UltraDMASupport);
printf("UltraDMAActive = %hu\n", idd->UltraDMAActive);
printf("ReservedWord89[0] = %hu\n", idd->ReservedWord89[0]);
printf("ReservedWord89[1] = %hu\n", idd->ReservedWord89[1]);
printf("ReservedWord89[2] = %hu\n", idd->ReservedWord89[2]);
printf("ReservedWord89[3] = %hu\n", idd->ReservedWord89[3]);
printf("HardwareResetResult = %hu\n", idd->HardwareResetResult);
printf("CurrentAcousticValue = %hu\n", idd->CurrentAcousticValue);
printf("RecommendedAcousticValue = %hu\n", idd->RecommendedAcousticValue);
printf("ReservedWord95[0] = %hu\n", idd->ReservedWord95[0]);
printf("ReservedWord95[1] = %hu\n", idd->ReservedWord95[1]);
printf("ReservedWord95[2] = %hu\n", idd->ReservedWord95[2]);
printf("ReservedWord95[3] = %hu\n", idd->ReservedWord95[3]);
printf("ReservedWord95[4] = %hu\n", idd->ReservedWord95[4]);
printf("Max48BitLBA[0] = %lu\n", idd->Max48BitLBA[0]);
printf("Max48BitLBA[1] = %lu\n", idd->Max48BitLBA[1]);
printf("StreamingTransferTime = %hu\n", idd->StreamingTransferTime);
printf("ReservedWord105 = %hu\n", idd->ReservedWord105);
printf("PhysicalLogicalSectorSize.LogicalSectorsPerPhysicalSector = %hu\n", idd->PhysicalLogicalSectorSize.LogicalSectorsPerPhysicalSector);
printf("PhysicalLogicalSectorSize.Reserved0 = %hu\n", idd->PhysicalLogicalSectorSize.Reserved0);
printf("PhysicalLogicalSectorSize.LogicalSectorLongerThan256Words = %hu\n", idd->PhysicalLogicalSectorSize.LogicalSectorLongerThan256Words);
printf("PhysicalLogicalSectorSize.MultipleLogicalSectorsPerPhysicalSector = %hu\n", idd->PhysicalLogicalSectorSize.MultipleLogicalSectorsPerPhysicalSector);
printf("PhysicalLogicalSectorSize.Reserved1 = %hu\n", idd->PhysicalLogicalSectorSize.Reserved1);
printf("InterSeekDelay = %hu\n", idd->InterSeekDelay);
printf("WorldWideName[0] = %hu\n", idd->WorldWideName[0]);
printf("WorldWideName[1] = %hu\n", idd->WorldWideName[1]);
printf("WorldWideName[2] = %hu\n", idd->WorldWideName[2]);
printf("WorldWideName[3] = %hu\n", idd->WorldWideName[3]);
printf("ReservedForWorldWideName128[0] = %hu\n", idd->ReservedForWorldWideName128[0]);
printf("ReservedForWorldWideName128[1] = %hu\n", idd->ReservedForWorldWideName128[1]);
printf("ReservedForWorldWideName128[2] = %hu\n", idd->ReservedForWorldWideName128[2]);
printf("ReservedForWorldWideName128[3] = %hu\n", idd->ReservedForWorldWideName128[3]);
printf("ReservedForTlcTechnicalReport = %hu\n", idd->ReservedForTlcTechnicalReport);
printf("WordsPerLogicalSector[0] = %hu\n", idd->WordsPerLogicalSector[0]);
printf("WordsPerLogicalSector[1] = %hu\n", idd->WordsPerLogicalSector[1]);
printf("CommandSetSupportExt.ReservedForDrqTechnicalReport = %hu\n", idd->CommandSetSupportExt.ReservedForDrqTechnicalReport);
printf("CommandSetSupportExt.WriteReadVerifySupported = %hu\n", idd->CommandSetSupportExt.WriteReadVerifySupported);
printf("CommandSetSupportExt.Reserved01 = %hu\n", idd->CommandSetSupportExt.Reserved01);
printf("CommandSetSupportExt.Reserved1 = %hu\n", idd->CommandSetSupportExt.Reserved1);
printf("CommandSetActiveExt.ReservedForDrqTechnicalReport = %hu\n", idd->CommandSetActiveExt.ReservedForDrqTechnicalReport);
printf("CommandSetActiveExt.WriteReadVerifyEnabled = %hu\n", idd->CommandSetActiveExt.WriteReadVerifyEnabled);
printf("CommandSetActiveExt.Reserved01 = %hu\n", idd->CommandSetActiveExt.Reserved01);
printf("CommandSetActiveExt.Reserved1 = %hu\n", idd->CommandSetActiveExt.Reserved1);
printf("ReservedForExpandedSupportandActive[0] = %hu\n", idd->ReservedForExpandedSupportandActive[0]);
printf("ReservedForExpandedSupportandActive[1] = %hu\n", idd->ReservedForExpandedSupportandActive[1]);
printf("ReservedForExpandedSupportandActive[2] = %hu\n", idd->ReservedForExpandedSupportandActive[2]);
printf("ReservedForExpandedSupportandActive[3] = %hu\n", idd->ReservedForExpandedSupportandActive[3]);
printf("ReservedForExpandedSupportandActive[4] = %hu\n", idd->ReservedForExpandedSupportandActive[4]);
printf("ReservedForExpandedSupportandActive[5] = %hu\n", idd->ReservedForExpandedSupportandActive[5]);
printf("MsnSupport = %hu\n", idd->MsnSupport);
printf("ReservedWord1274 = %hu\n", idd->ReservedWord1274);
printf("SecurityStatus.SecuritySupported = %hu\n", idd->SecurityStatus.SecuritySupported);
printf("SecurityStatus.SecurityEnabled = %hu\n", idd->SecurityStatus.SecurityEnabled);
printf("SecurityStatus.SecurityLocked = %hu\n", idd->SecurityStatus.SecurityLocked);
printf("SecurityStatus.SecurityFrozen = %hu\n", idd->SecurityStatus.SecurityFrozen);
printf("SecurityStatus.SecurityCountExpired = %hu\n", idd->SecurityStatus.SecurityCountExpired);
printf("SecurityStatus.EnhancedSecurityEraseSupported = %hu\n", idd->SecurityStatus.EnhancedSecurityEraseSupported);
printf("SecurityStatus.Reserved0 = %hu\n", idd->SecurityStatus.Reserved0);
printf("SecurityStatus.SecurityLevel = %hu\n", idd->SecurityStatus.SecurityLevel);
printf("SecurityStatus.Reserved1 = %hu\n", idd->SecurityStatus.Reserved1);
printf("ReservedWord129[0] = %hu\n", idd->ReservedWord129[0]);
printf("ReservedWord129[1] = %hu\n", idd->ReservedWord129[1]);
printf("ReservedWord129[2] = %hu\n", idd->ReservedWord129[2]);
printf("ReservedWord129[3] = %hu\n", idd->ReservedWord129[3]);
printf("ReservedWord129[4] = %hu\n", idd->ReservedWord129[4]);
printf("ReservedWord129[5] = %hu\n", idd->ReservedWord129[5]);
printf("ReservedWord129[6] = %hu\n", idd->ReservedWord129[6]);
printf("ReservedWord129[7] = %hu\n", idd->ReservedWord129[7]);
printf("ReservedWord129[8] = %hu\n", idd->ReservedWord129[8]);
printf("ReservedWord129[9] = %hu\n", idd->ReservedWord129[9]);
printf("ReservedWord129[10] = %hu\n", idd->ReservedWord129[10]);
printf("ReservedWord129[11] = %hu\n", idd->ReservedWord129[11]);
printf("ReservedWord129[12] = %hu\n", idd->ReservedWord129[12]);
printf("ReservedWord129[13] = %hu\n", idd->ReservedWord129[13]);
printf("ReservedWord129[14] = %hu\n", idd->ReservedWord129[14]);
printf("ReservedWord129[15] = %hu\n", idd->ReservedWord129[15]);
printf("ReservedWord129[16] = %hu\n", idd->ReservedWord129[16]);
printf("ReservedWord129[17] = %hu\n", idd->ReservedWord129[17]);
printf("ReservedWord129[18] = %hu\n", idd->ReservedWord129[18]);
printf("ReservedWord129[19] = %hu\n", idd->ReservedWord129[19]);
printf("ReservedWord129[20] = %hu\n", idd->ReservedWord129[20]);
printf("ReservedWord129[21] = %hu\n", idd->ReservedWord129[21]);
printf("ReservedWord129[22] = %hu\n", idd->ReservedWord129[22]);
printf("ReservedWord129[23] = %hu\n", idd->ReservedWord129[23]);
printf("ReservedWord129[24] = %hu\n", idd->ReservedWord129[24]);
printf("ReservedWord129[25] = %hu\n", idd->ReservedWord129[25]);
printf("ReservedWord129[26] = %hu\n", idd->ReservedWord129[26]);
printf("ReservedWord129[27] = %hu\n", idd->ReservedWord129[27]);
printf("ReservedWord129[28] = %hu\n", idd->ReservedWord129[28]);
printf("ReservedWord129[29] = %hu\n", idd->ReservedWord129[29]);
printf("ReservedWord129[30] = %hu\n", idd->ReservedWord129[30]);
printf("CfaPowerModel.MaximumCurrentInMA2 = %hu\n", idd->CfaPowerModel.MaximumCurrentInMA2);
printf("CfaPowerModel.CfaPowerMode1Disabled = %hu\n", idd->CfaPowerModel.CfaPowerMode1Disabled);
printf("CfaPowerModel.CfaPowerMode1Required = %hu\n", idd->CfaPowerModel.CfaPowerMode1Required);
printf("CfaPowerModel.Reserved0 = %hu\n", idd->CfaPowerModel.Reserved0);
printf("CfaPowerModel.Word160Supported = %hu\n", idd->CfaPowerModel.Word160Supported);
printf("ReservedForCfaWord161[0] = %hu\n", idd->ReservedForCfaWord161[0]);
printf("ReservedForCfaWord161[1] = %hu\n", idd->ReservedForCfaWord161[1]);
printf("ReservedForCfaWord161[2] = %hu\n", idd->ReservedForCfaWord161[2]);
printf("ReservedForCfaWord161[3] = %hu\n", idd->ReservedForCfaWord161[3]);
printf("ReservedForCfaWord161[4] = %hu\n", idd->ReservedForCfaWord161[4]);
printf("ReservedForCfaWord161[5] = %hu\n", idd->ReservedForCfaWord161[5]);
printf("ReservedForCfaWord161[6] = %hu\n", idd->ReservedForCfaWord161[6]);
printf("ReservedForCfaWord161[7] = %hu\n", idd->ReservedForCfaWord161[7]);
printf("DataSetManagementFeature.SupportsTrim = %hu\n", idd->DataSetManagementFeature.SupportsTrim);
printf("DataSetManagementFeature.Reserved0 = %hu\n", idd->DataSetManagementFeature.Reserved0);
printf("ReservedForCfaWord170[0] = %hu\n", idd->ReservedForCfaWord170[0]);
printf("ReservedForCfaWord170[1] = %hu\n", idd->ReservedForCfaWord170[1]);
printf("ReservedForCfaWord170[2] = %hu\n", idd->ReservedForCfaWord170[2]);
printf("ReservedForCfaWord170[3] = %hu\n", idd->ReservedForCfaWord170[3]);
printf("ReservedForCfaWord170[4] = %hu\n", idd->ReservedForCfaWord170[4]);
printf("ReservedForCfaWord170[5] = %hu\n", idd->ReservedForCfaWord170[5]);
printf("CurrentMediaSerialNumber[0] = %hu\n", idd->CurrentMediaSerialNumber[0]);
printf("CurrentMediaSerialNumber[1] = %hu\n", idd->CurrentMediaSerialNumber[1]);
printf("CurrentMediaSerialNumber[2] = %hu\n", idd->CurrentMediaSerialNumber[2]);
printf("CurrentMediaSerialNumber[3] = %hu\n", idd->CurrentMediaSerialNumber[3]);
printf("CurrentMediaSerialNumber[4] = %hu\n", idd->CurrentMediaSerialNumber[4]);
printf("CurrentMediaSerialNumber[5] = %hu\n", idd->CurrentMediaSerialNumber[5]);
printf("CurrentMediaSerialNumber[6] = %hu\n", idd->CurrentMediaSerialNumber[6]);
printf("CurrentMediaSerialNumber[7] = %hu\n", idd->CurrentMediaSerialNumber[7]);
printf("CurrentMediaSerialNumber[8] = %hu\n", idd->CurrentMediaSerialNumber[8]);
printf("CurrentMediaSerialNumber[9] = %hu\n", idd->CurrentMediaSerialNumber[9]);
printf("CurrentMediaSerialNumber[10] = %hu\n", idd->CurrentMediaSerialNumber[10]);
printf("CurrentMediaSerialNumber[11] = %hu\n", idd->CurrentMediaSerialNumber[11]);
printf("CurrentMediaSerialNumber[12] = %hu\n", idd->CurrentMediaSerialNumber[12]);
printf("CurrentMediaSerialNumber[13] = %hu\n", idd->CurrentMediaSerialNumber[13]);
printf("CurrentMediaSerialNumber[14] = %hu\n", idd->CurrentMediaSerialNumber[14]);
printf("CurrentMediaSerialNumber[15] = %hu\n", idd->CurrentMediaSerialNumber[15]);
printf("CurrentMediaSerialNumber[16] = %hu\n", idd->CurrentMediaSerialNumber[16]);
printf("CurrentMediaSerialNumber[17] = %hu\n", idd->CurrentMediaSerialNumber[17]);
printf("CurrentMediaSerialNumber[18] = %hu\n", idd->CurrentMediaSerialNumber[18]);
printf("CurrentMediaSerialNumber[19] = %hu\n", idd->CurrentMediaSerialNumber[19]);
printf("CurrentMediaSerialNumber[20] = %hu\n", idd->CurrentMediaSerialNumber[20]);
printf("CurrentMediaSerialNumber[21] = %hu\n", idd->CurrentMediaSerialNumber[21]);
printf("CurrentMediaSerialNumber[22] = %hu\n", idd->CurrentMediaSerialNumber[22]);
printf("CurrentMediaSerialNumber[23] = %hu\n", idd->CurrentMediaSerialNumber[23]);
printf("CurrentMediaSerialNumber[24] = %hu\n", idd->CurrentMediaSerialNumber[24]);
printf("CurrentMediaSerialNumber[25] = %hu\n", idd->CurrentMediaSerialNumber[25]);
printf("CurrentMediaSerialNumber[26] = %hu\n", idd->CurrentMediaSerialNumber[26]);
printf("CurrentMediaSerialNumber[27] = %hu\n", idd->CurrentMediaSerialNumber[27]);
printf("CurrentMediaSerialNumber[28] = %hu\n", idd->CurrentMediaSerialNumber[28]);
printf("CurrentMediaSerialNumber[29] = %hu\n", idd->CurrentMediaSerialNumber[29]);
printf("ReservedWord206 = %hu\n", idd->ReservedWord206);
printf("ReservedWord207[0] = %hu\n", idd->ReservedWord207[0]);
printf("ReservedWord207[1] = %hu\n", idd->ReservedWord207[1]);
printf("BlockAlignment.AlignmentOfLogicalWithinPhysical = %hu\n", idd->BlockAlignment.AlignmentOfLogicalWithinPhysical);
printf("BlockAlignment.Word209Supported = %hu\n", idd->BlockAlignment.Word209Supported);
printf("BlockAlignment.Reserved0 = %hu\n", idd->BlockAlignment.Reserved0);
printf("WriteReadVerifySectorCountMode3Only[0] = %hu\n", idd->WriteReadVerifySectorCountMode3Only[0]);
printf("WriteReadVerifySectorCountMode3Only[1] = %hu\n", idd->WriteReadVerifySectorCountMode3Only[1]);
printf("WriteReadVerifySectorCountMode2Only[0] = %hu\n", idd->WriteReadVerifySectorCountMode2Only[0]);
printf("WriteReadVerifySectorCountMode2Only[1] = %hu\n", idd->WriteReadVerifySectorCountMode2Only[1]);
printf("NVCacheCapabilities.NVCachePowerModeEnabled = %hu\n", idd->NVCacheCapabilities.NVCachePowerModeEnabled);
printf("NVCacheCapabilities.Reserved0 = %hu\n", idd->NVCacheCapabilities.Reserved0);
printf("NVCacheCapabilities.NVCacheFeatureSetEnabled = %hu\n", idd->NVCacheCapabilities.NVCacheFeatureSetEnabled);
printf("NVCacheCapabilities.Reserved1 = %hu\n", idd->NVCacheCapabilities.Reserved1);
printf("NVCacheCapabilities.NVCachePowerModeVersion = %hu\n", idd->NVCacheCapabilities.NVCachePowerModeVersion);
printf("NVCacheCapabilities.NVCacheFeatureSetVersion = %hu\n", idd->NVCacheCapabilities.NVCacheFeatureSetVersion);
printf("NVCacheSizeLSW = %hu\n", idd->NVCacheSizeLSW);
printf("NVCacheSizeMSW = %hu\n", idd->NVCacheSizeMSW);
printf("NominalMediaRotationRate = %hu\n", idd->NominalMediaRotationRate);
printf("ReservedWord218 = %hu\n", idd->ReservedWord218);
printf("NVCacheOptions.NVCacheEstimatedTimeToSpinUpInSeconds = %d\n", idd->NVCacheOptions.NVCacheEstimatedTimeToSpinUpInSeconds);
printf("NVCacheOptions.Reserved = %d\n", idd->NVCacheOptions.Reserved);
printf("ReservedWord220[0] = %hu\n", idd->ReservedWord220[0]);
printf("ReservedWord220[1] = %hu\n", idd->ReservedWord220[1]);
printf("ReservedWord220[2] = %hu\n", idd->ReservedWord220[2]);
printf("ReservedWord220[3] = %hu\n", idd->ReservedWord220[3]);
printf("ReservedWord220[4] = %hu\n", idd->ReservedWord220[4]);
printf("ReservedWord220[5] = %hu\n", idd->ReservedWord220[5]);
printf("ReservedWord220[6] = %hu\n", idd->ReservedWord220[6]);
printf("ReservedWord220[7] = %hu\n", idd->ReservedWord220[7]);
printf("ReservedWord220[8] = %hu\n", idd->ReservedWord220[8]);
printf("ReservedWord220[9] = %hu\n", idd->ReservedWord220[9]);
printf("ReservedWord220[10] = %hu\n", idd->ReservedWord220[10]);
printf("ReservedWord220[11] = %hu\n", idd->ReservedWord220[11]);
printf("ReservedWord220[12] = %hu\n", idd->ReservedWord220[12]);
printf("ReservedWord220[13] = %hu\n", idd->ReservedWord220[13]);
printf("ReservedWord220[14] = %hu\n", idd->ReservedWord220[14]);
printf("ReservedWord220[15] = %hu\n", idd->ReservedWord220[15]);
printf("ReservedWord220[16] = %hu\n", idd->ReservedWord220[16]);
printf("ReservedWord220[17] = %hu\n", idd->ReservedWord220[17]);
printf("ReservedWord220[18] = %hu\n", idd->ReservedWord220[18]);
printf("ReservedWord220[19] = %hu\n", idd->ReservedWord220[19]);
printf("ReservedWord220[20] = %hu\n", idd->ReservedWord220[20]);
printf("ReservedWord220[21] = %hu\n", idd->ReservedWord220[21]);
printf("ReservedWord220[22] = %hu\n", idd->ReservedWord220[22]);
printf("ReservedWord220[23] = %hu\n", idd->ReservedWord220[23]);
printf("ReservedWord220[24] = %hu\n", idd->ReservedWord220[24]);
printf("ReservedWord220[25] = %hu\n", idd->ReservedWord220[25]);
printf("ReservedWord220[26] = %hu\n", idd->ReservedWord220[26]);
printf("ReservedWord220[27] = %hu\n", idd->ReservedWord220[27]);
printf("ReservedWord220[28] = %hu\n", idd->ReservedWord220[28]);
printf("ReservedWord220[29] = %hu\n", idd->ReservedWord220[29]);
printf("ReservedWord220[30] = %hu\n", idd->ReservedWord220[30]);
printf("ReservedWord220[31] = %hu\n", idd->ReservedWord220[31]);
printf("ReservedWord220[32] = %hu\n", idd->ReservedWord220[32]);
printf("ReservedWord220[33] = %hu\n", idd->ReservedWord220[33]);
printf("ReservedWord220[34] = %hu\n", idd->ReservedWord220[34]);
printf("Signature = %hu\n", idd->Signature);
printf("CheckSum = %hu\n", idd->CheckSum);
printf("====================\n");
printf("END IDENTIFY_DEVICE_DATA for %s\n", deviceNameBuffer);
printf("====================\n");
printf("\n");
CloseHandle(diskHandle);
}
return 0;
}
@@ -0,0 +1,169 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{245D8670-A888-4ECC-9B51-80584E55B701}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>ATAIdentifyDump</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="IdentifyDeviceData.h" />
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="ATAIdentifyDump.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="IdentifyDeviceData.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ATAIdentifyDump.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
+250
View File
@@ -0,0 +1,250 @@
#pragma once
typedef struct _IDENTIFY_DEVICE_DATA {
struct {
USHORT Reserved1 : 1;
USHORT Retired3 : 1;
USHORT ResponseIncomplete : 1;
USHORT Retired2 : 3;
USHORT FixedDevice : 1;
USHORT RemovableMedia : 1;
USHORT Retired1 : 7;
USHORT DeviceType : 1;
} GeneralConfiguration;
USHORT NumCylinders;
USHORT ReservedWord2;
USHORT NumHeads;
USHORT Retired1[2];
USHORT NumSectorsPerTrack;
USHORT VendorUnique1[3];
UCHAR SerialNumber[20];
USHORT Retired2[2];
USHORT Obsolete1;
UCHAR FirmwareRevision[8];
UCHAR ModelNumber[40];
UCHAR MaximumBlockTransfer;
UCHAR VendorUnique2;
USHORT ReservedWord48;
struct {
UCHAR ReservedByte49;
UCHAR DmaSupported : 1;
UCHAR LbaSupported : 1;
UCHAR IordyDisable : 1;
UCHAR IordySupported : 1;
UCHAR Reserved1 : 1;
UCHAR StandybyTimerSupport : 1;
UCHAR Reserved2 : 2;
USHORT ReservedWord50;
} Capabilities;
USHORT ObsoleteWords51[2];
USHORT TranslationFieldsValid : 3;
USHORT Reserved3 : 13;
USHORT NumberOfCurrentCylinders;
USHORT NumberOfCurrentHeads;
USHORT CurrentSectorsPerTrack;
ULONG CurrentSectorCapacity;
UCHAR CurrentMultiSectorSetting;
UCHAR MultiSectorSettingValid : 1;
UCHAR ReservedByte59 : 7;
ULONG UserAddressableSectors;
USHORT ObsoleteWord62;
USHORT MultiWordDMASupport : 8;
USHORT MultiWordDMAActive : 8;
USHORT AdvancedPIOModes : 8;
USHORT ReservedByte64 : 8;
USHORT MinimumMWXferCycleTime;
USHORT RecommendedMWXferCycleTime;
USHORT MinimumPIOCycleTime;
USHORT MinimumPIOCycleTimeIORDY;
USHORT ReservedWords69[6];
USHORT QueueDepth : 5;
USHORT ReservedWord75 : 11;
USHORT ReservedWords76[4];
USHORT MajorRevision;
USHORT MinorRevision;
struct {
USHORT SmartCommands : 1;
USHORT SecurityMode : 1;
USHORT RemovableMediaFeature : 1;
USHORT PowerManagement : 1;
USHORT Reserved1 : 1;
USHORT WriteCache : 1;
USHORT LookAhead : 1;
USHORT ReleaseInterrupt : 1;
USHORT ServiceInterrupt : 1;
USHORT DeviceReset : 1;
USHORT HostProtectedArea : 1;
USHORT Obsolete1 : 1;
USHORT WriteBuffer : 1;
USHORT ReadBuffer : 1;
USHORT Nop : 1;
USHORT Obsolete2 : 1;
USHORT DownloadMicrocode : 1;
USHORT DmaQueued : 1;
USHORT Cfa : 1;
USHORT AdvancedPm : 1;
USHORT Msn : 1;
USHORT PowerUpInStandby : 1;
USHORT ManualPowerUp : 1;
USHORT Reserved2 : 1;
USHORT SetMax : 1;
USHORT Acoustics : 1;
USHORT BigLba : 1;
USHORT DeviceConfigOverlay : 1;
USHORT FlushCache : 1;
USHORT FlushCacheExt : 1;
USHORT Resrved3 : 2;
USHORT SmartErrorLog : 1;
USHORT SmartSelfTest : 1;
USHORT MediaSerialNumber : 1;
USHORT MediaCardPassThrough : 1;
USHORT StreamingFeature : 1;
USHORT GpLogging : 1;
USHORT WriteFua : 1;
USHORT WriteQueuedFua : 1;
USHORT WWN64Bit : 1;
USHORT URGReadStream : 1;
USHORT URGWriteStream : 1;
USHORT ReservedForTechReport : 2;
USHORT IdleWithUnloadFeature : 1;
USHORT Reserved4 : 2;
} CommandSetSupport;
struct {
USHORT SmartCommands : 1;
USHORT SecurityMode : 1;
USHORT RemovableMediaFeature : 1;
USHORT PowerManagement : 1;
USHORT Reserved1 : 1;
USHORT WriteCache : 1;
USHORT LookAhead : 1;
USHORT ReleaseInterrupt : 1;
USHORT ServiceInterrupt : 1;
USHORT DeviceReset : 1;
USHORT HostProtectedArea : 1;
USHORT Obsolete1 : 1;
USHORT WriteBuffer : 1;
USHORT ReadBuffer : 1;
USHORT Nop : 1;
USHORT Obsolete2 : 1;
USHORT DownloadMicrocode : 1;
USHORT DmaQueued : 1;
USHORT Cfa : 1;
USHORT AdvancedPm : 1;
USHORT Msn : 1;
USHORT PowerUpInStandby : 1;
USHORT ManualPowerUp : 1;
USHORT Reserved2 : 1;
USHORT SetMax : 1;
USHORT Acoustics : 1;
USHORT BigLba : 1;
USHORT DeviceConfigOverlay : 1;
USHORT FlushCache : 1;
USHORT FlushCacheExt : 1;
USHORT Resrved3 : 2;
USHORT SmartErrorLog : 1;
USHORT SmartSelfTest : 1;
USHORT MediaSerialNumber : 1;
USHORT MediaCardPassThrough : 1;
USHORT StreamingFeature : 1;
USHORT GpLogging : 1;
USHORT WriteFua : 1;
USHORT WriteQueuedFua : 1;
USHORT WWN64Bit : 1;
USHORT URGReadStream : 1;
USHORT URGWriteStream : 1;
USHORT ReservedForTechReport : 2;
USHORT IdleWithUnloadFeature : 1;
USHORT Reserved4 : 2;
} CommandSetActive;
USHORT UltraDMASupport : 8;
USHORT UltraDMAActive : 8;
USHORT ReservedWord89[4];
USHORT HardwareResetResult;
USHORT CurrentAcousticValue : 8;
USHORT RecommendedAcousticValue : 8;
USHORT ReservedWord95[5];
ULONG Max48BitLBA[2];
USHORT StreamingTransferTime;
USHORT ReservedWord105;
struct {
USHORT LogicalSectorsPerPhysicalSector : 4;
USHORT Reserved0 : 8;
USHORT LogicalSectorLongerThan256Words : 1;
USHORT MultipleLogicalSectorsPerPhysicalSector : 1;
USHORT Reserved1 : 2;
} PhysicalLogicalSectorSize;
USHORT InterSeekDelay;
USHORT WorldWideName[4];
USHORT ReservedForWorldWideName128[4];
USHORT ReservedForTlcTechnicalReport;
USHORT WordsPerLogicalSector[2];
struct {
USHORT ReservedForDrqTechnicalReport : 1;
USHORT WriteReadVerifySupported : 1;
USHORT Reserved01 : 11;
USHORT Reserved1 : 2;
} CommandSetSupportExt;
struct {
USHORT ReservedForDrqTechnicalReport : 1;
USHORT WriteReadVerifyEnabled : 1;
USHORT Reserved01 : 11;
USHORT Reserved1 : 2;
} CommandSetActiveExt;
USHORT ReservedForExpandedSupportandActive[6];
USHORT MsnSupport : 2;
USHORT ReservedWord1274 : 14;
struct {
USHORT SecuritySupported : 1;
USHORT SecurityEnabled : 1;
USHORT SecurityLocked : 1;
USHORT SecurityFrozen : 1;
USHORT SecurityCountExpired : 1;
USHORT EnhancedSecurityEraseSupported : 1;
USHORT Reserved0 : 2;
USHORT SecurityLevel : 1;
USHORT Reserved1 : 7;
} SecurityStatus;
USHORT ReservedWord129[31];
struct {
USHORT MaximumCurrentInMA2 : 12;
USHORT CfaPowerMode1Disabled : 1;
USHORT CfaPowerMode1Required : 1;
USHORT Reserved0 : 1;
USHORT Word160Supported : 1;
} CfaPowerModel;
USHORT ReservedForCfaWord161[8];
struct {
USHORT SupportsTrim : 1;
USHORT Reserved0 : 15;
} DataSetManagementFeature;
USHORT ReservedForCfaWord170[6];
USHORT CurrentMediaSerialNumber[30];
USHORT ReservedWord206;
USHORT ReservedWord207[2];
struct {
USHORT AlignmentOfLogicalWithinPhysical : 14;
USHORT Word209Supported : 1;
USHORT Reserved0 : 1;
} BlockAlignment;
USHORT WriteReadVerifySectorCountMode3Only[2];
USHORT WriteReadVerifySectorCountMode2Only[2];
struct {
USHORT NVCachePowerModeEnabled : 1;
USHORT Reserved0 : 3;
USHORT NVCacheFeatureSetEnabled : 1;
USHORT Reserved1 : 3;
USHORT NVCachePowerModeVersion : 4;
USHORT NVCacheFeatureSetVersion : 4;
} NVCacheCapabilities;
USHORT NVCacheSizeLSW;
USHORT NVCacheSizeMSW;
USHORT NominalMediaRotationRate;
USHORT ReservedWord218;
struct {
UCHAR NVCacheEstimatedTimeToSpinUpInSeconds;
UCHAR Reserved;
} NVCacheOptions;
USHORT ReservedWord220[35];
USHORT Signature : 8;
USHORT CheckSum : 8;
} IDENTIFY_DEVICE_DATA, *PIDENTIFY_DEVICE_DATA;
+5
View File
@@ -0,0 +1,5 @@
# ATAIdentifyDump
ATAIdentifyDump dumps ATA IDENTIFY data from physical disks. This data is useful for identifying VMs.
You must run this tool as an administrator.
+1
View File
@@ -0,0 +1 @@
#include "pch.h"
+9
View File
@@ -0,0 +1,9 @@
#ifndef PCH_H
#define PCH_H
#include <Windows.h>
#include <ntddscsi.h>
#include <stdio.h>
#include "IdentifyDeviceData.h"
#endif // PCH_H
+7
View File
@@ -0,0 +1,7 @@
# Struct Dump Codegen
This is a LINQpad script to turn a struct definition into C++ code that prints out its contents. So far it supports USHORT, ULONG, and UCHAR.
This was written specifically for IDENTIFY_DEVICE_DATA in order to speed up writing ATAIdentifyDump.
This can probably be used for similar structs too, so it might be useful elsewhere.
@@ -0,0 +1,213 @@
<Query Kind="Program">
<Reference>&lt;RuntimeDirectory&gt;\System.Drawing.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\System.IO.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\System.Net.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\System.Numerics.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\System.Numerics.Vectors.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\System.Security.dll</Reference>
<Namespace>System.Collections</Namespace>
<Namespace>System.Collections.Concurrent</Namespace>
<Namespace>System.Collections.Generic</Namespace>
<Namespace>System.Collections.Specialized</Namespace>
<Namespace>System.Drawing</Namespace>
<Namespace>System.Drawing.Imaging</Namespace>
<Namespace>System.IO</Namespace>
<Namespace>System.IO.MemoryMappedFiles</Namespace>
<Namespace>System.IO.Pipes</Namespace>
<Namespace>System.IO.Ports</Namespace>
<Namespace>System.Net</Namespace>
<Namespace>System.Net.Sockets</Namespace>
<Namespace>System.Numerics</Namespace>
<Namespace>System.Runtime.InteropServices</Namespace>
<Namespace>System.Runtime.InteropServices</Namespace>
<Namespace>System.Runtime.Serialization</Namespace>
<Namespace>System.Runtime.Serialization.Formatters.Binary</Namespace>
<Namespace>System.Security</Namespace>
<Namespace>System.Security.AccessControl</Namespace>
<Namespace>System.Security.Cryptography</Namespace>
<Namespace>System.Security.Principal</Namespace>
<Namespace>System.Text</Namespace>
<Namespace>System.Threading</Namespace>
<Namespace>System.Threading.Tasks</Namespace>
</Query>
/*
Script to turn a struct definition into C++ code that prints out its contents. So far it supports USHORT, ULONG, and UCHAR.
This was written specifically for IDENTIFY_DEVICE_DATA in order to speed up writing ATAIdentifyDump.
This can probably be used for similar structs too, so it might be useful elsewhere.
*/
const string SourceFile = @"C:\Users\Graham\Source\Repos\al-khaser\Tools\ATAIdentifyDump\IdentifyDeviceData.h";
const string StructVar = "idd";
const bool SwapStringEndian = true; // for IDENTIFY_DEVICE_DATA
void Main()
{
string[] lines = File.ReadAllLines(SourceFile);
bool foundStart = false;
bool inStruct = false;
var structLines = new List<string>();
var output = new StringBuilder();
foreach (string rawLine in lines)
{
var line = rawLine.Trim().TrimEnd(';');
if (!foundStart)
{
if (line.StartsWith("typedef struct"))
{
foundStart = true;
}
continue;
}
if (line.StartsWith("struct {"))
{
if (inStruct)
{
throw new InvalidDataException();
}
// we're starting a nested structure
inStruct = true;
structLines.Clear();
continue;
}
if (line.StartsWith("}"))
{
if (!inStruct)
{
Console.WriteLine("// end");
break;
}
// we're ending a nested structure
var structNameMatch = Regex.Match(line, "^}\\s+([a-zA-Z0-9]+)$");
if (!structNameMatch.Success)
{
throw new InvalidDataException();
}
string structName = structNameMatch.Groups[1].Value;
inStruct = false;
foreach (string structLine in structLines)
{
ProcessLine(StructVar, structLine, structName);
}
continue;
}
if (inStruct)
{
structLines.Add(line);
continue;
}
ProcessLine(StructVar, line);
}
}
void ProcessLine(string structvar, string line, string structname = null)
{
string[] parts = line.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
string fieldType = null;
string fieldName = null;
int arraySize = 0;
if (parts.Length == 2)
{
fieldType = parts[0];
if (parts[1].Contains("["))
{
var arrayMatch = Regex.Match(parts[1], "^([a-zA-Z0-9]+)\\[(\\d+)\\]$");
if (!arrayMatch.Success)
{
throw new InvalidDataException();
}
fieldName = arrayMatch.Groups[1].Value;
arraySize = int.Parse(arrayMatch.Groups[2].Value);
}
else
{
fieldName = parts[1];
}
}
else
{
if (!parts.Contains(":"))
{
throw new InvalidDataException();
}
fieldType = parts[0];
fieldName = parts[1];
}
if (structname != null)
{
structname += ".";
}
if (fieldType == "USHORT")
{
if (arraySize == 0)
{
Console.WriteLine($"printf(\"{structname ?? ""}{fieldName} = %hu\\r\\n\", {structvar}->{structname ?? ""}{fieldName});");
}
else
{
for (int i = 0; i < arraySize; i++)
{
Console.WriteLine($"printf(\"{structname ?? ""}{fieldName}[{i}] = %hu\\r\\n\", {structvar}->{structname ?? ""}{fieldName}[{i}]);");
}
}
}
else if (fieldType == "ULONG")
{
if (arraySize == 0)
{
Console.WriteLine($"printf(\"{structname ?? ""}{fieldName} = %lu\\r\\n\", {structvar}->{structname ?? ""}{fieldName});");
}
else
{
for (int i = 0; i < arraySize; i++)
{
Console.WriteLine($"printf(\"{structname ?? ""}{fieldName}[{i}] = %lu\\r\\n\", {structvar}->{structname ?? ""}{fieldName}[{i}]);");
}
}
}
else if (fieldType == "UCHAR")
{
if (arraySize == 0)
{
Console.WriteLine($"printf(\"{structname ?? ""}{fieldName} = %d\\r\\n\", {structvar}->{structname ?? ""}{fieldName});");
}
else
{
string format = string.Concat(Enumerable.Repeat("%c", arraySize));
Console.Write($"printf(\"{structname ?? ""}{fieldName} = \\\"{format}\\\"\\r\\n\"");
for (int i = 0; i < arraySize; i++)
{
int ni = i;
if (SwapStringEndian)
{
ni = (i - (i % 2)) + (1 - (i % 2));
}
Console.Write($", {structvar}->{structname ?? ""}{fieldName}[{ni}]");
}
Console.WriteLine(");");
}
}
else
{
throw new InvalidDataException();
}
}
+15
View File
@@ -4,6 +4,10 @@ VisualStudioVersion = 15.0.28010.2026
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "al-khaser", "al-khaser\al-khaser.vcxproj", "{77AEFBC3-0ECE-46AD-A113-966AAAA838E1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{71BFEE2B-52EC-4526-90F5-D91D98B9C786}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ATAIdentifyDump", "Tools\ATAIdentifyDump\ATAIdentifyDump.vcxproj", "{245D8670-A888-4ECC-9B51-80584E55B701}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -20,10 +24,21 @@ Global
{77AEFBC3-0ECE-46AD-A113-966AAAA838E1}.Release|x64.Build.0 = Release|x64
{77AEFBC3-0ECE-46AD-A113-966AAAA838E1}.Release|x86.ActiveCfg = Release|Win32
{77AEFBC3-0ECE-46AD-A113-966AAAA838E1}.Release|x86.Build.0 = Release|Win32
{245D8670-A888-4ECC-9B51-80584E55B701}.Debug|x64.ActiveCfg = Debug|x64
{245D8670-A888-4ECC-9B51-80584E55B701}.Debug|x64.Build.0 = Debug|x64
{245D8670-A888-4ECC-9B51-80584E55B701}.Debug|x86.ActiveCfg = Debug|Win32
{245D8670-A888-4ECC-9B51-80584E55B701}.Debug|x86.Build.0 = Debug|Win32
{245D8670-A888-4ECC-9B51-80584E55B701}.Release|x64.ActiveCfg = Release|x64
{245D8670-A888-4ECC-9B51-80584E55B701}.Release|x64.Build.0 = Release|x64
{245D8670-A888-4ECC-9B51-80584E55B701}.Release|x86.ActiveCfg = Release|Win32
{245D8670-A888-4ECC-9B51-80584E55B701}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{245D8670-A888-4ECC-9B51-80584E55B701} = {71BFEE2B-52EC-4526-90F5-D91D98B9C786}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0772817E-132F-4922-8377-5DA07255372F}
EndGlobalSection
+1
View File
@@ -268,3 +268,4 @@ int main(void)
getchar();
return 0;
}
+91 -23
View File
@@ -23,7 +23,7 @@ VOID loaded_dlls()
_T("vmcheck.dll"), // Virtual PC
_T("wpespy.dll"), // WPE Pro
_T("cmdvrt64.dll"), // Comodo Container
_T("cmdvrt32.dll"), // Comodo Container
_T("cmdvrt32.dll"), // Comodo Container
};
@@ -59,7 +59,7 @@ BOOL NumberOfProcessors()
PULONG ulNumberProcessors = (PULONG)(__readgsqword(0x60) + 0xB8);
#elif defined(ENV32BIT)
PULONG ulNumberProcessors = (PULONG)(__readfsdword(0x30) + 0x64) ;
PULONG ulNumberProcessors = (PULONG)(__readfsdword(0x30) + 0x64);
#endif
@@ -81,7 +81,7 @@ PS: Does not seem to work on newer version of VMWare Workstation (Tested on v12)
BOOL idt_trick()
{
UINT idt_base = get_idt_base();
if ((idt_base >> 24) == 0xff)
if ((idt_base >> 24) == 0xff)
return TRUE;
else
@@ -89,15 +89,15 @@ BOOL idt_trick()
}
/*
Same for Local Descriptor Table (LDT)
Same for Local Descriptor Table (LDT)
*/
BOOL ldt_trick()
{
UINT ldt_base = get_ldt_base();
if (ldt_base == 0xdead0000)
if (ldt_base == 0xdead0000)
return FALSE;
else
else
return TRUE; // VMWare detected
}
@@ -121,7 +121,7 @@ BOOL gdt_trick()
The instruction STR (Store Task Register) stores the selector segment of the TR
register (Task Register) in the specified operand (memory or other general purpose register).
All x86 processors can manage tasks in the same way as an operating system would do it.
That is, keeping the task state and recovering it when that task is executed again. All
That is, keeping the task state and recovering it when that task is executed again. All
the states of a task are kept in its TSS; there is one TSS per task. How can we know which
is the TSS associated to the execution task? Using STR instruction, due to the fact that
the selector segment that was brought back points into the TSS of the present task.
@@ -265,10 +265,10 @@ BOOL disk_size_wmi()
VariantClear(&vtProp);
}
}
// release class object
pclsObj->Release();
// break from while
if (bFound)
break;
@@ -326,7 +326,7 @@ BOOL dizk_size_deviceiocontrol()
SecureZeroMemory(driveRootPathBuffer, MAX_PATH);
wnsprintf(driveRootPathBuffer, MAX_PATH, _T("\\\\.\\%C:"), _T('A') + driveNumber);
// open a handle to the volume
HANDLE hVolume = CreateFile(
driveRootPathBuffer,
@@ -340,7 +340,7 @@ BOOL dizk_size_deviceiocontrol()
if (hVolume != INVALID_HANDLE_VALUE)
{
DWORD extentSize = 8192; //256 VOLUME_DISK_EXTENTS entries
PVOLUME_DISK_EXTENTS diskExtents = NULL;
PVOLUME_DISK_EXTENTS diskExtents = NULL;
diskExtents = static_cast<PVOLUME_DISK_EXTENTS>(LocalAlloc(LPTR, extentSize));
if (diskExtents) {
@@ -514,7 +514,7 @@ BOOL setupdi_diskdrive()
}
}
if (buffer)
if (buffer)
LocalFree(buffer);
// Cleanup
@@ -548,7 +548,7 @@ BOOL mouse_movement() {
/* Probably a sandbox, because mouse position did not change. */
return TRUE;
else
else
return FALSE;
}
@@ -560,7 +560,7 @@ more tasks at the same time.
BOOL memory_space()
{
DWORDLONG ullMinRam = (1024LL * (1024LL * (1024LL * 1LL))); // 1GB
MEMORYSTATUSEX statex = {0};
MEMORYSTATUSEX statex = { 0 };
statex.dwLength = sizeof(statex);
GlobalMemoryStatusEx(&statex);
@@ -597,7 +597,7 @@ Sleep and check if time have been accelerated
BOOL accelerated_sleep()
{
DWORD dwStart = 0, dwEnd = 0, dwDiff = 0;
DWORD dwMillisecondsToSleep = 60*1000;
DWORD dwMillisecondsToSleep = 60 * 1000;
/* Retrieves the number of milliseconds that have elapsed since the system was started */
dwStart = GetTickCount();
@@ -612,13 +612,13 @@ BOOL accelerated_sleep()
dwDiff = dwEnd - dwStart;
if (dwDiff > dwMillisecondsToSleep - 1000) // substracted 1s just to be sure
return FALSE;
else
else
return TRUE;
}
/*
The CPUID instruction is a processor supplementary instruction (its name derived from
CPU IDentification) for the x86 architecture allowing software to discover details of
The CPUID instruction is a processor supplementary instruction (its name derived from
CPU IDentification) for the x86 architecture allowing software to discover details of
the processor. By calling CPUID with EAX =1, The 31bit of ECX register if set will
reveal the precense of a hypervisor.
*/
@@ -628,7 +628,7 @@ BOOL cpuid_is_hypervisor()
/* Query hypervisor precense using CPUID (EAX=1), BIT 31 in ECX */
__cpuid(CPUInfo, 1);
if ((CPUInfo[2] >> 31) & 1)
if ((CPUInfo[2] >> 31) & 1)
return TRUE;
else
return FALSE;
@@ -641,7 +641,7 @@ When CPUID is called with EAX=0x40000000, cpuid return the hypervisor signature.
*/
BOOL cpuid_hypervisor_vendor()
{
INT CPUInfo[4] = {-1};
INT CPUInfo[4] = { -1 };
CHAR szHypervisorVendor[0x40];
WCHAR *pwszConverted;
@@ -672,7 +672,7 @@ BOOL cpuid_hypervisor_vendor()
if (pwszConverted) {
bResult = (_tcscmp(pwszConverted, szBlacklistedHypervisors[i]) == 0);
free(pwszConverted);
if (bResult)
@@ -718,13 +718,13 @@ BOOL serial_number_bios_wmi()
// Get the value of the Name property
hRes = pclsObj->Get(_T("SerialNumber"), 0, &vtProp, 0, 0);
if (SUCCEEDED(hRes)) {
if (SUCCEEDED(hRes)) {
if (vtProp.vt == VT_BSTR) {
// Do our comparison
if (
(StrStrI(vtProp.bstrVal, _T("VMWare")) != 0) ||
(StrStrI(vtProp.bstrVal, _T("0")) != 0) || // VBox
(wcscmp(vtProp.bstrVal, _T("0")) == 0) || // VBox (serial is just "0")
(StrStrI(vtProp.bstrVal, _T("Xen")) != 0) ||
(StrStrI(vtProp.bstrVal, _T("Virtual")) != 0) ||
(StrStrI(vtProp.bstrVal, _T("A M I")) != 0)
@@ -1092,6 +1092,74 @@ BOOL cpu_fan_wmi()
return bFound;
}
/*
Check Caption from VideoController using WMI
*/
BOOL caption_video_controller_wmi()
{
IWbemServices *pSvc = NULL;
IWbemLocator *pLoc = NULL;
IEnumWbemClassObject* pEnumerator = NULL;
BOOL bStatus = FALSE;
HRESULT hRes;
BOOL bFound = FALSE;
// Init WMI
bStatus = InitWMI(&pSvc, &pLoc, _T("ROOT\\CIMV2"));
if (bStatus)
{
// If success, execute the desired query
bStatus = ExecWMIQuery(&pSvc, &pLoc, &pEnumerator, _T("SELECT * FROM Win32_VideoController"));
if (bStatus)
{
// Get the data from the query
IWbemClassObject *pclsObj = NULL;
ULONG uReturn = 0;
VARIANT vtProp;
while (pEnumerator)
{
hRes = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn);
if (0 == uReturn)
break;
// Get the value of the Name property
hRes = pclsObj->Get(_T("Caption"), 0, &vtProp, 0, 0);
if (SUCCEEDED(hRes)) {
if (vtProp.vt == VT_BSTR) {
// Do our comparison
if (
(StrStrI(vtProp.bstrVal, _T("Hyper-V")) != 0) ||
(StrStrI(vtProp.bstrVal, _T("VMWare")) != 0)
)
{
VariantClear(&vtProp);
pclsObj->Release();
bFound = TRUE;
break;
}
}
VariantClear(&vtProp);
}
// release the current result object
pclsObj->Release();
}
// Cleanup
pSvc->Release();
pLoc->Release();
pEnumerator->Release();
CoUninitialize();
}
}
return bFound;
}
/*
Detect Virtual machine by calling NtQueryLicenseValue with Kernel-VMDetection-Private as license value.
This detection works on Windows 7 and does not detect Microsoft Hypervisor.
+1
View File
@@ -24,6 +24,7 @@ BOOL process_id_processor_wmi();
BOOL power_capabilities();
BOOL hybridanalysismacdetect();
BOOL cpu_fan_wmi();
BOOL caption_video_controller_wmi();
BOOL query_license_value();
BOOL cachememory_wmi();
BOOL physicalmemory_wmi();
+16
View File
@@ -97,6 +97,10 @@
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
@@ -112,6 +116,10 @@
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@@ -131,6 +139,9 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>copy $(OutDir)$(AssemblyName).exe $(SolutionDir)$(AssemblyName)_$(PlatformTarget).exe</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@@ -150,6 +161,9 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>copy $(OutDir)$(AssemblyName).exe $(SolutionDir)$(AssemblyName)_$(Platform).exe</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="AntiAnalysis\pch.h" />
@@ -300,6 +314,8 @@
</MASM>
</ItemGroup>
<ItemGroup>
<None Include="..\CHANGELOG.md" />
<None Include="..\README.md" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
+2
View File
@@ -451,5 +451,7 @@
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="..\README.md" />
<None Include="..\CHANGELOG.md" />
</ItemGroup>
</Project>
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.