]>
Commit | Line | Data |
---|---|---|
ba946828 CV |
1 | /* wincap.h: Header for OS capability class. |
2 | ||
bc837d22 | 3 | Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, |
4aa4632a | 4 | 2012, 2013 Red Hat, Inc. |
ba946828 CV |
5 | |
6 | This file is part of Cygwin. | |
7 | ||
8 | This software is a copyrighted work licensed under the terms of the | |
9 | Cygwin license. Please consult the file "CYGWIN_LICENSE" for | |
10 | details. */ | |
11 | ||
12 | #ifndef _WINCAP_H | |
13 | #define _WINCAP_H | |
14 | ||
15 | struct wincaps | |
9c510edc | 16 | { |
cce28460 | 17 | DWORD max_sys_priv; |
aff96307 | 18 | unsigned is_server : 1; |
ba946828 | 19 | unsigned has_physical_mem_access : 1; |
2fd2ddf3 | 20 | unsigned has_mandatory_integrity_control : 1; |
c6674b53 | 21 | unsigned needs_count_in_si_lpres2 : 1; |
cbfb7b1b | 22 | unsigned has_recycle_dot_bin : 1; |
96d7dee2 | 23 | unsigned has_gaa_on_link_prefix : 1; |
00a76ece | 24 | unsigned has_gaa_largeaddress_bug : 1; |
4815dd49 | 25 | unsigned supports_all_posix_ai_flags : 1; |
5cb998e6 | 26 | unsigned has_restricted_stack_args : 1; |
4c153b24 | 27 | unsigned has_transactions : 1; |
3787b37e | 28 | unsigned has_sendmsg : 1; |
43616e55 | 29 | unsigned has_broken_udf : 1; |
8d1d548f | 30 | unsigned has_broken_alloc_console : 1; |
20fc2f49 | 31 | unsigned has_always_all_codepages : 1; |
326fb376 | 32 | unsigned has_localenames : 1; |
9c154abe | 33 | unsigned has_fast_cwd : 1; |
95a5c969 | 34 | unsigned has_restricted_raw_disk_access : 1; |
ba5f9298 | 35 | unsigned use_dont_resolve_hack : 1; |
c52fd6cd | 36 | unsigned has_console_logon_sid : 1; |
f08bc858 | 37 | unsigned wow64_has_secondary_stack : 1; |
aba77cbe | 38 | unsigned has_program_compatibility_assistant : 1; |
61522196 | 39 | unsigned has_pipe_reject_remote_clients : 1; |
4aa4632a | 40 | unsigned terminate_thread_frees_stack : 1; |
ba946828 CV |
41 | }; |
42 | ||
43 | class wincapc | |
44 | { | |
c29e6933 | 45 | SYSTEM_INFO system_info; |
aff96307 CF |
46 | OSVERSIONINFOEX version; |
47 | char osnam[40]; | |
61522196 | 48 | ULONG_PTR wow64; |
aff96307 | 49 | void *caps; |
ba946828 CV |
50 | |
51 | public: | |
52 | void init (); | |
53 | ||
c29e6933 | 54 | const DWORD cpu_count () const { return system_info.dwNumberOfProcessors; } |
61522196 CV |
55 | /* The casts to size_t make sure that the returned value has the size of |
56 | a pointer on any system. This is important when using them for bit | |
57 | mask operations, like in roundup2. */ | |
58 | const size_t page_size () const { return (size_t) system_info.dwPageSize; } | |
59 | const size_t allocation_granularity () const | |
60 | { return (size_t) system_info.dwAllocationGranularity; } | |
ba946828 | 61 | const char *osname () const { return osnam; } |
61522196 | 62 | const bool is_wow64 () const { return !!wow64; } |
ba946828 | 63 | |
aff96307 | 64 | #define IMPLEMENT(cap) cap() const { return ((wincaps *) this->caps)->cap; } |
ba946828 | 65 | |
cce28460 | 66 | DWORD IMPLEMENT (max_sys_priv) |
aff96307 | 67 | bool IMPLEMENT (is_server) |
ba946828 | 68 | bool IMPLEMENT (has_physical_mem_access) |
2fd2ddf3 | 69 | bool IMPLEMENT (has_mandatory_integrity_control) |
c6674b53 | 70 | bool IMPLEMENT (needs_count_in_si_lpres2) |
cbfb7b1b | 71 | bool IMPLEMENT (has_recycle_dot_bin) |
96d7dee2 | 72 | bool IMPLEMENT (has_gaa_on_link_prefix) |
00a76ece | 73 | bool IMPLEMENT (has_gaa_largeaddress_bug) |
4815dd49 | 74 | bool IMPLEMENT (supports_all_posix_ai_flags) |
5cb998e6 | 75 | bool IMPLEMENT (has_restricted_stack_args) |
4c153b24 | 76 | bool IMPLEMENT (has_transactions) |
3787b37e | 77 | bool IMPLEMENT (has_sendmsg) |
43616e55 | 78 | bool IMPLEMENT (has_broken_udf) |
8d1d548f | 79 | bool IMPLEMENT (has_broken_alloc_console) |
20fc2f49 | 80 | bool IMPLEMENT (has_always_all_codepages) |
326fb376 | 81 | bool IMPLEMENT (has_localenames) |
9c154abe | 82 | bool IMPLEMENT (has_fast_cwd) |
95a5c969 | 83 | bool IMPLEMENT (has_restricted_raw_disk_access) |
ba5f9298 | 84 | bool IMPLEMENT (use_dont_resolve_hack) |
c52fd6cd | 85 | bool IMPLEMENT (has_console_logon_sid) |
f08bc858 | 86 | bool IMPLEMENT (wow64_has_secondary_stack) |
aba77cbe | 87 | bool IMPLEMENT (has_program_compatibility_assistant) |
61522196 | 88 | bool IMPLEMENT (has_pipe_reject_remote_clients) |
4aa4632a | 89 | bool IMPLEMENT (terminate_thread_frees_stack) |
ba946828 CV |
90 | |
91 | #undef IMPLEMENT | |
92 | }; | |
93 | ||
94 | extern wincapc wincap; | |
95 | ||
96 | #endif /* _WINCAP_H */ |