/win32/shellext/SysInfo.h

https://bitbucket.org/tortoisehg/hgtk/ · C Header · 42 lines · 17 code · 7 blank · 18 comment · 2 complexity · 1ffc20ecc3836db74b8c77a7a49080c8 MD5 · raw file

  1. // TortoiseSVN - a Windows shell extension for easy version control
  2. // Copyright (C) 2008 - TortoiseSVN
  3. // This program is free software; you can redistribute it and/or
  4. // modify it under the terms of the GNU General Public License
  5. // as published by the Free Software Foundation; either version 2
  6. // of the License, or (at your option) any later version.
  7. // This program is distributed in the hope that it will be useful,
  8. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. // GNU General Public License for more details.
  11. // You should have received a copy of the GNU General Public License
  12. // along with this program; if not, write to the Free Software Foundation,
  13. // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  14. //
  15. #pragma once
  16. /**
  17. * \ingroup Utils
  18. * This singleton class handles system information
  19. */
  20. class SysInfo
  21. {
  22. private:
  23. SysInfo(void);
  24. ~SysInfo(void);
  25. public:
  26. static const SysInfo& Instance();
  27. DWORD GetFullVersion() const {return MAKEWORD(inf.dwMinorVersion, inf.dwMajorVersion);}
  28. bool IsXP() const {return (GetFullVersion() < 0x0600);} // cover Win5.1 and 5.2 alike
  29. bool IsVista() const {return (GetFullVersion() == 0x0600);}
  30. bool IsVistaOrLater() const {return (GetFullVersion() >= 0x0600);}
  31. bool IsWin7() const {return (GetFullVersion() == 0x0601);}
  32. bool IsWin7OrLater() const {return (GetFullVersion() >= 0x0601);}
  33. private:
  34. OSVERSIONINFOEX inf;
  35. };