-
Notifications
You must be signed in to change notification settings - Fork 7
/
CWinStation.hpp
76 lines (66 loc) · 2.64 KB
/
CWinStation.hpp
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//////////////////////////////////////////////////////////////////////////////
//
// CWinStation.hpp
// Win32::Daemon Perl extension windows station class header file
//
// Copyright (c) 1998-2008 Dave Roth
// Courtesy of Roth Consulting
// http://www.roth.net/
//
// This file may be copied or modified only under the terms of either
// the Artistic License or the GNU General Public License, which may
// be found in the Perl 5.0 source kit.
//
// 2008.03.24 :Date
// 20080324 :Version
//////////////////////////////////////////////////////////////////////////////
#ifndef _CWINSTATION_H_
#define _CWINSTATION_H_
#define WINSTA_ALL ( WINSTA_ACCESSCLIPBOARD \
| WINSTA_CREATEDESKTOP \
| WINSTA_ACCESSGLOBALATOMS \
| WINSTA_ENUMDESKTOPS \
| WINSTA_ENUMERATE \
| WINSTA_EXITWINDOWS \
| WINSTA_READATTRIBUTES \
| WINSTA_READSCREEN \
| WINSTA_WRITEATTRIBUTES \
| DELETE \
| READ_CONTROL \
| WRITE_DAC \
| WRITE_OWNER )
#define DESKTOP_ALL ( DESKTOP_CREATEMENU \
| DESKTOP_CREATEWINDOW \
| DESKTOP_ENUMERATE \
| DESKTOP_HOOKCONTROL \
| DESKTOP_JOURNALPLAYBACK \
| DESKTOP_JOURNALRECORD \
| DESKTOP_READOBJECTS \
| DESKTOP_SWITCHDESKTOP \
| DESKTOP_WRITEOBJECTS \
| DELETE \
| READ_CONTROL \
| WRITE_DAC \
| WRITE_OWNER )
#define GENERIC_ACCESS ( GENERIC_READ \
| GENERIC_WRITE \
| GENERIC_EXECUTE \
| GENERIC_ALL )
class CWinStation
{
public:
CWinStation();
~CWinStation();
BOOL Set( LPCTSTR pszWindowStation, LPCTSTR pszDesktop );
BOOL Restore();
SID *SetSid( SID *pSid );
private:
enum PermissionType { eWindowStation, eDesktop };
void GetThisStation();
BOOL AddSecurityPrivileges( HANDLE hHandle, SID *pSid, PermissionType ePermType );
HWINSTA m_hWinStation;
DWORD m_dwThreadId;
HDESK m_hDesktop;
SID *m_pSid;
};
#endif // _CWINSTATION_H_