|
1 // Copyright 2011 The Go Authors. All rights reserved. |
|
2 // Use of this source code is governed by a BSD-style |
|
3 // license that can be found in the LICENSE file. |
|
4 |
|
5 package windows |
|
6 |
|
7 import ( |
|
8 "net" |
|
9 "syscall" |
|
10 "unsafe" |
|
11 ) |
|
12 |
|
13 // NTStatus corresponds with NTSTATUS, error values returned by ntdll.dll and |
|
14 // other native functions. |
|
15 type NTStatus uint32 |
|
16 |
|
17 const ( |
|
18 // Invented values to support what package os expects. |
|
19 O_RDONLY = 0x00000 |
|
20 O_WRONLY = 0x00001 |
|
21 O_RDWR = 0x00002 |
|
22 O_CREAT = 0x00040 |
|
23 O_EXCL = 0x00080 |
|
24 O_NOCTTY = 0x00100 |
|
25 O_TRUNC = 0x00200 |
|
26 O_NONBLOCK = 0x00800 |
|
27 O_APPEND = 0x00400 |
|
28 O_SYNC = 0x01000 |
|
29 O_ASYNC = 0x02000 |
|
30 O_CLOEXEC = 0x80000 |
|
31 ) |
|
32 |
|
33 const ( |
|
34 // More invented values for signals |
|
35 SIGHUP = Signal(0x1) |
|
36 SIGINT = Signal(0x2) |
|
37 SIGQUIT = Signal(0x3) |
|
38 SIGILL = Signal(0x4) |
|
39 SIGTRAP = Signal(0x5) |
|
40 SIGABRT = Signal(0x6) |
|
41 SIGBUS = Signal(0x7) |
|
42 SIGFPE = Signal(0x8) |
|
43 SIGKILL = Signal(0x9) |
|
44 SIGSEGV = Signal(0xb) |
|
45 SIGPIPE = Signal(0xd) |
|
46 SIGALRM = Signal(0xe) |
|
47 SIGTERM = Signal(0xf) |
|
48 ) |
|
49 |
|
50 var signals = [...]string{ |
|
51 1: "hangup", |
|
52 2: "interrupt", |
|
53 3: "quit", |
|
54 4: "illegal instruction", |
|
55 5: "trace/breakpoint trap", |
|
56 6: "aborted", |
|
57 7: "bus error", |
|
58 8: "floating point exception", |
|
59 9: "killed", |
|
60 10: "user defined signal 1", |
|
61 11: "segmentation fault", |
|
62 12: "user defined signal 2", |
|
63 13: "broken pipe", |
|
64 14: "alarm clock", |
|
65 15: "terminated", |
|
66 } |
|
67 |
|
68 const ( |
|
69 FILE_READ_DATA = 0x00000001 |
|
70 FILE_READ_ATTRIBUTES = 0x00000080 |
|
71 FILE_READ_EA = 0x00000008 |
|
72 FILE_WRITE_DATA = 0x00000002 |
|
73 FILE_WRITE_ATTRIBUTES = 0x00000100 |
|
74 FILE_WRITE_EA = 0x00000010 |
|
75 FILE_APPEND_DATA = 0x00000004 |
|
76 FILE_EXECUTE = 0x00000020 |
|
77 |
|
78 FILE_GENERIC_READ = STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE |
|
79 FILE_GENERIC_WRITE = STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE |
|
80 FILE_GENERIC_EXECUTE = STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE |
|
81 |
|
82 FILE_LIST_DIRECTORY = 0x00000001 |
|
83 FILE_TRAVERSE = 0x00000020 |
|
84 |
|
85 FILE_SHARE_READ = 0x00000001 |
|
86 FILE_SHARE_WRITE = 0x00000002 |
|
87 FILE_SHARE_DELETE = 0x00000004 |
|
88 |
|
89 FILE_ATTRIBUTE_READONLY = 0x00000001 |
|
90 FILE_ATTRIBUTE_HIDDEN = 0x00000002 |
|
91 FILE_ATTRIBUTE_SYSTEM = 0x00000004 |
|
92 FILE_ATTRIBUTE_DIRECTORY = 0x00000010 |
|
93 FILE_ATTRIBUTE_ARCHIVE = 0x00000020 |
|
94 FILE_ATTRIBUTE_DEVICE = 0x00000040 |
|
95 FILE_ATTRIBUTE_NORMAL = 0x00000080 |
|
96 FILE_ATTRIBUTE_TEMPORARY = 0x00000100 |
|
97 FILE_ATTRIBUTE_SPARSE_FILE = 0x00000200 |
|
98 FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400 |
|
99 FILE_ATTRIBUTE_COMPRESSED = 0x00000800 |
|
100 FILE_ATTRIBUTE_OFFLINE = 0x00001000 |
|
101 FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x00002000 |
|
102 FILE_ATTRIBUTE_ENCRYPTED = 0x00004000 |
|
103 FILE_ATTRIBUTE_INTEGRITY_STREAM = 0x00008000 |
|
104 FILE_ATTRIBUTE_VIRTUAL = 0x00010000 |
|
105 FILE_ATTRIBUTE_NO_SCRUB_DATA = 0x00020000 |
|
106 FILE_ATTRIBUTE_RECALL_ON_OPEN = 0x00040000 |
|
107 FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS = 0x00400000 |
|
108 |
|
109 INVALID_FILE_ATTRIBUTES = 0xffffffff |
|
110 |
|
111 CREATE_NEW = 1 |
|
112 CREATE_ALWAYS = 2 |
|
113 OPEN_EXISTING = 3 |
|
114 OPEN_ALWAYS = 4 |
|
115 TRUNCATE_EXISTING = 5 |
|
116 |
|
117 FILE_FLAG_OPEN_REQUIRING_OPLOCK = 0x00040000 |
|
118 FILE_FLAG_FIRST_PIPE_INSTANCE = 0x00080000 |
|
119 FILE_FLAG_OPEN_NO_RECALL = 0x00100000 |
|
120 FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000 |
|
121 FILE_FLAG_SESSION_AWARE = 0x00800000 |
|
122 FILE_FLAG_POSIX_SEMANTICS = 0x01000000 |
|
123 FILE_FLAG_BACKUP_SEMANTICS = 0x02000000 |
|
124 FILE_FLAG_DELETE_ON_CLOSE = 0x04000000 |
|
125 FILE_FLAG_SEQUENTIAL_SCAN = 0x08000000 |
|
126 FILE_FLAG_RANDOM_ACCESS = 0x10000000 |
|
127 FILE_FLAG_NO_BUFFERING = 0x20000000 |
|
128 FILE_FLAG_OVERLAPPED = 0x40000000 |
|
129 FILE_FLAG_WRITE_THROUGH = 0x80000000 |
|
130 |
|
131 HANDLE_FLAG_INHERIT = 0x00000001 |
|
132 STARTF_USESTDHANDLES = 0x00000100 |
|
133 STARTF_USESHOWWINDOW = 0x00000001 |
|
134 DUPLICATE_CLOSE_SOURCE = 0x00000001 |
|
135 DUPLICATE_SAME_ACCESS = 0x00000002 |
|
136 |
|
137 STD_INPUT_HANDLE = -10 & (1<<32 - 1) |
|
138 STD_OUTPUT_HANDLE = -11 & (1<<32 - 1) |
|
139 STD_ERROR_HANDLE = -12 & (1<<32 - 1) |
|
140 |
|
141 FILE_BEGIN = 0 |
|
142 FILE_CURRENT = 1 |
|
143 FILE_END = 2 |
|
144 |
|
145 LANG_ENGLISH = 0x09 |
|
146 SUBLANG_ENGLISH_US = 0x01 |
|
147 |
|
148 FORMAT_MESSAGE_ALLOCATE_BUFFER = 256 |
|
149 FORMAT_MESSAGE_IGNORE_INSERTS = 512 |
|
150 FORMAT_MESSAGE_FROM_STRING = 1024 |
|
151 FORMAT_MESSAGE_FROM_HMODULE = 2048 |
|
152 FORMAT_MESSAGE_FROM_SYSTEM = 4096 |
|
153 FORMAT_MESSAGE_ARGUMENT_ARRAY = 8192 |
|
154 FORMAT_MESSAGE_MAX_WIDTH_MASK = 255 |
|
155 |
|
156 MAX_PATH = 260 |
|
157 MAX_LONG_PATH = 32768 |
|
158 |
|
159 MAX_MODULE_NAME32 = 255 |
|
160 |
|
161 MAX_COMPUTERNAME_LENGTH = 15 |
|
162 |
|
163 MAX_DHCPV6_DUID_LENGTH = 130 |
|
164 |
|
165 MAX_DNS_SUFFIX_STRING_LENGTH = 256 |
|
166 |
|
167 TIME_ZONE_ID_UNKNOWN = 0 |
|
168 TIME_ZONE_ID_STANDARD = 1 |
|
169 |
|
170 TIME_ZONE_ID_DAYLIGHT = 2 |
|
171 IGNORE = 0 |
|
172 INFINITE = 0xffffffff |
|
173 |
|
174 WAIT_ABANDONED = 0x00000080 |
|
175 WAIT_OBJECT_0 = 0x00000000 |
|
176 WAIT_FAILED = 0xFFFFFFFF |
|
177 |
|
178 // Access rights for process. |
|
179 PROCESS_CREATE_PROCESS = 0x0080 |
|
180 PROCESS_CREATE_THREAD = 0x0002 |
|
181 PROCESS_DUP_HANDLE = 0x0040 |
|
182 PROCESS_QUERY_INFORMATION = 0x0400 |
|
183 PROCESS_QUERY_LIMITED_INFORMATION = 0x1000 |
|
184 PROCESS_SET_INFORMATION = 0x0200 |
|
185 PROCESS_SET_QUOTA = 0x0100 |
|
186 PROCESS_SUSPEND_RESUME = 0x0800 |
|
187 PROCESS_TERMINATE = 0x0001 |
|
188 PROCESS_VM_OPERATION = 0x0008 |
|
189 PROCESS_VM_READ = 0x0010 |
|
190 PROCESS_VM_WRITE = 0x0020 |
|
191 |
|
192 // Access rights for thread. |
|
193 THREAD_DIRECT_IMPERSONATION = 0x0200 |
|
194 THREAD_GET_CONTEXT = 0x0008 |
|
195 THREAD_IMPERSONATE = 0x0100 |
|
196 THREAD_QUERY_INFORMATION = 0x0040 |
|
197 THREAD_QUERY_LIMITED_INFORMATION = 0x0800 |
|
198 THREAD_SET_CONTEXT = 0x0010 |
|
199 THREAD_SET_INFORMATION = 0x0020 |
|
200 THREAD_SET_LIMITED_INFORMATION = 0x0400 |
|
201 THREAD_SET_THREAD_TOKEN = 0x0080 |
|
202 THREAD_SUSPEND_RESUME = 0x0002 |
|
203 THREAD_TERMINATE = 0x0001 |
|
204 |
|
205 FILE_MAP_COPY = 0x01 |
|
206 FILE_MAP_WRITE = 0x02 |
|
207 FILE_MAP_READ = 0x04 |
|
208 FILE_MAP_EXECUTE = 0x20 |
|
209 |
|
210 CTRL_C_EVENT = 0 |
|
211 CTRL_BREAK_EVENT = 1 |
|
212 CTRL_CLOSE_EVENT = 2 |
|
213 CTRL_LOGOFF_EVENT = 5 |
|
214 CTRL_SHUTDOWN_EVENT = 6 |
|
215 |
|
216 // Windows reserves errors >= 1<<29 for application use. |
|
217 APPLICATION_ERROR = 1 << 29 |
|
218 ) |
|
219 |
|
220 const ( |
|
221 // Process creation flags. |
|
222 CREATE_BREAKAWAY_FROM_JOB = 0x01000000 |
|
223 CREATE_DEFAULT_ERROR_MODE = 0x04000000 |
|
224 CREATE_NEW_CONSOLE = 0x00000010 |
|
225 CREATE_NEW_PROCESS_GROUP = 0x00000200 |
|
226 CREATE_NO_WINDOW = 0x08000000 |
|
227 CREATE_PROTECTED_PROCESS = 0x00040000 |
|
228 CREATE_PRESERVE_CODE_AUTHZ_LEVEL = 0x02000000 |
|
229 CREATE_SEPARATE_WOW_VDM = 0x00000800 |
|
230 CREATE_SHARED_WOW_VDM = 0x00001000 |
|
231 CREATE_SUSPENDED = 0x00000004 |
|
232 CREATE_UNICODE_ENVIRONMENT = 0x00000400 |
|
233 DEBUG_ONLY_THIS_PROCESS = 0x00000002 |
|
234 DEBUG_PROCESS = 0x00000001 |
|
235 DETACHED_PROCESS = 0x00000008 |
|
236 EXTENDED_STARTUPINFO_PRESENT = 0x00080000 |
|
237 INHERIT_PARENT_AFFINITY = 0x00010000 |
|
238 ) |
|
239 |
|
240 const ( |
|
241 // attributes for ProcThreadAttributeList |
|
242 PROC_THREAD_ATTRIBUTE_PARENT_PROCESS = 0x00020000 |
|
243 PROC_THREAD_ATTRIBUTE_HANDLE_LIST = 0x00020002 |
|
244 PROC_THREAD_ATTRIBUTE_GROUP_AFFINITY = 0x00030003 |
|
245 PROC_THREAD_ATTRIBUTE_PREFERRED_NODE = 0x00020004 |
|
246 PROC_THREAD_ATTRIBUTE_IDEAL_PROCESSOR = 0x00030005 |
|
247 PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY = 0x00020007 |
|
248 PROC_THREAD_ATTRIBUTE_UMS_THREAD = 0x00030006 |
|
249 PROC_THREAD_ATTRIBUTE_PROTECTION_LEVEL = 0x0002000b |
|
250 ) |
|
251 |
|
252 const ( |
|
253 // flags for CreateToolhelp32Snapshot |
|
254 TH32CS_SNAPHEAPLIST = 0x01 |
|
255 TH32CS_SNAPPROCESS = 0x02 |
|
256 TH32CS_SNAPTHREAD = 0x04 |
|
257 TH32CS_SNAPMODULE = 0x08 |
|
258 TH32CS_SNAPMODULE32 = 0x10 |
|
259 TH32CS_SNAPALL = TH32CS_SNAPHEAPLIST | TH32CS_SNAPMODULE | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD |
|
260 TH32CS_INHERIT = 0x80000000 |
|
261 ) |
|
262 |
|
263 const ( |
|
264 // flags for EnumProcessModulesEx |
|
265 LIST_MODULES_32BIT = 0x01 |
|
266 LIST_MODULES_64BIT = 0x02 |
|
267 LIST_MODULES_ALL = 0x03 |
|
268 LIST_MODULES_DEFAULT = 0x00 |
|
269 ) |
|
270 |
|
271 const ( |
|
272 // filters for ReadDirectoryChangesW and FindFirstChangeNotificationW |
|
273 FILE_NOTIFY_CHANGE_FILE_NAME = 0x001 |
|
274 FILE_NOTIFY_CHANGE_DIR_NAME = 0x002 |
|
275 FILE_NOTIFY_CHANGE_ATTRIBUTES = 0x004 |
|
276 FILE_NOTIFY_CHANGE_SIZE = 0x008 |
|
277 FILE_NOTIFY_CHANGE_LAST_WRITE = 0x010 |
|
278 FILE_NOTIFY_CHANGE_LAST_ACCESS = 0x020 |
|
279 FILE_NOTIFY_CHANGE_CREATION = 0x040 |
|
280 FILE_NOTIFY_CHANGE_SECURITY = 0x100 |
|
281 ) |
|
282 |
|
283 const ( |
|
284 // do not reorder |
|
285 FILE_ACTION_ADDED = iota + 1 |
|
286 FILE_ACTION_REMOVED |
|
287 FILE_ACTION_MODIFIED |
|
288 FILE_ACTION_RENAMED_OLD_NAME |
|
289 FILE_ACTION_RENAMED_NEW_NAME |
|
290 ) |
|
291 |
|
292 const ( |
|
293 // wincrypt.h |
|
294 /* certenrolld_begin -- PROV_RSA_*/ |
|
295 PROV_RSA_FULL = 1 |
|
296 PROV_RSA_SIG = 2 |
|
297 PROV_DSS = 3 |
|
298 PROV_FORTEZZA = 4 |
|
299 PROV_MS_EXCHANGE = 5 |
|
300 PROV_SSL = 6 |
|
301 PROV_RSA_SCHANNEL = 12 |
|
302 PROV_DSS_DH = 13 |
|
303 PROV_EC_ECDSA_SIG = 14 |
|
304 PROV_EC_ECNRA_SIG = 15 |
|
305 PROV_EC_ECDSA_FULL = 16 |
|
306 PROV_EC_ECNRA_FULL = 17 |
|
307 PROV_DH_SCHANNEL = 18 |
|
308 PROV_SPYRUS_LYNKS = 20 |
|
309 PROV_RNG = 21 |
|
310 PROV_INTEL_SEC = 22 |
|
311 PROV_REPLACE_OWF = 23 |
|
312 PROV_RSA_AES = 24 |
|
313 |
|
314 /* dwFlags definitions for CryptAcquireContext */ |
|
315 CRYPT_VERIFYCONTEXT = 0xF0000000 |
|
316 CRYPT_NEWKEYSET = 0x00000008 |
|
317 CRYPT_DELETEKEYSET = 0x00000010 |
|
318 CRYPT_MACHINE_KEYSET = 0x00000020 |
|
319 CRYPT_SILENT = 0x00000040 |
|
320 CRYPT_DEFAULT_CONTAINER_OPTIONAL = 0x00000080 |
|
321 |
|
322 /* Flags for PFXImportCertStore */ |
|
323 CRYPT_EXPORTABLE = 0x00000001 |
|
324 CRYPT_USER_PROTECTED = 0x00000002 |
|
325 CRYPT_USER_KEYSET = 0x00001000 |
|
326 PKCS12_PREFER_CNG_KSP = 0x00000100 |
|
327 PKCS12_ALWAYS_CNG_KSP = 0x00000200 |
|
328 PKCS12_ALLOW_OVERWRITE_KEY = 0x00004000 |
|
329 PKCS12_NO_PERSIST_KEY = 0x00008000 |
|
330 PKCS12_INCLUDE_EXTENDED_PROPERTIES = 0x00000010 |
|
331 |
|
332 /* Flags for CryptAcquireCertificatePrivateKey */ |
|
333 CRYPT_ACQUIRE_CACHE_FLAG = 0x00000001 |
|
334 CRYPT_ACQUIRE_USE_PROV_INFO_FLAG = 0x00000002 |
|
335 CRYPT_ACQUIRE_COMPARE_KEY_FLAG = 0x00000004 |
|
336 CRYPT_ACQUIRE_NO_HEALING = 0x00000008 |
|
337 CRYPT_ACQUIRE_SILENT_FLAG = 0x00000040 |
|
338 CRYPT_ACQUIRE_WINDOW_HANDLE_FLAG = 0x00000080 |
|
339 CRYPT_ACQUIRE_NCRYPT_KEY_FLAGS_MASK = 0x00070000 |
|
340 CRYPT_ACQUIRE_ALLOW_NCRYPT_KEY_FLAG = 0x00010000 |
|
341 CRYPT_ACQUIRE_PREFER_NCRYPT_KEY_FLAG = 0x00020000 |
|
342 CRYPT_ACQUIRE_ONLY_NCRYPT_KEY_FLAG = 0x00040000 |
|
343 |
|
344 /* pdwKeySpec for CryptAcquireCertificatePrivateKey */ |
|
345 AT_KEYEXCHANGE = 1 |
|
346 AT_SIGNATURE = 2 |
|
347 CERT_NCRYPT_KEY_SPEC = 0xFFFFFFFF |
|
348 |
|
349 /* Default usage match type is AND with value zero */ |
|
350 USAGE_MATCH_TYPE_AND = 0 |
|
351 USAGE_MATCH_TYPE_OR = 1 |
|
352 |
|
353 /* msgAndCertEncodingType values for CertOpenStore function */ |
|
354 X509_ASN_ENCODING = 0x00000001 |
|
355 PKCS_7_ASN_ENCODING = 0x00010000 |
|
356 |
|
357 /* storeProvider values for CertOpenStore function */ |
|
358 CERT_STORE_PROV_MSG = 1 |
|
359 CERT_STORE_PROV_MEMORY = 2 |
|
360 CERT_STORE_PROV_FILE = 3 |
|
361 CERT_STORE_PROV_REG = 4 |
|
362 CERT_STORE_PROV_PKCS7 = 5 |
|
363 CERT_STORE_PROV_SERIALIZED = 6 |
|
364 CERT_STORE_PROV_FILENAME_A = 7 |
|
365 CERT_STORE_PROV_FILENAME_W = 8 |
|
366 CERT_STORE_PROV_FILENAME = CERT_STORE_PROV_FILENAME_W |
|
367 CERT_STORE_PROV_SYSTEM_A = 9 |
|
368 CERT_STORE_PROV_SYSTEM_W = 10 |
|
369 CERT_STORE_PROV_SYSTEM = CERT_STORE_PROV_SYSTEM_W |
|
370 CERT_STORE_PROV_COLLECTION = 11 |
|
371 CERT_STORE_PROV_SYSTEM_REGISTRY_A = 12 |
|
372 CERT_STORE_PROV_SYSTEM_REGISTRY_W = 13 |
|
373 CERT_STORE_PROV_SYSTEM_REGISTRY = CERT_STORE_PROV_SYSTEM_REGISTRY_W |
|
374 CERT_STORE_PROV_PHYSICAL_W = 14 |
|
375 CERT_STORE_PROV_PHYSICAL = CERT_STORE_PROV_PHYSICAL_W |
|
376 CERT_STORE_PROV_SMART_CARD_W = 15 |
|
377 CERT_STORE_PROV_SMART_CARD = CERT_STORE_PROV_SMART_CARD_W |
|
378 CERT_STORE_PROV_LDAP_W = 16 |
|
379 CERT_STORE_PROV_LDAP = CERT_STORE_PROV_LDAP_W |
|
380 CERT_STORE_PROV_PKCS12 = 17 |
|
381 |
|
382 /* store characteristics (low WORD of flag) for CertOpenStore function */ |
|
383 CERT_STORE_NO_CRYPT_RELEASE_FLAG = 0x00000001 |
|
384 CERT_STORE_SET_LOCALIZED_NAME_FLAG = 0x00000002 |
|
385 CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG = 0x00000004 |
|
386 CERT_STORE_DELETE_FLAG = 0x00000010 |
|
387 CERT_STORE_UNSAFE_PHYSICAL_FLAG = 0x00000020 |
|
388 CERT_STORE_SHARE_STORE_FLAG = 0x00000040 |
|
389 CERT_STORE_SHARE_CONTEXT_FLAG = 0x00000080 |
|
390 CERT_STORE_MANIFOLD_FLAG = 0x00000100 |
|
391 CERT_STORE_ENUM_ARCHIVED_FLAG = 0x00000200 |
|
392 CERT_STORE_UPDATE_KEYID_FLAG = 0x00000400 |
|
393 CERT_STORE_BACKUP_RESTORE_FLAG = 0x00000800 |
|
394 CERT_STORE_MAXIMUM_ALLOWED_FLAG = 0x00001000 |
|
395 CERT_STORE_CREATE_NEW_FLAG = 0x00002000 |
|
396 CERT_STORE_OPEN_EXISTING_FLAG = 0x00004000 |
|
397 CERT_STORE_READONLY_FLAG = 0x00008000 |
|
398 |
|
399 /* store locations (high WORD of flag) for CertOpenStore function */ |
|
400 CERT_SYSTEM_STORE_CURRENT_USER = 0x00010000 |
|
401 CERT_SYSTEM_STORE_LOCAL_MACHINE = 0x00020000 |
|
402 CERT_SYSTEM_STORE_CURRENT_SERVICE = 0x00040000 |
|
403 CERT_SYSTEM_STORE_SERVICES = 0x00050000 |
|
404 CERT_SYSTEM_STORE_USERS = 0x00060000 |
|
405 CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY = 0x00070000 |
|
406 CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY = 0x00080000 |
|
407 CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE = 0x00090000 |
|
408 CERT_SYSTEM_STORE_UNPROTECTED_FLAG = 0x40000000 |
|
409 CERT_SYSTEM_STORE_RELOCATE_FLAG = 0x80000000 |
|
410 |
|
411 /* Miscellaneous high-WORD flags for CertOpenStore function */ |
|
412 CERT_REGISTRY_STORE_REMOTE_FLAG = 0x00010000 |
|
413 CERT_REGISTRY_STORE_SERIALIZED_FLAG = 0x00020000 |
|
414 CERT_REGISTRY_STORE_ROAMING_FLAG = 0x00040000 |
|
415 CERT_REGISTRY_STORE_MY_IE_DIRTY_FLAG = 0x00080000 |
|
416 CERT_REGISTRY_STORE_LM_GPT_FLAG = 0x01000000 |
|
417 CERT_REGISTRY_STORE_CLIENT_GPT_FLAG = 0x80000000 |
|
418 CERT_FILE_STORE_COMMIT_ENABLE_FLAG = 0x00010000 |
|
419 CERT_LDAP_STORE_SIGN_FLAG = 0x00010000 |
|
420 CERT_LDAP_STORE_AREC_EXCLUSIVE_FLAG = 0x00020000 |
|
421 CERT_LDAP_STORE_OPENED_FLAG = 0x00040000 |
|
422 CERT_LDAP_STORE_UNBIND_FLAG = 0x00080000 |
|
423 |
|
424 /* addDisposition values for CertAddCertificateContextToStore function */ |
|
425 CERT_STORE_ADD_NEW = 1 |
|
426 CERT_STORE_ADD_USE_EXISTING = 2 |
|
427 CERT_STORE_ADD_REPLACE_EXISTING = 3 |
|
428 CERT_STORE_ADD_ALWAYS = 4 |
|
429 CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES = 5 |
|
430 CERT_STORE_ADD_NEWER = 6 |
|
431 CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES = 7 |
|
432 |
|
433 /* ErrorStatus values for CertTrustStatus struct */ |
|
434 CERT_TRUST_NO_ERROR = 0x00000000 |
|
435 CERT_TRUST_IS_NOT_TIME_VALID = 0x00000001 |
|
436 CERT_TRUST_IS_REVOKED = 0x00000004 |
|
437 CERT_TRUST_IS_NOT_SIGNATURE_VALID = 0x00000008 |
|
438 CERT_TRUST_IS_NOT_VALID_FOR_USAGE = 0x00000010 |
|
439 CERT_TRUST_IS_UNTRUSTED_ROOT = 0x00000020 |
|
440 CERT_TRUST_REVOCATION_STATUS_UNKNOWN = 0x00000040 |
|
441 CERT_TRUST_IS_CYCLIC = 0x00000080 |
|
442 CERT_TRUST_INVALID_EXTENSION = 0x00000100 |
|
443 CERT_TRUST_INVALID_POLICY_CONSTRAINTS = 0x00000200 |
|
444 CERT_TRUST_INVALID_BASIC_CONSTRAINTS = 0x00000400 |
|
445 CERT_TRUST_INVALID_NAME_CONSTRAINTS = 0x00000800 |
|
446 CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT = 0x00001000 |
|
447 CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT = 0x00002000 |
|
448 CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT = 0x00004000 |
|
449 CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT = 0x00008000 |
|
450 CERT_TRUST_IS_PARTIAL_CHAIN = 0x00010000 |
|
451 CERT_TRUST_CTL_IS_NOT_TIME_VALID = 0x00020000 |
|
452 CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID = 0x00040000 |
|
453 CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 0x00080000 |
|
454 CERT_TRUST_HAS_WEAK_SIGNATURE = 0x00100000 |
|
455 CERT_TRUST_IS_OFFLINE_REVOCATION = 0x01000000 |
|
456 CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY = 0x02000000 |
|
457 CERT_TRUST_IS_EXPLICIT_DISTRUST = 0x04000000 |
|
458 CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT = 0x08000000 |
|
459 |
|
460 /* InfoStatus values for CertTrustStatus struct */ |
|
461 CERT_TRUST_HAS_EXACT_MATCH_ISSUER = 0x00000001 |
|
462 CERT_TRUST_HAS_KEY_MATCH_ISSUER = 0x00000002 |
|
463 CERT_TRUST_HAS_NAME_MATCH_ISSUER = 0x00000004 |
|
464 CERT_TRUST_IS_SELF_SIGNED = 0x00000008 |
|
465 CERT_TRUST_HAS_PREFERRED_ISSUER = 0x00000100 |
|
466 CERT_TRUST_HAS_ISSUANCE_CHAIN_POLICY = 0x00000400 |
|
467 CERT_TRUST_HAS_VALID_NAME_CONSTRAINTS = 0x00000400 |
|
468 CERT_TRUST_IS_PEER_TRUSTED = 0x00000800 |
|
469 CERT_TRUST_HAS_CRL_VALIDITY_EXTENDED = 0x00001000 |
|
470 CERT_TRUST_IS_FROM_EXCLUSIVE_TRUST_STORE = 0x00002000 |
|
471 CERT_TRUST_IS_CA_TRUSTED = 0x00004000 |
|
472 CERT_TRUST_IS_COMPLEX_CHAIN = 0x00010000 |
|
473 |
|
474 /* Certificate Information Flags */ |
|
475 CERT_INFO_VERSION_FLAG = 1 |
|
476 CERT_INFO_SERIAL_NUMBER_FLAG = 2 |
|
477 CERT_INFO_SIGNATURE_ALGORITHM_FLAG = 3 |
|
478 CERT_INFO_ISSUER_FLAG = 4 |
|
479 CERT_INFO_NOT_BEFORE_FLAG = 5 |
|
480 CERT_INFO_NOT_AFTER_FLAG = 6 |
|
481 CERT_INFO_SUBJECT_FLAG = 7 |
|
482 CERT_INFO_SUBJECT_PUBLIC_KEY_INFO_FLAG = 8 |
|
483 CERT_INFO_ISSUER_UNIQUE_ID_FLAG = 9 |
|
484 CERT_INFO_SUBJECT_UNIQUE_ID_FLAG = 10 |
|
485 CERT_INFO_EXTENSION_FLAG = 11 |
|
486 |
|
487 /* dwFindType for CertFindCertificateInStore */ |
|
488 CERT_COMPARE_MASK = 0xFFFF |
|
489 CERT_COMPARE_SHIFT = 16 |
|
490 CERT_COMPARE_ANY = 0 |
|
491 CERT_COMPARE_SHA1_HASH = 1 |
|
492 CERT_COMPARE_NAME = 2 |
|
493 CERT_COMPARE_ATTR = 3 |
|
494 CERT_COMPARE_MD5_HASH = 4 |
|
495 CERT_COMPARE_PROPERTY = 5 |
|
496 CERT_COMPARE_PUBLIC_KEY = 6 |
|
497 CERT_COMPARE_HASH = CERT_COMPARE_SHA1_HASH |
|
498 CERT_COMPARE_NAME_STR_A = 7 |
|
499 CERT_COMPARE_NAME_STR_W = 8 |
|
500 CERT_COMPARE_KEY_SPEC = 9 |
|
501 CERT_COMPARE_ENHKEY_USAGE = 10 |
|
502 CERT_COMPARE_CTL_USAGE = CERT_COMPARE_ENHKEY_USAGE |
|
503 CERT_COMPARE_SUBJECT_CERT = 11 |
|
504 CERT_COMPARE_ISSUER_OF = 12 |
|
505 CERT_COMPARE_EXISTING = 13 |
|
506 CERT_COMPARE_SIGNATURE_HASH = 14 |
|
507 CERT_COMPARE_KEY_IDENTIFIER = 15 |
|
508 CERT_COMPARE_CERT_ID = 16 |
|
509 CERT_COMPARE_CROSS_CERT_DIST_POINTS = 17 |
|
510 CERT_COMPARE_PUBKEY_MD5_HASH = 18 |
|
511 CERT_COMPARE_SUBJECT_INFO_ACCESS = 19 |
|
512 CERT_COMPARE_HASH_STR = 20 |
|
513 CERT_COMPARE_HAS_PRIVATE_KEY = 21 |
|
514 CERT_FIND_ANY = (CERT_COMPARE_ANY << CERT_COMPARE_SHIFT) |
|
515 CERT_FIND_SHA1_HASH = (CERT_COMPARE_SHA1_HASH << CERT_COMPARE_SHIFT) |
|
516 CERT_FIND_MD5_HASH = (CERT_COMPARE_MD5_HASH << CERT_COMPARE_SHIFT) |
|
517 CERT_FIND_SIGNATURE_HASH = (CERT_COMPARE_SIGNATURE_HASH << CERT_COMPARE_SHIFT) |
|
518 CERT_FIND_KEY_IDENTIFIER = (CERT_COMPARE_KEY_IDENTIFIER << CERT_COMPARE_SHIFT) |
|
519 CERT_FIND_HASH = CERT_FIND_SHA1_HASH |
|
520 CERT_FIND_PROPERTY = (CERT_COMPARE_PROPERTY << CERT_COMPARE_SHIFT) |
|
521 CERT_FIND_PUBLIC_KEY = (CERT_COMPARE_PUBLIC_KEY << CERT_COMPARE_SHIFT) |
|
522 CERT_FIND_SUBJECT_NAME = (CERT_COMPARE_NAME<<CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG) |
|
523 CERT_FIND_SUBJECT_ATTR = (CERT_COMPARE_ATTR<<CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG) |
|
524 CERT_FIND_ISSUER_NAME = (CERT_COMPARE_NAME<<CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG) |
|
525 CERT_FIND_ISSUER_ATTR = (CERT_COMPARE_ATTR<<CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG) |
|
526 CERT_FIND_SUBJECT_STR_A = (CERT_COMPARE_NAME_STR_A<<CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG) |
|
527 CERT_FIND_SUBJECT_STR_W = (CERT_COMPARE_NAME_STR_W<<CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG) |
|
528 CERT_FIND_SUBJECT_STR = CERT_FIND_SUBJECT_STR_W |
|
529 CERT_FIND_ISSUER_STR_A = (CERT_COMPARE_NAME_STR_A<<CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG) |
|
530 CERT_FIND_ISSUER_STR_W = (CERT_COMPARE_NAME_STR_W<<CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG) |
|
531 CERT_FIND_ISSUER_STR = CERT_FIND_ISSUER_STR_W |
|
532 CERT_FIND_KEY_SPEC = (CERT_COMPARE_KEY_SPEC << CERT_COMPARE_SHIFT) |
|
533 CERT_FIND_ENHKEY_USAGE = (CERT_COMPARE_ENHKEY_USAGE << CERT_COMPARE_SHIFT) |
|
534 CERT_FIND_CTL_USAGE = CERT_FIND_ENHKEY_USAGE |
|
535 CERT_FIND_SUBJECT_CERT = (CERT_COMPARE_SUBJECT_CERT << CERT_COMPARE_SHIFT) |
|
536 CERT_FIND_ISSUER_OF = (CERT_COMPARE_ISSUER_OF << CERT_COMPARE_SHIFT) |
|
537 CERT_FIND_EXISTING = (CERT_COMPARE_EXISTING << CERT_COMPARE_SHIFT) |
|
538 CERT_FIND_CERT_ID = (CERT_COMPARE_CERT_ID << CERT_COMPARE_SHIFT) |
|
539 CERT_FIND_CROSS_CERT_DIST_POINTS = (CERT_COMPARE_CROSS_CERT_DIST_POINTS << CERT_COMPARE_SHIFT) |
|
540 CERT_FIND_PUBKEY_MD5_HASH = (CERT_COMPARE_PUBKEY_MD5_HASH << CERT_COMPARE_SHIFT) |
|
541 CERT_FIND_SUBJECT_INFO_ACCESS = (CERT_COMPARE_SUBJECT_INFO_ACCESS << CERT_COMPARE_SHIFT) |
|
542 CERT_FIND_HASH_STR = (CERT_COMPARE_HASH_STR << CERT_COMPARE_SHIFT) |
|
543 CERT_FIND_HAS_PRIVATE_KEY = (CERT_COMPARE_HAS_PRIVATE_KEY << CERT_COMPARE_SHIFT) |
|
544 CERT_FIND_OPTIONAL_ENHKEY_USAGE_FLAG = 0x1 |
|
545 CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG = 0x2 |
|
546 CERT_FIND_PROP_ONLY_ENHKEY_USAGE_FLAG = 0x4 |
|
547 CERT_FIND_NO_ENHKEY_USAGE_FLAG = 0x8 |
|
548 CERT_FIND_OR_ENHKEY_USAGE_FLAG = 0x10 |
|
549 CERT_FIND_VALID_ENHKEY_USAGE_FLAG = 0x20 |
|
550 CERT_FIND_OPTIONAL_CTL_USAGE_FLAG = CERT_FIND_OPTIONAL_ENHKEY_USAGE_FLAG |
|
551 CERT_FIND_EXT_ONLY_CTL_USAGE_FLAG = CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG |
|
552 CERT_FIND_PROP_ONLY_CTL_USAGE_FLAG = CERT_FIND_PROP_ONLY_ENHKEY_USAGE_FLAG |
|
553 CERT_FIND_NO_CTL_USAGE_FLAG = CERT_FIND_NO_ENHKEY_USAGE_FLAG |
|
554 CERT_FIND_OR_CTL_USAGE_FLAG = CERT_FIND_OR_ENHKEY_USAGE_FLAG |
|
555 CERT_FIND_VALID_CTL_USAGE_FLAG = CERT_FIND_VALID_ENHKEY_USAGE_FLAG |
|
556 |
|
557 /* policyOID values for CertVerifyCertificateChainPolicy function */ |
|
558 CERT_CHAIN_POLICY_BASE = 1 |
|
559 CERT_CHAIN_POLICY_AUTHENTICODE = 2 |
|
560 CERT_CHAIN_POLICY_AUTHENTICODE_TS = 3 |
|
561 CERT_CHAIN_POLICY_SSL = 4 |
|
562 CERT_CHAIN_POLICY_BASIC_CONSTRAINTS = 5 |
|
563 CERT_CHAIN_POLICY_NT_AUTH = 6 |
|
564 CERT_CHAIN_POLICY_MICROSOFT_ROOT = 7 |
|
565 CERT_CHAIN_POLICY_EV = 8 |
|
566 CERT_CHAIN_POLICY_SSL_F12 = 9 |
|
567 |
|
568 /* flag for dwFindType CertFindChainInStore */ |
|
569 CERT_CHAIN_FIND_BY_ISSUER = 1 |
|
570 |
|
571 /* dwFindFlags for CertFindChainInStore when dwFindType == CERT_CHAIN_FIND_BY_ISSUER */ |
|
572 CERT_CHAIN_FIND_BY_ISSUER_COMPARE_KEY_FLAG = 0x0001 |
|
573 CERT_CHAIN_FIND_BY_ISSUER_COMPLEX_CHAIN_FLAG = 0x0002 |
|
574 CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_URL_FLAG = 0x0004 |
|
575 CERT_CHAIN_FIND_BY_ISSUER_LOCAL_MACHINE_FLAG = 0x0008 |
|
576 CERT_CHAIN_FIND_BY_ISSUER_NO_KEY_FLAG = 0x4000 |
|
577 CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_FLAG = 0x8000 |
|
578 |
|
579 /* Certificate Store close flags */ |
|
580 CERT_CLOSE_STORE_FORCE_FLAG = 0x00000001 |
|
581 CERT_CLOSE_STORE_CHECK_FLAG = 0x00000002 |
|
582 |
|
583 /* CryptQueryObject object type */ |
|
584 CERT_QUERY_OBJECT_FILE = 1 |
|
585 CERT_QUERY_OBJECT_BLOB = 2 |
|
586 |
|
587 /* CryptQueryObject content type flags */ |
|
588 CERT_QUERY_CONTENT_CERT = 1 |
|
589 CERT_QUERY_CONTENT_CTL = 2 |
|
590 CERT_QUERY_CONTENT_CRL = 3 |
|
591 CERT_QUERY_CONTENT_SERIALIZED_STORE = 4 |
|
592 CERT_QUERY_CONTENT_SERIALIZED_CERT = 5 |
|
593 CERT_QUERY_CONTENT_SERIALIZED_CTL = 6 |
|
594 CERT_QUERY_CONTENT_SERIALIZED_CRL = 7 |
|
595 CERT_QUERY_CONTENT_PKCS7_SIGNED = 8 |
|
596 CERT_QUERY_CONTENT_PKCS7_UNSIGNED = 9 |
|
597 CERT_QUERY_CONTENT_PKCS7_SIGNED_EMBED = 10 |
|
598 CERT_QUERY_CONTENT_PKCS10 = 11 |
|
599 CERT_QUERY_CONTENT_PFX = 12 |
|
600 CERT_QUERY_CONTENT_CERT_PAIR = 13 |
|
601 CERT_QUERY_CONTENT_PFX_AND_LOAD = 14 |
|
602 CERT_QUERY_CONTENT_FLAG_CERT = (1 << CERT_QUERY_CONTENT_CERT) |
|
603 CERT_QUERY_CONTENT_FLAG_CTL = (1 << CERT_QUERY_CONTENT_CTL) |
|
604 CERT_QUERY_CONTENT_FLAG_CRL = (1 << CERT_QUERY_CONTENT_CRL) |
|
605 CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE = (1 << CERT_QUERY_CONTENT_SERIALIZED_STORE) |
|
606 CERT_QUERY_CONTENT_FLAG_SERIALIZED_CERT = (1 << CERT_QUERY_CONTENT_SERIALIZED_CERT) |
|
607 CERT_QUERY_CONTENT_FLAG_SERIALIZED_CTL = (1 << CERT_QUERY_CONTENT_SERIALIZED_CTL) |
|
608 CERT_QUERY_CONTENT_FLAG_SERIALIZED_CRL = (1 << CERT_QUERY_CONTENT_SERIALIZED_CRL) |
|
609 CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED = (1 << CERT_QUERY_CONTENT_PKCS7_SIGNED) |
|
610 CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED = (1 << CERT_QUERY_CONTENT_PKCS7_UNSIGNED) |
|
611 CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED = (1 << CERT_QUERY_CONTENT_PKCS7_SIGNED_EMBED) |
|
612 CERT_QUERY_CONTENT_FLAG_PKCS10 = (1 << CERT_QUERY_CONTENT_PKCS10) |
|
613 CERT_QUERY_CONTENT_FLAG_PFX = (1 << CERT_QUERY_CONTENT_PFX) |
|
614 CERT_QUERY_CONTENT_FLAG_CERT_PAIR = (1 << CERT_QUERY_CONTENT_CERT_PAIR) |
|
615 CERT_QUERY_CONTENT_FLAG_PFX_AND_LOAD = (1 << CERT_QUERY_CONTENT_PFX_AND_LOAD) |
|
616 CERT_QUERY_CONTENT_FLAG_ALL = (CERT_QUERY_CONTENT_FLAG_CERT | CERT_QUERY_CONTENT_FLAG_CTL | CERT_QUERY_CONTENT_FLAG_CRL | CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE | CERT_QUERY_CONTENT_FLAG_SERIALIZED_CERT | CERT_QUERY_CONTENT_FLAG_SERIALIZED_CTL | CERT_QUERY_CONTENT_FLAG_SERIALIZED_CRL | CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED | CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED | CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED | CERT_QUERY_CONTENT_FLAG_PKCS10 | CERT_QUERY_CONTENT_FLAG_PFX | CERT_QUERY_CONTENT_FLAG_CERT_PAIR) |
|
617 CERT_QUERY_CONTENT_FLAG_ALL_ISSUER_CERT = (CERT_QUERY_CONTENT_FLAG_CERT | CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE | CERT_QUERY_CONTENT_FLAG_SERIALIZED_CERT | CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED | CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED) |
|
618 |
|
619 /* CryptQueryObject format type flags */ |
|
620 CERT_QUERY_FORMAT_BINARY = 1 |
|
621 CERT_QUERY_FORMAT_BASE64_ENCODED = 2 |
|
622 CERT_QUERY_FORMAT_ASN_ASCII_HEX_ENCODED = 3 |
|
623 CERT_QUERY_FORMAT_FLAG_BINARY = (1 << CERT_QUERY_FORMAT_BINARY) |
|
624 CERT_QUERY_FORMAT_FLAG_BASE64_ENCODED = (1 << CERT_QUERY_FORMAT_BASE64_ENCODED) |
|
625 CERT_QUERY_FORMAT_FLAG_ASN_ASCII_HEX_ENCODED = (1 << CERT_QUERY_FORMAT_ASN_ASCII_HEX_ENCODED) |
|
626 CERT_QUERY_FORMAT_FLAG_ALL = (CERT_QUERY_FORMAT_FLAG_BINARY | CERT_QUERY_FORMAT_FLAG_BASE64_ENCODED | CERT_QUERY_FORMAT_FLAG_ASN_ASCII_HEX_ENCODED) |
|
627 |
|
628 /* CertGetNameString name types */ |
|
629 CERT_NAME_EMAIL_TYPE = 1 |
|
630 CERT_NAME_RDN_TYPE = 2 |
|
631 CERT_NAME_ATTR_TYPE = 3 |
|
632 CERT_NAME_SIMPLE_DISPLAY_TYPE = 4 |
|
633 CERT_NAME_FRIENDLY_DISPLAY_TYPE = 5 |
|
634 CERT_NAME_DNS_TYPE = 6 |
|
635 CERT_NAME_URL_TYPE = 7 |
|
636 CERT_NAME_UPN_TYPE = 8 |
|
637 |
|
638 /* CertGetNameString flags */ |
|
639 CERT_NAME_ISSUER_FLAG = 0x1 |
|
640 CERT_NAME_DISABLE_IE4_UTF8_FLAG = 0x10000 |
|
641 CERT_NAME_SEARCH_ALL_NAMES_FLAG = 0x2 |
|
642 CERT_NAME_STR_ENABLE_PUNYCODE_FLAG = 0x00200000 |
|
643 |
|
644 /* AuthType values for SSLExtraCertChainPolicyPara struct */ |
|
645 AUTHTYPE_CLIENT = 1 |
|
646 AUTHTYPE_SERVER = 2 |
|
647 |
|
648 /* Checks values for SSLExtraCertChainPolicyPara struct */ |
|
649 SECURITY_FLAG_IGNORE_REVOCATION = 0x00000080 |
|
650 SECURITY_FLAG_IGNORE_UNKNOWN_CA = 0x00000100 |
|
651 SECURITY_FLAG_IGNORE_WRONG_USAGE = 0x00000200 |
|
652 SECURITY_FLAG_IGNORE_CERT_CN_INVALID = 0x00001000 |
|
653 SECURITY_FLAG_IGNORE_CERT_DATE_INVALID = 0x00002000 |
|
654 |
|
655 /* Flags for Crypt[Un]ProtectData */ |
|
656 CRYPTPROTECT_UI_FORBIDDEN = 0x1 |
|
657 CRYPTPROTECT_LOCAL_MACHINE = 0x4 |
|
658 CRYPTPROTECT_CRED_SYNC = 0x8 |
|
659 CRYPTPROTECT_AUDIT = 0x10 |
|
660 CRYPTPROTECT_NO_RECOVERY = 0x20 |
|
661 CRYPTPROTECT_VERIFY_PROTECTION = 0x40 |
|
662 CRYPTPROTECT_CRED_REGENERATE = 0x80 |
|
663 |
|
664 /* Flags for CryptProtectPromptStruct */ |
|
665 CRYPTPROTECT_PROMPT_ON_UNPROTECT = 1 |
|
666 CRYPTPROTECT_PROMPT_ON_PROTECT = 2 |
|
667 CRYPTPROTECT_PROMPT_RESERVED = 4 |
|
668 CRYPTPROTECT_PROMPT_STRONG = 8 |
|
669 CRYPTPROTECT_PROMPT_REQUIRE_STRONG = 16 |
|
670 ) |
|
671 |
|
672 const ( |
|
673 // flags for SetErrorMode |
|
674 SEM_FAILCRITICALERRORS = 0x0001 |
|
675 SEM_NOALIGNMENTFAULTEXCEPT = 0x0004 |
|
676 SEM_NOGPFAULTERRORBOX = 0x0002 |
|
677 SEM_NOOPENFILEERRORBOX = 0x8000 |
|
678 ) |
|
679 |
|
680 const ( |
|
681 // Priority class. |
|
682 ABOVE_NORMAL_PRIORITY_CLASS = 0x00008000 |
|
683 BELOW_NORMAL_PRIORITY_CLASS = 0x00004000 |
|
684 HIGH_PRIORITY_CLASS = 0x00000080 |
|
685 IDLE_PRIORITY_CLASS = 0x00000040 |
|
686 NORMAL_PRIORITY_CLASS = 0x00000020 |
|
687 PROCESS_MODE_BACKGROUND_BEGIN = 0x00100000 |
|
688 PROCESS_MODE_BACKGROUND_END = 0x00200000 |
|
689 REALTIME_PRIORITY_CLASS = 0x00000100 |
|
690 ) |
|
691 |
|
692 /* wintrust.h constants for WinVerifyTrustEx */ |
|
693 const ( |
|
694 WTD_UI_ALL = 1 |
|
695 WTD_UI_NONE = 2 |
|
696 WTD_UI_NOBAD = 3 |
|
697 WTD_UI_NOGOOD = 4 |
|
698 |
|
699 WTD_REVOKE_NONE = 0 |
|
700 WTD_REVOKE_WHOLECHAIN = 1 |
|
701 |
|
702 WTD_CHOICE_FILE = 1 |
|
703 WTD_CHOICE_CATALOG = 2 |
|
704 WTD_CHOICE_BLOB = 3 |
|
705 WTD_CHOICE_SIGNER = 4 |
|
706 WTD_CHOICE_CERT = 5 |
|
707 |
|
708 WTD_STATEACTION_IGNORE = 0x00000000 |
|
709 WTD_STATEACTION_VERIFY = 0x00000001 |
|
710 WTD_STATEACTION_CLOSE = 0x00000002 |
|
711 WTD_STATEACTION_AUTO_CACHE = 0x00000003 |
|
712 WTD_STATEACTION_AUTO_CACHE_FLUSH = 0x00000004 |
|
713 |
|
714 WTD_USE_IE4_TRUST_FLAG = 0x1 |
|
715 WTD_NO_IE4_CHAIN_FLAG = 0x2 |
|
716 WTD_NO_POLICY_USAGE_FLAG = 0x4 |
|
717 WTD_REVOCATION_CHECK_NONE = 0x10 |
|
718 WTD_REVOCATION_CHECK_END_CERT = 0x20 |
|
719 WTD_REVOCATION_CHECK_CHAIN = 0x40 |
|
720 WTD_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT = 0x80 |
|
721 WTD_SAFER_FLAG = 0x100 |
|
722 WTD_HASH_ONLY_FLAG = 0x200 |
|
723 WTD_USE_DEFAULT_OSVER_CHECK = 0x400 |
|
724 WTD_LIFETIME_SIGNING_FLAG = 0x800 |
|
725 WTD_CACHE_ONLY_URL_RETRIEVAL = 0x1000 |
|
726 WTD_DISABLE_MD2_MD4 = 0x2000 |
|
727 WTD_MOTW = 0x4000 |
|
728 |
|
729 WTD_UICONTEXT_EXECUTE = 0 |
|
730 WTD_UICONTEXT_INSTALL = 1 |
|
731 ) |
|
732 |
|
733 var ( |
|
734 OID_PKIX_KP_SERVER_AUTH = []byte("1.3.6.1.5.5.7.3.1\x00") |
|
735 OID_SERVER_GATED_CRYPTO = []byte("1.3.6.1.4.1.311.10.3.3\x00") |
|
736 OID_SGC_NETSCAPE = []byte("2.16.840.1.113730.4.1\x00") |
|
737 |
|
738 WINTRUST_ACTION_GENERIC_VERIFY_V2 = GUID{ |
|
739 Data1: 0xaac56b, |
|
740 Data2: 0xcd44, |
|
741 Data3: 0x11d0, |
|
742 Data4: [8]byte{0x8c, 0xc2, 0x0, 0xc0, 0x4f, 0xc2, 0x95, 0xee}, |
|
743 } |
|
744 ) |
|
745 |
|
746 // Pointer represents a pointer to an arbitrary Windows type. |
|
747 // |
|
748 // Pointer-typed fields may point to one of many different types. It's |
|
749 // up to the caller to provide a pointer to the appropriate type, cast |
|
750 // to Pointer. The caller must obey the unsafe.Pointer rules while |
|
751 // doing so. |
|
752 type Pointer *struct{} |
|
753 |
|
754 // Invented values to support what package os expects. |
|
755 type Timeval struct { |
|
756 Sec int32 |
|
757 Usec int32 |
|
758 } |
|
759 |
|
760 func (tv *Timeval) Nanoseconds() int64 { |
|
761 return (int64(tv.Sec)*1e6 + int64(tv.Usec)) * 1e3 |
|
762 } |
|
763 |
|
764 func NsecToTimeval(nsec int64) (tv Timeval) { |
|
765 tv.Sec = int32(nsec / 1e9) |
|
766 tv.Usec = int32(nsec % 1e9 / 1e3) |
|
767 return |
|
768 } |
|
769 |
|
770 type Overlapped struct { |
|
771 Internal uintptr |
|
772 InternalHigh uintptr |
|
773 Offset uint32 |
|
774 OffsetHigh uint32 |
|
775 HEvent Handle |
|
776 } |
|
777 |
|
778 type FileNotifyInformation struct { |
|
779 NextEntryOffset uint32 |
|
780 Action uint32 |
|
781 FileNameLength uint32 |
|
782 FileName uint16 |
|
783 } |
|
784 |
|
785 type Filetime struct { |
|
786 LowDateTime uint32 |
|
787 HighDateTime uint32 |
|
788 } |
|
789 |
|
790 // Nanoseconds returns Filetime ft in nanoseconds |
|
791 // since Epoch (00:00:00 UTC, January 1, 1970). |
|
792 func (ft *Filetime) Nanoseconds() int64 { |
|
793 // 100-nanosecond intervals since January 1, 1601 |
|
794 nsec := int64(ft.HighDateTime)<<32 + int64(ft.LowDateTime) |
|
795 // change starting time to the Epoch (00:00:00 UTC, January 1, 1970) |
|
796 nsec -= 116444736000000000 |
|
797 // convert into nanoseconds |
|
798 nsec *= 100 |
|
799 return nsec |
|
800 } |
|
801 |
|
802 func NsecToFiletime(nsec int64) (ft Filetime) { |
|
803 // convert into 100-nanosecond |
|
804 nsec /= 100 |
|
805 // change starting time to January 1, 1601 |
|
806 nsec += 116444736000000000 |
|
807 // split into high / low |
|
808 ft.LowDateTime = uint32(nsec & 0xffffffff) |
|
809 ft.HighDateTime = uint32(nsec >> 32 & 0xffffffff) |
|
810 return ft |
|
811 } |
|
812 |
|
813 type Win32finddata struct { |
|
814 FileAttributes uint32 |
|
815 CreationTime Filetime |
|
816 LastAccessTime Filetime |
|
817 LastWriteTime Filetime |
|
818 FileSizeHigh uint32 |
|
819 FileSizeLow uint32 |
|
820 Reserved0 uint32 |
|
821 Reserved1 uint32 |
|
822 FileName [MAX_PATH - 1]uint16 |
|
823 AlternateFileName [13]uint16 |
|
824 } |
|
825 |
|
826 // This is the actual system call structure. |
|
827 // Win32finddata is what we committed to in Go 1. |
|
828 type win32finddata1 struct { |
|
829 FileAttributes uint32 |
|
830 CreationTime Filetime |
|
831 LastAccessTime Filetime |
|
832 LastWriteTime Filetime |
|
833 FileSizeHigh uint32 |
|
834 FileSizeLow uint32 |
|
835 Reserved0 uint32 |
|
836 Reserved1 uint32 |
|
837 FileName [MAX_PATH]uint16 |
|
838 AlternateFileName [14]uint16 |
|
839 |
|
840 // The Microsoft documentation for this struct¹ describes three additional |
|
841 // fields: dwFileType, dwCreatorType, and wFinderFlags. However, those fields |
|
842 // are empirically only present in the macOS port of the Win32 API,² and thus |
|
843 // not needed for binaries built for Windows. |
|
844 // |
|
845 // ¹ https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-win32_find_dataw describe |
|
846 // ² https://golang.org/issue/42637#issuecomment-760715755. |
|
847 } |
|
848 |
|
849 func copyFindData(dst *Win32finddata, src *win32finddata1) { |
|
850 dst.FileAttributes = src.FileAttributes |
|
851 dst.CreationTime = src.CreationTime |
|
852 dst.LastAccessTime = src.LastAccessTime |
|
853 dst.LastWriteTime = src.LastWriteTime |
|
854 dst.FileSizeHigh = src.FileSizeHigh |
|
855 dst.FileSizeLow = src.FileSizeLow |
|
856 dst.Reserved0 = src.Reserved0 |
|
857 dst.Reserved1 = src.Reserved1 |
|
858 |
|
859 // The src is 1 element bigger than dst, but it must be NUL. |
|
860 copy(dst.FileName[:], src.FileName[:]) |
|
861 copy(dst.AlternateFileName[:], src.AlternateFileName[:]) |
|
862 } |
|
863 |
|
864 type ByHandleFileInformation struct { |
|
865 FileAttributes uint32 |
|
866 CreationTime Filetime |
|
867 LastAccessTime Filetime |
|
868 LastWriteTime Filetime |
|
869 VolumeSerialNumber uint32 |
|
870 FileSizeHigh uint32 |
|
871 FileSizeLow uint32 |
|
872 NumberOfLinks uint32 |
|
873 FileIndexHigh uint32 |
|
874 FileIndexLow uint32 |
|
875 } |
|
876 |
|
877 const ( |
|
878 GetFileExInfoStandard = 0 |
|
879 GetFileExMaxInfoLevel = 1 |
|
880 ) |
|
881 |
|
882 type Win32FileAttributeData struct { |
|
883 FileAttributes uint32 |
|
884 CreationTime Filetime |
|
885 LastAccessTime Filetime |
|
886 LastWriteTime Filetime |
|
887 FileSizeHigh uint32 |
|
888 FileSizeLow uint32 |
|
889 } |
|
890 |
|
891 // ShowWindow constants |
|
892 const ( |
|
893 // winuser.h |
|
894 SW_HIDE = 0 |
|
895 SW_NORMAL = 1 |
|
896 SW_SHOWNORMAL = 1 |
|
897 SW_SHOWMINIMIZED = 2 |
|
898 SW_SHOWMAXIMIZED = 3 |
|
899 SW_MAXIMIZE = 3 |
|
900 SW_SHOWNOACTIVATE = 4 |
|
901 SW_SHOW = 5 |
|
902 SW_MINIMIZE = 6 |
|
903 SW_SHOWMINNOACTIVE = 7 |
|
904 SW_SHOWNA = 8 |
|
905 SW_RESTORE = 9 |
|
906 SW_SHOWDEFAULT = 10 |
|
907 SW_FORCEMINIMIZE = 11 |
|
908 ) |
|
909 |
|
910 type StartupInfo struct { |
|
911 Cb uint32 |
|
912 _ *uint16 |
|
913 Desktop *uint16 |
|
914 Title *uint16 |
|
915 X uint32 |
|
916 Y uint32 |
|
917 XSize uint32 |
|
918 YSize uint32 |
|
919 XCountChars uint32 |
|
920 YCountChars uint32 |
|
921 FillAttribute uint32 |
|
922 Flags uint32 |
|
923 ShowWindow uint16 |
|
924 _ uint16 |
|
925 _ *byte |
|
926 StdInput Handle |
|
927 StdOutput Handle |
|
928 StdErr Handle |
|
929 } |
|
930 |
|
931 type StartupInfoEx struct { |
|
932 StartupInfo |
|
933 ProcThreadAttributeList *ProcThreadAttributeList |
|
934 } |
|
935 |
|
936 // ProcThreadAttributeList is a placeholder type to represent a PROC_THREAD_ATTRIBUTE_LIST. |
|
937 // |
|
938 // To create a *ProcThreadAttributeList, use NewProcThreadAttributeList, update |
|
939 // it with ProcThreadAttributeListContainer.Update, free its memory using |
|
940 // ProcThreadAttributeListContainer.Delete, and access the list itself using |
|
941 // ProcThreadAttributeListContainer.List. |
|
942 type ProcThreadAttributeList struct{} |
|
943 |
|
944 type ProcThreadAttributeListContainer struct { |
|
945 data *ProcThreadAttributeList |
|
946 pointers []unsafe.Pointer |
|
947 } |
|
948 |
|
949 type ProcessInformation struct { |
|
950 Process Handle |
|
951 Thread Handle |
|
952 ProcessId uint32 |
|
953 ThreadId uint32 |
|
954 } |
|
955 |
|
956 type ProcessEntry32 struct { |
|
957 Size uint32 |
|
958 Usage uint32 |
|
959 ProcessID uint32 |
|
960 DefaultHeapID uintptr |
|
961 ModuleID uint32 |
|
962 Threads uint32 |
|
963 ParentProcessID uint32 |
|
964 PriClassBase int32 |
|
965 Flags uint32 |
|
966 ExeFile [MAX_PATH]uint16 |
|
967 } |
|
968 |
|
969 type ThreadEntry32 struct { |
|
970 Size uint32 |
|
971 Usage uint32 |
|
972 ThreadID uint32 |
|
973 OwnerProcessID uint32 |
|
974 BasePri int32 |
|
975 DeltaPri int32 |
|
976 Flags uint32 |
|
977 } |
|
978 |
|
979 type ModuleEntry32 struct { |
|
980 Size uint32 |
|
981 ModuleID uint32 |
|
982 ProcessID uint32 |
|
983 GlblcntUsage uint32 |
|
984 ProccntUsage uint32 |
|
985 ModBaseAddr uintptr |
|
986 ModBaseSize uint32 |
|
987 ModuleHandle Handle |
|
988 Module [MAX_MODULE_NAME32 + 1]uint16 |
|
989 ExePath [MAX_PATH]uint16 |
|
990 } |
|
991 |
|
992 const SizeofModuleEntry32 = unsafe.Sizeof(ModuleEntry32{}) |
|
993 |
|
994 type Systemtime struct { |
|
995 Year uint16 |
|
996 Month uint16 |
|
997 DayOfWeek uint16 |
|
998 Day uint16 |
|
999 Hour uint16 |
|
1000 Minute uint16 |
|
1001 Second uint16 |
|
1002 Milliseconds uint16 |
|
1003 } |
|
1004 |
|
1005 type Timezoneinformation struct { |
|
1006 Bias int32 |
|
1007 StandardName [32]uint16 |
|
1008 StandardDate Systemtime |
|
1009 StandardBias int32 |
|
1010 DaylightName [32]uint16 |
|
1011 DaylightDate Systemtime |
|
1012 DaylightBias int32 |
|
1013 } |
|
1014 |
|
1015 // Socket related. |
|
1016 |
|
1017 const ( |
|
1018 AF_UNSPEC = 0 |
|
1019 AF_UNIX = 1 |
|
1020 AF_INET = 2 |
|
1021 AF_NETBIOS = 17 |
|
1022 AF_INET6 = 23 |
|
1023 AF_IRDA = 26 |
|
1024 AF_BTH = 32 |
|
1025 |
|
1026 SOCK_STREAM = 1 |
|
1027 SOCK_DGRAM = 2 |
|
1028 SOCK_RAW = 3 |
|
1029 SOCK_RDM = 4 |
|
1030 SOCK_SEQPACKET = 5 |
|
1031 |
|
1032 IPPROTO_IP = 0 |
|
1033 IPPROTO_ICMP = 1 |
|
1034 IPPROTO_IGMP = 2 |
|
1035 BTHPROTO_RFCOMM = 3 |
|
1036 IPPROTO_TCP = 6 |
|
1037 IPPROTO_UDP = 17 |
|
1038 IPPROTO_IPV6 = 41 |
|
1039 IPPROTO_ICMPV6 = 58 |
|
1040 IPPROTO_RM = 113 |
|
1041 |
|
1042 SOL_SOCKET = 0xffff |
|
1043 SO_REUSEADDR = 4 |
|
1044 SO_KEEPALIVE = 8 |
|
1045 SO_DONTROUTE = 16 |
|
1046 SO_BROADCAST = 32 |
|
1047 SO_LINGER = 128 |
|
1048 SO_RCVBUF = 0x1002 |
|
1049 SO_RCVTIMEO = 0x1006 |
|
1050 SO_SNDBUF = 0x1001 |
|
1051 SO_UPDATE_ACCEPT_CONTEXT = 0x700b |
|
1052 SO_UPDATE_CONNECT_CONTEXT = 0x7010 |
|
1053 |
|
1054 IOC_OUT = 0x40000000 |
|
1055 IOC_IN = 0x80000000 |
|
1056 IOC_VENDOR = 0x18000000 |
|
1057 IOC_INOUT = IOC_IN | IOC_OUT |
|
1058 IOC_WS2 = 0x08000000 |
|
1059 SIO_GET_EXTENSION_FUNCTION_POINTER = IOC_INOUT | IOC_WS2 | 6 |
|
1060 SIO_KEEPALIVE_VALS = IOC_IN | IOC_VENDOR | 4 |
|
1061 SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12 |
|
1062 |
|
1063 // cf. http://support.microsoft.com/default.aspx?scid=kb;en-us;257460 |
|
1064 |
|
1065 IP_HDRINCL = 0x2 |
|
1066 IP_TOS = 0x3 |
|
1067 IP_TTL = 0x4 |
|
1068 IP_MULTICAST_IF = 0x9 |
|
1069 IP_MULTICAST_TTL = 0xa |
|
1070 IP_MULTICAST_LOOP = 0xb |
|
1071 IP_ADD_MEMBERSHIP = 0xc |
|
1072 IP_DROP_MEMBERSHIP = 0xd |
|
1073 IP_PKTINFO = 0x13 |
|
1074 |
|
1075 IPV6_V6ONLY = 0x1b |
|
1076 IPV6_UNICAST_HOPS = 0x4 |
|
1077 IPV6_MULTICAST_IF = 0x9 |
|
1078 IPV6_MULTICAST_HOPS = 0xa |
|
1079 IPV6_MULTICAST_LOOP = 0xb |
|
1080 IPV6_JOIN_GROUP = 0xc |
|
1081 IPV6_LEAVE_GROUP = 0xd |
|
1082 IPV6_PKTINFO = 0x13 |
|
1083 |
|
1084 MSG_OOB = 0x1 |
|
1085 MSG_PEEK = 0x2 |
|
1086 MSG_DONTROUTE = 0x4 |
|
1087 MSG_WAITALL = 0x8 |
|
1088 |
|
1089 MSG_TRUNC = 0x0100 |
|
1090 MSG_CTRUNC = 0x0200 |
|
1091 MSG_BCAST = 0x0400 |
|
1092 MSG_MCAST = 0x0800 |
|
1093 |
|
1094 SOMAXCONN = 0x7fffffff |
|
1095 |
|
1096 TCP_NODELAY = 1 |
|
1097 |
|
1098 SHUT_RD = 0 |
|
1099 SHUT_WR = 1 |
|
1100 SHUT_RDWR = 2 |
|
1101 |
|
1102 WSADESCRIPTION_LEN = 256 |
|
1103 WSASYS_STATUS_LEN = 128 |
|
1104 ) |
|
1105 |
|
1106 type WSABuf struct { |
|
1107 Len uint32 |
|
1108 Buf *byte |
|
1109 } |
|
1110 |
|
1111 type WSAMsg struct { |
|
1112 Name *syscall.RawSockaddrAny |
|
1113 Namelen int32 |
|
1114 Buffers *WSABuf |
|
1115 BufferCount uint32 |
|
1116 Control WSABuf |
|
1117 Flags uint32 |
|
1118 } |
|
1119 |
|
1120 // Flags for WSASocket |
|
1121 const ( |
|
1122 WSA_FLAG_OVERLAPPED = 0x01 |
|
1123 WSA_FLAG_MULTIPOINT_C_ROOT = 0x02 |
|
1124 WSA_FLAG_MULTIPOINT_C_LEAF = 0x04 |
|
1125 WSA_FLAG_MULTIPOINT_D_ROOT = 0x08 |
|
1126 WSA_FLAG_MULTIPOINT_D_LEAF = 0x10 |
|
1127 WSA_FLAG_ACCESS_SYSTEM_SECURITY = 0x40 |
|
1128 WSA_FLAG_NO_HANDLE_INHERIT = 0x80 |
|
1129 WSA_FLAG_REGISTERED_IO = 0x100 |
|
1130 ) |
|
1131 |
|
1132 // Invented values to support what package os expects. |
|
1133 const ( |
|
1134 S_IFMT = 0x1f000 |
|
1135 S_IFIFO = 0x1000 |
|
1136 S_IFCHR = 0x2000 |
|
1137 S_IFDIR = 0x4000 |
|
1138 S_IFBLK = 0x6000 |
|
1139 S_IFREG = 0x8000 |
|
1140 S_IFLNK = 0xa000 |
|
1141 S_IFSOCK = 0xc000 |
|
1142 S_ISUID = 0x800 |
|
1143 S_ISGID = 0x400 |
|
1144 S_ISVTX = 0x200 |
|
1145 S_IRUSR = 0x100 |
|
1146 S_IWRITE = 0x80 |
|
1147 S_IWUSR = 0x80 |
|
1148 S_IXUSR = 0x40 |
|
1149 ) |
|
1150 |
|
1151 const ( |
|
1152 FILE_TYPE_CHAR = 0x0002 |
|
1153 FILE_TYPE_DISK = 0x0001 |
|
1154 FILE_TYPE_PIPE = 0x0003 |
|
1155 FILE_TYPE_REMOTE = 0x8000 |
|
1156 FILE_TYPE_UNKNOWN = 0x0000 |
|
1157 ) |
|
1158 |
|
1159 type Hostent struct { |
|
1160 Name *byte |
|
1161 Aliases **byte |
|
1162 AddrType uint16 |
|
1163 Length uint16 |
|
1164 AddrList **byte |
|
1165 } |
|
1166 |
|
1167 type Protoent struct { |
|
1168 Name *byte |
|
1169 Aliases **byte |
|
1170 Proto uint16 |
|
1171 } |
|
1172 |
|
1173 const ( |
|
1174 DNS_TYPE_A = 0x0001 |
|
1175 DNS_TYPE_NS = 0x0002 |
|
1176 DNS_TYPE_MD = 0x0003 |
|
1177 DNS_TYPE_MF = 0x0004 |
|
1178 DNS_TYPE_CNAME = 0x0005 |
|
1179 DNS_TYPE_SOA = 0x0006 |
|
1180 DNS_TYPE_MB = 0x0007 |
|
1181 DNS_TYPE_MG = 0x0008 |
|
1182 DNS_TYPE_MR = 0x0009 |
|
1183 DNS_TYPE_NULL = 0x000a |
|
1184 DNS_TYPE_WKS = 0x000b |
|
1185 DNS_TYPE_PTR = 0x000c |
|
1186 DNS_TYPE_HINFO = 0x000d |
|
1187 DNS_TYPE_MINFO = 0x000e |
|
1188 DNS_TYPE_MX = 0x000f |
|
1189 DNS_TYPE_TEXT = 0x0010 |
|
1190 DNS_TYPE_RP = 0x0011 |
|
1191 DNS_TYPE_AFSDB = 0x0012 |
|
1192 DNS_TYPE_X25 = 0x0013 |
|
1193 DNS_TYPE_ISDN = 0x0014 |
|
1194 DNS_TYPE_RT = 0x0015 |
|
1195 DNS_TYPE_NSAP = 0x0016 |
|
1196 DNS_TYPE_NSAPPTR = 0x0017 |
|
1197 DNS_TYPE_SIG = 0x0018 |
|
1198 DNS_TYPE_KEY = 0x0019 |
|
1199 DNS_TYPE_PX = 0x001a |
|
1200 DNS_TYPE_GPOS = 0x001b |
|
1201 DNS_TYPE_AAAA = 0x001c |
|
1202 DNS_TYPE_LOC = 0x001d |
|
1203 DNS_TYPE_NXT = 0x001e |
|
1204 DNS_TYPE_EID = 0x001f |
|
1205 DNS_TYPE_NIMLOC = 0x0020 |
|
1206 DNS_TYPE_SRV = 0x0021 |
|
1207 DNS_TYPE_ATMA = 0x0022 |
|
1208 DNS_TYPE_NAPTR = 0x0023 |
|
1209 DNS_TYPE_KX = 0x0024 |
|
1210 DNS_TYPE_CERT = 0x0025 |
|
1211 DNS_TYPE_A6 = 0x0026 |
|
1212 DNS_TYPE_DNAME = 0x0027 |
|
1213 DNS_TYPE_SINK = 0x0028 |
|
1214 DNS_TYPE_OPT = 0x0029 |
|
1215 DNS_TYPE_DS = 0x002B |
|
1216 DNS_TYPE_RRSIG = 0x002E |
|
1217 DNS_TYPE_NSEC = 0x002F |
|
1218 DNS_TYPE_DNSKEY = 0x0030 |
|
1219 DNS_TYPE_DHCID = 0x0031 |
|
1220 DNS_TYPE_UINFO = 0x0064 |
|
1221 DNS_TYPE_UID = 0x0065 |
|
1222 DNS_TYPE_GID = 0x0066 |
|
1223 DNS_TYPE_UNSPEC = 0x0067 |
|
1224 DNS_TYPE_ADDRS = 0x00f8 |
|
1225 DNS_TYPE_TKEY = 0x00f9 |
|
1226 DNS_TYPE_TSIG = 0x00fa |
|
1227 DNS_TYPE_IXFR = 0x00fb |
|
1228 DNS_TYPE_AXFR = 0x00fc |
|
1229 DNS_TYPE_MAILB = 0x00fd |
|
1230 DNS_TYPE_MAILA = 0x00fe |
|
1231 DNS_TYPE_ALL = 0x00ff |
|
1232 DNS_TYPE_ANY = 0x00ff |
|
1233 DNS_TYPE_WINS = 0xff01 |
|
1234 DNS_TYPE_WINSR = 0xff02 |
|
1235 DNS_TYPE_NBSTAT = 0xff01 |
|
1236 ) |
|
1237 |
|
1238 const ( |
|
1239 // flags inside DNSRecord.Dw |
|
1240 DnsSectionQuestion = 0x0000 |
|
1241 DnsSectionAnswer = 0x0001 |
|
1242 DnsSectionAuthority = 0x0002 |
|
1243 DnsSectionAdditional = 0x0003 |
|
1244 ) |
|
1245 |
|
1246 type DNSSRVData struct { |
|
1247 Target *uint16 |
|
1248 Priority uint16 |
|
1249 Weight uint16 |
|
1250 Port uint16 |
|
1251 Pad uint16 |
|
1252 } |
|
1253 |
|
1254 type DNSPTRData struct { |
|
1255 Host *uint16 |
|
1256 } |
|
1257 |
|
1258 type DNSMXData struct { |
|
1259 NameExchange *uint16 |
|
1260 Preference uint16 |
|
1261 Pad uint16 |
|
1262 } |
|
1263 |
|
1264 type DNSTXTData struct { |
|
1265 StringCount uint16 |
|
1266 StringArray [1]*uint16 |
|
1267 } |
|
1268 |
|
1269 type DNSRecord struct { |
|
1270 Next *DNSRecord |
|
1271 Name *uint16 |
|
1272 Type uint16 |
|
1273 Length uint16 |
|
1274 Dw uint32 |
|
1275 Ttl uint32 |
|
1276 Reserved uint32 |
|
1277 Data [40]byte |
|
1278 } |
|
1279 |
|
1280 const ( |
|
1281 TF_DISCONNECT = 1 |
|
1282 TF_REUSE_SOCKET = 2 |
|
1283 TF_WRITE_BEHIND = 4 |
|
1284 TF_USE_DEFAULT_WORKER = 0 |
|
1285 TF_USE_SYSTEM_THREAD = 16 |
|
1286 TF_USE_KERNEL_APC = 32 |
|
1287 ) |
|
1288 |
|
1289 type TransmitFileBuffers struct { |
|
1290 Head uintptr |
|
1291 HeadLength uint32 |
|
1292 Tail uintptr |
|
1293 TailLength uint32 |
|
1294 } |
|
1295 |
|
1296 const ( |
|
1297 IFF_UP = 1 |
|
1298 IFF_BROADCAST = 2 |
|
1299 IFF_LOOPBACK = 4 |
|
1300 IFF_POINTTOPOINT = 8 |
|
1301 IFF_MULTICAST = 16 |
|
1302 ) |
|
1303 |
|
1304 const SIO_GET_INTERFACE_LIST = 0x4004747F |
|
1305 |
|
1306 // TODO(mattn): SockaddrGen is union of sockaddr/sockaddr_in/sockaddr_in6_old. |
|
1307 // will be fixed to change variable type as suitable. |
|
1308 |
|
1309 type SockaddrGen [24]byte |
|
1310 |
|
1311 type InterfaceInfo struct { |
|
1312 Flags uint32 |
|
1313 Address SockaddrGen |
|
1314 BroadcastAddress SockaddrGen |
|
1315 Netmask SockaddrGen |
|
1316 } |
|
1317 |
|
1318 type IpAddressString struct { |
|
1319 String [16]byte |
|
1320 } |
|
1321 |
|
1322 type IpMaskString IpAddressString |
|
1323 |
|
1324 type IpAddrString struct { |
|
1325 Next *IpAddrString |
|
1326 IpAddress IpAddressString |
|
1327 IpMask IpMaskString |
|
1328 Context uint32 |
|
1329 } |
|
1330 |
|
1331 const MAX_ADAPTER_NAME_LENGTH = 256 |
|
1332 const MAX_ADAPTER_DESCRIPTION_LENGTH = 128 |
|
1333 const MAX_ADAPTER_ADDRESS_LENGTH = 8 |
|
1334 |
|
1335 type IpAdapterInfo struct { |
|
1336 Next *IpAdapterInfo |
|
1337 ComboIndex uint32 |
|
1338 AdapterName [MAX_ADAPTER_NAME_LENGTH + 4]byte |
|
1339 Description [MAX_ADAPTER_DESCRIPTION_LENGTH + 4]byte |
|
1340 AddressLength uint32 |
|
1341 Address [MAX_ADAPTER_ADDRESS_LENGTH]byte |
|
1342 Index uint32 |
|
1343 Type uint32 |
|
1344 DhcpEnabled uint32 |
|
1345 CurrentIpAddress *IpAddrString |
|
1346 IpAddressList IpAddrString |
|
1347 GatewayList IpAddrString |
|
1348 DhcpServer IpAddrString |
|
1349 HaveWins bool |
|
1350 PrimaryWinsServer IpAddrString |
|
1351 SecondaryWinsServer IpAddrString |
|
1352 LeaseObtained int64 |
|
1353 LeaseExpires int64 |
|
1354 } |
|
1355 |
|
1356 const MAXLEN_PHYSADDR = 8 |
|
1357 const MAX_INTERFACE_NAME_LEN = 256 |
|
1358 const MAXLEN_IFDESCR = 256 |
|
1359 |
|
1360 type MibIfRow struct { |
|
1361 Name [MAX_INTERFACE_NAME_LEN]uint16 |
|
1362 Index uint32 |
|
1363 Type uint32 |
|
1364 Mtu uint32 |
|
1365 Speed uint32 |
|
1366 PhysAddrLen uint32 |
|
1367 PhysAddr [MAXLEN_PHYSADDR]byte |
|
1368 AdminStatus uint32 |
|
1369 OperStatus uint32 |
|
1370 LastChange uint32 |
|
1371 InOctets uint32 |
|
1372 InUcastPkts uint32 |
|
1373 InNUcastPkts uint32 |
|
1374 InDiscards uint32 |
|
1375 InErrors uint32 |
|
1376 InUnknownProtos uint32 |
|
1377 OutOctets uint32 |
|
1378 OutUcastPkts uint32 |
|
1379 OutNUcastPkts uint32 |
|
1380 OutDiscards uint32 |
|
1381 OutErrors uint32 |
|
1382 OutQLen uint32 |
|
1383 DescrLen uint32 |
|
1384 Descr [MAXLEN_IFDESCR]byte |
|
1385 } |
|
1386 |
|
1387 type CertInfo struct { |
|
1388 Version uint32 |
|
1389 SerialNumber CryptIntegerBlob |
|
1390 SignatureAlgorithm CryptAlgorithmIdentifier |
|
1391 Issuer CertNameBlob |
|
1392 NotBefore Filetime |
|
1393 NotAfter Filetime |
|
1394 Subject CertNameBlob |
|
1395 SubjectPublicKeyInfo CertPublicKeyInfo |
|
1396 IssuerUniqueId CryptBitBlob |
|
1397 SubjectUniqueId CryptBitBlob |
|
1398 CountExtensions uint32 |
|
1399 Extensions *CertExtension |
|
1400 } |
|
1401 |
|
1402 type CertExtension struct { |
|
1403 ObjId *byte |
|
1404 Critical int32 |
|
1405 Value CryptObjidBlob |
|
1406 } |
|
1407 |
|
1408 type CryptAlgorithmIdentifier struct { |
|
1409 ObjId *byte |
|
1410 Parameters CryptObjidBlob |
|
1411 } |
|
1412 |
|
1413 type CertPublicKeyInfo struct { |
|
1414 Algorithm CryptAlgorithmIdentifier |
|
1415 PublicKey CryptBitBlob |
|
1416 } |
|
1417 |
|
1418 type DataBlob struct { |
|
1419 Size uint32 |
|
1420 Data *byte |
|
1421 } |
|
1422 type CryptIntegerBlob DataBlob |
|
1423 type CryptUintBlob DataBlob |
|
1424 type CryptObjidBlob DataBlob |
|
1425 type CertNameBlob DataBlob |
|
1426 type CertRdnValueBlob DataBlob |
|
1427 type CertBlob DataBlob |
|
1428 type CrlBlob DataBlob |
|
1429 type CryptDataBlob DataBlob |
|
1430 type CryptHashBlob DataBlob |
|
1431 type CryptDigestBlob DataBlob |
|
1432 type CryptDerBlob DataBlob |
|
1433 type CryptAttrBlob DataBlob |
|
1434 |
|
1435 type CryptBitBlob struct { |
|
1436 Size uint32 |
|
1437 Data *byte |
|
1438 UnusedBits uint32 |
|
1439 } |
|
1440 |
|
1441 type CertContext struct { |
|
1442 EncodingType uint32 |
|
1443 EncodedCert *byte |
|
1444 Length uint32 |
|
1445 CertInfo *CertInfo |
|
1446 Store Handle |
|
1447 } |
|
1448 |
|
1449 type CertChainContext struct { |
|
1450 Size uint32 |
|
1451 TrustStatus CertTrustStatus |
|
1452 ChainCount uint32 |
|
1453 Chains **CertSimpleChain |
|
1454 LowerQualityChainCount uint32 |
|
1455 LowerQualityChains **CertChainContext |
|
1456 HasRevocationFreshnessTime uint32 |
|
1457 RevocationFreshnessTime uint32 |
|
1458 } |
|
1459 |
|
1460 type CertTrustListInfo struct { |
|
1461 // Not implemented |
|
1462 } |
|
1463 |
|
1464 type CertSimpleChain struct { |
|
1465 Size uint32 |
|
1466 TrustStatus CertTrustStatus |
|
1467 NumElements uint32 |
|
1468 Elements **CertChainElement |
|
1469 TrustListInfo *CertTrustListInfo |
|
1470 HasRevocationFreshnessTime uint32 |
|
1471 RevocationFreshnessTime uint32 |
|
1472 } |
|
1473 |
|
1474 type CertChainElement struct { |
|
1475 Size uint32 |
|
1476 CertContext *CertContext |
|
1477 TrustStatus CertTrustStatus |
|
1478 RevocationInfo *CertRevocationInfo |
|
1479 IssuanceUsage *CertEnhKeyUsage |
|
1480 ApplicationUsage *CertEnhKeyUsage |
|
1481 ExtendedErrorInfo *uint16 |
|
1482 } |
|
1483 |
|
1484 type CertRevocationCrlInfo struct { |
|
1485 // Not implemented |
|
1486 } |
|
1487 |
|
1488 type CertRevocationInfo struct { |
|
1489 Size uint32 |
|
1490 RevocationResult uint32 |
|
1491 RevocationOid *byte |
|
1492 OidSpecificInfo Pointer |
|
1493 HasFreshnessTime uint32 |
|
1494 FreshnessTime uint32 |
|
1495 CrlInfo *CertRevocationCrlInfo |
|
1496 } |
|
1497 |
|
1498 type CertTrustStatus struct { |
|
1499 ErrorStatus uint32 |
|
1500 InfoStatus uint32 |
|
1501 } |
|
1502 |
|
1503 type CertUsageMatch struct { |
|
1504 Type uint32 |
|
1505 Usage CertEnhKeyUsage |
|
1506 } |
|
1507 |
|
1508 type CertEnhKeyUsage struct { |
|
1509 Length uint32 |
|
1510 UsageIdentifiers **byte |
|
1511 } |
|
1512 |
|
1513 type CertChainPara struct { |
|
1514 Size uint32 |
|
1515 RequestedUsage CertUsageMatch |
|
1516 RequstedIssuancePolicy CertUsageMatch |
|
1517 URLRetrievalTimeout uint32 |
|
1518 CheckRevocationFreshnessTime uint32 |
|
1519 RevocationFreshnessTime uint32 |
|
1520 CacheResync *Filetime |
|
1521 } |
|
1522 |
|
1523 type CertChainPolicyPara struct { |
|
1524 Size uint32 |
|
1525 Flags uint32 |
|
1526 ExtraPolicyPara Pointer |
|
1527 } |
|
1528 |
|
1529 type SSLExtraCertChainPolicyPara struct { |
|
1530 Size uint32 |
|
1531 AuthType uint32 |
|
1532 Checks uint32 |
|
1533 ServerName *uint16 |
|
1534 } |
|
1535 |
|
1536 type CertChainPolicyStatus struct { |
|
1537 Size uint32 |
|
1538 Error uint32 |
|
1539 ChainIndex uint32 |
|
1540 ElementIndex uint32 |
|
1541 ExtraPolicyStatus Pointer |
|
1542 } |
|
1543 |
|
1544 type CertPolicyInfo struct { |
|
1545 Identifier *byte |
|
1546 CountQualifiers uint32 |
|
1547 Qualifiers *CertPolicyQualifierInfo |
|
1548 } |
|
1549 |
|
1550 type CertPoliciesInfo struct { |
|
1551 Count uint32 |
|
1552 PolicyInfos *CertPolicyInfo |
|
1553 } |
|
1554 |
|
1555 type CertPolicyQualifierInfo struct { |
|
1556 // Not implemented |
|
1557 } |
|
1558 |
|
1559 type CertStrongSignPara struct { |
|
1560 Size uint32 |
|
1561 InfoChoice uint32 |
|
1562 InfoOrSerializedInfoOrOID unsafe.Pointer |
|
1563 } |
|
1564 |
|
1565 type CryptProtectPromptStruct struct { |
|
1566 Size uint32 |
|
1567 PromptFlags uint32 |
|
1568 App HWND |
|
1569 Prompt *uint16 |
|
1570 } |
|
1571 |
|
1572 type CertChainFindByIssuerPara struct { |
|
1573 Size uint32 |
|
1574 UsageIdentifier *byte |
|
1575 KeySpec uint32 |
|
1576 AcquirePrivateKeyFlags uint32 |
|
1577 IssuerCount uint32 |
|
1578 Issuer Pointer |
|
1579 FindCallback Pointer |
|
1580 FindArg Pointer |
|
1581 IssuerChainIndex *uint32 |
|
1582 IssuerElementIndex *uint32 |
|
1583 } |
|
1584 |
|
1585 type WinTrustData struct { |
|
1586 Size uint32 |
|
1587 PolicyCallbackData uintptr |
|
1588 SIPClientData uintptr |
|
1589 UIChoice uint32 |
|
1590 RevocationChecks uint32 |
|
1591 UnionChoice uint32 |
|
1592 FileOrCatalogOrBlobOrSgnrOrCert unsafe.Pointer |
|
1593 StateAction uint32 |
|
1594 StateData Handle |
|
1595 URLReference *uint16 |
|
1596 ProvFlags uint32 |
|
1597 UIContext uint32 |
|
1598 SignatureSettings *WinTrustSignatureSettings |
|
1599 } |
|
1600 |
|
1601 type WinTrustFileInfo struct { |
|
1602 Size uint32 |
|
1603 FilePath *uint16 |
|
1604 File Handle |
|
1605 KnownSubject *GUID |
|
1606 } |
|
1607 |
|
1608 type WinTrustSignatureSettings struct { |
|
1609 Size uint32 |
|
1610 Index uint32 |
|
1611 Flags uint32 |
|
1612 SecondarySigs uint32 |
|
1613 VerifiedSigIndex uint32 |
|
1614 CryptoPolicy *CertStrongSignPara |
|
1615 } |
|
1616 |
|
1617 const ( |
|
1618 // do not reorder |
|
1619 HKEY_CLASSES_ROOT = 0x80000000 + iota |
|
1620 HKEY_CURRENT_USER |
|
1621 HKEY_LOCAL_MACHINE |
|
1622 HKEY_USERS |
|
1623 HKEY_PERFORMANCE_DATA |
|
1624 HKEY_CURRENT_CONFIG |
|
1625 HKEY_DYN_DATA |
|
1626 |
|
1627 KEY_QUERY_VALUE = 1 |
|
1628 KEY_SET_VALUE = 2 |
|
1629 KEY_CREATE_SUB_KEY = 4 |
|
1630 KEY_ENUMERATE_SUB_KEYS = 8 |
|
1631 KEY_NOTIFY = 16 |
|
1632 KEY_CREATE_LINK = 32 |
|
1633 KEY_WRITE = 0x20006 |
|
1634 KEY_EXECUTE = 0x20019 |
|
1635 KEY_READ = 0x20019 |
|
1636 KEY_WOW64_64KEY = 0x0100 |
|
1637 KEY_WOW64_32KEY = 0x0200 |
|
1638 KEY_ALL_ACCESS = 0xf003f |
|
1639 ) |
|
1640 |
|
1641 const ( |
|
1642 // do not reorder |
|
1643 REG_NONE = iota |
|
1644 REG_SZ |
|
1645 REG_EXPAND_SZ |
|
1646 REG_BINARY |
|
1647 REG_DWORD_LITTLE_ENDIAN |
|
1648 REG_DWORD_BIG_ENDIAN |
|
1649 REG_LINK |
|
1650 REG_MULTI_SZ |
|
1651 REG_RESOURCE_LIST |
|
1652 REG_FULL_RESOURCE_DESCRIPTOR |
|
1653 REG_RESOURCE_REQUIREMENTS_LIST |
|
1654 REG_QWORD_LITTLE_ENDIAN |
|
1655 REG_DWORD = REG_DWORD_LITTLE_ENDIAN |
|
1656 REG_QWORD = REG_QWORD_LITTLE_ENDIAN |
|
1657 ) |
|
1658 |
|
1659 const ( |
|
1660 EVENT_MODIFY_STATE = 0x0002 |
|
1661 EVENT_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3 |
|
1662 |
|
1663 MUTANT_QUERY_STATE = 0x0001 |
|
1664 MUTANT_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | MUTANT_QUERY_STATE |
|
1665 |
|
1666 SEMAPHORE_MODIFY_STATE = 0x0002 |
|
1667 SEMAPHORE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3 |
|
1668 |
|
1669 TIMER_QUERY_STATE = 0x0001 |
|
1670 TIMER_MODIFY_STATE = 0x0002 |
|
1671 TIMER_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | TIMER_QUERY_STATE | TIMER_MODIFY_STATE |
|
1672 |
|
1673 MUTEX_MODIFY_STATE = MUTANT_QUERY_STATE |
|
1674 MUTEX_ALL_ACCESS = MUTANT_ALL_ACCESS |
|
1675 |
|
1676 CREATE_EVENT_MANUAL_RESET = 0x1 |
|
1677 CREATE_EVENT_INITIAL_SET = 0x2 |
|
1678 CREATE_MUTEX_INITIAL_OWNER = 0x1 |
|
1679 ) |
|
1680 |
|
1681 type AddrinfoW struct { |
|
1682 Flags int32 |
|
1683 Family int32 |
|
1684 Socktype int32 |
|
1685 Protocol int32 |
|
1686 Addrlen uintptr |
|
1687 Canonname *uint16 |
|
1688 Addr uintptr |
|
1689 Next *AddrinfoW |
|
1690 } |
|
1691 |
|
1692 const ( |
|
1693 AI_PASSIVE = 1 |
|
1694 AI_CANONNAME = 2 |
|
1695 AI_NUMERICHOST = 4 |
|
1696 ) |
|
1697 |
|
1698 type GUID struct { |
|
1699 Data1 uint32 |
|
1700 Data2 uint16 |
|
1701 Data3 uint16 |
|
1702 Data4 [8]byte |
|
1703 } |
|
1704 |
|
1705 var WSAID_CONNECTEX = GUID{ |
|
1706 0x25a207b9, |
|
1707 0xddf3, |
|
1708 0x4660, |
|
1709 [8]byte{0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}, |
|
1710 } |
|
1711 |
|
1712 var WSAID_WSASENDMSG = GUID{ |
|
1713 0xa441e712, |
|
1714 0x754f, |
|
1715 0x43ca, |
|
1716 [8]byte{0x84, 0xa7, 0x0d, 0xee, 0x44, 0xcf, 0x60, 0x6d}, |
|
1717 } |
|
1718 |
|
1719 var WSAID_WSARECVMSG = GUID{ |
|
1720 0xf689d7c8, |
|
1721 0x6f1f, |
|
1722 0x436b, |
|
1723 [8]byte{0x8a, 0x53, 0xe5, 0x4f, 0xe3, 0x51, 0xc3, 0x22}, |
|
1724 } |
|
1725 |
|
1726 const ( |
|
1727 FILE_SKIP_COMPLETION_PORT_ON_SUCCESS = 1 |
|
1728 FILE_SKIP_SET_EVENT_ON_HANDLE = 2 |
|
1729 ) |
|
1730 |
|
1731 const ( |
|
1732 WSAPROTOCOL_LEN = 255 |
|
1733 MAX_PROTOCOL_CHAIN = 7 |
|
1734 BASE_PROTOCOL = 1 |
|
1735 LAYERED_PROTOCOL = 0 |
|
1736 |
|
1737 XP1_CONNECTIONLESS = 0x00000001 |
|
1738 XP1_GUARANTEED_DELIVERY = 0x00000002 |
|
1739 XP1_GUARANTEED_ORDER = 0x00000004 |
|
1740 XP1_MESSAGE_ORIENTED = 0x00000008 |
|
1741 XP1_PSEUDO_STREAM = 0x00000010 |
|
1742 XP1_GRACEFUL_CLOSE = 0x00000020 |
|
1743 XP1_EXPEDITED_DATA = 0x00000040 |
|
1744 XP1_CONNECT_DATA = 0x00000080 |
|
1745 XP1_DISCONNECT_DATA = 0x00000100 |
|
1746 XP1_SUPPORT_BROADCAST = 0x00000200 |
|
1747 XP1_SUPPORT_MULTIPOINT = 0x00000400 |
|
1748 XP1_MULTIPOINT_CONTROL_PLANE = 0x00000800 |
|
1749 XP1_MULTIPOINT_DATA_PLANE = 0x00001000 |
|
1750 XP1_QOS_SUPPORTED = 0x00002000 |
|
1751 XP1_UNI_SEND = 0x00008000 |
|
1752 XP1_UNI_RECV = 0x00010000 |
|
1753 XP1_IFS_HANDLES = 0x00020000 |
|
1754 XP1_PARTIAL_MESSAGE = 0x00040000 |
|
1755 XP1_SAN_SUPPORT_SDP = 0x00080000 |
|
1756 |
|
1757 PFL_MULTIPLE_PROTO_ENTRIES = 0x00000001 |
|
1758 PFL_RECOMMENDED_PROTO_ENTRY = 0x00000002 |
|
1759 PFL_HIDDEN = 0x00000004 |
|
1760 PFL_MATCHES_PROTOCOL_ZERO = 0x00000008 |
|
1761 PFL_NETWORKDIRECT_PROVIDER = 0x00000010 |
|
1762 ) |
|
1763 |
|
1764 type WSAProtocolInfo struct { |
|
1765 ServiceFlags1 uint32 |
|
1766 ServiceFlags2 uint32 |
|
1767 ServiceFlags3 uint32 |
|
1768 ServiceFlags4 uint32 |
|
1769 ProviderFlags uint32 |
|
1770 ProviderId GUID |
|
1771 CatalogEntryId uint32 |
|
1772 ProtocolChain WSAProtocolChain |
|
1773 Version int32 |
|
1774 AddressFamily int32 |
|
1775 MaxSockAddr int32 |
|
1776 MinSockAddr int32 |
|
1777 SocketType int32 |
|
1778 Protocol int32 |
|
1779 ProtocolMaxOffset int32 |
|
1780 NetworkByteOrder int32 |
|
1781 SecurityScheme int32 |
|
1782 MessageSize uint32 |
|
1783 ProviderReserved uint32 |
|
1784 ProtocolName [WSAPROTOCOL_LEN + 1]uint16 |
|
1785 } |
|
1786 |
|
1787 type WSAProtocolChain struct { |
|
1788 ChainLen int32 |
|
1789 ChainEntries [MAX_PROTOCOL_CHAIN]uint32 |
|
1790 } |
|
1791 |
|
1792 type TCPKeepalive struct { |
|
1793 OnOff uint32 |
|
1794 Time uint32 |
|
1795 Interval uint32 |
|
1796 } |
|
1797 |
|
1798 type symbolicLinkReparseBuffer struct { |
|
1799 SubstituteNameOffset uint16 |
|
1800 SubstituteNameLength uint16 |
|
1801 PrintNameOffset uint16 |
|
1802 PrintNameLength uint16 |
|
1803 Flags uint32 |
|
1804 PathBuffer [1]uint16 |
|
1805 } |
|
1806 |
|
1807 type mountPointReparseBuffer struct { |
|
1808 SubstituteNameOffset uint16 |
|
1809 SubstituteNameLength uint16 |
|
1810 PrintNameOffset uint16 |
|
1811 PrintNameLength uint16 |
|
1812 PathBuffer [1]uint16 |
|
1813 } |
|
1814 |
|
1815 type reparseDataBuffer struct { |
|
1816 ReparseTag uint32 |
|
1817 ReparseDataLength uint16 |
|
1818 Reserved uint16 |
|
1819 |
|
1820 // GenericReparseBuffer |
|
1821 reparseBuffer byte |
|
1822 } |
|
1823 |
|
1824 const ( |
|
1825 FSCTL_CREATE_OR_GET_OBJECT_ID = 0x0900C0 |
|
1826 FSCTL_DELETE_OBJECT_ID = 0x0900A0 |
|
1827 FSCTL_DELETE_REPARSE_POINT = 0x0900AC |
|
1828 FSCTL_DUPLICATE_EXTENTS_TO_FILE = 0x098344 |
|
1829 FSCTL_DUPLICATE_EXTENTS_TO_FILE_EX = 0x0983E8 |
|
1830 FSCTL_FILESYSTEM_GET_STATISTICS = 0x090060 |
|
1831 FSCTL_FILE_LEVEL_TRIM = 0x098208 |
|
1832 FSCTL_FIND_FILES_BY_SID = 0x09008F |
|
1833 FSCTL_GET_COMPRESSION = 0x09003C |
|
1834 FSCTL_GET_INTEGRITY_INFORMATION = 0x09027C |
|
1835 FSCTL_GET_NTFS_VOLUME_DATA = 0x090064 |
|
1836 FSCTL_GET_REFS_VOLUME_DATA = 0x0902D8 |
|
1837 FSCTL_GET_OBJECT_ID = 0x09009C |
|
1838 FSCTL_GET_REPARSE_POINT = 0x0900A8 |
|
1839 FSCTL_GET_RETRIEVAL_POINTER_COUNT = 0x09042B |
|
1840 FSCTL_GET_RETRIEVAL_POINTERS = 0x090073 |
|
1841 FSCTL_GET_RETRIEVAL_POINTERS_AND_REFCOUNT = 0x0903D3 |
|
1842 FSCTL_IS_PATHNAME_VALID = 0x09002C |
|
1843 FSCTL_LMR_SET_LINK_TRACKING_INFORMATION = 0x1400EC |
|
1844 FSCTL_MARK_HANDLE = 0x0900FC |
|
1845 FSCTL_OFFLOAD_READ = 0x094264 |
|
1846 FSCTL_OFFLOAD_WRITE = 0x098268 |
|
1847 FSCTL_PIPE_PEEK = 0x11400C |
|
1848 FSCTL_PIPE_TRANSCEIVE = 0x11C017 |
|
1849 FSCTL_PIPE_WAIT = 0x110018 |
|
1850 FSCTL_QUERY_ALLOCATED_RANGES = 0x0940CF |
|
1851 FSCTL_QUERY_FAT_BPB = 0x090058 |
|
1852 FSCTL_QUERY_FILE_REGIONS = 0x090284 |
|
1853 FSCTL_QUERY_ON_DISK_VOLUME_INFO = 0x09013C |
|
1854 FSCTL_QUERY_SPARING_INFO = 0x090138 |
|
1855 FSCTL_READ_FILE_USN_DATA = 0x0900EB |
|
1856 FSCTL_RECALL_FILE = 0x090117 |
|
1857 FSCTL_REFS_STREAM_SNAPSHOT_MANAGEMENT = 0x090440 |
|
1858 FSCTL_SET_COMPRESSION = 0x09C040 |
|
1859 FSCTL_SET_DEFECT_MANAGEMENT = 0x098134 |
|
1860 FSCTL_SET_ENCRYPTION = 0x0900D7 |
|
1861 FSCTL_SET_INTEGRITY_INFORMATION = 0x09C280 |
|
1862 FSCTL_SET_INTEGRITY_INFORMATION_EX = 0x090380 |
|
1863 FSCTL_SET_OBJECT_ID = 0x090098 |
|
1864 FSCTL_SET_OBJECT_ID_EXTENDED = 0x0900BC |
|
1865 FSCTL_SET_REPARSE_POINT = 0x0900A4 |
|
1866 FSCTL_SET_SPARSE = 0x0900C4 |
|
1867 FSCTL_SET_ZERO_DATA = 0x0980C8 |
|
1868 FSCTL_SET_ZERO_ON_DEALLOCATION = 0x090194 |
|
1869 FSCTL_SIS_COPYFILE = 0x090100 |
|
1870 FSCTL_WRITE_USN_CLOSE_RECORD = 0x0900EF |
|
1871 |
|
1872 MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16 * 1024 |
|
1873 IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003 |
|
1874 IO_REPARSE_TAG_SYMLINK = 0xA000000C |
|
1875 SYMBOLIC_LINK_FLAG_DIRECTORY = 0x1 |
|
1876 ) |
|
1877 |
|
1878 const ( |
|
1879 ComputerNameNetBIOS = 0 |
|
1880 ComputerNameDnsHostname = 1 |
|
1881 ComputerNameDnsDomain = 2 |
|
1882 ComputerNameDnsFullyQualified = 3 |
|
1883 ComputerNamePhysicalNetBIOS = 4 |
|
1884 ComputerNamePhysicalDnsHostname = 5 |
|
1885 ComputerNamePhysicalDnsDomain = 6 |
|
1886 ComputerNamePhysicalDnsFullyQualified = 7 |
|
1887 ComputerNameMax = 8 |
|
1888 ) |
|
1889 |
|
1890 // For MessageBox() |
|
1891 const ( |
|
1892 MB_OK = 0x00000000 |
|
1893 MB_OKCANCEL = 0x00000001 |
|
1894 MB_ABORTRETRYIGNORE = 0x00000002 |
|
1895 MB_YESNOCANCEL = 0x00000003 |
|
1896 MB_YESNO = 0x00000004 |
|
1897 MB_RETRYCANCEL = 0x00000005 |
|
1898 MB_CANCELTRYCONTINUE = 0x00000006 |
|
1899 MB_ICONHAND = 0x00000010 |
|
1900 MB_ICONQUESTION = 0x00000020 |
|
1901 MB_ICONEXCLAMATION = 0x00000030 |
|
1902 MB_ICONASTERISK = 0x00000040 |
|
1903 MB_USERICON = 0x00000080 |
|
1904 MB_ICONWARNING = MB_ICONEXCLAMATION |
|
1905 MB_ICONERROR = MB_ICONHAND |
|
1906 MB_ICONINFORMATION = MB_ICONASTERISK |
|
1907 MB_ICONSTOP = MB_ICONHAND |
|
1908 MB_DEFBUTTON1 = 0x00000000 |
|
1909 MB_DEFBUTTON2 = 0x00000100 |
|
1910 MB_DEFBUTTON3 = 0x00000200 |
|
1911 MB_DEFBUTTON4 = 0x00000300 |
|
1912 MB_APPLMODAL = 0x00000000 |
|
1913 MB_SYSTEMMODAL = 0x00001000 |
|
1914 MB_TASKMODAL = 0x00002000 |
|
1915 MB_HELP = 0x00004000 |
|
1916 MB_NOFOCUS = 0x00008000 |
|
1917 MB_SETFOREGROUND = 0x00010000 |
|
1918 MB_DEFAULT_DESKTOP_ONLY = 0x00020000 |
|
1919 MB_TOPMOST = 0x00040000 |
|
1920 MB_RIGHT = 0x00080000 |
|
1921 MB_RTLREADING = 0x00100000 |
|
1922 MB_SERVICE_NOTIFICATION = 0x00200000 |
|
1923 ) |
|
1924 |
|
1925 const ( |
|
1926 MOVEFILE_REPLACE_EXISTING = 0x1 |
|
1927 MOVEFILE_COPY_ALLOWED = 0x2 |
|
1928 MOVEFILE_DELAY_UNTIL_REBOOT = 0x4 |
|
1929 MOVEFILE_WRITE_THROUGH = 0x8 |
|
1930 MOVEFILE_CREATE_HARDLINK = 0x10 |
|
1931 MOVEFILE_FAIL_IF_NOT_TRACKABLE = 0x20 |
|
1932 ) |
|
1933 |
|
1934 const GAA_FLAG_INCLUDE_PREFIX = 0x00000010 |
|
1935 |
|
1936 const ( |
|
1937 IF_TYPE_OTHER = 1 |
|
1938 IF_TYPE_ETHERNET_CSMACD = 6 |
|
1939 IF_TYPE_ISO88025_TOKENRING = 9 |
|
1940 IF_TYPE_PPP = 23 |
|
1941 IF_TYPE_SOFTWARE_LOOPBACK = 24 |
|
1942 IF_TYPE_ATM = 37 |
|
1943 IF_TYPE_IEEE80211 = 71 |
|
1944 IF_TYPE_TUNNEL = 131 |
|
1945 IF_TYPE_IEEE1394 = 144 |
|
1946 ) |
|
1947 |
|
1948 type SocketAddress struct { |
|
1949 Sockaddr *syscall.RawSockaddrAny |
|
1950 SockaddrLength int32 |
|
1951 } |
|
1952 |
|
1953 // IP returns an IPv4 or IPv6 address, or nil if the underlying SocketAddress is neither. |
|
1954 func (addr *SocketAddress) IP() net.IP { |
|
1955 if uintptr(addr.SockaddrLength) >= unsafe.Sizeof(RawSockaddrInet4{}) && addr.Sockaddr.Addr.Family == AF_INET { |
|
1956 return (*RawSockaddrInet4)(unsafe.Pointer(addr.Sockaddr)).Addr[:] |
|
1957 } else if uintptr(addr.SockaddrLength) >= unsafe.Sizeof(RawSockaddrInet6{}) && addr.Sockaddr.Addr.Family == AF_INET6 { |
|
1958 return (*RawSockaddrInet6)(unsafe.Pointer(addr.Sockaddr)).Addr[:] |
|
1959 } |
|
1960 return nil |
|
1961 } |
|
1962 |
|
1963 type IpAdapterUnicastAddress struct { |
|
1964 Length uint32 |
|
1965 Flags uint32 |
|
1966 Next *IpAdapterUnicastAddress |
|
1967 Address SocketAddress |
|
1968 PrefixOrigin int32 |
|
1969 SuffixOrigin int32 |
|
1970 DadState int32 |
|
1971 ValidLifetime uint32 |
|
1972 PreferredLifetime uint32 |
|
1973 LeaseLifetime uint32 |
|
1974 OnLinkPrefixLength uint8 |
|
1975 } |
|
1976 |
|
1977 type IpAdapterAnycastAddress struct { |
|
1978 Length uint32 |
|
1979 Flags uint32 |
|
1980 Next *IpAdapterAnycastAddress |
|
1981 Address SocketAddress |
|
1982 } |
|
1983 |
|
1984 type IpAdapterMulticastAddress struct { |
|
1985 Length uint32 |
|
1986 Flags uint32 |
|
1987 Next *IpAdapterMulticastAddress |
|
1988 Address SocketAddress |
|
1989 } |
|
1990 |
|
1991 type IpAdapterDnsServerAdapter struct { |
|
1992 Length uint32 |
|
1993 Reserved uint32 |
|
1994 Next *IpAdapterDnsServerAdapter |
|
1995 Address SocketAddress |
|
1996 } |
|
1997 |
|
1998 type IpAdapterPrefix struct { |
|
1999 Length uint32 |
|
2000 Flags uint32 |
|
2001 Next *IpAdapterPrefix |
|
2002 Address SocketAddress |
|
2003 PrefixLength uint32 |
|
2004 } |
|
2005 |
|
2006 type IpAdapterAddresses struct { |
|
2007 Length uint32 |
|
2008 IfIndex uint32 |
|
2009 Next *IpAdapterAddresses |
|
2010 AdapterName *byte |
|
2011 FirstUnicastAddress *IpAdapterUnicastAddress |
|
2012 FirstAnycastAddress *IpAdapterAnycastAddress |
|
2013 FirstMulticastAddress *IpAdapterMulticastAddress |
|
2014 FirstDnsServerAddress *IpAdapterDnsServerAdapter |
|
2015 DnsSuffix *uint16 |
|
2016 Description *uint16 |
|
2017 FriendlyName *uint16 |
|
2018 PhysicalAddress [syscall.MAX_ADAPTER_ADDRESS_LENGTH]byte |
|
2019 PhysicalAddressLength uint32 |
|
2020 Flags uint32 |
|
2021 Mtu uint32 |
|
2022 IfType uint32 |
|
2023 OperStatus uint32 |
|
2024 Ipv6IfIndex uint32 |
|
2025 ZoneIndices [16]uint32 |
|
2026 FirstPrefix *IpAdapterPrefix |
|
2027 TransmitLinkSpeed uint64 |
|
2028 ReceiveLinkSpeed uint64 |
|
2029 FirstWinsServerAddress *IpAdapterWinsServerAddress |
|
2030 FirstGatewayAddress *IpAdapterGatewayAddress |
|
2031 Ipv4Metric uint32 |
|
2032 Ipv6Metric uint32 |
|
2033 Luid uint64 |
|
2034 Dhcpv4Server SocketAddress |
|
2035 CompartmentId uint32 |
|
2036 NetworkGuid GUID |
|
2037 ConnectionType uint32 |
|
2038 TunnelType uint32 |
|
2039 Dhcpv6Server SocketAddress |
|
2040 Dhcpv6ClientDuid [MAX_DHCPV6_DUID_LENGTH]byte |
|
2041 Dhcpv6ClientDuidLength uint32 |
|
2042 Dhcpv6Iaid uint32 |
|
2043 FirstDnsSuffix *IpAdapterDNSSuffix |
|
2044 } |
|
2045 |
|
2046 type IpAdapterWinsServerAddress struct { |
|
2047 Length uint32 |
|
2048 Reserved uint32 |
|
2049 Next *IpAdapterWinsServerAddress |
|
2050 Address SocketAddress |
|
2051 } |
|
2052 |
|
2053 type IpAdapterGatewayAddress struct { |
|
2054 Length uint32 |
|
2055 Reserved uint32 |
|
2056 Next *IpAdapterGatewayAddress |
|
2057 Address SocketAddress |
|
2058 } |
|
2059 |
|
2060 type IpAdapterDNSSuffix struct { |
|
2061 Next *IpAdapterDNSSuffix |
|
2062 String [MAX_DNS_SUFFIX_STRING_LENGTH]uint16 |
|
2063 } |
|
2064 |
|
2065 const ( |
|
2066 IfOperStatusUp = 1 |
|
2067 IfOperStatusDown = 2 |
|
2068 IfOperStatusTesting = 3 |
|
2069 IfOperStatusUnknown = 4 |
|
2070 IfOperStatusDormant = 5 |
|
2071 IfOperStatusNotPresent = 6 |
|
2072 IfOperStatusLowerLayerDown = 7 |
|
2073 ) |
|
2074 |
|
2075 // Console related constants used for the mode parameter to SetConsoleMode. See |
|
2076 // https://docs.microsoft.com/en-us/windows/console/setconsolemode for details. |
|
2077 |
|
2078 const ( |
|
2079 ENABLE_PROCESSED_INPUT = 0x1 |
|
2080 ENABLE_LINE_INPUT = 0x2 |
|
2081 ENABLE_ECHO_INPUT = 0x4 |
|
2082 ENABLE_WINDOW_INPUT = 0x8 |
|
2083 ENABLE_MOUSE_INPUT = 0x10 |
|
2084 ENABLE_INSERT_MODE = 0x20 |
|
2085 ENABLE_QUICK_EDIT_MODE = 0x40 |
|
2086 ENABLE_EXTENDED_FLAGS = 0x80 |
|
2087 ENABLE_AUTO_POSITION = 0x100 |
|
2088 ENABLE_VIRTUAL_TERMINAL_INPUT = 0x200 |
|
2089 |
|
2090 ENABLE_PROCESSED_OUTPUT = 0x1 |
|
2091 ENABLE_WRAP_AT_EOL_OUTPUT = 0x2 |
|
2092 ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x4 |
|
2093 DISABLE_NEWLINE_AUTO_RETURN = 0x8 |
|
2094 ENABLE_LVB_GRID_WORLDWIDE = 0x10 |
|
2095 ) |
|
2096 |
|
2097 type Coord struct { |
|
2098 X int16 |
|
2099 Y int16 |
|
2100 } |
|
2101 |
|
2102 type SmallRect struct { |
|
2103 Left int16 |
|
2104 Top int16 |
|
2105 Right int16 |
|
2106 Bottom int16 |
|
2107 } |
|
2108 |
|
2109 // Used with GetConsoleScreenBuffer to retrieve information about a console |
|
2110 // screen buffer. See |
|
2111 // https://docs.microsoft.com/en-us/windows/console/console-screen-buffer-info-str |
|
2112 // for details. |
|
2113 |
|
2114 type ConsoleScreenBufferInfo struct { |
|
2115 Size Coord |
|
2116 CursorPosition Coord |
|
2117 Attributes uint16 |
|
2118 Window SmallRect |
|
2119 MaximumWindowSize Coord |
|
2120 } |
|
2121 |
|
2122 const UNIX_PATH_MAX = 108 // defined in afunix.h |
|
2123 |
|
2124 const ( |
|
2125 // flags for JOBOBJECT_BASIC_LIMIT_INFORMATION.LimitFlags |
|
2126 JOB_OBJECT_LIMIT_ACTIVE_PROCESS = 0x00000008 |
|
2127 JOB_OBJECT_LIMIT_AFFINITY = 0x00000010 |
|
2128 JOB_OBJECT_LIMIT_BREAKAWAY_OK = 0x00000800 |
|
2129 JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION = 0x00000400 |
|
2130 JOB_OBJECT_LIMIT_JOB_MEMORY = 0x00000200 |
|
2131 JOB_OBJECT_LIMIT_JOB_TIME = 0x00000004 |
|
2132 JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = 0x00002000 |
|
2133 JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME = 0x00000040 |
|
2134 JOB_OBJECT_LIMIT_PRIORITY_CLASS = 0x00000020 |
|
2135 JOB_OBJECT_LIMIT_PROCESS_MEMORY = 0x00000100 |
|
2136 JOB_OBJECT_LIMIT_PROCESS_TIME = 0x00000002 |
|
2137 JOB_OBJECT_LIMIT_SCHEDULING_CLASS = 0x00000080 |
|
2138 JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK = 0x00001000 |
|
2139 JOB_OBJECT_LIMIT_SUBSET_AFFINITY = 0x00004000 |
|
2140 JOB_OBJECT_LIMIT_WORKINGSET = 0x00000001 |
|
2141 ) |
|
2142 |
|
2143 type IO_COUNTERS struct { |
|
2144 ReadOperationCount uint64 |
|
2145 WriteOperationCount uint64 |
|
2146 OtherOperationCount uint64 |
|
2147 ReadTransferCount uint64 |
|
2148 WriteTransferCount uint64 |
|
2149 OtherTransferCount uint64 |
|
2150 } |
|
2151 |
|
2152 type JOBOBJECT_EXTENDED_LIMIT_INFORMATION struct { |
|
2153 BasicLimitInformation JOBOBJECT_BASIC_LIMIT_INFORMATION |
|
2154 IoInfo IO_COUNTERS |
|
2155 ProcessMemoryLimit uintptr |
|
2156 JobMemoryLimit uintptr |
|
2157 PeakProcessMemoryUsed uintptr |
|
2158 PeakJobMemoryUsed uintptr |
|
2159 } |
|
2160 |
|
2161 const ( |
|
2162 // UIRestrictionsClass |
|
2163 JOB_OBJECT_UILIMIT_DESKTOP = 0x00000040 |
|
2164 JOB_OBJECT_UILIMIT_DISPLAYSETTINGS = 0x00000010 |
|
2165 JOB_OBJECT_UILIMIT_EXITWINDOWS = 0x00000080 |
|
2166 JOB_OBJECT_UILIMIT_GLOBALATOMS = 0x00000020 |
|
2167 JOB_OBJECT_UILIMIT_HANDLES = 0x00000001 |
|
2168 JOB_OBJECT_UILIMIT_READCLIPBOARD = 0x00000002 |
|
2169 JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS = 0x00000008 |
|
2170 JOB_OBJECT_UILIMIT_WRITECLIPBOARD = 0x00000004 |
|
2171 ) |
|
2172 |
|
2173 type JOBOBJECT_BASIC_UI_RESTRICTIONS struct { |
|
2174 UIRestrictionsClass uint32 |
|
2175 } |
|
2176 |
|
2177 const ( |
|
2178 // JobObjectInformationClass |
|
2179 JobObjectAssociateCompletionPortInformation = 7 |
|
2180 JobObjectBasicLimitInformation = 2 |
|
2181 JobObjectBasicUIRestrictions = 4 |
|
2182 JobObjectCpuRateControlInformation = 15 |
|
2183 JobObjectEndOfJobTimeInformation = 6 |
|
2184 JobObjectExtendedLimitInformation = 9 |
|
2185 JobObjectGroupInformation = 11 |
|
2186 JobObjectGroupInformationEx = 14 |
|
2187 JobObjectLimitViolationInformation2 = 35 |
|
2188 JobObjectNetRateControlInformation = 32 |
|
2189 JobObjectNotificationLimitInformation = 12 |
|
2190 JobObjectNotificationLimitInformation2 = 34 |
|
2191 JobObjectSecurityLimitInformation = 5 |
|
2192 ) |
|
2193 |
|
2194 const ( |
|
2195 KF_FLAG_DEFAULT = 0x00000000 |
|
2196 KF_FLAG_FORCE_APP_DATA_REDIRECTION = 0x00080000 |
|
2197 KF_FLAG_RETURN_FILTER_REDIRECTION_TARGET = 0x00040000 |
|
2198 KF_FLAG_FORCE_PACKAGE_REDIRECTION = 0x00020000 |
|
2199 KF_FLAG_NO_PACKAGE_REDIRECTION = 0x00010000 |
|
2200 KF_FLAG_FORCE_APPCONTAINER_REDIRECTION = 0x00020000 |
|
2201 KF_FLAG_NO_APPCONTAINER_REDIRECTION = 0x00010000 |
|
2202 KF_FLAG_CREATE = 0x00008000 |
|
2203 KF_FLAG_DONT_VERIFY = 0x00004000 |
|
2204 KF_FLAG_DONT_UNEXPAND = 0x00002000 |
|
2205 KF_FLAG_NO_ALIAS = 0x00001000 |
|
2206 KF_FLAG_INIT = 0x00000800 |
|
2207 KF_FLAG_DEFAULT_PATH = 0x00000400 |
|
2208 KF_FLAG_NOT_PARENT_RELATIVE = 0x00000200 |
|
2209 KF_FLAG_SIMPLE_IDLIST = 0x00000100 |
|
2210 KF_FLAG_ALIAS_ONLY = 0x80000000 |
|
2211 ) |
|
2212 |
|
2213 type OsVersionInfoEx struct { |
|
2214 osVersionInfoSize uint32 |
|
2215 MajorVersion uint32 |
|
2216 MinorVersion uint32 |
|
2217 BuildNumber uint32 |
|
2218 PlatformId uint32 |
|
2219 CsdVersion [128]uint16 |
|
2220 ServicePackMajor uint16 |
|
2221 ServicePackMinor uint16 |
|
2222 SuiteMask uint16 |
|
2223 ProductType byte |
|
2224 _ byte |
|
2225 } |
|
2226 |
|
2227 const ( |
|
2228 EWX_LOGOFF = 0x00000000 |
|
2229 EWX_SHUTDOWN = 0x00000001 |
|
2230 EWX_REBOOT = 0x00000002 |
|
2231 EWX_FORCE = 0x00000004 |
|
2232 EWX_POWEROFF = 0x00000008 |
|
2233 EWX_FORCEIFHUNG = 0x00000010 |
|
2234 EWX_QUICKRESOLVE = 0x00000020 |
|
2235 EWX_RESTARTAPPS = 0x00000040 |
|
2236 EWX_HYBRID_SHUTDOWN = 0x00400000 |
|
2237 EWX_BOOTOPTIONS = 0x01000000 |
|
2238 |
|
2239 SHTDN_REASON_FLAG_COMMENT_REQUIRED = 0x01000000 |
|
2240 SHTDN_REASON_FLAG_DIRTY_PROBLEM_ID_REQUIRED = 0x02000000 |
|
2241 SHTDN_REASON_FLAG_CLEAN_UI = 0x04000000 |
|
2242 SHTDN_REASON_FLAG_DIRTY_UI = 0x08000000 |
|
2243 SHTDN_REASON_FLAG_USER_DEFINED = 0x40000000 |
|
2244 SHTDN_REASON_FLAG_PLANNED = 0x80000000 |
|
2245 SHTDN_REASON_MAJOR_OTHER = 0x00000000 |
|
2246 SHTDN_REASON_MAJOR_NONE = 0x00000000 |
|
2247 SHTDN_REASON_MAJOR_HARDWARE = 0x00010000 |
|
2248 SHTDN_REASON_MAJOR_OPERATINGSYSTEM = 0x00020000 |
|
2249 SHTDN_REASON_MAJOR_SOFTWARE = 0x00030000 |
|
2250 SHTDN_REASON_MAJOR_APPLICATION = 0x00040000 |
|
2251 SHTDN_REASON_MAJOR_SYSTEM = 0x00050000 |
|
2252 SHTDN_REASON_MAJOR_POWER = 0x00060000 |
|
2253 SHTDN_REASON_MAJOR_LEGACY_API = 0x00070000 |
|
2254 SHTDN_REASON_MINOR_OTHER = 0x00000000 |
|
2255 SHTDN_REASON_MINOR_NONE = 0x000000ff |
|
2256 SHTDN_REASON_MINOR_MAINTENANCE = 0x00000001 |
|
2257 SHTDN_REASON_MINOR_INSTALLATION = 0x00000002 |
|
2258 SHTDN_REASON_MINOR_UPGRADE = 0x00000003 |
|
2259 SHTDN_REASON_MINOR_RECONFIG = 0x00000004 |
|
2260 SHTDN_REASON_MINOR_HUNG = 0x00000005 |
|
2261 SHTDN_REASON_MINOR_UNSTABLE = 0x00000006 |
|
2262 SHTDN_REASON_MINOR_DISK = 0x00000007 |
|
2263 SHTDN_REASON_MINOR_PROCESSOR = 0x00000008 |
|
2264 SHTDN_REASON_MINOR_NETWORKCARD = 0x00000009 |
|
2265 SHTDN_REASON_MINOR_POWER_SUPPLY = 0x0000000a |
|
2266 SHTDN_REASON_MINOR_CORDUNPLUGGED = 0x0000000b |
|
2267 SHTDN_REASON_MINOR_ENVIRONMENT = 0x0000000c |
|
2268 SHTDN_REASON_MINOR_HARDWARE_DRIVER = 0x0000000d |
|
2269 SHTDN_REASON_MINOR_OTHERDRIVER = 0x0000000e |
|
2270 SHTDN_REASON_MINOR_BLUESCREEN = 0x0000000F |
|
2271 SHTDN_REASON_MINOR_SERVICEPACK = 0x00000010 |
|
2272 SHTDN_REASON_MINOR_HOTFIX = 0x00000011 |
|
2273 SHTDN_REASON_MINOR_SECURITYFIX = 0x00000012 |
|
2274 SHTDN_REASON_MINOR_SECURITY = 0x00000013 |
|
2275 SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY = 0x00000014 |
|
2276 SHTDN_REASON_MINOR_WMI = 0x00000015 |
|
2277 SHTDN_REASON_MINOR_SERVICEPACK_UNINSTALL = 0x00000016 |
|
2278 SHTDN_REASON_MINOR_HOTFIX_UNINSTALL = 0x00000017 |
|
2279 SHTDN_REASON_MINOR_SECURITYFIX_UNINSTALL = 0x00000018 |
|
2280 SHTDN_REASON_MINOR_MMC = 0x00000019 |
|
2281 SHTDN_REASON_MINOR_SYSTEMRESTORE = 0x0000001a |
|
2282 SHTDN_REASON_MINOR_TERMSRV = 0x00000020 |
|
2283 SHTDN_REASON_MINOR_DC_PROMOTION = 0x00000021 |
|
2284 SHTDN_REASON_MINOR_DC_DEMOTION = 0x00000022 |
|
2285 SHTDN_REASON_UNKNOWN = SHTDN_REASON_MINOR_NONE |
|
2286 SHTDN_REASON_LEGACY_API = SHTDN_REASON_MAJOR_LEGACY_API | SHTDN_REASON_FLAG_PLANNED |
|
2287 SHTDN_REASON_VALID_BIT_MASK = 0xc0ffffff |
|
2288 |
|
2289 SHUTDOWN_NORETRY = 0x1 |
|
2290 ) |
|
2291 |
|
2292 // Flags used for GetModuleHandleEx |
|
2293 const ( |
|
2294 GET_MODULE_HANDLE_EX_FLAG_PIN = 1 |
|
2295 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT = 2 |
|
2296 GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS = 4 |
|
2297 ) |
|
2298 |
|
2299 // MUI function flag values |
|
2300 const ( |
|
2301 MUI_LANGUAGE_ID = 0x4 |
|
2302 MUI_LANGUAGE_NAME = 0x8 |
|
2303 MUI_MERGE_SYSTEM_FALLBACK = 0x10 |
|
2304 MUI_MERGE_USER_FALLBACK = 0x20 |
|
2305 MUI_UI_FALLBACK = MUI_MERGE_SYSTEM_FALLBACK | MUI_MERGE_USER_FALLBACK |
|
2306 MUI_THREAD_LANGUAGES = 0x40 |
|
2307 MUI_CONSOLE_FILTER = 0x100 |
|
2308 MUI_COMPLEX_SCRIPT_FILTER = 0x200 |
|
2309 MUI_RESET_FILTERS = 0x001 |
|
2310 MUI_USER_PREFERRED_UI_LANGUAGES = 0x10 |
|
2311 MUI_USE_INSTALLED_LANGUAGES = 0x20 |
|
2312 MUI_USE_SEARCH_ALL_LANGUAGES = 0x40 |
|
2313 MUI_LANG_NEUTRAL_PE_FILE = 0x100 |
|
2314 MUI_NON_LANG_NEUTRAL_FILE = 0x200 |
|
2315 MUI_MACHINE_LANGUAGE_SETTINGS = 0x400 |
|
2316 MUI_FILETYPE_NOT_LANGUAGE_NEUTRAL = 0x001 |
|
2317 MUI_FILETYPE_LANGUAGE_NEUTRAL_MAIN = 0x002 |
|
2318 MUI_FILETYPE_LANGUAGE_NEUTRAL_MUI = 0x004 |
|
2319 MUI_QUERY_TYPE = 0x001 |
|
2320 MUI_QUERY_CHECKSUM = 0x002 |
|
2321 MUI_QUERY_LANGUAGE_NAME = 0x004 |
|
2322 MUI_QUERY_RESOURCE_TYPES = 0x008 |
|
2323 MUI_FILEINFO_VERSION = 0x001 |
|
2324 |
|
2325 MUI_FULL_LANGUAGE = 0x01 |
|
2326 MUI_PARTIAL_LANGUAGE = 0x02 |
|
2327 MUI_LIP_LANGUAGE = 0x04 |
|
2328 MUI_LANGUAGE_INSTALLED = 0x20 |
|
2329 MUI_LANGUAGE_LICENSED = 0x40 |
|
2330 ) |
|
2331 |
|
2332 // FILE_INFO_BY_HANDLE_CLASS constants for SetFileInformationByHandle/GetFileInformationByHandleEx |
|
2333 const ( |
|
2334 FileBasicInfo = 0 |
|
2335 FileStandardInfo = 1 |
|
2336 FileNameInfo = 2 |
|
2337 FileRenameInfo = 3 |
|
2338 FileDispositionInfo = 4 |
|
2339 FileAllocationInfo = 5 |
|
2340 FileEndOfFileInfo = 6 |
|
2341 FileStreamInfo = 7 |
|
2342 FileCompressionInfo = 8 |
|
2343 FileAttributeTagInfo = 9 |
|
2344 FileIdBothDirectoryInfo = 10 |
|
2345 FileIdBothDirectoryRestartInfo = 11 |
|
2346 FileIoPriorityHintInfo = 12 |
|
2347 FileRemoteProtocolInfo = 13 |
|
2348 FileFullDirectoryInfo = 14 |
|
2349 FileFullDirectoryRestartInfo = 15 |
|
2350 FileStorageInfo = 16 |
|
2351 FileAlignmentInfo = 17 |
|
2352 FileIdInfo = 18 |
|
2353 FileIdExtdDirectoryInfo = 19 |
|
2354 FileIdExtdDirectoryRestartInfo = 20 |
|
2355 FileDispositionInfoEx = 21 |
|
2356 FileRenameInfoEx = 22 |
|
2357 FileCaseSensitiveInfo = 23 |
|
2358 FileNormalizedNameInfo = 24 |
|
2359 ) |
|
2360 |
|
2361 // LoadLibrary flags for determining from where to search for a DLL |
|
2362 const ( |
|
2363 DONT_RESOLVE_DLL_REFERENCES = 0x1 |
|
2364 LOAD_LIBRARY_AS_DATAFILE = 0x2 |
|
2365 LOAD_WITH_ALTERED_SEARCH_PATH = 0x8 |
|
2366 LOAD_IGNORE_CODE_AUTHZ_LEVEL = 0x10 |
|
2367 LOAD_LIBRARY_AS_IMAGE_RESOURCE = 0x20 |
|
2368 LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE = 0x40 |
|
2369 LOAD_LIBRARY_REQUIRE_SIGNED_TARGET = 0x80 |
|
2370 LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = 0x100 |
|
2371 LOAD_LIBRARY_SEARCH_APPLICATION_DIR = 0x200 |
|
2372 LOAD_LIBRARY_SEARCH_USER_DIRS = 0x400 |
|
2373 LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x800 |
|
2374 LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x1000 |
|
2375 LOAD_LIBRARY_SAFE_CURRENT_DIRS = 0x00002000 |
|
2376 LOAD_LIBRARY_SEARCH_SYSTEM32_NO_FORWARDER = 0x00004000 |
|
2377 LOAD_LIBRARY_OS_INTEGRITY_CONTINUITY = 0x00008000 |
|
2378 ) |
|
2379 |
|
2380 // RegNotifyChangeKeyValue notifyFilter flags. |
|
2381 const ( |
|
2382 // REG_NOTIFY_CHANGE_NAME notifies the caller if a subkey is added or deleted. |
|
2383 REG_NOTIFY_CHANGE_NAME = 0x00000001 |
|
2384 |
|
2385 // REG_NOTIFY_CHANGE_ATTRIBUTES notifies the caller of changes to the attributes of the key, such as the security descriptor information. |
|
2386 REG_NOTIFY_CHANGE_ATTRIBUTES = 0x00000002 |
|
2387 |
|
2388 // REG_NOTIFY_CHANGE_LAST_SET notifies the caller of changes to a value of the key. This can include adding or deleting a value, or changing an existing value. |
|
2389 REG_NOTIFY_CHANGE_LAST_SET = 0x00000004 |
|
2390 |
|
2391 // REG_NOTIFY_CHANGE_SECURITY notifies the caller of changes to the security descriptor of the key. |
|
2392 REG_NOTIFY_CHANGE_SECURITY = 0x00000008 |
|
2393 |
|
2394 // REG_NOTIFY_THREAD_AGNOSTIC indicates that the lifetime of the registration must not be tied to the lifetime of the thread issuing the RegNotifyChangeKeyValue call. Note: This flag value is only supported in Windows 8 and later. |
|
2395 REG_NOTIFY_THREAD_AGNOSTIC = 0x10000000 |
|
2396 ) |
|
2397 |
|
2398 type CommTimeouts struct { |
|
2399 ReadIntervalTimeout uint32 |
|
2400 ReadTotalTimeoutMultiplier uint32 |
|
2401 ReadTotalTimeoutConstant uint32 |
|
2402 WriteTotalTimeoutMultiplier uint32 |
|
2403 WriteTotalTimeoutConstant uint32 |
|
2404 } |
|
2405 |
|
2406 // NTUnicodeString is a UTF-16 string for NT native APIs, corresponding to UNICODE_STRING. |
|
2407 type NTUnicodeString struct { |
|
2408 Length uint16 |
|
2409 MaximumLength uint16 |
|
2410 Buffer *uint16 |
|
2411 } |
|
2412 |
|
2413 // NTString is an ANSI string for NT native APIs, corresponding to STRING. |
|
2414 type NTString struct { |
|
2415 Length uint16 |
|
2416 MaximumLength uint16 |
|
2417 Buffer *byte |
|
2418 } |
|
2419 |
|
2420 type LIST_ENTRY struct { |
|
2421 Flink *LIST_ENTRY |
|
2422 Blink *LIST_ENTRY |
|
2423 } |
|
2424 |
|
2425 type RUNTIME_FUNCTION struct { |
|
2426 BeginAddress uint32 |
|
2427 EndAddress uint32 |
|
2428 UnwindData uint32 |
|
2429 } |
|
2430 |
|
2431 type LDR_DATA_TABLE_ENTRY struct { |
|
2432 reserved1 [2]uintptr |
|
2433 InMemoryOrderLinks LIST_ENTRY |
|
2434 reserved2 [2]uintptr |
|
2435 DllBase uintptr |
|
2436 reserved3 [2]uintptr |
|
2437 FullDllName NTUnicodeString |
|
2438 reserved4 [8]byte |
|
2439 reserved5 [3]uintptr |
|
2440 reserved6 uintptr |
|
2441 TimeDateStamp uint32 |
|
2442 } |
|
2443 |
|
2444 type PEB_LDR_DATA struct { |
|
2445 reserved1 [8]byte |
|
2446 reserved2 [3]uintptr |
|
2447 InMemoryOrderModuleList LIST_ENTRY |
|
2448 } |
|
2449 |
|
2450 type CURDIR struct { |
|
2451 DosPath NTUnicodeString |
|
2452 Handle Handle |
|
2453 } |
|
2454 |
|
2455 type RTL_DRIVE_LETTER_CURDIR struct { |
|
2456 Flags uint16 |
|
2457 Length uint16 |
|
2458 TimeStamp uint32 |
|
2459 DosPath NTString |
|
2460 } |
|
2461 |
|
2462 type RTL_USER_PROCESS_PARAMETERS struct { |
|
2463 MaximumLength, Length uint32 |
|
2464 |
|
2465 Flags, DebugFlags uint32 |
|
2466 |
|
2467 ConsoleHandle Handle |
|
2468 ConsoleFlags uint32 |
|
2469 StandardInput, StandardOutput, StandardError Handle |
|
2470 |
|
2471 CurrentDirectory CURDIR |
|
2472 DllPath NTUnicodeString |
|
2473 ImagePathName NTUnicodeString |
|
2474 CommandLine NTUnicodeString |
|
2475 Environment unsafe.Pointer |
|
2476 |
|
2477 StartingX, StartingY, CountX, CountY, CountCharsX, CountCharsY, FillAttribute uint32 |
|
2478 |
|
2479 WindowFlags, ShowWindowFlags uint32 |
|
2480 WindowTitle, DesktopInfo, ShellInfo, RuntimeData NTUnicodeString |
|
2481 CurrentDirectories [32]RTL_DRIVE_LETTER_CURDIR |
|
2482 |
|
2483 EnvironmentSize, EnvironmentVersion uintptr |
|
2484 |
|
2485 PackageDependencyData unsafe.Pointer |
|
2486 ProcessGroupId uint32 |
|
2487 LoaderThreads uint32 |
|
2488 |
|
2489 RedirectionDllName NTUnicodeString |
|
2490 HeapPartitionName NTUnicodeString |
|
2491 DefaultThreadpoolCpuSetMasks uintptr |
|
2492 DefaultThreadpoolCpuSetMaskCount uint32 |
|
2493 } |
|
2494 |
|
2495 type PEB struct { |
|
2496 reserved1 [2]byte |
|
2497 BeingDebugged byte |
|
2498 BitField byte |
|
2499 reserved3 uintptr |
|
2500 ImageBaseAddress uintptr |
|
2501 Ldr *PEB_LDR_DATA |
|
2502 ProcessParameters *RTL_USER_PROCESS_PARAMETERS |
|
2503 reserved4 [3]uintptr |
|
2504 AtlThunkSListPtr uintptr |
|
2505 reserved5 uintptr |
|
2506 reserved6 uint32 |
|
2507 reserved7 uintptr |
|
2508 reserved8 uint32 |
|
2509 AtlThunkSListPtr32 uint32 |
|
2510 reserved9 [45]uintptr |
|
2511 reserved10 [96]byte |
|
2512 PostProcessInitRoutine uintptr |
|
2513 reserved11 [128]byte |
|
2514 reserved12 [1]uintptr |
|
2515 SessionId uint32 |
|
2516 } |
|
2517 |
|
2518 type OBJECT_ATTRIBUTES struct { |
|
2519 Length uint32 |
|
2520 RootDirectory Handle |
|
2521 ObjectName *NTUnicodeString |
|
2522 Attributes uint32 |
|
2523 SecurityDescriptor *SECURITY_DESCRIPTOR |
|
2524 SecurityQoS *SECURITY_QUALITY_OF_SERVICE |
|
2525 } |
|
2526 |
|
2527 // Values for the Attributes member of OBJECT_ATTRIBUTES. |
|
2528 const ( |
|
2529 OBJ_INHERIT = 0x00000002 |
|
2530 OBJ_PERMANENT = 0x00000010 |
|
2531 OBJ_EXCLUSIVE = 0x00000020 |
|
2532 OBJ_CASE_INSENSITIVE = 0x00000040 |
|
2533 OBJ_OPENIF = 0x00000080 |
|
2534 OBJ_OPENLINK = 0x00000100 |
|
2535 OBJ_KERNEL_HANDLE = 0x00000200 |
|
2536 OBJ_FORCE_ACCESS_CHECK = 0x00000400 |
|
2537 OBJ_IGNORE_IMPERSONATED_DEVICEMAP = 0x00000800 |
|
2538 OBJ_DONT_REPARSE = 0x00001000 |
|
2539 OBJ_VALID_ATTRIBUTES = 0x00001FF2 |
|
2540 ) |
|
2541 |
|
2542 type IO_STATUS_BLOCK struct { |
|
2543 Status NTStatus |
|
2544 Information uintptr |
|
2545 } |
|
2546 |
|
2547 type RTLP_CURDIR_REF struct { |
|
2548 RefCount int32 |
|
2549 Handle Handle |
|
2550 } |
|
2551 |
|
2552 type RTL_RELATIVE_NAME struct { |
|
2553 RelativeName NTUnicodeString |
|
2554 ContainingDirectory Handle |
|
2555 CurDirRef *RTLP_CURDIR_REF |
|
2556 } |
|
2557 |
|
2558 const ( |
|
2559 // CreateDisposition flags for NtCreateFile and NtCreateNamedPipeFile. |
|
2560 FILE_SUPERSEDE = 0x00000000 |
|
2561 FILE_OPEN = 0x00000001 |
|
2562 FILE_CREATE = 0x00000002 |
|
2563 FILE_OPEN_IF = 0x00000003 |
|
2564 FILE_OVERWRITE = 0x00000004 |
|
2565 FILE_OVERWRITE_IF = 0x00000005 |
|
2566 FILE_MAXIMUM_DISPOSITION = 0x00000005 |
|
2567 |
|
2568 // CreateOptions flags for NtCreateFile and NtCreateNamedPipeFile. |
|
2569 FILE_DIRECTORY_FILE = 0x00000001 |
|
2570 FILE_WRITE_THROUGH = 0x00000002 |
|
2571 FILE_SEQUENTIAL_ONLY = 0x00000004 |
|
2572 FILE_NO_INTERMEDIATE_BUFFERING = 0x00000008 |
|
2573 FILE_SYNCHRONOUS_IO_ALERT = 0x00000010 |
|
2574 FILE_SYNCHRONOUS_IO_NONALERT = 0x00000020 |
|
2575 FILE_NON_DIRECTORY_FILE = 0x00000040 |
|
2576 FILE_CREATE_TREE_CONNECTION = 0x00000080 |
|
2577 FILE_COMPLETE_IF_OPLOCKED = 0x00000100 |
|
2578 FILE_NO_EA_KNOWLEDGE = 0x00000200 |
|
2579 FILE_OPEN_REMOTE_INSTANCE = 0x00000400 |
|
2580 FILE_RANDOM_ACCESS = 0x00000800 |
|
2581 FILE_DELETE_ON_CLOSE = 0x00001000 |
|
2582 FILE_OPEN_BY_FILE_ID = 0x00002000 |
|
2583 FILE_OPEN_FOR_BACKUP_INTENT = 0x00004000 |
|
2584 FILE_NO_COMPRESSION = 0x00008000 |
|
2585 FILE_OPEN_REQUIRING_OPLOCK = 0x00010000 |
|
2586 FILE_DISALLOW_EXCLUSIVE = 0x00020000 |
|
2587 FILE_RESERVE_OPFILTER = 0x00100000 |
|
2588 FILE_OPEN_REPARSE_POINT = 0x00200000 |
|
2589 FILE_OPEN_NO_RECALL = 0x00400000 |
|
2590 FILE_OPEN_FOR_FREE_SPACE_QUERY = 0x00800000 |
|
2591 |
|
2592 // Parameter constants for NtCreateNamedPipeFile. |
|
2593 |
|
2594 FILE_PIPE_BYTE_STREAM_TYPE = 0x00000000 |
|
2595 FILE_PIPE_MESSAGE_TYPE = 0x00000001 |
|
2596 |
|
2597 FILE_PIPE_ACCEPT_REMOTE_CLIENTS = 0x00000000 |
|
2598 FILE_PIPE_REJECT_REMOTE_CLIENTS = 0x00000002 |
|
2599 |
|
2600 FILE_PIPE_TYPE_VALID_MASK = 0x00000003 |
|
2601 |
|
2602 FILE_PIPE_BYTE_STREAM_MODE = 0x00000000 |
|
2603 FILE_PIPE_MESSAGE_MODE = 0x00000001 |
|
2604 |
|
2605 FILE_PIPE_QUEUE_OPERATION = 0x00000000 |
|
2606 FILE_PIPE_COMPLETE_OPERATION = 0x00000001 |
|
2607 |
|
2608 FILE_PIPE_INBOUND = 0x00000000 |
|
2609 FILE_PIPE_OUTBOUND = 0x00000001 |
|
2610 FILE_PIPE_FULL_DUPLEX = 0x00000002 |
|
2611 |
|
2612 FILE_PIPE_DISCONNECTED_STATE = 0x00000001 |
|
2613 FILE_PIPE_LISTENING_STATE = 0x00000002 |
|
2614 FILE_PIPE_CONNECTED_STATE = 0x00000003 |
|
2615 FILE_PIPE_CLOSING_STATE = 0x00000004 |
|
2616 |
|
2617 FILE_PIPE_CLIENT_END = 0x00000000 |
|
2618 FILE_PIPE_SERVER_END = 0x00000001 |
|
2619 ) |
|
2620 |
|
2621 const ( |
|
2622 // FileInformationClass for NtSetInformationFile |
|
2623 FileBasicInformation = 4 |
|
2624 FileRenameInformation = 10 |
|
2625 FileDispositionInformation = 13 |
|
2626 FilePositionInformation = 14 |
|
2627 FileEndOfFileInformation = 20 |
|
2628 FileValidDataLengthInformation = 39 |
|
2629 FileShortNameInformation = 40 |
|
2630 FileIoPriorityHintInformation = 43 |
|
2631 FileReplaceCompletionInformation = 61 |
|
2632 FileDispositionInformationEx = 64 |
|
2633 FileCaseSensitiveInformation = 71 |
|
2634 FileLinkInformation = 72 |
|
2635 FileCaseSensitiveInformationForceAccessCheck = 75 |
|
2636 FileKnownFolderInformation = 76 |
|
2637 |
|
2638 // Flags for FILE_RENAME_INFORMATION |
|
2639 FILE_RENAME_REPLACE_IF_EXISTS = 0x00000001 |
|
2640 FILE_RENAME_POSIX_SEMANTICS = 0x00000002 |
|
2641 FILE_RENAME_SUPPRESS_PIN_STATE_INHERITANCE = 0x00000004 |
|
2642 FILE_RENAME_SUPPRESS_STORAGE_RESERVE_INHERITANCE = 0x00000008 |
|
2643 FILE_RENAME_NO_INCREASE_AVAILABLE_SPACE = 0x00000010 |
|
2644 FILE_RENAME_NO_DECREASE_AVAILABLE_SPACE = 0x00000020 |
|
2645 FILE_RENAME_PRESERVE_AVAILABLE_SPACE = 0x00000030 |
|
2646 FILE_RENAME_IGNORE_READONLY_ATTRIBUTE = 0x00000040 |
|
2647 FILE_RENAME_FORCE_RESIZE_TARGET_SR = 0x00000080 |
|
2648 FILE_RENAME_FORCE_RESIZE_SOURCE_SR = 0x00000100 |
|
2649 FILE_RENAME_FORCE_RESIZE_SR = 0x00000180 |
|
2650 |
|
2651 // Flags for FILE_DISPOSITION_INFORMATION_EX |
|
2652 FILE_DISPOSITION_DO_NOT_DELETE = 0x00000000 |
|
2653 FILE_DISPOSITION_DELETE = 0x00000001 |
|
2654 FILE_DISPOSITION_POSIX_SEMANTICS = 0x00000002 |
|
2655 FILE_DISPOSITION_FORCE_IMAGE_SECTION_CHECK = 0x00000004 |
|
2656 FILE_DISPOSITION_ON_CLOSE = 0x00000008 |
|
2657 FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE = 0x00000010 |
|
2658 |
|
2659 // Flags for FILE_CASE_SENSITIVE_INFORMATION |
|
2660 FILE_CS_FLAG_CASE_SENSITIVE_DIR = 0x00000001 |
|
2661 |
|
2662 // Flags for FILE_LINK_INFORMATION |
|
2663 FILE_LINK_REPLACE_IF_EXISTS = 0x00000001 |
|
2664 FILE_LINK_POSIX_SEMANTICS = 0x00000002 |
|
2665 FILE_LINK_SUPPRESS_STORAGE_RESERVE_INHERITANCE = 0x00000008 |
|
2666 FILE_LINK_NO_INCREASE_AVAILABLE_SPACE = 0x00000010 |
|
2667 FILE_LINK_NO_DECREASE_AVAILABLE_SPACE = 0x00000020 |
|
2668 FILE_LINK_PRESERVE_AVAILABLE_SPACE = 0x00000030 |
|
2669 FILE_LINK_IGNORE_READONLY_ATTRIBUTE = 0x00000040 |
|
2670 FILE_LINK_FORCE_RESIZE_TARGET_SR = 0x00000080 |
|
2671 FILE_LINK_FORCE_RESIZE_SOURCE_SR = 0x00000100 |
|
2672 FILE_LINK_FORCE_RESIZE_SR = 0x00000180 |
|
2673 ) |
|
2674 |
|
2675 // ProcessInformationClasses for NtQueryInformationProcess and NtSetInformationProcess. |
|
2676 const ( |
|
2677 ProcessBasicInformation = iota |
|
2678 ProcessQuotaLimits |
|
2679 ProcessIoCounters |
|
2680 ProcessVmCounters |
|
2681 ProcessTimes |
|
2682 ProcessBasePriority |
|
2683 ProcessRaisePriority |
|
2684 ProcessDebugPort |
|
2685 ProcessExceptionPort |
|
2686 ProcessAccessToken |
|
2687 ProcessLdtInformation |
|
2688 ProcessLdtSize |
|
2689 ProcessDefaultHardErrorMode |
|
2690 ProcessIoPortHandlers |
|
2691 ProcessPooledUsageAndLimits |
|
2692 ProcessWorkingSetWatch |
|
2693 ProcessUserModeIOPL |
|
2694 ProcessEnableAlignmentFaultFixup |
|
2695 ProcessPriorityClass |
|
2696 ProcessWx86Information |
|
2697 ProcessHandleCount |
|
2698 ProcessAffinityMask |
|
2699 ProcessPriorityBoost |
|
2700 ProcessDeviceMap |
|
2701 ProcessSessionInformation |
|
2702 ProcessForegroundInformation |
|
2703 ProcessWow64Information |
|
2704 ProcessImageFileName |
|
2705 ProcessLUIDDeviceMapsEnabled |
|
2706 ProcessBreakOnTermination |
|
2707 ProcessDebugObjectHandle |
|
2708 ProcessDebugFlags |
|
2709 ProcessHandleTracing |
|
2710 ProcessIoPriority |
|
2711 ProcessExecuteFlags |
|
2712 ProcessTlsInformation |
|
2713 ProcessCookie |
|
2714 ProcessImageInformation |
|
2715 ProcessCycleTime |
|
2716 ProcessPagePriority |
|
2717 ProcessInstrumentationCallback |
|
2718 ProcessThreadStackAllocation |
|
2719 ProcessWorkingSetWatchEx |
|
2720 ProcessImageFileNameWin32 |
|
2721 ProcessImageFileMapping |
|
2722 ProcessAffinityUpdateMode |
|
2723 ProcessMemoryAllocationMode |
|
2724 ProcessGroupInformation |
|
2725 ProcessTokenVirtualizationEnabled |
|
2726 ProcessConsoleHostProcess |
|
2727 ProcessWindowInformation |
|
2728 ProcessHandleInformation |
|
2729 ProcessMitigationPolicy |
|
2730 ProcessDynamicFunctionTableInformation |
|
2731 ProcessHandleCheckingMode |
|
2732 ProcessKeepAliveCount |
|
2733 ProcessRevokeFileHandles |
|
2734 ProcessWorkingSetControl |
|
2735 ProcessHandleTable |
|
2736 ProcessCheckStackExtentsMode |
|
2737 ProcessCommandLineInformation |
|
2738 ProcessProtectionInformation |
|
2739 ProcessMemoryExhaustion |
|
2740 ProcessFaultInformation |
|
2741 ProcessTelemetryIdInformation |
|
2742 ProcessCommitReleaseInformation |
|
2743 ProcessDefaultCpuSetsInformation |
|
2744 ProcessAllowedCpuSetsInformation |
|
2745 ProcessSubsystemProcess |
|
2746 ProcessJobMemoryInformation |
|
2747 ProcessInPrivate |
|
2748 ProcessRaiseUMExceptionOnInvalidHandleClose |
|
2749 ProcessIumChallengeResponse |
|
2750 ProcessChildProcessInformation |
|
2751 ProcessHighGraphicsPriorityInformation |
|
2752 ProcessSubsystemInformation |
|
2753 ProcessEnergyValues |
|
2754 ProcessActivityThrottleState |
|
2755 ProcessActivityThrottlePolicy |
|
2756 ProcessWin32kSyscallFilterInformation |
|
2757 ProcessDisableSystemAllowedCpuSets |
|
2758 ProcessWakeInformation |
|
2759 ProcessEnergyTrackingState |
|
2760 ProcessManageWritesToExecutableMemory |
|
2761 ProcessCaptureTrustletLiveDump |
|
2762 ProcessTelemetryCoverage |
|
2763 ProcessEnclaveInformation |
|
2764 ProcessEnableReadWriteVmLogging |
|
2765 ProcessUptimeInformation |
|
2766 ProcessImageSection |
|
2767 ProcessDebugAuthInformation |
|
2768 ProcessSystemResourceManagement |
|
2769 ProcessSequenceNumber |
|
2770 ProcessLoaderDetour |
|
2771 ProcessSecurityDomainInformation |
|
2772 ProcessCombineSecurityDomainsInformation |
|
2773 ProcessEnableLogging |
|
2774 ProcessLeapSecondInformation |
|
2775 ProcessFiberShadowStackAllocation |
|
2776 ProcessFreeFiberShadowStackAllocation |
|
2777 ProcessAltSystemCallInformation |
|
2778 ProcessDynamicEHContinuationTargets |
|
2779 ProcessDynamicEnforcedCetCompatibleRanges |
|
2780 ) |
|
2781 |
|
2782 type PROCESS_BASIC_INFORMATION struct { |
|
2783 ExitStatus NTStatus |
|
2784 PebBaseAddress *PEB |
|
2785 AffinityMask uintptr |
|
2786 BasePriority int32 |
|
2787 UniqueProcessId uintptr |
|
2788 InheritedFromUniqueProcessId uintptr |
|
2789 } |
|
2790 |
|
2791 type SYSTEM_PROCESS_INFORMATION struct { |
|
2792 NextEntryOffset uint32 |
|
2793 NumberOfThreads uint32 |
|
2794 WorkingSetPrivateSize int64 |
|
2795 HardFaultCount uint32 |
|
2796 NumberOfThreadsHighWatermark uint32 |
|
2797 CycleTime uint64 |
|
2798 CreateTime int64 |
|
2799 UserTime int64 |
|
2800 KernelTime int64 |
|
2801 ImageName NTUnicodeString |
|
2802 BasePriority int32 |
|
2803 UniqueProcessID uintptr |
|
2804 InheritedFromUniqueProcessID uintptr |
|
2805 HandleCount uint32 |
|
2806 SessionID uint32 |
|
2807 UniqueProcessKey *uint32 |
|
2808 PeakVirtualSize uintptr |
|
2809 VirtualSize uintptr |
|
2810 PageFaultCount uint32 |
|
2811 PeakWorkingSetSize uintptr |
|
2812 WorkingSetSize uintptr |
|
2813 QuotaPeakPagedPoolUsage uintptr |
|
2814 QuotaPagedPoolUsage uintptr |
|
2815 QuotaPeakNonPagedPoolUsage uintptr |
|
2816 QuotaNonPagedPoolUsage uintptr |
|
2817 PagefileUsage uintptr |
|
2818 PeakPagefileUsage uintptr |
|
2819 PrivatePageCount uintptr |
|
2820 ReadOperationCount int64 |
|
2821 WriteOperationCount int64 |
|
2822 OtherOperationCount int64 |
|
2823 ReadTransferCount int64 |
|
2824 WriteTransferCount int64 |
|
2825 OtherTransferCount int64 |
|
2826 } |
|
2827 |
|
2828 // SystemInformationClasses for NtQuerySystemInformation and NtSetSystemInformation |
|
2829 const ( |
|
2830 SystemBasicInformation = iota |
|
2831 SystemProcessorInformation |
|
2832 SystemPerformanceInformation |
|
2833 SystemTimeOfDayInformation |
|
2834 SystemPathInformation |
|
2835 SystemProcessInformation |
|
2836 SystemCallCountInformation |
|
2837 SystemDeviceInformation |
|
2838 SystemProcessorPerformanceInformation |
|
2839 SystemFlagsInformation |
|
2840 SystemCallTimeInformation |
|
2841 SystemModuleInformation |
|
2842 SystemLocksInformation |
|
2843 SystemStackTraceInformation |
|
2844 SystemPagedPoolInformation |
|
2845 SystemNonPagedPoolInformation |
|
2846 SystemHandleInformation |
|
2847 SystemObjectInformation |
|
2848 SystemPageFileInformation |
|
2849 SystemVdmInstemulInformation |
|
2850 SystemVdmBopInformation |
|
2851 SystemFileCacheInformation |
|
2852 SystemPoolTagInformation |
|
2853 SystemInterruptInformation |
|
2854 SystemDpcBehaviorInformation |
|
2855 SystemFullMemoryInformation |
|
2856 SystemLoadGdiDriverInformation |
|
2857 SystemUnloadGdiDriverInformation |
|
2858 SystemTimeAdjustmentInformation |
|
2859 SystemSummaryMemoryInformation |
|
2860 SystemMirrorMemoryInformation |
|
2861 SystemPerformanceTraceInformation |
|
2862 systemObsolete0 |
|
2863 SystemExceptionInformation |
|
2864 SystemCrashDumpStateInformation |
|
2865 SystemKernelDebuggerInformation |
|
2866 SystemContextSwitchInformation |
|
2867 SystemRegistryQuotaInformation |
|
2868 SystemExtendServiceTableInformation |
|
2869 SystemPrioritySeperation |
|
2870 SystemVerifierAddDriverInformation |
|
2871 SystemVerifierRemoveDriverInformation |
|
2872 SystemProcessorIdleInformation |
|
2873 SystemLegacyDriverInformation |
|
2874 SystemCurrentTimeZoneInformation |
|
2875 SystemLookasideInformation |
|
2876 SystemTimeSlipNotification |
|
2877 SystemSessionCreate |
|
2878 SystemSessionDetach |
|
2879 SystemSessionInformation |
|
2880 SystemRangeStartInformation |
|
2881 SystemVerifierInformation |
|
2882 SystemVerifierThunkExtend |
|
2883 SystemSessionProcessInformation |
|
2884 SystemLoadGdiDriverInSystemSpace |
|
2885 SystemNumaProcessorMap |
|
2886 SystemPrefetcherInformation |
|
2887 SystemExtendedProcessInformation |
|
2888 SystemRecommendedSharedDataAlignment |
|
2889 SystemComPlusPackage |
|
2890 SystemNumaAvailableMemory |
|
2891 SystemProcessorPowerInformation |
|
2892 SystemEmulationBasicInformation |
|
2893 SystemEmulationProcessorInformation |
|
2894 SystemExtendedHandleInformation |
|
2895 SystemLostDelayedWriteInformation |
|
2896 SystemBigPoolInformation |
|
2897 SystemSessionPoolTagInformation |
|
2898 SystemSessionMappedViewInformation |
|
2899 SystemHotpatchInformation |
|
2900 SystemObjectSecurityMode |
|
2901 SystemWatchdogTimerHandler |
|
2902 SystemWatchdogTimerInformation |
|
2903 SystemLogicalProcessorInformation |
|
2904 SystemWow64SharedInformationObsolete |
|
2905 SystemRegisterFirmwareTableInformationHandler |
|
2906 SystemFirmwareTableInformation |
|
2907 SystemModuleInformationEx |
|
2908 SystemVerifierTriageInformation |
|
2909 SystemSuperfetchInformation |
|
2910 SystemMemoryListInformation |
|
2911 SystemFileCacheInformationEx |
|
2912 SystemThreadPriorityClientIdInformation |
|
2913 SystemProcessorIdleCycleTimeInformation |
|
2914 SystemVerifierCancellationInformation |
|
2915 SystemProcessorPowerInformationEx |
|
2916 SystemRefTraceInformation |
|
2917 SystemSpecialPoolInformation |
|
2918 SystemProcessIdInformation |
|
2919 SystemErrorPortInformation |
|
2920 SystemBootEnvironmentInformation |
|
2921 SystemHypervisorInformation |
|
2922 SystemVerifierInformationEx |
|
2923 SystemTimeZoneInformation |
|
2924 SystemImageFileExecutionOptionsInformation |
|
2925 SystemCoverageInformation |
|
2926 SystemPrefetchPatchInformation |
|
2927 SystemVerifierFaultsInformation |
|
2928 SystemSystemPartitionInformation |
|
2929 SystemSystemDiskInformation |
|
2930 SystemProcessorPerformanceDistribution |
|
2931 SystemNumaProximityNodeInformation |
|
2932 SystemDynamicTimeZoneInformation |
|
2933 SystemCodeIntegrityInformation |
|
2934 SystemProcessorMicrocodeUpdateInformation |
|
2935 SystemProcessorBrandString |
|
2936 SystemVirtualAddressInformation |
|
2937 SystemLogicalProcessorAndGroupInformation |
|
2938 SystemProcessorCycleTimeInformation |
|
2939 SystemStoreInformation |
|
2940 SystemRegistryAppendString |
|
2941 SystemAitSamplingValue |
|
2942 SystemVhdBootInformation |
|
2943 SystemCpuQuotaInformation |
|
2944 SystemNativeBasicInformation |
|
2945 systemSpare1 |
|
2946 SystemLowPriorityIoInformation |
|
2947 SystemTpmBootEntropyInformation |
|
2948 SystemVerifierCountersInformation |
|
2949 SystemPagedPoolInformationEx |
|
2950 SystemSystemPtesInformationEx |
|
2951 SystemNodeDistanceInformation |
|
2952 SystemAcpiAuditInformation |
|
2953 SystemBasicPerformanceInformation |
|
2954 SystemQueryPerformanceCounterInformation |
|
2955 SystemSessionBigPoolInformation |
|
2956 SystemBootGraphicsInformation |
|
2957 SystemScrubPhysicalMemoryInformation |
|
2958 SystemBadPageInformation |
|
2959 SystemProcessorProfileControlArea |
|
2960 SystemCombinePhysicalMemoryInformation |
|
2961 SystemEntropyInterruptTimingCallback |
|
2962 SystemConsoleInformation |
|
2963 SystemPlatformBinaryInformation |
|
2964 SystemThrottleNotificationInformation |
|
2965 SystemHypervisorProcessorCountInformation |
|
2966 SystemDeviceDataInformation |
|
2967 SystemDeviceDataEnumerationInformation |
|
2968 SystemMemoryTopologyInformation |
|
2969 SystemMemoryChannelInformation |
|
2970 SystemBootLogoInformation |
|
2971 SystemProcessorPerformanceInformationEx |
|
2972 systemSpare0 |
|
2973 SystemSecureBootPolicyInformation |
|
2974 SystemPageFileInformationEx |
|
2975 SystemSecureBootInformation |
|
2976 SystemEntropyInterruptTimingRawInformation |
|
2977 SystemPortableWorkspaceEfiLauncherInformation |
|
2978 SystemFullProcessInformation |
|
2979 SystemKernelDebuggerInformationEx |
|
2980 SystemBootMetadataInformation |
|
2981 SystemSoftRebootInformation |
|
2982 SystemElamCertificateInformation |
|
2983 SystemOfflineDumpConfigInformation |
|
2984 SystemProcessorFeaturesInformation |
|
2985 SystemRegistryReconciliationInformation |
|
2986 SystemEdidInformation |
|
2987 SystemManufacturingInformation |
|
2988 SystemEnergyEstimationConfigInformation |
|
2989 SystemHypervisorDetailInformation |
|
2990 SystemProcessorCycleStatsInformation |
|
2991 SystemVmGenerationCountInformation |
|
2992 SystemTrustedPlatformModuleInformation |
|
2993 SystemKernelDebuggerFlags |
|
2994 SystemCodeIntegrityPolicyInformation |
|
2995 SystemIsolatedUserModeInformation |
|
2996 SystemHardwareSecurityTestInterfaceResultsInformation |
|
2997 SystemSingleModuleInformation |
|
2998 SystemAllowedCpuSetsInformation |
|
2999 SystemDmaProtectionInformation |
|
3000 SystemInterruptCpuSetsInformation |
|
3001 SystemSecureBootPolicyFullInformation |
|
3002 SystemCodeIntegrityPolicyFullInformation |
|
3003 SystemAffinitizedInterruptProcessorInformation |
|
3004 SystemRootSiloInformation |
|
3005 ) |
|
3006 |
|
3007 type RTL_PROCESS_MODULE_INFORMATION struct { |
|
3008 Section Handle |
|
3009 MappedBase uintptr |
|
3010 ImageBase uintptr |
|
3011 ImageSize uint32 |
|
3012 Flags uint32 |
|
3013 LoadOrderIndex uint16 |
|
3014 InitOrderIndex uint16 |
|
3015 LoadCount uint16 |
|
3016 OffsetToFileName uint16 |
|
3017 FullPathName [256]byte |
|
3018 } |
|
3019 |
|
3020 type RTL_PROCESS_MODULES struct { |
|
3021 NumberOfModules uint32 |
|
3022 Modules [1]RTL_PROCESS_MODULE_INFORMATION |
|
3023 } |
|
3024 |
|
3025 // Constants for LocalAlloc flags. |
|
3026 const ( |
|
3027 LMEM_FIXED = 0x0 |
|
3028 LMEM_MOVEABLE = 0x2 |
|
3029 LMEM_NOCOMPACT = 0x10 |
|
3030 LMEM_NODISCARD = 0x20 |
|
3031 LMEM_ZEROINIT = 0x40 |
|
3032 LMEM_MODIFY = 0x80 |
|
3033 LMEM_DISCARDABLE = 0xf00 |
|
3034 LMEM_VALID_FLAGS = 0xf72 |
|
3035 LMEM_INVALID_HANDLE = 0x8000 |
|
3036 LHND = LMEM_MOVEABLE | LMEM_ZEROINIT |
|
3037 LPTR = LMEM_FIXED | LMEM_ZEROINIT |
|
3038 NONZEROLHND = LMEM_MOVEABLE |
|
3039 NONZEROLPTR = LMEM_FIXED |
|
3040 ) |
|
3041 |
|
3042 // Constants for the CreateNamedPipe-family of functions. |
|
3043 const ( |
|
3044 PIPE_ACCESS_INBOUND = 0x1 |
|
3045 PIPE_ACCESS_OUTBOUND = 0x2 |
|
3046 PIPE_ACCESS_DUPLEX = 0x3 |
|
3047 |
|
3048 PIPE_CLIENT_END = 0x0 |
|
3049 PIPE_SERVER_END = 0x1 |
|
3050 |
|
3051 PIPE_WAIT = 0x0 |
|
3052 PIPE_NOWAIT = 0x1 |
|
3053 PIPE_READMODE_BYTE = 0x0 |
|
3054 PIPE_READMODE_MESSAGE = 0x2 |
|
3055 PIPE_TYPE_BYTE = 0x0 |
|
3056 PIPE_TYPE_MESSAGE = 0x4 |
|
3057 PIPE_ACCEPT_REMOTE_CLIENTS = 0x0 |
|
3058 PIPE_REJECT_REMOTE_CLIENTS = 0x8 |
|
3059 |
|
3060 PIPE_UNLIMITED_INSTANCES = 255 |
|
3061 ) |
|
3062 |
|
3063 // Constants for security attributes when opening named pipes. |
|
3064 const ( |
|
3065 SECURITY_ANONYMOUS = SecurityAnonymous << 16 |
|
3066 SECURITY_IDENTIFICATION = SecurityIdentification << 16 |
|
3067 SECURITY_IMPERSONATION = SecurityImpersonation << 16 |
|
3068 SECURITY_DELEGATION = SecurityDelegation << 16 |
|
3069 |
|
3070 SECURITY_CONTEXT_TRACKING = 0x40000 |
|
3071 SECURITY_EFFECTIVE_ONLY = 0x80000 |
|
3072 |
|
3073 SECURITY_SQOS_PRESENT = 0x100000 |
|
3074 SECURITY_VALID_SQOS_FLAGS = 0x1f0000 |
|
3075 ) |
|
3076 |
|
3077 // ResourceID represents a 16-bit resource identifier, traditionally created with the MAKEINTRESOURCE macro. |
|
3078 type ResourceID uint16 |
|
3079 |
|
3080 // ResourceIDOrString must be either a ResourceID, to specify a resource or resource type by ID, |
|
3081 // or a string, to specify a resource or resource type by name. |
|
3082 type ResourceIDOrString interface{} |
|
3083 |
|
3084 // Predefined resource names and types. |
|
3085 var ( |
|
3086 // Predefined names. |
|
3087 CREATEPROCESS_MANIFEST_RESOURCE_ID ResourceID = 1 |
|
3088 ISOLATIONAWARE_MANIFEST_RESOURCE_ID ResourceID = 2 |
|
3089 ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID ResourceID = 3 |
|
3090 ISOLATIONPOLICY_MANIFEST_RESOURCE_ID ResourceID = 4 |
|
3091 ISOLATIONPOLICY_BROWSER_MANIFEST_RESOURCE_ID ResourceID = 5 |
|
3092 MINIMUM_RESERVED_MANIFEST_RESOURCE_ID ResourceID = 1 // inclusive |
|
3093 MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID ResourceID = 16 // inclusive |
|
3094 |
|
3095 // Predefined types. |
|
3096 RT_CURSOR ResourceID = 1 |
|
3097 RT_BITMAP ResourceID = 2 |
|
3098 RT_ICON ResourceID = 3 |
|
3099 RT_MENU ResourceID = 4 |
|
3100 RT_DIALOG ResourceID = 5 |
|
3101 RT_STRING ResourceID = 6 |
|
3102 RT_FONTDIR ResourceID = 7 |
|
3103 RT_FONT ResourceID = 8 |
|
3104 RT_ACCELERATOR ResourceID = 9 |
|
3105 RT_RCDATA ResourceID = 10 |
|
3106 RT_MESSAGETABLE ResourceID = 11 |
|
3107 RT_GROUP_CURSOR ResourceID = 12 |
|
3108 RT_GROUP_ICON ResourceID = 14 |
|
3109 RT_VERSION ResourceID = 16 |
|
3110 RT_DLGINCLUDE ResourceID = 17 |
|
3111 RT_PLUGPLAY ResourceID = 19 |
|
3112 RT_VXD ResourceID = 20 |
|
3113 RT_ANICURSOR ResourceID = 21 |
|
3114 RT_ANIICON ResourceID = 22 |
|
3115 RT_HTML ResourceID = 23 |
|
3116 RT_MANIFEST ResourceID = 24 |
|
3117 ) |
|
3118 |
|
3119 type VS_FIXEDFILEINFO struct { |
|
3120 Signature uint32 |
|
3121 StrucVersion uint32 |
|
3122 FileVersionMS uint32 |
|
3123 FileVersionLS uint32 |
|
3124 ProductVersionMS uint32 |
|
3125 ProductVersionLS uint32 |
|
3126 FileFlagsMask uint32 |
|
3127 FileFlags uint32 |
|
3128 FileOS uint32 |
|
3129 FileType uint32 |
|
3130 FileSubtype uint32 |
|
3131 FileDateMS uint32 |
|
3132 FileDateLS uint32 |
|
3133 } |
|
3134 |
|
3135 type COAUTHIDENTITY struct { |
|
3136 User *uint16 |
|
3137 UserLength uint32 |
|
3138 Domain *uint16 |
|
3139 DomainLength uint32 |
|
3140 Password *uint16 |
|
3141 PasswordLength uint32 |
|
3142 Flags uint32 |
|
3143 } |
|
3144 |
|
3145 type COAUTHINFO struct { |
|
3146 AuthnSvc uint32 |
|
3147 AuthzSvc uint32 |
|
3148 ServerPrincName *uint16 |
|
3149 AuthnLevel uint32 |
|
3150 ImpersonationLevel uint32 |
|
3151 AuthIdentityData *COAUTHIDENTITY |
|
3152 Capabilities uint32 |
|
3153 } |
|
3154 |
|
3155 type COSERVERINFO struct { |
|
3156 Reserved1 uint32 |
|
3157 Aame *uint16 |
|
3158 AuthInfo *COAUTHINFO |
|
3159 Reserved2 uint32 |
|
3160 } |
|
3161 |
|
3162 type BIND_OPTS3 struct { |
|
3163 CbStruct uint32 |
|
3164 Flags uint32 |
|
3165 Mode uint32 |
|
3166 TickCountDeadline uint32 |
|
3167 TrackFlags uint32 |
|
3168 ClassContext uint32 |
|
3169 Locale uint32 |
|
3170 ServerInfo *COSERVERINFO |
|
3171 Hwnd HWND |
|
3172 } |
|
3173 |
|
3174 const ( |
|
3175 CLSCTX_INPROC_SERVER = 0x1 |
|
3176 CLSCTX_INPROC_HANDLER = 0x2 |
|
3177 CLSCTX_LOCAL_SERVER = 0x4 |
|
3178 CLSCTX_INPROC_SERVER16 = 0x8 |
|
3179 CLSCTX_REMOTE_SERVER = 0x10 |
|
3180 CLSCTX_INPROC_HANDLER16 = 0x20 |
|
3181 CLSCTX_RESERVED1 = 0x40 |
|
3182 CLSCTX_RESERVED2 = 0x80 |
|
3183 CLSCTX_RESERVED3 = 0x100 |
|
3184 CLSCTX_RESERVED4 = 0x200 |
|
3185 CLSCTX_NO_CODE_DOWNLOAD = 0x400 |
|
3186 CLSCTX_RESERVED5 = 0x800 |
|
3187 CLSCTX_NO_CUSTOM_MARSHAL = 0x1000 |
|
3188 CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000 |
|
3189 CLSCTX_NO_FAILURE_LOG = 0x4000 |
|
3190 CLSCTX_DISABLE_AAA = 0x8000 |
|
3191 CLSCTX_ENABLE_AAA = 0x10000 |
|
3192 CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000 |
|
3193 CLSCTX_ACTIVATE_32_BIT_SERVER = 0x40000 |
|
3194 CLSCTX_ACTIVATE_64_BIT_SERVER = 0x80000 |
|
3195 CLSCTX_ENABLE_CLOAKING = 0x100000 |
|
3196 CLSCTX_APPCONTAINER = 0x400000 |
|
3197 CLSCTX_ACTIVATE_AAA_AS_IU = 0x800000 |
|
3198 CLSCTX_PS_DLL = 0x80000000 |
|
3199 |
|
3200 COINIT_MULTITHREADED = 0x0 |
|
3201 COINIT_APARTMENTTHREADED = 0x2 |
|
3202 COINIT_DISABLE_OLE1DDE = 0x4 |
|
3203 COINIT_SPEED_OVER_MEMORY = 0x8 |
|
3204 ) |
|
3205 |
|
3206 // Flag for QueryFullProcessImageName. |
|
3207 const PROCESS_NAME_NATIVE = 1 |
|
3208 |
|
3209 type ModuleInfo struct { |
|
3210 BaseOfDll uintptr |
|
3211 SizeOfImage uint32 |
|
3212 EntryPoint uintptr |
|
3213 } |
|
3214 |
|
3215 const ALL_PROCESSOR_GROUPS = 0xFFFF |
|
3216 |
|
3217 type Rect struct { |
|
3218 Left int32 |
|
3219 Top int32 |
|
3220 Right int32 |
|
3221 Bottom int32 |
|
3222 } |
|
3223 |
|
3224 type GUIThreadInfo struct { |
|
3225 Size uint32 |
|
3226 Flags uint32 |
|
3227 Active HWND |
|
3228 Focus HWND |
|
3229 Capture HWND |
|
3230 MenuOwner HWND |
|
3231 MoveSize HWND |
|
3232 CaretHandle HWND |
|
3233 CaretRect Rect |
|
3234 } |
|
3235 |
|
3236 const ( |
|
3237 DWMWA_NCRENDERING_ENABLED = 1 |
|
3238 DWMWA_NCRENDERING_POLICY = 2 |
|
3239 DWMWA_TRANSITIONS_FORCEDISABLED = 3 |
|
3240 DWMWA_ALLOW_NCPAINT = 4 |
|
3241 DWMWA_CAPTION_BUTTON_BOUNDS = 5 |
|
3242 DWMWA_NONCLIENT_RTL_LAYOUT = 6 |
|
3243 DWMWA_FORCE_ICONIC_REPRESENTATION = 7 |
|
3244 DWMWA_FLIP3D_POLICY = 8 |
|
3245 DWMWA_EXTENDED_FRAME_BOUNDS = 9 |
|
3246 DWMWA_HAS_ICONIC_BITMAP = 10 |
|
3247 DWMWA_DISALLOW_PEEK = 11 |
|
3248 DWMWA_EXCLUDED_FROM_PEEK = 12 |
|
3249 DWMWA_CLOAK = 13 |
|
3250 DWMWA_CLOAKED = 14 |
|
3251 DWMWA_FREEZE_REPRESENTATION = 15 |
|
3252 DWMWA_PASSIVE_UPDATE_MODE = 16 |
|
3253 DWMWA_USE_HOSTBACKDROPBRUSH = 17 |
|
3254 DWMWA_USE_IMMERSIVE_DARK_MODE = 20 |
|
3255 DWMWA_WINDOW_CORNER_PREFERENCE = 33 |
|
3256 DWMWA_BORDER_COLOR = 34 |
|
3257 DWMWA_CAPTION_COLOR = 35 |
|
3258 DWMWA_TEXT_COLOR = 36 |
|
3259 DWMWA_VISIBLE_FRAME_BORDER_THICKNESS = 37 |
|
3260 ) |