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.

139 lines
3.2 KiB

  1. /*++ BUILD Version: 0000 // Increment this if a change has global effects
  2. Copyright (c) 2000-2002 Microsoft Corporation
  3. Module Name:
  4. mmcmgmt.h
  5. Abstract:
  6. Header file for MMC manipulation
  7. Author:
  8. Xiaohai Zhang (xzhang) 22-March-2000
  9. Revision History:
  10. --*/
  11. #ifndef __MMCMGMT_H__
  12. #define __MMCMGMT_H__
  13. #include "tapi.h"
  14. #include "tapimmc.h"
  15. #include "util.h"
  16. typedef struct _USERNAME_TUPLE
  17. {
  18. LPTSTR pDomainUserNames;
  19. LPTSTR pFriendlyUserNames;
  20. } USERNAME_TUPLE, *LPUSERNAME_TUPLE;
  21. typedef LONG (WINAPI * PMMCGETDEVICEFLAGS)(
  22. HMMCAPP hMmcApp,
  23. BOOL bLine,
  24. DWORD dwProviderID,
  25. DWORD dwPermanentDeviceID,
  26. DWORD * pdwFlags,
  27. DWORD * pdwDeviceID
  28. );
  29. class CMMCManagement
  30. {
  31. public:
  32. CMMCManagement ()
  33. {
  34. HMODULE hTapi32;
  35. m_pDeviceInfoList = NULL;
  36. m_pUserTuple = NULL;
  37. m_pProviderList = NULL;
  38. m_pProviderName = NULL;
  39. m_hMmc = NULL;
  40. m_bMarkedBusy = FALSE;
  41. hTapi32 = LoadLibrary (TEXT("tapi32.dll"));
  42. if (hTapi32)
  43. {
  44. m_pFuncGetDeviceFlags = (PMMCGETDEVICEFLAGS)GetProcAddress (
  45. hTapi32,
  46. "MMCGetDeviceFlags"
  47. );
  48. FreeLibrary (hTapi32);
  49. }
  50. else
  51. {
  52. m_pFuncGetDeviceFlags = NULL;
  53. }
  54. }
  55. ~CMMCManagement ()
  56. {
  57. FreeMMCData ();
  58. }
  59. HRESULT GetMMCData ();
  60. HRESULT RemoveLinesForUser (LPTSTR szDomainUser);
  61. HRESULT IsValidPID (DWORD dwPermanentID);
  62. HRESULT IsValidAddress (LPTSTR szAddr);
  63. HRESULT AddLinePIDForUser (
  64. DWORD dwPermanentID,
  65. LPTSTR szDomainUser,
  66. LPTSTR szFriendlyName
  67. );
  68. HRESULT AddLineAddrForUser (
  69. LPTSTR szAddr,
  70. LPTSTR szDomainUser,
  71. LPTSTR szFriendlyName
  72. );
  73. HRESULT RemoveLinePIDForUser (
  74. DWORD dwPermanentID,
  75. LPTSTR szDomainUser
  76. );
  77. HRESULT RemoveLineAddrForUser (
  78. LPTSTR szAddr,
  79. LPTSTR szDomainUser
  80. );
  81. HRESULT DisplayMMCData ();
  82. HRESULT FreeMMCData ();
  83. private:
  84. HRESULT FindEntryFromAddr (LPTSTR szAddr, DWORD * pdwIndex);
  85. HRESULT FindEntryFromPID (DWORD dwPID, DWORD * pdwIndex);
  86. HRESULT FindEntriesForUser (
  87. LPTSTR szDomainUser,
  88. LPDWORD * padwIndex,
  89. DWORD * pdwNumEntries
  90. );
  91. HRESULT AddEntryForUser (
  92. DWORD dwIndex,
  93. LPTSTR szDomainUser,
  94. LPTSTR szFriendlyName
  95. );
  96. HRESULT RemoveEntryForUser (
  97. DWORD dwIndex,
  98. LPTSTR szDomainUser
  99. );
  100. HRESULT WriteMMCEntry (DWORD dwIndex);
  101. BOOL IsDeviceLocalOnly (DWORD dwProviderID, DWORD dwDeviceID);
  102. private:
  103. HMMCAPP m_hMmc;
  104. BOOL m_bMarkedBusy;
  105. DEVICEINFOLIST * m_pDeviceInfoList;
  106. USERNAME_TUPLE * m_pUserTuple;
  107. LINEPROVIDERLIST * m_pProviderList;
  108. LPTSTR * m_pProviderName;
  109. PMMCGETDEVICEFLAGS m_pFuncGetDeviceFlags;
  110. };
  111. #endif // mmcmgmt.h