Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

189 lines
6.3 KiB

  1. #include <windows.h>
  2. #include <wchar.h>
  3. #include "faxsvc.h"
  4. #include "faxutil.h"
  5. #define QUEUE_SEARCH L"*.fqe"
  6. #define QUEUE_DIR L"Microsoft\\Windows NT\\MSFax\\queue"
  7. #define BUFFER_SIZE 4096
  8. BYTE Buffer[BUFFER_SIZE];
  9. WCHAR * JobTypeStrings[] = {
  10. L"Unknown",
  11. L"Send",
  12. L"Receive",
  13. L"Routing"
  14. };
  15. WCHAR * JobScheduleStrings[] = {
  16. L"Now",
  17. L"Specific Time",
  18. L"Discount Period"
  19. };
  20. int
  21. _cdecl
  22. wmain(
  23. INT Argc,
  24. WCHAR *Argv[]
  25. )
  26. {
  27. HANDLE FindHandle;
  28. WIN32_FIND_DATA FindData;
  29. PJOB_QUEUE_FILE JobQueue = (PJOB_QUEUE_FILE) &Buffer[0];
  30. HANDLE FileHandle;
  31. WCHAR QueueDir[MAX_PATH];
  32. if (!GetSpecialPath(CSIDL_COMMON_APPDATA,QueueDir)) {
  33. return FALSE;
  34. }
  35. ConcatenatePaths(QueueDir,QUEUE_DIR);
  36. SetCurrentDirectory( QueueDir );
  37. FindHandle = FindFirstFile( QUEUE_SEARCH, &FindData );
  38. if (FindHandle != INVALID_HANDLE_VALUE) {
  39. do {
  40. wprintf( L"Queue FileName %s\n", FindData.cFileName );
  41. FileHandle = CreateFile(
  42. FindData.cFileName,
  43. GENERIC_READ,
  44. FILE_SHARE_READ,
  45. NULL,
  46. OPEN_EXISTING,
  47. 0,
  48. NULL
  49. );
  50. if (FileHandle != INVALID_HANDLE_VALUE) {
  51. DWORD BytesRead;
  52. ReadFile(
  53. FileHandle,
  54. &Buffer[0],
  55. BUFFER_SIZE,
  56. &BytesRead,
  57. NULL
  58. );
  59. if (BytesRead > 0) {
  60. wprintf (L"Unique Id %d\n", JobQueue->UniqueId );
  61. wprintf (L"Job Type - %s\n", JobTypeStrings[JobQueue->JobType] );
  62. wprintf (L"Tiff FileName %s\n", Buffer + (DWORD) JobQueue->FileName );
  63. wprintf (L"Retries %d\n", JobQueue->SendRetries );
  64. wprintf (L"Schedule Action - %s\n", JobScheduleStrings[JobQueue->ScheduleAction] );
  65. if (JobQueue->ScheduleAction == JSA_SPECIFIC_TIME) {
  66. SYSTEMTIME SystemTime;
  67. FILETIME LocalFileTime;
  68. WCHAR TimeBuffer[128];
  69. FileTimeToLocalFileTime( (LPFILETIME) &JobQueue->ScheduleTime, &LocalFileTime );
  70. FileTimeToSystemTime( &LocalFileTime, &SystemTime );
  71. GetDateFormat(
  72. LOCALE_SYSTEM_DEFAULT,
  73. 0,
  74. &SystemTime,
  75. NULL,
  76. TimeBuffer,
  77. sizeof(TimeBuffer)
  78. );
  79. wprintf( L"Schedule Date - %s ", TimeBuffer );
  80. GetTimeFormat(
  81. LOCALE_SYSTEM_DEFAULT,
  82. 0,
  83. &SystemTime,
  84. NULL,
  85. TimeBuffer,
  86. sizeof(TimeBuffer)
  87. );
  88. wprintf( L"Schedule Time - %s\n", TimeBuffer );
  89. wprintf( L"Schedule Quadword %I64x\n", JobQueue->ScheduleTime );
  90. }
  91. }
  92. CloseHandle( FileHandle );
  93. wprintf( L"\n\n" );
  94. }
  95. } while ( FindNextFile( FindHandle, &FindData ));
  96. }
  97. return 1;
  98. }
  99. #if 0
  100. #define JSA_NOW 0
  101. #define JSA_SPECIFIC_TIME 1
  102. #define JSA_DISCOUNT_PERIOD 2
  103. //
  104. // job type defines
  105. //
  106. #define JT_UNKNOWN 0
  107. #define JT_SEND 1
  108. #define JT_RECEIVE 2
  109. #define JT_ROUTING 3
  110. //
  111. // job status defines
  112. //
  113. #define JS_PENDING 0x00000000
  114. #define JS_INPROGRESS 0x00000001
  115. #define JS_DELETING 0x00000002
  116. #define JS_FAILED 0x00000004
  117. #define JS_PAUSED 0x00000008
  118. #define JS_NOLINE 0x00000010
  119. typedef struct _JOB_QUEUE_FILE {
  120. DWORD SizeOfStruct; // size of this structure
  121. DWORDLONG UniqueId; //
  122. DWORD JobType; // job type, see JT defines
  123. LPTSTR FileName; //
  124. LPTSTR QueueFileName; //
  125. LPTSTR UserName; //
  126. LPTSTR RecipientNumber; // recipient fax number
  127. LPTSTR RecipientName; // recipient name
  128. LPTSTR Tsid; // transmitter's id
  129. LPTSTR SenderName; // sender name
  130. LPTSTR SenderCompany; // sender company
  131. LPTSTR SenderDept; // sender department
  132. LPTSTR BillingCode; // billing code
  133. LPTSTR DeliveryReportAddress; //
  134. LPTSTR DocumentName; //
  135. DWORD DeliveryReportType; //
  136. DWORD ScheduleAction; // when to schedule the fax, see JSA defines
  137. DWORDLONG ScheduleTime; // schedule time in 64bit version
  138. BOOL BroadcastJob; // is this a broadcast fax job?
  139. DWORDLONG BroadcastOwner; // unique id of the broadcast owner
  140. DWORD SendRetries; // number of times send attempt has been made
  141. DWORD FaxRouteSize;
  142. PFAX_ROUTE FaxRoute;
  143. DWORD CountFaxRouteFiles; // count of files to be routed
  144. DWORD FaxRouteFileGuid; // offset array of GUID's
  145. DWORD FaxRouteFiles; // offset to a multi-sz of filenames
  146. DWORD CountFailureInfo; // number of ROUTE_FAILURE_INFO structs that follow
  147. ROUTE_FAILURE_INFO RouteFailureInfo[1]; // array of ROUTE_FAILURE_INFO structs
  148. } JOB_QUEUE_FILE, *PJOB_QUEUE_FILE;
  149. #endif