cscutils.h
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 1k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. //+-------------------------------------------------------------------------
  2. //
  3. //  Microsoft Windows
  4. //
  5. //  Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. //  File:       cscutils.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _INC_CSCVIEW_CSCUTILS_H
  11. #define _INC_CSCVIEW_CSCUTILS_H
  12. //-----------------------------------------------------------------------------
  13. // class CscFindHandle
  14. //-----------------------------------------------------------------------------
  15. //
  16. // Trivial class to ensure cleanup of FindFirst/FindNext handle.
  17. //
  18. class CscFindHandle
  19. {
  20.     public:
  21.         explicit CscFindHandle(HANDLE hFind) throw()
  22.             : m_hFind(hFind) { }
  23.         ~CscFindHandle(void) throw()
  24.             { 
  25.                 if (IsValidHandle()) 
  26.                     CSCFindClose(m_hFind);
  27.             }
  28.         operator HANDLE() const throw()
  29.             { return m_hFind; }
  30.         bool IsValidHandle(void) const throw()
  31.             { return (INVALID_HANDLE_VALUE != m_hFind); }
  32.         HANDLE Handle(void) const throw()
  33.             { return m_hFind; }
  34.     private:
  35.         HANDLE m_hFind;
  36. };
  37. #endif //_INC_CSCVIEW_CSCUTILS_H