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