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.

173 lines
4.3 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1996 - 1999
  3. Module Name:
  4. GLOBALS.CPP
  5. Abstract:
  6. Placeholder for global data definitions and routines to
  7. initialize/save global information
  8. Author:
  9. Vlad Sadovsky (vlads) 12-20-96
  10. Revision History:
  11. --*/
  12. #include "precomp.h"
  13. //
  14. // Headers
  15. //
  16. #define DEFINE_GLOBAL_VARIABLES
  17. #define DEFINE_WIA_PROPID_TO_NAME
  18. #define WIA_DECLARE_DEVINFO_PROP_ARRAY
  19. #define WIA_DECLARE_MANAGED_PROPS
  20. #include "stiexe.h"
  21. #include <statreg.h>
  22. #include <atlconv.h>
  23. #include <atlimpl.cpp>
  24. #include <statreg.cpp>
  25. #include <wiadef.h>
  26. //#include <atlconv.cpp>
  27. #include <ks.h>
  28. #include <ksmedia.h>
  29. //
  30. // Array of device interface IDs we listen on.
  31. //
  32. const GUID g_pguidDeviceNotificationsGuidArray[NOTIFICATION_GUIDS_NUM] =
  33. {
  34. STATIC_KSCATEGORY_VIDEO,
  35. STATIC_PINNAME_VIDEO_STILL,
  36. STATIC_KSCATEGORY_CAPTURE,
  37. STATIC_GUID_NULL
  38. };
  39. HDEVNOTIFY g_phDeviceNotificationsSinkArray[NOTIFICATION_GUIDS_NUM] ;
  40. WIAEVENTRPCSTRUCT g_RpcEvent = { 0 };
  41. //
  42. // Object used for Wia run-time events
  43. //
  44. WiaEventNotifier *g_pWiaEventNotifier = NULL;
  45. WCHAR g_szWEDate[MAX_PATH];
  46. WCHAR g_szWETime[MAX_PATH];
  47. WCHAR g_szWEPageCount[MAX_PATH];
  48. WCHAR g_szWEDay[10];
  49. WCHAR g_szWEMonth[10];
  50. WCHAR g_szWEYear[10];
  51. WIAS_ENDORSER_VALUE g_pwevDefault[] = {WIA_ENDORSER_TOK_DATE, g_szWEDate,
  52. WIA_ENDORSER_TOK_TIME, g_szWETime,
  53. WIA_ENDORSER_TOK_PAGE_COUNT, g_szWEPageCount,
  54. WIA_ENDORSER_TOK_DAY, g_szWEDay,
  55. WIA_ENDORSER_TOK_MONTH, g_szWEMonth,
  56. WIA_ENDORSER_TOK_YEAR, g_szWEYear,
  57. NULL, NULL};
  58. //
  59. // Static variables used for WIA Managed properties
  60. //
  61. PROPID s_piItemNameType[] = {
  62. WIA_IPA_ITEM_NAME,
  63. WIA_IPA_FULL_ITEM_NAME,
  64. WIA_IPA_ITEM_FLAGS,
  65. WIA_IPA_ICM_PROFILE_NAME,
  66. };
  67. LPOLESTR s_pszItemNameType[] = {
  68. WIA_IPA_ITEM_NAME_STR,
  69. WIA_IPA_FULL_ITEM_NAME_STR,
  70. WIA_IPA_ITEM_FLAGS_STR,
  71. WIA_IPA_ICM_PROFILE_NAME_STR,
  72. };
  73. PROPSPEC s_psItemNameType[] = {
  74. {PRSPEC_PROPID, WIA_IPA_ITEM_NAME},
  75. {PRSPEC_PROPID, WIA_IPA_FULL_ITEM_NAME},
  76. {PRSPEC_PROPID, WIA_IPA_ITEM_FLAGS},
  77. {PRSPEC_PROPID, WIA_IPA_ICM_PROFILE_NAME}
  78. };
  79. //
  80. // Default DCOM AccessPermission for WIA Device Manager
  81. //
  82. // The string is in SDDL format.
  83. // NOTE: For COM objects, CC which is "Create Child" permission, is used to
  84. // denote access to that object i.e. if CC is in the rights field, then that
  85. // user/group may instantiate the COM object.
  86. //
  87. WCHAR wszDefaultDaclForDCOMAccessPermission[] =
  88. L"O:BAG:BA" // Owner is built-in admins, as is Group
  89. L"D:(A;;CC;;;BA)" // Built-in Admins have Generic All and Object Access rights
  90. L"(A;;CC;;;SY)" // System has Generic All and Object Access rights
  91. L"(A;;CC;;;IU)"; // Interactive User has Object Access rights.
  92. //
  93. // Code section
  94. //
  95. DWORD
  96. InitGlobalConfigFromReg(VOID)
  97. /*++
  98. Loads the global configuration parameters from registry and performs start-up checks
  99. Returns:
  100. Win32 error code. NO_ERROR on success
  101. --*/
  102. {
  103. DWORD dwError = NO_ERROR;
  104. DWORD dwMask = -1;
  105. RegEntry re(REGSTR_PATH_STICONTROL,HKEY_LOCAL_MACHINE);
  106. g_fUIPermitted = re.GetNumber(REGSTR_VAL_DEBUG_STIMONUI,0);
  107. #if 0
  108. #ifdef DEBUG
  109. dwMask = re.GetNumber(REGVAL_STR_STIMON_DEBUGMASK,(DWORD) (DM_ERROR | DM_ASSERT));
  110. StiSetDebugMask(dwMask & ~DM_LOG_FILE);
  111. StiSetDebugParameters(TEXT("STISVC"),TEXT(""));
  112. #endif
  113. #endif
  114. //
  115. // Initialize list of non Image device interfaces we will listen on
  116. // This is done to allow STI service data structures to be refreshed when
  117. // device events occur and we don't subscribe to notifications on StillImage
  118. // interface, exposed by WDM driver ( like video or storage).
  119. //
  120. for (UINT uiIndex = 0;uiIndex < NOTIFICATION_GUIDS_NUM; uiIndex++)
  121. {
  122. g_phDeviceNotificationsSinkArray[uiIndex] = NULL;
  123. }
  124. return dwError;
  125. } // InitGlobalConfigFromReg()