I can access my USB device from command prompt manually by appending a .bsc file as shown
C:\a\TestDriveRead\TestDriveRead\Debug>TestDriveRead.exe G: TestDriveRead.bsc
I'm unable to debug and access from using visual studio directly .
How do i append "G: TestDriveRead.bsc" into code below
Please help me out.
#include "stdafx.h"
#include "windows.h"
#include <iostream>
#include "conio.h"
FILE *mpe;
FILE *mpeout;
int i,lloop=0,nRet,data,count=0;
unsigned char buffer[10 * 1024 * 1024];
char drive[10];
DWORD dwBytes;
int main(int argc, char* argv[])
{
HANDLE m_hDrive;
printf("-----------------------------------------------------------------------------\n");
printf( " %s\n",&logo);
getch();
if ( !(strcmp(argv[0],"c")) || !(strcmp(argv[1],"C:")) || !(strcmp(argv[1],"d:")) || !(strcmp(argv[1],"D:")) || !(strcmp(argv[1],"e:")) || !(strcmp(argv[1],"E:")) || !(strcmp(argv[1],"f:")) || !(strcmp(argv[1],"F:")))
{
printf(" Caution Drive should be D: and above \n");
return 1;
}
strcpy(drive,"\\\\?\\");
strcat(drive,argv[1]);
mpe= fopen(argv[2],"rb");
if ( mpe == NULL )
{
printf(" Error openning File %s \n",argv[2]);
return 1;
}
mpeout= fopen("mpedata.dat","wb");
if ( mpeout == NULL )
{
printf(" Error creating output File \n");
return 1;
}
#if 1
m_hDrive = CreateFile(drive,
GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0,
0);
if( m_hDrive == INVALID_HANDLE_VALUE)
{
printf("Could not open the file error %d \n",GetLastError());
return 0;
}
}
[edit]Code block added - OriginalGriff[/edit]