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.

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