#include <windows.h> #include <winioctl.h>
int main() { HANDLE hDevice; char buffer[512]; memset(buffer, 'c', 512); DWORD bytesread ;
hDevice = CreateFile("\\\\.\\a:", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL); if (!hDevice) { MessageBox (0, "open", "Failed !", 0); return NULL; } SetFilePointer(hDevice, 0, NULL, FILE_BEGIN); if (!ReadFile(hDevice, buffer, 512, &bytesread, NULL)) { MessageBox (0, "read!", "Failed !", 0); return NULL; } CloseHandle(hDevice);
} |