forked from troter/xyzzy
/
sysdep.h
139 lines (114 loc) · 2.73 KB
/
sysdep.h
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#ifndef _sysdep_h_
# define _sysdep_h_
# include "cdecl.h"
struct Sysdep
{
Sysdep ();
~Sysdep ();
OSVERSIONINFO os_ver;
SIZE border;
SIZE dblclk;
SIZE edge;
UINT vscroll;
UINT hscroll;
COLORREF btn_text;
COLORREF btn_highlight;
COLORREF btn_shadow;
COLORREF btn_face;
COLORREF window_text;
COLORREF gray_text;
COLORREF highlight_text;
COLORREF highlight;
COLORREF window;
HGDIOBJ hbr_white;
HGDIOBJ hbr_black;
HGDIOBJ hpen_white;
HGDIOBJ hpen_black;
HCURSOR hcur_arrow;
HCURSOR hcur_revarrow;
HCURSOR hcur_ibeam;
HCURSOR hcur_wait;
HCURSOR hcur_sizewe;
HCURSOR hcur_sizens;
HCURSOR hcur_current;
enum windows_type
{
WINTYPE_UNKNOWN,
WINTYPE_WIN32S,
WINTYPE_WINDOWS_95,
WINTYPE_WINDOWS_98,
WINTYPE_WINDOWS_NT,
WINTYPE_WINDOWS_NT5,
WINTYPE_WINDOWS_NT6,
};
windows_type wintype;
const char *windows_name;
const char *windows_short_name;
HFONT hfont_ruler;
SIZE ruler_ext;
enum machine_type
{
MACHINETYPE_UNKNOWN,
MACHINETYPE_X86,
MACHINETYPE_X64,
MACHINETYPE_IA64,
};
machine_type machine_type;
enum process_type
{
PROCESSTYPE_UNKNOWN,
PROCESSTYPE_NATIVE,
PROCESSTYPE_WOW64,
};
process_type process_type;
private:
HFONT hfont_ui;
HFONT hfont_ui90;
HFONT hfont_ui270;
static HFONT create_ui_font (int);
void init_wintype ();
void init_machine_type ();
void init_process_type ();
public:
HFONT ui_font ();
HFONT ui_font90 ();
HFONT ui_font270 ();
char curdir[PATH_MAX];
char host_name[MAX_COMPUTERNAME_LENGTH + 1];
DWORD process_id;
__int64 perf_freq;
int perf_counter_present_p;
DWORD comctl32_version;
DWORD shell32_version;
void load_colors ();
void load_settings ();
void load_cursors ();
static DWORD get_dll_version (const char *);
#define PACK_VERSION(MAJ, MIN) MAKELONG ((MIN), (MAJ))
enum
{
WIN98_VERSION = PACK_VERSION (4, 10),
WINME_VERSION = PACK_VERSION (4, 90),
WINXP_VERSION = PACK_VERSION (5, 1),
WIN7_VERSION = PACK_VERSION (6, 1),
WIN8_VERSION = PACK_VERSION (6, 2),
};
DWORD version () const
{return PACK_VERSION (os_ver.dwMajorVersion, os_ver.dwMinorVersion);}
int Win4p () const
{return os_ver.dwMajorVersion >= 4;}
int Win5p () const
{return os_ver.dwMajorVersion >= 5;}
int Win6p () const
{return os_ver.dwMajorVersion >= 6;}
int Win6_1p () const
{return os_ver.dwMajorVersion >= 6 && os_ver.dwMinorVersion >= 1;}
int Win95p () const
{return wintype == WINTYPE_WINDOWS_95;}
int Win98p () const
{return wintype == WINTYPE_WINDOWS_98;}
int WinNTp () const
{return os_ver.dwPlatformId == VER_PLATFORM_WIN32_NT;}
};
extern Sysdep sysdep;
#endif