Advertisement
ruudkoot

Write-Read-Verify

Jan 30th, 2012
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <fcntl.h>
  3. #include <sys/ioctl.h>
  4. #include <sys/stat.h>
  5. #include <sys/types.h>
  6.  
  7. #define HDIO_DRIVE_TASK 0x031e
  8. #define HDIO_DRIVE_CMD  0x031f
  9.  
  10. int main(int argc, char* argv[]) {
  11.     int fd = open(argv[1], O_RDWR);
  12.     unsigned char args[7] = { 0xef, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00 };
  13.     if (ioctl(fd, HDIO_DRIVE_TASK, args)) {
  14.         printf("error\n");
  15.     } else {
  16.         printf("okay\n");
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement