eraseMedium.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef NULLSOFT_ERASEMEDIUM_HEADER
  2. #define NULLSOFT_ERASEMEDIUM_HEADER
  3. #include "./main.h"
  4. #include "./primosdk.h"
  5. #define ERASEMEDIUM_STATUS 0x0000
  6. #define ERASEMEDIUM_ERROR 0x1000
  7. // status messages
  8. #define ERASEMEDIUM_READY ((ERASEMEDIUM_STATUS) + 0x0001)
  9. #define ERASEMEDIUM_INITIALIZING ((ERASEMEDIUM_STATUS) + 0x0002)
  10. #define ERASEMEDIUM_ERASING ((ERASEMEDIUM_STATUS) + 0x0003)
  11. #define ERASEMEDIUM_FINISHING ((ERASEMEDIUM_STATUS) + 0x0004)
  12. #define ERASEMEDIUM_CANCELING ((ERASEMEDIUM_STATUS) + 0x0005)
  13. #define ERASEMEDIUM_COMPLETED ((ERASEMEDIUM_STATUS) + 0x0006)
  14. #define ERASEMEDIUM_ABORTED ((ERASEMEDIUM_STATUS) + 0x0007)
  15. // error messages
  16. #define ERASEMEDIUM_ALREADYSTARTED ((ERASEMEDIUM_ERROR) + 0x0001)
  17. #define ERASEMEDIUM_UNABLEINITPRIMO ((ERASEMEDIUM_ERROR) + 0x0002)
  18. #define ERASEMEDIUM_DEVICENOTREADY ((ERASEMEDIUM_ERROR) + 0x0003)
  19. #define ERASEMEDIUM_DISCINFOERROR ((ERASEMEDIUM_ERROR) + 0x0004)
  20. #define ERASEMEDIUM_DISCNOTERASABLE ((ERASEMEDIUM_ERROR) + 0x0005)
  21. #define ERASEMEDIUM_BEGINBURNFAILED ((ERASEMEDIUM_ERROR) + 0x0006)
  22. #define ERASEMEDIUM_ENDBURNFAILED ((ERASEMEDIUM_ERROR) + 0x0007)
  23. #define ERASEMEDIUM_ERASEMEDIUMFAILED ((ERASEMEDIUM_ERROR) + 0x0008)
  24. // callback returns
  25. #define ERASEMEDIUM_CONTINUE 0
  26. #define ERASEMEDIUM_STOP 1
  27. typedef DWORD (WINAPI *ERASEMEDIUMCALLBACK)(void*, void*, DWORD, DWORD);
  28. class EraseMedium
  29. {
  30. public:
  31. BURNLIB_API EraseMedium(void);
  32. BURNLIB_API ~EraseMedium(void);
  33. public:
  34. BURNLIB_API DWORD Start(DWORD drive, DWORD eraseMode, ERASEMEDIUMCALLBACK notifyCB, void *userParam, int block);
  35. BURNLIB_API void Stop(void);
  36. BURNLIB_API DWORD GetErrorCode(void) { return errorCode; }
  37. BURNLIB_API BOOL IsRunning(void) { return (NULL != hThread); }
  38. public:
  39. BURNLIB_API DWORD SetEject(DWORD eject);
  40. protected:
  41. DWORD OnNotify(DWORD eraseCode, DWORD primoCode);
  42. static DWORD WINAPI StatusThread(void* parameter);
  43. protected:
  44. WABURNSTRUCT bs;
  45. obj_primo *primoSDK;
  46. unsigned int eject;
  47. HANDLE hThread;
  48. HANDLE evntStop;
  49. HANDLE evntThreadExit;
  50. DWORD errorCode;
  51. void* userparam;
  52. ERASEMEDIUMCALLBACK notifyCB;
  53. };
  54. #endif //NULLSOFT_ERASEMEDIUM_HEADER