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.

70 lines
1.7 KiB

  1. #pragma once
  2. /************************************************************************
  3. Copyright (c) 2001 Microsoft Corporation
  4. File Name: CProfileConsent.h -- Definition of CProfileConsent.cpp
  5. Abstract: Access Profile Consent data stored in DB.
  6. Revision History:
  7. 2001/1/27 lifenwu Created.
  8. ***************************************************************************/
  9. #include "cuserprofileex.h"
  10. class CProfileConsent
  11. {
  12. public:
  13. CProfileConsent();
  14. CProfileConsent(PROFILE_CATEGORY t);
  15. ~CProfileConsent();
  16. HRESULT InitFromDB(LARGE_INTEGER PUID, CStringW cswCredName);
  17. HRESULT InitFromString(LPCSTR sz);
  18. void ResetConsent();
  19. // Persist to DB or String
  20. HRESULT Persist(LARGE_INTEGER PUID, CStringW cswCredName);
  21. HRESULT Persist(CStringA& szConsent);
  22. //
  23. // get/set operations for a particuar field number
  24. //
  25. BOOL GetConsent(ULONG ulFieldNum);
  26. HRESULT SetConsent(ULONG ulFieldNum, BOOL bConsent);
  27. void SetCategoryType(PROFILE_CATEGORY t) { m_type = t; }
  28. //
  29. // You don't have to worry about consent memory allocation.
  30. // It rellocates each time when the field number requested is not in range.
  31. // However, you can help to make it more efficient, by pre-allocating
  32. // enough space, as you know the maximum number of fields.
  33. //
  34. // You use this to help allocate memory only when you don't initialize
  35. // from DB. (bFromFlag = FALSE). I pretty much know the size when initializing
  36. // from DB.
  37. //
  38. HRESULT PreAllocConsent(int iMaxNumFields);
  39. void SetDBAdminPUID(LARGE_INTEGER p) { m_biDBAdminPUID = p; }
  40. private:
  41. unsigned char Bin2Hex(unsigned char c);
  42. unsigned char *m_bytes;
  43. int m_iSize;
  44. PROFILE_CATEGORY m_type;
  45. LARGE_INTEGER m_biDBAdminPUID;
  46. };