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.

165 lines
6.2 KiB

  1. /*****************************************************************************\
  2. * MODULE: globals.c
  3. *
  4. * This is the common global variable module. Any globals used throughout the
  5. * executable should be placed in here and the cooresponding declaration
  6. * should be in "globals.h".
  7. *
  8. *
  9. * Copyright (C) 1996-1997 Microsoft Corporation
  10. * Copyright (C) 1996-1997 Hewlett Packard
  11. *
  12. * History:
  13. * 07-Oct-1996 HWP-Guys Initiated port from win95 to winNT
  14. *
  15. \*****************************************************************************/
  16. #include "precomp.h"
  17. #include "priv.h"
  18. // Global variables which can change state.
  19. //
  20. HINSTANCE g_hInst = NULL;
  21. DWORD g_dwJobLimit = 1000; // 1000 iterations.
  22. CRITICAL_SECTION g_csMonitorSection = {0, 0, 0, 0, 0, 0};
  23. BOOL g_bUpgrade = FALSE;
  24. CCriticalSection *g_pcsEndBrowserSessionLock = NULL;
  25. CRITICAL_SECTION g_csCreateSection = {0, 0, 0, 0, 0, 0};
  26. HANDLE g_eResetConnections= INVALID_HANDLE_VALUE;
  27. DWORD g_dwConCount = 0;
  28. #ifdef DEBUG
  29. DWORD g_dwCritOwner = 0;
  30. #endif
  31. // Holds the machine-name.
  32. //
  33. TCHAR g_szMachine[MAX_COMPUTERNAME_LENGTH + 1] = {0};
  34. LPTSTR g_szRegProvider = NULL;
  35. LPTSTR g_szRegPrintProviders = NULL;
  36. TCHAR g_szDefSplDir [MAX_PATH];
  37. TCHAR g_szDisplayStr[MAX_PATH];
  38. // Spooler-Directory Strings.
  39. //
  40. CONST TCHAR g_szSplDir9X [] = TEXT("\\spool\\printers");
  41. CONST TCHAR g_szSplPfx [] = TEXT("IPP");
  42. // Constant string identifiers.
  43. //
  44. CONST TCHAR g_szUserAgent[] = TEXT("Internet Print Provider");
  45. CONST TCHAR g_szLocalPort[] = TEXT("Internet Port");
  46. CONST TCHAR g_szDisplayName[] = TEXT("DisplayName");
  47. CONST TCHAR g_szLibraryName[] = TEXT("inetpp.dll");
  48. CONST TCHAR g_szWinInetDll[] = TEXT("wininet.dll");
  49. CONST TCHAR g_szUriPrinters[] = TEXT("scripts/%s/.printer");
  50. CONST TCHAR g_szPOST[] = TEXT("POST");
  51. CONST TCHAR g_szGET[] = TEXT("GET");
  52. CONST TCHAR g_szContentLen[] = TEXT("Content-length: %d\r\n");
  53. CONST TCHAR g_szContentType[] = TEXT("Content-type: application/ipp\r\n");
  54. CONST TCHAR g_szEmptyString[] = TEXT("");
  55. CONST TCHAR g_szDescription[] = TEXT("Windows NT Internet Printing");
  56. CONST TCHAR g_szComment[] = TEXT("Internet URL Printers");
  57. CONST TCHAR g_szProviderName[] = TEXT("Windows NT Internet Provider");
  58. CONST TCHAR g_szNewLine[] = TEXT("\n");
  59. CONST TCHAR g_szConfigureMsg[] = TEXT("There is nothing to configure for this port.");
  60. CONST TCHAR g_szRegPorts[] = TEXT("Ports");
  61. CONST TCHAR g_szAuthDlg[] = TEXT("AuthDlg");
  62. CONST TCHAR g_szDocRemote[] = TEXT("Remote Downlevel Document");
  63. CONST TCHAR g_szDocLocal[] = TEXT("Local Downlevel Document");
  64. // Registry Value
  65. //
  66. CONST TCHAR g_szAuthMethod[] = TEXT("Authentication");
  67. CONST TCHAR g_szUserName[] = TEXT("UserName");
  68. CONST TCHAR g_szPassword[] = TEXT("Password");
  69. CONST TCHAR g_szPerUserPath[] = TEXT("Printers\\Inetnet Print Provider");
  70. // Http Version Number
  71. //
  72. CONST TCHAR g_szHttpVersion[] = TEXT("HTTP/1.1");
  73. CONST TCHAR g_szProcessName[] = TEXT("spoolsv.exe");
  74. // String constants for the Internet API. These strings are
  75. // used exclusively by the GetProcAddress() call, which does not
  76. // support Unicode. Therefore, these strings should NOT be wrapped
  77. // by the TEXT macro.
  78. //
  79. CONST CHAR g_szInternetCloseHandle[] = "InternetCloseHandle";
  80. CONST CHAR g_szInternetErrorDlg[] = "InternetErrorDlg";
  81. CONST CHAR g_szInternetReadFile[] = "InternetReadFile";
  82. CONST CHAR g_szInternetWriteFile[] = "InternetWriteFile";
  83. #ifdef UNIMPLEMENTED
  84. // NOTE: Currently, the release of WININET.DLL that was used (07-Aug-1996)
  85. // does not support the Unicode calls. So, in order to support this
  86. // this correctly (Until it becomes available), this DLL will still
  87. // be compilable and runable in Unicode. However, the WININET calls
  88. // will be dealt with as Ansi in the (inetwrap.c) module.
  89. //
  90. // Change this to (#ifdef UNICODE) once WinInet is fixed
  91. // to support Unicode. For now, we can rely on the wrappers
  92. // in "inetwrap.c"
  93. //
  94. // 15-Oct-1996 : ChrisWil
  95. //
  96. CONST CHAR g_szHttpQueryInfo[] = "HttpQueryInfoW";
  97. CONST CHAR g_szInternetOpenUrl[] = "InternetOpenUrlW";
  98. CONST CHAR g_szHttpSendRequest[] = "HttpSendRequestW";
  99. CONST CHAR g_szHttpSendRequestEx[] = "HttpSendRequestExW";
  100. CONST CHAR g_szInternetOpen[] = "InternetOpenW";
  101. CONST CHAR g_szInternetConnect[] = "InternetConnectW";
  102. CONST CHAR g_szHttpOpenRequest[] = "HttpOpenRequestW";
  103. CONST CHAR g_szHttpAddRequestHeaders[] = "HttpAddRequestHeadersW";
  104. CONST CHAR g_szHttpEndRequest[] = "HttpEndRequestW";
  105. CONST CHAR g_szInternetSetOption[] = "InternetSetOptionW";
  106. #else
  107. CONST CHAR g_szHttpQueryInfo[] = "HttpQueryInfoA";
  108. CONST CHAR g_szInternetOpenUrl[] = "InternetOpenUrlA";
  109. CONST CHAR g_szHttpSendRequest[] = "HttpSendRequestA";
  110. CONST CHAR g_szHttpSendRequestEx[] = "HttpSendRequestExA";
  111. CONST CHAR g_szInternetOpen[] = "InternetOpenA";
  112. CONST CHAR g_szInternetConnect[] = "InternetConnectA";
  113. CONST CHAR g_szHttpOpenRequest[] = "HttpOpenRequestA";
  114. CONST CHAR g_szHttpAddRequestHeaders[] = "HttpAddRequestHeadersA";
  115. CONST CHAR g_szHttpEndRequest[] = "HttpEndRequestA";
  116. CONST CHAR g_szInternetSetOption[] = "InternetSetOptionA";
  117. #endif
  118. // Internet API pointers for controling the Url output.
  119. //
  120. PFNHTTPQUERYINFO g_pfnHttpQueryInfo;
  121. PFNINTERNETOPENURL g_pfnInternetOpenUrl;
  122. PFNINTERNETERRORDLG g_pfnInternetErrorDlg;
  123. PFNHTTPSENDREQUEST g_pfnHttpSendRequest;
  124. PFNHTTPSENDREQUESTEX g_pfnHttpSendRequestEx;
  125. PFNINTERNETREADFILE g_pfnInternetReadFile;
  126. PFNINTERNETWRITEFILE g_pfnInternetWriteFile;
  127. PFNINTERNETCLOSEHANDLE g_pfnInternetCloseHandle;
  128. PFNINTERNETOPEN g_pfnInternetOpen;
  129. PFNINTERNETCONNECT g_pfnInternetConnect;
  130. PFNHTTPOPENREQUEST g_pfnHttpOpenRequest;
  131. PFNHTTPADDREQUESTHEADERS g_pfnHttpAddRequestHeaders;
  132. PFNHTTPENDREQUEST g_pfnHttpEndRequest;
  133. PFNINTERNETSETOPTION g_pfnInternetSetOption;
  134. PCINETMON gpInetMon = NULL;