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.

157 lines
3.4 KiB

  1. #include "inspch.h"
  2. #include "util2.h"
  3. #include "inseng.h"
  4. #include "ciffile.h"
  5. //=--------------------------------------------------------------------------=
  6. // Function name here
  7. //=--------------------------------------------------------------------------=
  8. // Function description
  9. //
  10. // Parameters:
  11. //
  12. // Returns:
  13. //
  14. // Notes:
  15. //
  16. CCifGroup::CCifGroup(LPCSTR pszCompID, UINT uGrpNum, CCifFile *pCif) : CCifEntry(pszCompID, pCif)
  17. {
  18. _uGrpNum = uGrpNum;
  19. }
  20. //=--------------------------------------------------------------------------=
  21. // Function name here
  22. //=--------------------------------------------------------------------------=
  23. // Function description
  24. //
  25. // Parameters:
  26. //
  27. // Returns:
  28. //
  29. // Notes:
  30. //
  31. CCifGroup::~CCifGroup()
  32. {
  33. }
  34. STDMETHODIMP CCifGroup::GetID(LPSTR pszID, DWORD dwSize)
  35. {
  36. lstrcpyn(pszID, _szID, dwSize);
  37. return NOERROR;
  38. }
  39. STDMETHODIMP CCifGroup::GetDescription(LPSTR pszDesc, DWORD dwSize)
  40. {
  41. return(MyTranslateString(_pCif->GetCifPath(), _szID, DISPLAYNAME_KEY, pszDesc, dwSize));
  42. }
  43. STDMETHODIMP_(DWORD) CCifGroup::GetPriority()
  44. {
  45. return(GetPrivateProfileInt(_szID, PRIORITY, 0, _pCif->GetCifPath()));
  46. }
  47. STDMETHODIMP CCifGroup::EnumComponents(IEnumCifComponents **pp, DWORD dwFilter, LPVOID pv)
  48. {
  49. CCifComponentEnum *pce;
  50. HRESULT hr = E_FAIL;
  51. *pp = 0;
  52. pce = new CCifComponentEnum(_pCif->GetComponentList(), dwFilter, PARENTTYPE_GROUP, _szID);
  53. if(pce)
  54. {
  55. *pp = (IEnumCifComponents *) pce;
  56. (*pp)->AddRef();
  57. hr = NOERROR;
  58. }
  59. return hr;
  60. }
  61. STDMETHODIMP_(DWORD) CCifGroup::GetInstallQueueState()
  62. {
  63. return E_NOTIMPL;
  64. }
  65. STDMETHODIMP_(DWORD) CCifGroup::GetCurrentPriority()
  66. {
  67. if(_uPriority == 0xffffffff)
  68. _uPriority = ((GetPriority() << 10) + _uGrpNum) << 10;
  69. return _uPriority;
  70. }
  71. //=========== ICifRWGroup implementation ============================================
  72. //
  73. CCifRWGroup::CCifRWGroup(LPCSTR pszID, UINT uGrpNum, CCifFile *pCif) : CCifGroup(pszID, uGrpNum, pCif)
  74. {
  75. }
  76. CCifRWGroup::~CCifRWGroup()
  77. {
  78. }
  79. STDMETHODIMP CCifRWGroup::GetID(LPSTR pszID, DWORD dwSize)
  80. {
  81. return(CCifGroup::GetID(pszID, dwSize));
  82. }
  83. STDMETHODIMP CCifRWGroup::GetDescription(LPSTR pszDesc, DWORD dwSize)
  84. {
  85. return(CCifGroup::GetDescription(pszDesc, dwSize));
  86. }
  87. STDMETHODIMP_(DWORD) CCifRWGroup::GetPriority()
  88. {
  89. return(CCifGroup::GetPriority());
  90. }
  91. STDMETHODIMP CCifRWGroup::EnumComponents(IEnumCifComponents **pp, DWORD dwFilter, LPVOID pv)
  92. {
  93. CCifComponentEnum *pce;
  94. HRESULT hr = E_FAIL;
  95. *pp = 0;
  96. pce = new CCifComponentEnum((CCifComponent**)_pCif->GetComponentList(), dwFilter, PARENTTYPE_GROUP, _szID);
  97. if(pce)
  98. {
  99. *pp = (IEnumCifComponents *) pce;
  100. (*pp)->AddRef();
  101. hr = NOERROR;
  102. }
  103. return hr;
  104. }
  105. // access to state
  106. STDMETHODIMP_(DWORD) CCifRWGroup::GetCurrentPriority()
  107. {
  108. return(CCifGroup::GetCurrentPriority());
  109. }
  110. STDMETHODIMP CCifRWGroup::SetDescription(LPCSTR pszDesc)
  111. {
  112. return(WriteTokenizeString(_pCif->GetCifPath(), _szID, DISPLAYNAME_KEY, pszDesc));
  113. }
  114. STDMETHODIMP CCifRWGroup::SetPriority(DWORD dwPri)
  115. {
  116. char szbuf[20];
  117. return(WritePrivateProfileString(_szID, PRIORITY, ULtoA(dwPri, szbuf, 10), _pCif->GetCifPath()));
  118. }
  119. STDMETHODIMP CCifRWGroup::SetDetails(LPCSTR pszDetails)
  120. {
  121. return(WriteTokenizeString(_pCif->GetCifPath(), _szID, DETAILS_KEY, pszDetails));
  122. }