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.

160 lines
4.5 KiB

  1. /********
  2. *
  3. * Copyright (c) 1995 Microsoft Corporation
  4. *
  5. *
  6. * Module Name : globals.h
  7. *
  8. * Abstract :
  9. *
  10. * This module contains the structure definitions and prototypes for the
  11. * version 1.0 HTTP Printers Server Extension.
  12. *
  13. ******************/
  14. //
  15. // Notes:
  16. // TEXT (".printer"), TEXT ("/scripts"), TEXT ("PrintersFolder") hardcoded
  17. // ReadRegistry needs implementation
  18. #ifndef _GLOBALS_H
  19. #define _GLOBALS_H
  20. // Debugging Environment (SPLLIB.LIB)
  21. //
  22. #define MODULE "msw3prt:"
  23. // Define local error code
  24. #define ERROR_DRIVER_NOT_FOUND 5500
  25. #define ERROR_SERVER_DISK_FULL 5512
  26. // URL strings for links
  27. #define URL_PREFIX TEXT ("http://%s") // g_szComputerName
  28. #define URL_PRINTER TEXT ("/printers/%s/.printer") // pPageInfo->pPrinterInfo->pShareName
  29. #define URL_PRINTER_LINK TEXT ("/%s") // pPageInfo->pPrinterInfo->pShareName
  30. #define URL_FOLDER TEXT ("/%s/") // g_szPrinters
  31. #define URLS_JOBINFO TEXT ("?ShowJobInfo&%d") // dwJobID
  32. #define URLS_JOBCONTROL TEXT ("?JobControl&%d&") // dwJobID, append P,R,C,S
  33. //
  34. //
  35. #define PROCESSOR_ARCHITECTURE_UNSUPPORTED 0xFFFE
  36. // Buffer size for HTML format buffer and size to flush after
  37. #define BUFSIZE 2047
  38. #define FLUSHSIZE 1792
  39. #define STRBUFSIZE 256 // For string resources and our path
  40. #define MAX_Q_ARG 32 // Maximum number of query arguments
  41. // This contains all relevant info for this specific connection
  42. typedef struct
  43. {
  44. //
  45. // Group the structure fields in 4*DWORD groups so it can be easily found in the debugger dump.
  46. //
  47. // Transient info that is regenerated each session
  48. EXTENSION_CONTROL_BLOCK *pECB; // Struct from ISAPI interface
  49. LPTSTR lpszMethod; // Unicode correspondece of the data member in pECB
  50. LPTSTR lpszQueryString;
  51. LPTSTR lpszPathInfo;
  52. LPTSTR lpszPathTranslated;
  53. UINT iQueryCommand; // CMD_something
  54. int iNumQueryArgs; // Yep, number of query arguments
  55. BOOL fQueryArgIsNum[MAX_Q_ARG]; // TRUE if arg is a number
  56. UINT_PTR QueryArgValue[MAX_Q_ARG]; // number or pointer to string
  57. DWORD dwError; // Error message ID set in action tags
  58. TCHAR szStringBuf[STRBUFSIZE]; // For string resources
  59. } ALLINFO, *PALLINFO;
  60. // Contains information opened for the printer page, if any.
  61. typedef struct
  62. {
  63. LPTSTR pszFriendlyName; // Friendly name from Windows (!JobData && !JobClose)
  64. PPRINTER_INFO_2 pPrinterInfo; // NULL if JobData or JobClose
  65. HANDLE hPrinter; // NULL if JobData or JobClose
  66. } PRINTERPAGEINFO, *PPRINTERPAGEINFO;
  67. // Query string command identifiers
  68. enum
  69. {
  70. CMD_Invalid,
  71. CMD_IPP,
  72. CMD_Install,
  73. CMD_CreateExe,
  74. CMD_WebUI
  75. };
  76. // Supported Architectures ids.
  77. typedef enum _ARCHITECTURE {
  78. ARCHITECTURE_X86,
  79. ARCHITECTURE_ALPHA
  80. } ARCHITECTURE;
  81. // Relates status values to status strings (job or printer status)
  82. typedef struct
  83. {
  84. DWORD dwStatus; // Status code (ie, PRINTER_STATUS_PAUSED)
  85. UINT iShortStringID; // Short string (ie, TEXT ("Paused"))
  86. UINT iLongStringID; // Long string(ie, TEXT ("The printer is paused."))
  87. } STAT_STRING_MAP, *PSTAT_STRING_MAP;
  88. // Structure to relate query string command to command ID
  89. typedef struct
  90. {
  91. LPTSTR pszCommand;
  92. UINT iCommandID;
  93. } QUERY_MAP, *PQUERY_MAP;
  94. // Inline functions and macros
  95. #define ARRAY_COUNT(x) (sizeof(x) / sizeof(x[0]))
  96. //
  97. // utils
  98. //
  99. BOOL FreeStr( LPCTSTR );
  100. LPTSTR AllocStr( LPCTSTR );
  101. // from Spool.CPP
  102. DWORD SplIppJob(WORD wReq, PALLINFO pAllInfo, PPRINTERPAGEINFO pPageInfo);
  103. // Variables in globals.cpp
  104. extern CRITICAL_SECTION SplCritSect;
  105. extern CRITICAL_SECTION TagCritSect;
  106. extern const QUERY_MAP rgQueryMap[];
  107. extern const int iNumQueryMap;
  108. //extern TCHAR g_szComputerName[INTERNET_MAX_HOST_NAME_LENGTH + 1];
  109. extern TCHAR g_szHttpServerName[INTERNET_MAX_HOST_NAME_LENGTH + 1];
  110. extern TCHAR g_szPrintServerName[INTERNET_MAX_HOST_NAME_LENGTH + 1];
  111. extern HINSTANCE g_hInstance;
  112. extern LPTSTR g_szPrintersFolder;
  113. extern LPTSTR g_szPrinters;
  114. extern LPTSTR g_szRemotePortAdmin;
  115. #endif