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.

75 lines
2.3 KiB

  1. // query.h - header file for query functions
  2. #ifndef _QUERY_H_
  3. #define _QUERY_H_
  4. #include <cmnquery.h>
  5. #include <list>
  6. #include <set>
  7. #include <map>
  8. enum NameContextType
  9. {
  10. NAMECTX_SCHEMA = 0,
  11. NAMECTX_CONFIG = 1,
  12. NAMECTX_COUNT
  13. };
  14. ///////////////////////////////////////////////////////////////////////////////////////
  15. // class CPersistQuery
  16. //
  17. typedef std::map< tstring, std::auto_ptr<BYTE> > QuerySectionMap;
  18. typedef std::map< tstring, QuerySectionMap > QueryDataMap;
  19. interface IPersistQuery;
  20. class CPersistQuery : public IPersistQuery
  21. {
  22. public:
  23. CPersistQuery();
  24. // IUnknown
  25. STDMETHOD(QueryInterface)(REFIID riid, LPVOID* ppvObject);
  26. STDMETHOD_(ULONG, AddRef)();
  27. STDMETHOD_(ULONG, Release)();
  28. // IPersist
  29. STDMETHOD(GetClassID)(THIS_ CLSID* pClassID);
  30. // IPersistQuery
  31. STDMETHOD(WriteString)(THIS_ LPCTSTR pSection, LPCTSTR pValueName, LPCTSTR pValue);
  32. STDMETHOD(ReadString)(THIS_ LPCTSTR pSection, LPCTSTR pValueName, LPTSTR pBuffer, INT cchBuffer);
  33. STDMETHOD(WriteInt)(THIS_ LPCTSTR pSection, LPCTSTR pValueName, INT value);
  34. STDMETHOD(ReadInt)(THIS_ LPCTSTR pSection, LPCTSTR pValueName, LPINT pValue);
  35. STDMETHOD(WriteStruct)(THIS_ LPCTSTR pSection, LPCTSTR pValueName, LPVOID pStruct, DWORD cbStruct);
  36. STDMETHOD(ReadStruct)(THIS_ LPCTSTR pSection, LPCTSTR pValueName, LPVOID pStruct, DWORD cbStruct);
  37. STDMETHOD(Clear)(THIS);
  38. HRESULT Save(byte_string& strOut);
  39. HRESULT Load(byte_string& strIn, tstring& strScope);
  40. private:
  41. ULONG m_cRefCount;
  42. QueryDataMap m_mapQueryData;
  43. };
  44. /////////////////////////////////////////////////////////////////////////////////////
  45. // Query Helper Functions
  46. //
  47. HRESULT GetQuery(tstring& strScope, tstring& strQuery, byte_string& bsQueryData, HWND hWnd);
  48. HRESULT GetQueryClasses(tstring& strQuery, std::set<tstring>& setClasses);
  49. HRESULT GetQueryScope(HWND hDlg, tstring& strScope);
  50. HRESULT GetNamingContext(NameContextType ctx, LPCWSTR* ppszContextDN);
  51. HRESULT FindClassObject(LPCWSTR pszClass, tstring& strObjPath);
  52. LPCWSTR GetLocalDomain();
  53. void GetScopeDisplayString(tstring& strScope, tstring& strDisplay);
  54. void GetFullyQualifiedScopeString(tstring& strScope, tstring& strQualified);
  55. #endif // _QUERY_H_