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.

234 lines
6.9 KiB

  1. //==============================================================;
  2. //
  3. // This source code is only intended as a supplement to
  4. // existing Microsoft documentation.
  5. //
  6. //
  7. //
  8. //
  9. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  10. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  11. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  12. // PURPOSE.
  13. //
  14. // Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  15. //
  16. //
  17. //
  18. //==============================================================;
  19. #ifndef _PEOPLE_H
  20. #define _PEOPLE_H
  21. #include "DeleBase.h"
  22. #include <wbemcli.h>
  23. #include "SimpleArray.h"
  24. class CBicycle;
  25. class CEventSink;
  26. class CBicycleFolder : public CDelegationBase {
  27. public:
  28. CBicycleFolder();
  29. virtual ~CBicycleFolder();
  30. virtual const _TCHAR *GetDisplayName(int nCol = 0) { return _T("Bicycles"); }
  31. virtual const GUID & getNodeType() { return thisGuid; }
  32. virtual const int GetBitmapIndex() { return INDEX_PEOPLEICON; }
  33. // virtual functions go here (for MMCN_*)
  34. virtual HRESULT OnShow(IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem);
  35. HRESULT GetPtr(IWbemServices **ptr);
  36. private:
  37. // {2974380D-4C4B-11d2-89D8-000021473128}
  38. static const GUID thisGuid;
  39. CSimpleArray<CBicycle *> m_children;
  40. bool EnumChildren(IWbemServices *service);
  41. void EmptyChildren(void);
  42. HRESULT DisplayChildren(void);
  43. bool ErrorString(HRESULT hr, TCHAR *errMsg, UINT errSize);
  44. // for the connection thread.
  45. void StopThread();
  46. static LRESULT CALLBACK WindowProc(
  47. HWND hwnd, // handle to window
  48. UINT uMsg, // message identifier
  49. WPARAM wParam, // first message parameter
  50. LPARAM lParam); // second message parameter
  51. static DWORD WINAPI ThreadProc(LPVOID lpParameter);
  52. void RegisterEventSink(IWbemServices *service);
  53. IWbemObjectSink *m_pStubSink;
  54. IUnsecuredApartment *m_pUnsecApp;
  55. HWND m_connectHwnd;
  56. DWORD m_threadId;
  57. HANDLE m_thread;
  58. HANDLE m_doWork; // telling the thread to do something.
  59. int m_threadCmd; // what command the thread should do.
  60. #define CT_CONNECT 0
  61. #define CT_GET_PTR 1
  62. #define CT_EXIT 2
  63. CRITICAL_SECTION m_critSect;
  64. bool m_running; // thread is processing a command now.
  65. HANDLE m_ptrReady; // the thread has done the work.
  66. IResultData *m_pResultData;
  67. IStream *m_pStream;
  68. IWbemServices *m_realWMI;// lives in the background thread. Use marshalling.
  69. };
  70. class CBicycle : public CDelegationBase {
  71. public:
  72. CBicycle(CBicycleFolder *parent, IWbemClassObject *inst);
  73. virtual ~CBicycle()
  74. {
  75. if(m_inst)
  76. m_inst->Release();
  77. m_inst = 0;
  78. }
  79. virtual const _TCHAR *GetDisplayName(int nCol = 0);
  80. virtual const GUID & getNodeType() { return thisGuid; }
  81. virtual const int GetBitmapIndex() { return INDEX_PEOPLEICON; }
  82. public:
  83. // virtual functions go here (for MMCN_*)
  84. virtual HRESULT OnSelect(IConsole *pConsole, BOOL bScope, BOOL bSelect);
  85. virtual HRESULT CreatePropertyPages(IPropertySheetCallback *lpProvider, LONG_PTR handle);
  86. virtual HRESULT HasPropertySheets();
  87. virtual HRESULT GetWatermarks(HBITMAP *lphWatermark,
  88. HBITMAP *lphHeader,
  89. HPALETTE *lphPalette,
  90. BOOL *bStretch);
  91. virtual HRESULT OnPropertyChange();
  92. private:
  93. CBicycleFolder *m_parent;
  94. IWbemClassObject *m_inst;
  95. LONG_PTR m_ppHandle;
  96. static BOOL CALLBACK DialogProc(
  97. HWND hwndDlg, // handle to dialog box
  98. UINT uMsg, // message
  99. WPARAM wParam, // first message parameter
  100. LPARAM lParam);// second message parameter
  101. // {2974380D-4C4B-11d2-89D8-000021473128}
  102. static const GUID thisGuid;
  103. bool GetGirls(void);
  104. const TCHAR *ConvertSurfaceValue(BYTE val);
  105. HRESULT PutProperty(LPWSTR propName, LPTSTR str);
  106. HRESULT PutProperty(LPWSTR propName, BYTE val);
  107. HRESULT PutProperty(LPWSTR propName, bool val);
  108. void LoadSurfaces(HWND hwndDlg, BYTE iSurface);
  109. BYTE m_iSurface;
  110. };
  111. class CSkateboard : public CDelegationBase {
  112. public:
  113. CSkateboard(int i) : id(i) { }
  114. virtual ~CSkateboard() {}
  115. virtual const _TCHAR *GetDisplayName(int nCol = 0);
  116. virtual const GUID & getNodeType() { return thisGuid; }
  117. virtual const int GetBitmapIndex() { return INDEX_PEOPLEICON; }
  118. private:
  119. // {2974380D-4C4B-11d2-89D8-000021473128}
  120. static const GUID thisGuid;
  121. int id;
  122. };
  123. class CSkateboardFolder : public CDelegationBase {
  124. public:
  125. CSkateboardFolder();
  126. virtual ~CSkateboardFolder();
  127. virtual const _TCHAR *GetDisplayName(int nCol = 0) { return _T("Skateboards"); }
  128. virtual const GUID & getNodeType() { return thisGuid; }
  129. virtual const int GetBitmapIndex() { return INDEX_PEOPLEICON; }
  130. public:
  131. // virtual functions go here (for MMCN_*)
  132. virtual HRESULT OnShow(IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem);
  133. private:
  134. // {2974380D-4C4B-11d2-89D8-000021473128}
  135. static const GUID thisGuid;
  136. enum { NUMBER_OF_CHILDREN = 20 };
  137. CDelegationBase *children[NUMBER_OF_CHILDREN];
  138. };
  139. class CIceSkate : public CDelegationBase {
  140. public:
  141. CIceSkate(int i) : id(i) { }
  142. virtual ~CIceSkate() {}
  143. virtual const _TCHAR *GetDisplayName(int nCol = 0);
  144. virtual const GUID & getNodeType() { return thisGuid; }
  145. virtual const int GetBitmapIndex() { return INDEX_PEOPLEICON; }
  146. private:
  147. // {2974380D-4C4B-11d2-89D8-000021473128}
  148. static const GUID thisGuid;
  149. int id;
  150. };
  151. class CIceSkateFolder : public CDelegationBase {
  152. public:
  153. CIceSkateFolder();
  154. virtual ~CIceSkateFolder();
  155. virtual const _TCHAR *GetDisplayName(int nCol = 0) { return _T("Ice Skates"); }
  156. virtual const GUID & getNodeType() { return thisGuid; }
  157. virtual const int GetBitmapIndex() { return INDEX_PEOPLEICON; }
  158. public:
  159. // virtual functions go here (for MMCN_*)
  160. virtual HRESULT OnShow(IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem);
  161. private:
  162. // {2974380D-4C4B-11d2-89D8-000021473128}
  163. static const GUID thisGuid;
  164. enum { NUMBER_OF_CHILDREN = 20 };
  165. CDelegationBase *children[NUMBER_OF_CHILDREN];
  166. };
  167. class CPeoplePoweredVehicle : public CDelegationBase {
  168. public:
  169. CPeoplePoweredVehicle();
  170. virtual ~CPeoplePoweredVehicle();
  171. virtual const _TCHAR *GetDisplayName(int nCol = 0) { return _T("People-powered Vehicles"); }
  172. virtual const GUID & getNodeType() { return thisGuid; }
  173. virtual const int GetBitmapIndex() { return INDEX_PEOPLEICON; }
  174. virtual HRESULT OnExpand(IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent);
  175. private:
  176. enum { IDM_NEW_PEOPLE = 1 };
  177. // {2974380D-4C4B-11d2-89D8-000021473128}
  178. static const GUID thisGuid;
  179. enum { NUMBER_OF_CHILDREN = 3 };
  180. CDelegationBase *children[3];
  181. };
  182. #endif // _PEOPLE_H