forked from CobaltFusion/DebugViewPP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDBWinBuffer.cpp
More file actions
39 lines (33 loc) · 1.37 KB
/
Copy pathDBWinBuffer.cpp
File metadata and controls
39 lines (33 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include "Win32/Win32Lib.h"
#include "DebugViewppLib/DBWinBuffer.h"
namespace fusion {
namespace debugviewpp {
// this method is used to prevent acquiring the global DBWIN_BUFFER on XP, which will otherwise popup a MessageBox with a tip to 'Run As Administator'
// however, as there are no 'global' messages there, this does not apply to WindowsXP
bool IsWindowsVistaOrGreater()
{
// consider using ::AtlIsOldWindows? needs to be tested on XP
OSVERSIONINFO osvi = {};
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
// http://stackoverflow.com/questions/27246562/how-to-get-the-os-version-in-win8-1-as-getversion-getversionex-are-deprecated
// it looks like we can safely suppress this warning
#pragma warning(suppress : 4996)
GetVersionEx(&osvi);
return (osvi.dwMajorVersion > 5);
}
bool IsDBWinViewerActive()
{
Win32::Handle hMap(::OpenFileMapping(FILE_MAP_READ, 0, L"DBWIN_BUFFER"));
return hMap != nullptr;
}
bool HasGlobalDBWinReaderRights()
{
Win32::Handle hMap(::CreateFileMapping(nullptr, nullptr, PAGE_READWRITE, 0, sizeof(DbWinBuffer), L"Global\\DBWIN_BUFFER"));
return hMap != nullptr;
}
} // namespace debugviewpp
} // namespace fusion