stdafx.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. // stdafx.cpp : 只包括标准包含文件的源文件
  2. // BurndiscTest.pch 将作为预编译头
  3. // stdafx.obj 将包含预编译类型信息
  4. #include "stdafx.h"
  5. BOOL NERO_CALLBACK_ATTR _IdleCallback (void *pUserData)
  6. {
  7. return false;
  8. }
  9. NeroUserDlgInOut NERO_CALLBACK_ATTR _UserDialog (void *pUserData, NeroUserDlgInOut type, void *data)
  10. {
  11. return DLG_RETURN_EXIT;
  12. }
  13. BOOL NERO_CALLBACK_ATTR _ProgressCallback (void *pUserData, DWORD dwProgressInPercent)
  14. {
  15. printf ("%03d%%\r", dwProgressInPercent);
  16. return false;
  17. }
  18. BOOL NERO_CALLBACK_ATTR _AbortedCallback (void *pUserData)
  19. {
  20. // printf("Abort ?\n");
  21. return false;
  22. }
  23. void NERO_CALLBACK_ATTR _AddLogLine (void *pUserData, NERO_TEXT_TYPE type, const char *text)
  24. {
  25. char *header = " ";
  26. const char *start;
  27. switch (type) {
  28. case NERO_TEXT_INFO: /* informative text */
  29. header = "i ";
  30. break;
  31. case NERO_TEXT_STOP: /* some operation stopped prematurely */
  32. header = "# ";
  33. break;
  34. case NERO_TEXT_EXCLAMATION: /* important information */
  35. header = "! ";
  36. break;
  37. case NERO_TEXT_QUESTION: /* a question which requires an answer */
  38. header = "? ";
  39. break;
  40. case NERO_TEXT_DRIVE: /* a message concerning a CD-ROM drive or recorder */
  41. header = "- ";
  42. break;
  43. default:
  44. break;
  45. }
  46. start = text;
  47. while (start) {
  48. const char *end = strchr (start, '\n');
  49. int len = end ? (int)(end - start) : strlen (start);
  50. fputs (header, stdout);
  51. fwrite (start, 1, len, stdout);
  52. // clear rest of line
  53. len = 79 - strlen (header) - len;
  54. while (--len >= 0) {
  55. putchar (' ');
  56. }
  57. puts ("");
  58. start = end ? end + 1 : NULL;
  59. }
  60. }
  61. void NERO_CALLBACK_ATTR _SetPhaseCallback (void *pUserData, const char *text)
  62. {
  63. int len;
  64. printf (" %s", text);
  65. // clear rest of line
  66. len = 79 - strlen (text) - 5;
  67. while (--len >= 0) {
  68. putchar (' ');
  69. }
  70. putchar ('\r');
  71. }
  72. void NERO_CALLBACK_ATTR _DisableAbortCallback (void *pUserData, BOOL enableAbort)
  73. {
  74. if (!enableAbort)
  75. puts("The current process cannot be interrupted");
  76. else puts("The process can be interrupted again");
  77. }
  78. void NERO_CALLBACK_ATTR _SetMajorPhaseCallback(void *pUserData,NERO_MAJOR_PHASE phase,void *reserved)
  79. {
  80. }
  81. DWORD NERO_CALLBACK_ATTR _WriteIOCallback (void *pUserData, BYTE *pBuffer, DWORD dwLen)
  82. {
  83. return fwrite (pBuffer, 1, dwLen, (FILE *)pUserData);
  84. }
  85. BOOL NERO_CALLBACK_ATTR _EOFCallback (void *pUserData)
  86. {
  87. return feof ((FILE *)pUserData);
  88. }
  89. BOOL NERO_CALLBACK_ATTR _ErrorCallback (void *pUserData)
  90. {
  91. return ferror ((FILE *)pUserData);
  92. }
  93. DWORD NERO_CALLBACK_ATTR _ReadIOCallback (void *pUserData, BYTE *pBuffer, DWORD dwLen)
  94. {
  95. return fread (pBuffer, 1, dwLen, (FILE *)pUserData);
  96. }