A forum for reverse engineering, OS internals and malware analysis 

Forum for discussion about kernel-mode development.
 #11388  by Tigzy
 Wed Feb 01, 2012 2:53 pm
Hello

I'm looking for new ways to read MBR.

SPTI is owned (only READ10 seems to work, the others returns invalid function error)
APTI is quite good (don't works in some cases, I'm on it)

ASPI need to be installed
SPTD is under licence.

I also heard about EPTI, without being given what the acronym means. Anybody have heard of that?
 #11392  by Tigzy
 Wed Feb 01, 2012 7:07 pm
Hello Alex! ;)

EPTI for IDE PTI , why not? :D
Thanks for the info!


EDIT
// ATA-Befehl IDENTIFY
IP->irDriveRegs.bCommandReg = 0xEC;
This really looks like APTI...
 #11584  by Tigzy
 Sun Feb 12, 2012 11:16 pm
Hi guys, I tried EPTI, that's really simple, but it only seems to work with "old" OS. XP SP3 is the only OS where I succeed to make it work.
Is IDE_PT the "parent" of ATA_PT ?

Here's my code, you may will find something wrong...
Code: Select all
#define IOCTL_IDE_PASS_THROUGH  CTL_CODE(IOCTL_SCSI_BASE, 0x040A, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
typedef struct{
	UCHAR bFeaturesReg;
	UCHAR bSectorCountReg;
	UCHAR bSectorNumberReg;
	UCHAR bCylLowReg;
	UCHAR bCylHighReg;
	UCHAR bDriveHeadReg;
	UCHAR bCommandReg;
	UCHAR bReserved;
} IDE_REGISTER, *PIDE_REGISTER;

typedef struct{
    IDE_REGISTER IdeReg;
    ULONG   DataBufferSize;
    UCHAR   DataBuffer[1];
}ATA_PASS_THROUGH;

unsigned int Size = sizeof(ATA_PASS_THROUGH) + sizeBuff;
	ATA_PASS_THROUGH *pAPT = (ATA_PASS_THROUGH *)VirtualAlloc(NULL, Size, MEM_COMMIT, PAGE_READWRITE);
	memset(pAPT, 0, Size);

	pAPT->DataBufferSize = sizeBuff;
	pAPT->IdeReg.bFeaturesReg = 0x0; //Feature ID
	pAPT->IdeReg.bSectorCountReg = 0x01; //Number of sectors
	pAPT->IdeReg.bSectorNumberReg = LOBYTE(LOWORD(firstSector));
	pAPT->IdeReg.bCylLowReg = HIBYTE(LOWORD(firstSector));
	pAPT->IdeReg.bCylHighReg = LOBYTE(HIWORD(firstSector));
	pAPT->IdeReg.bDriveHeadReg = HIBYTE(HIWORD(firstSector));
	pAPT->IdeReg.bCommandReg = 0x20; //Command
	pAPT->IdeReg.bReserved = 0x00; //Res

    bool status =  DeviceIoControl(hDevice, IOCTL_IDE_PASS_THROUGH, pAPT, Size, pAPT, Size, &bytescopied, FALSE);
	memcpy(outBuff, pAPT->DataBuffer, sizeBuff);
  • 1
  • 3
  • 4
  • 5
  • 6
  • 7