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.

378 lines
8.2 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1996 - 1999
  3. Module Name:
  4. GLOBALS.H
  5. Abstract:
  6. Global defines and data.
  7. Variables and string , located in global scope are defined here
  8. and memory for them will be allocated in no more than one source
  9. module, containing definition of DEFINE_GLOBAL_VARIABLES before
  10. including this file
  11. Author:
  12. Vlad Sadovsky (vlads) 12-20-96
  13. Revision History:
  14. --*/
  15. #ifndef WINVER
  16. #define WINVER 0x0500 /* version 5.0 */
  17. #else
  18. #endif /* !WINVER */
  19. // Use class guid to identify device events, as opposed to global
  20. #define USE_CLASS_GUID_FORPNP_EVENTS 1
  21. #include <windows.h>
  22. #include <winuser.h>
  23. #include <stilog.h>
  24. #include <eventlog.h>
  25. #include <wialog.h>
  26. #include <infoset.h>
  27. #include <devguid.h>
  28. #include <wia.h>
  29. #include "handler.h"
  30. #ifndef USE_CLASS_GUID_FORPNP_EVENTS
  31. #include <pnpmgr.h>
  32. #endif
  33. //
  34. // Required forward declarations
  35. //
  36. class CWiaDevMan; // Class defined in wiadevman.h
  37. //
  38. // Following line should be disabled for release
  39. //
  40. //#pragma message("**Attn**: Following line should be disabled for release ")
  41. // #define BETA_PRODUCT 1
  42. #ifdef BETA_PRODUCT
  43. #define BETA_LIMIT_YEAR 1997
  44. #define BETA_LIMIT_MONTH 12
  45. #endif
  46. //
  47. // Global variables are defined in one module, which has definition of
  48. // DEFINE_GLOBAL_VARIABLES before including this header file.
  49. //
  50. #ifdef DEFINE_GLOBAL_VARIABLES
  51. // #pragma message("STIMON: Defining global variables should be done only once")
  52. #undef ASSIGN
  53. #define ASSIGN(value) =value
  54. #undef EXTERN
  55. #define EXTERN
  56. #else
  57. #define ASSIGN(value)
  58. #if !defined(EXTERN)
  59. #define EXTERN extern
  60. #endif
  61. #endif
  62. //
  63. // General char values
  64. //
  65. #define COLON_CHAR TEXT(':') // Native syntax delimiter
  66. #define DOT_CHAR TEXT('.')
  67. #define SLASH_CHAR TEXT('/')
  68. #define BACKSLASH_CHAR TEXT('\\')
  69. #define STAR_CHAR TEXT('*')
  70. #define EQUAL_CHAR TEXT('=')
  71. #define COMMA_CHAR TEXT(',')
  72. #define WHITESPACE_CHAR TEXT(' ')
  73. #define DOUBLEQUOTE_CHAR TEXT('"')
  74. #define SINGLEQUOTE_CHAR TEXT('\'')
  75. #define TAB_CHAR TEXT('\t')
  76. #define DEADSPACE(x) (((x)==WHITESPACE_CHAR) || ((x)==DOUBLEQUOTE_CHAR) )
  77. #define IS_EMPTY_STRING(pch) (!(pch) || !(*(pch)))
  78. //
  79. // Default DCOM AccessPermission for WIA Device Manager
  80. //
  81. extern WCHAR wszDefaultDaclForDCOMAccessPermission[];
  82. //
  83. // Macros
  84. //
  85. #define TEXTCONST(name,text) extern const TCHAR name[] ASSIGN(text)
  86. #define EXT_STRING(name) extern const TCHAR name[]
  87. //
  88. // Trace strings should not appear in retail builds, thus define following macro
  89. //
  90. #ifdef DEBUG
  91. #define DEBUG_STRING(s) (s)
  92. #else
  93. #define DEBUG_STRING(s) (NULL)
  94. #endif
  95. //
  96. // Various defines
  97. //
  98. //
  99. // Information extracted from PnP device broadcast.
  100. // We can not keep broadcast structure itself for too long, because it expires .
  101. //
  102. #ifndef _DEVICE_BROADCAST_INFO_
  103. #define _DEVICE_BROADCAST_INFO_
  104. class DEVICE_BROADCAST_INFO {
  105. public:
  106. UINT m_uiDeviceChangeMessage;
  107. DWORD m_dwDevNode;
  108. StiCString m_strDeviceName;
  109. StiCString m_strBroadcastedName;
  110. };
  111. #endif
  112. typedef DEVICE_BROADCAST_INFO *PDEVICE_BROADCAST_INFO;
  113. //
  114. // Show verbose UI window
  115. //
  116. #define SHOWMONUI 1
  117. //
  118. //
  119. // STI Device specific values
  120. //
  121. #ifdef DEBUG
  122. #define STIMON_AD_DEFAULT_POLL_INTERVAL 10000 // 10s
  123. #else
  124. #define STIMON_AD_DEFAULT_POLL_INTERVAL 1000 // 1s
  125. #endif
  126. #define STIMON_AD_DEFAULT_WAIT_LOCK 100 // 100ms
  127. #define STIMON_AD_DEFAULT_WAIT_LAUNCH 5000 // 5s
  128. //
  129. // External references to GLOBAL DATA
  130. //
  131. //
  132. // Server process instance
  133. //
  134. EXTERN HINSTANCE g_hInst ASSIGN(NULL);
  135. //
  136. // Global pointer to STI access object
  137. //
  138. //EXTERN PSTI g_pSti ASSIGN(NULL);
  139. //
  140. // Handle of main window
  141. //
  142. EXTERN HWND g_hMainWindow ASSIGN(NULL); ;
  143. //
  144. // Handle of debug verbose window
  145. //
  146. EXTERN HWND g_hLogWindow ASSIGN(NULL); ;
  147. //
  148. // Default timeout for pollable devices
  149. //
  150. EXTERN UINT g_uiDefaultPollTimeout ASSIGN(STIMON_AD_DEFAULT_POLL_INTERVAL);
  151. //
  152. // Trace UI is visible
  153. //
  154. EXTERN BOOL g_fUIPermitted ASSIGN(FALSE);
  155. //
  156. //
  157. //
  158. EXTERN BOOL g_fRefreshDeviceList ASSIGN(FALSE);
  159. //
  160. // Attempt to refresh device controller in case of repeated failures
  161. //
  162. EXTERN BOOL g_fRefreshDeviceControllerOnFailures ASSIGN(FALSE);
  163. //
  164. // Platform type
  165. //
  166. EXTERN BOOL g_fIsWindows9x ASSIGN(FALSE);
  167. //
  168. // Setup in progress flag
  169. //
  170. EXTERN BOOL g_fIsSetupInProgress ASSIGN(FALSE);
  171. //
  172. //
  173. //
  174. EXTERN DWORD g_dwCurrentState ASSIGN(0);
  175. //
  176. // Reentrancy flag for timeout selection
  177. //
  178. EXTERN BOOL g_fTimeoutSelectionDialog ASSIGN(FALSE);
  179. //
  180. // Results of command line parsing
  181. //
  182. EXTERN BOOL g_fInstallingRequest ASSIGN(FALSE);
  183. EXTERN BOOL g_fRemovingRequest ASSIGN(FALSE);
  184. //
  185. // Running as a service
  186. //
  187. EXTERN BOOL g_fRunningAsService ASSIGN(TRUE);
  188. //
  189. // Shutdown in process
  190. //
  191. EXTERN BOOL g_fServiceInShutdown ASSIGN(FALSE);
  192. //
  193. // Number of active transfers (used to veto powerdown)
  194. //
  195. EXTERN LONG g_NumberOfActiveTransfers ASSIGN(0);
  196. //
  197. // Event indicating refreshing the device list
  198. //
  199. EXTERN HANDLE g_hDevListCompleteEvent ASSIGN(NULL);
  200. //
  201. // Global pointer to event log class for process
  202. //
  203. EXTERN EVENT_LOG* g_EventLog ASSIGN(NULL);
  204. //
  205. // Global pointer for STI logging
  206. //
  207. EXTERN STI_FILE_LOG* g_StiFileLog ASSIGN(NULL);
  208. EXTERN IWiaLogEx* g_pIWiaLog ASSIGN(NULL);
  209. //
  210. // Handle of the message pump thread
  211. //
  212. EXTERN DWORD g_dwMessagePumpThreadId ASSIGN(0);
  213. EXTERN HANDLE g_hMessageLoopThread ASSIGN(NULL);
  214. //
  215. // Global flag indicating whether this is the first DEVNODE_CHANGE message
  216. // received after coming out of StandBy
  217. //
  218. EXTERN BOOL g_fFirstDevNodeChangeMsg ASSIGN(FALSE);
  219. //
  220. // Global pointer for Device Manager object
  221. //
  222. EXTERN CWiaDevMan* g_pDevMan ASSIGN(NULL);
  223. //
  224. // Global msg/event handler for PnP and Power management
  225. //
  226. EXTERN CMsgHandler* g_pMsgHandler ASSIGN(NULL);
  227. //
  228. // Globals used for endorser string parsing
  229. //
  230. EXTERN WCHAR g_szWEDate[];
  231. EXTERN WCHAR g_szWETime[];
  232. EXTERN WCHAR g_szWEPageCount[];
  233. EXTERN WCHAR g_szWEDay[];
  234. EXTERN WCHAR g_szWEMonth[];
  235. EXTERN WCHAR g_szWEYear[];
  236. EXTERN WIAS_ENDORSER_VALUE g_pwevDefault[];
  237. #define NUM_WIA_MANAGED_PROPS 4
  238. #define PROFILE_INDEX 3
  239. EXTERN PROPID s_piItemNameType[];
  240. EXTERN LPOLESTR s_pszItemNameType[];
  241. EXTERN PROPSPEC s_psItemNameType[];
  242. //
  243. // Monitored GUID for device notifications
  244. //
  245. // ( should really be GUID_DEVCLASS_IMAGE always)
  246. //
  247. #ifndef USE_CLASS_GUID_FORPNP_EVENTS
  248. EXTERN const GUID *g_pguidDeviceNotificationsGuid ASSIGN(&GUID_DEVNODE_CHANGE);
  249. #else
  250. EXTERN const GUID *g_pguidDeviceNotificationsGuid ASSIGN(&GUID_DEVCLASS_IMAGE);
  251. #endif
  252. //
  253. // Globally visible device info set
  254. //
  255. EXTERN DEVICE_INFOSET *g_pDeviceInfoSet ASSIGN(NULL);
  256. //
  257. // Strings
  258. //
  259. TEXTCONST(g_szBACK, TEXT("\\"));
  260. TEXTCONST(g_szClassValueName,TEXT("ClassGUID"));
  261. TEXTCONST(g_szSubClassValueName, TEXT("SubClass"));
  262. TEXTCONST(g_szTitle,TEXT("STI Monitor"));
  263. TEXTCONST(STIStartedEvent_name,TEXT("STIExeStartedEvent"));
  264. TEXTCONST(g_szFiction,TEXT("noskileFaneL"));
  265. // Default settings
  266. // When baud rate is not set for serial device driver , we will populate it's property with
  267. // this default setting.
  268. #define DEF_BAUD_RATE_STR L"115200"
  269. //
  270. // FS driver related
  271. //
  272. #define FS_USD_CLSID L"{D2923B86-15F1-46FF-A19A-DE825F919576}"
  273. #define FS_UI_CLSID L"{D2923B86-15F1-46FF-A19A-DE825F919576}"
  274. #define DEF_UI_CLSID_STR L"{00000000-0000-0000-0000-000000000000}"
  275. #define FS_UI_DLL L""
  276. #define FS_VEDNOR_DESC L"WIA File System"
  277. #define FS_DEVICE_DESC L"Removable drive"
  278. //
  279. // Class name for the services hidden window
  280. //
  281. TEXTCONST(g_szStiSvcClassName,STISVC_WINDOW_CLASS);
  282. TEXTCONST(g_szClass,STIMON_WINDOW_CLASS);