Thanks for the reply!
I use followinf funktion:
Code:
void tmain(void)
{
HANDLE hFile;
DWORD dwBytesRead = 0;
char ReadBuffer[BUFFER_SIZE] = {0};
hFile = CreateFile("\\.\E:",GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
printf("Could not open file (error %d)\n", GetLastError());
return;
}
// Read one character less than the buffer size to save room for
// the terminating NULL character.
if( FALSE == ReadFile(hFile, ReadBuffer, BUFFER_SIZE-2, &dwBytesRead, NULL) )
{
printf("Could not read from file (error %d)\n", GetLastError());
CloseHandle(hFile);
return;
}
if (dwBytesRead > 0)
{
ReadBuffer[dwBytesRead+1]='\0'; // NULL character
_tprintf(TEXT("Text read from %s (%d bytes): \n"), dwBytesRead);
printf("%s\n", ReadBuffer);
}
else
{
_tprintf(TEXT("No data read from file %s\n"));
}
CloseHandle(hFile);
}
But it always jumps into this Funktion
Code:
if (hFile == INVALID_HANDLE_VALUE)
because of hFile is 0xffffffff
What can I do?