Using IRP_MJ_CREATE (handle/createFile/access rom drive)
Hello,
I'm trying to write some code which uses a handle to access a rom drive on windows xp. The code below produces this output, "Error opening drive\.E:"
The codes not correctly accessing the drive. I've been googling and I think it might be related not issuing IRP_MJ_CREATE to request the use of a handle. According to msdn E (rom drive) should be set out as "\\.\E:"
Has anyone any code or reference material which could help me in using IRP_MJ_CREATE, if its the problem?
Many thanks.
IRP_MJ_CREATE http://msdn.microsoft.com/en-us/library/ms806162.aspx
CreateFile Function http://msdn.microsoft.com/en-us/libr...58(VS.85).aspx
Code:
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <windows.h>
#include <winioctl.h>
int main()
{
HANDLE device;
char deviceName[20];
strcpy(deviceName, "\\.\E:");
device = CreateFile(deviceName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0);
if(device == INVALID_HANDLE_VALUE) //Error opening drive
{
printf("Error opening drive");
}
printf("%s", deviceName);
printf("debug1");
}