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.

91 lines
1.7 KiB

  1. //*******************************************************************************************
  2. //
  3. // Filename : ThisDll.h
  4. //
  5. // Generic OLE header file
  6. //
  7. // Copyright (c) 1994 - 1996 Microsoft Corporation. All rights reserved
  8. //
  9. //*******************************************************************************************
  10. #ifndef _THISDLL_H_
  11. #define _THISDLL_H_
  12. class CWaitCursor
  13. {
  14. public:
  15. CWaitCursor() {m_cOld=SetCursor(LoadCursor(NULL, IDC_WAIT));}
  16. ~CWaitCursor() {SetCursor(m_cOld);}
  17. private:
  18. HCURSOR m_cOld;
  19. } ;
  20. class CRefCount
  21. {
  22. public:
  23. CRefCount() : m_cRef(0) {};
  24. UINT AddRef() {return(++m_cRef);}
  25. UINT Release() {return(--m_cRef);}
  26. UINT GetRef() {return( m_cRef);}
  27. private:
  28. UINT m_cRef;
  29. } ;
  30. class CThisDll
  31. {
  32. public:
  33. CThisDll() {
  34. m_hInst=NULL;
  35. }
  36. // Make no destructor for global classes (requires CRT stuff)
  37. void SetInstance(HINSTANCE hInst) {m_hInst=hInst;}
  38. HINSTANCE GetInstance() {return(m_hInst);}
  39. CRefCount m_cRef;
  40. CRefCount m_cLock;
  41. private:
  42. HINSTANCE m_hInst;
  43. } ;
  44. extern CThisDll g_ThisDll;
  45. class CRefDll
  46. {
  47. public:
  48. CRefDll() {g_ThisDll.m_cRef.AddRef ();}
  49. ~CRefDll() {g_ThisDll.m_cRef.Release();}
  50. } ;
  51. extern HRESULT CabFolder_CreateInstance(REFIID riid, LPVOID *ppvObj);
  52. extern HRESULT CabViewDataObject_CreateInstance(REFIID riid, LPVOID *ppvObj);
  53. class CSafeMalloc
  54. {
  55. public:
  56. CSafeMalloc()
  57. {
  58. if (!SUCCEEDED(SHGetMalloc(&m_ShIMalloc)))
  59. {
  60. m_ShIMalloc = NULL;
  61. }
  62. }
  63. ~CSafeMalloc() {if (m_ShIMalloc) m_ShIMalloc->Release();}
  64. LPVOID Alloc(UINT cb) {return(m_ShIMalloc ? m_ShIMalloc->Alloc(cb) : NULL);}
  65. void Free(LPVOID pv) {if (m_ShIMalloc) m_ShIMalloc->Free(pv);}
  66. private:
  67. IMalloc* m_ShIMalloc;
  68. } ;
  69. #endif // _THISDLL_H_