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.

31 lines
552 B

  1. #ifndef _REFERENC_H_
  2. #define _REFERENC_H_
  3. class REFCOUNT
  4. {
  5. public:
  6. REFCOUNT();
  7. virtual ~REFCOUNT();
  8. DWORD AddRef();
  9. DWORD Release();
  10. DWORD Delete();
  11. void OnStack() {bOnStack = TRUE;};
  12. private:
  13. DWORD NumRefs;
  14. // Give 2 bits since BOOL is signed
  15. BOOL bMarkedForDelete : 2;
  16. BOOL bOnStack : 2;
  17. };
  18. class REFERENCE
  19. {
  20. public:
  21. REFERENCE(REFCOUNT * _pRefCount) : pRefCount(_pRefCount) {pRefCount->AddRef();};
  22. ~REFERENCE() {pRefCount->Release();};
  23. private:
  24. REFCOUNT * pRefCount;
  25. };
  26. #endif // ! _REFERENC_H_