Leaked source code of windows server 2003
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.

188 lines
4.3 KiB

  1. /*++
  2. Copyright (c) 1990-1994 Microsoft Corporation
  3. All rights reserved
  4. Module Name:
  5. job.c
  6. Abstract:
  7. Author:
  8. Environment:
  9. User Mode -Win32
  10. Revision History:
  11. --*/
  12. #include "precomp.h"
  13. #pragma hdrstop
  14. BOOL
  15. SetJobW(
  16. HANDLE hPrinter,
  17. DWORD JobId,
  18. DWORD Level,
  19. LPBYTE pJob,
  20. DWORD Command)
  21. /*++
  22. Routine Description:
  23. This function will modify the settings of the specified Print Job.
  24. Arguments:
  25. lpJob - Points to a valid JOB structure containing at least a valid
  26. lpPrinter, and JobId.
  27. Command - Specifies the operation to perform on the specified Job. A value
  28. of FALSE indicates that only the elements of the JOB structure are to
  29. be examined and set.
  30. Return Value:
  31. TRUE - The operation was successful.
  32. FALSE/NULL - The operation failed. Extended error status is available
  33. using GetLastError.
  34. --*/
  35. {
  36. LPPRINTHANDLE pPrintHandle=(LPPRINTHANDLE)hPrinter;
  37. if (!pPrintHandle || pPrintHandle->signature != PRINTHANDLE_SIGNATURE) {
  38. SetLastError(ERROR_INVALID_HANDLE);
  39. return FALSE;
  40. }
  41. return (*pPrintHandle->pProvidor->PrintProvidor.fpSetJob) (pPrintHandle->hPrinter,
  42. JobId, Level, pJob, Command);
  43. }
  44. BOOL
  45. GetJobW(
  46. HANDLE hPrinter,
  47. DWORD JobId,
  48. DWORD Level,
  49. LPBYTE pJob,
  50. DWORD cbBuf,
  51. LPDWORD pcbNeeded)
  52. /*++
  53. Routine Description:
  54. This function will retrieve the settings of the specified Print Job.
  55. Arguments:
  56. lpJob - Points to a valid JOB structure containing at least a valid
  57. lpPrinter, and JobId.
  58. Return Value:
  59. TRUE - The operation was successful.
  60. FALSE/NULL - The operation failed. Extended error status is available
  61. using GetLastError.
  62. --*/
  63. {
  64. LPPRINTHANDLE pPrintHandle=(LPPRINTHANDLE)hPrinter;
  65. if (!pPrintHandle || pPrintHandle->signature != PRINTHANDLE_SIGNATURE) {
  66. SetLastError(ERROR_INVALID_HANDLE);
  67. return FALSE;
  68. }
  69. if ((pJob == NULL) && (cbBuf != 0)) {
  70. SetLastError(ERROR_INVALID_USER_BUFFER);
  71. return FALSE;
  72. }
  73. return (*pPrintHandle->pProvidor->PrintProvidor.fpGetJob)
  74. (pPrintHandle->hPrinter, JobId, Level, pJob,
  75. cbBuf, pcbNeeded);
  76. }
  77. BOOL
  78. EnumJobsW(
  79. HANDLE hPrinter,
  80. DWORD FirstJob,
  81. DWORD NoJobs,
  82. DWORD Level,
  83. LPBYTE pJob,
  84. DWORD cbBuf,
  85. LPDWORD pcbNeeded,
  86. LPDWORD pcReturned)
  87. {
  88. LPPRINTHANDLE pPrintHandle=(LPPRINTHANDLE)hPrinter;
  89. if (!pPrintHandle || pPrintHandle->signature != PRINTHANDLE_SIGNATURE) {
  90. SetLastError(ERROR_INVALID_HANDLE);
  91. return FALSE;
  92. }
  93. if ((pJob == NULL) && (cbBuf != 0)) {
  94. SetLastError(ERROR_INVALID_USER_BUFFER);
  95. return FALSE;
  96. }
  97. return (*pPrintHandle->pProvidor->PrintProvidor.fpEnumJobs)(pPrintHandle->hPrinter,
  98. FirstJob, NoJobs,
  99. Level, pJob, cbBuf,
  100. pcbNeeded, pcReturned);
  101. }
  102. BOOL
  103. AddJobW(
  104. HANDLE hPrinter,
  105. DWORD Level,
  106. LPBYTE pAddJob,
  107. DWORD cbBuf,
  108. LPDWORD pcbNeeded)
  109. {
  110. LPPRINTHANDLE pPrintHandle=(LPPRINTHANDLE)hPrinter;
  111. if (!pPrintHandle || pPrintHandle->signature != PRINTHANDLE_SIGNATURE) {
  112. SetLastError(ERROR_INVALID_HANDLE);
  113. return FALSE;
  114. }
  115. if ((pAddJob == NULL) && (cbBuf != 0)) {
  116. SetLastError(ERROR_INVALID_USER_BUFFER);
  117. return FALSE;
  118. }
  119. return (*pPrintHandle->pProvidor->PrintProvidor.fpAddJob) (pPrintHandle->hPrinter,
  120. Level, pAddJob, cbBuf,
  121. pcbNeeded);
  122. }
  123. BOOL
  124. ScheduleJob(
  125. HANDLE hPrinter,
  126. DWORD JobId)
  127. {
  128. LPPRINTHANDLE pPrintHandle=(LPPRINTHANDLE)hPrinter;
  129. if (!pPrintHandle || pPrintHandle->signature != PRINTHANDLE_SIGNATURE) {
  130. SetLastError(ERROR_INVALID_HANDLE);
  131. return FALSE;
  132. }
  133. return (*pPrintHandle->pProvidor->PrintProvidor.fpScheduleJob) (pPrintHandle->hPrinter,
  134. JobId);
  135. }