windows-pr 0.8.7 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/CHANGES +15 -0
  2. data/MANIFEST +9 -1
  3. data/lib/windows/clipboard.rb +1 -2
  4. data/lib/windows/com/automation.rb +58 -0
  5. data/lib/windows/com.rb +0 -1
  6. data/lib/windows/console.rb +0 -1
  7. data/lib/windows/debug.rb +0 -1
  8. data/lib/windows/device_io.rb +0 -1
  9. data/lib/windows/error.rb +37 -32
  10. data/lib/windows/eventlog.rb +5 -6
  11. data/lib/windows/file.rb +10 -36
  12. data/lib/windows/file_mapping.rb +0 -1
  13. data/lib/windows/filesystem.rb +0 -1
  14. data/lib/windows/gdi/bitmap.rb +0 -1
  15. data/lib/windows/gdi/device_context.rb +0 -1
  16. data/lib/windows/gdi/painting_drawing.rb +0 -1
  17. data/lib/windows/handle.rb +0 -1
  18. data/lib/windows/library.rb +0 -1
  19. data/lib/windows/memory.rb +0 -1
  20. data/lib/windows/msvcrt/buffer.rb +0 -1
  21. data/lib/windows/msvcrt/directory.rb +8 -9
  22. data/lib/windows/msvcrt/file.rb +0 -1
  23. data/lib/windows/msvcrt/io.rb +0 -1
  24. data/lib/windows/msvcrt/string.rb +0 -1
  25. data/lib/windows/msvcrt/time.rb +0 -1
  26. data/lib/windows/national.rb +0 -1
  27. data/lib/windows/network/management.rb +523 -0
  28. data/lib/windows/network/snmp.rb +90 -0
  29. data/lib/windows/network/winsock.rb +126 -0
  30. data/lib/windows/nio.rb +0 -1
  31. data/lib/windows/ntfs/file.rb +58 -0
  32. data/lib/windows/path.rb +105 -38
  33. data/lib/windows/pipe.rb +0 -1
  34. data/lib/windows/security.rb +292 -6
  35. data/lib/windows/service.rb +0 -1
  36. data/lib/windows/shell.rb +4 -1
  37. data/lib/windows/sound.rb +0 -1
  38. data/lib/windows/synchronize.rb +0 -1
  39. data/lib/windows/system_info.rb +0 -1
  40. data/lib/windows/thread.rb +0 -1
  41. data/lib/windows/time.rb +0 -1
  42. data/lib/windows/unicode.rb +0 -1
  43. data/lib/windows/volume.rb +0 -1
  44. data/lib/windows/window/dialog.rb +89 -0
  45. data/lib/windows/window/message.rb +289 -0
  46. data/lib/windows/window/properties.rb +18 -0
  47. data/lib/windows/window/timer.rb +17 -0
  48. data/lib/windows/window.rb +0 -1
  49. data/test/tc_com.rb +17 -19
  50. data/test/tc_msvcrt_directory.rb +57 -27
  51. data/test/tc_msvcrt_string.rb +74 -18
  52. data/windows-pr.gemspec +4 -5
  53. metadata +33 -15
@@ -1,5 +1,4 @@
1
1
  require 'windows/api'
2
- include Windows
3
2
 
4
3
  module Windows
5
4
  module Security
@@ -9,6 +8,7 @@ module Windows
9
8
  API.auto_unicode = false
10
9
 
11
10
  ACL_REVISION = 2
11
+ ACL_REVISION1 = 1
12
12
  ACL_REVISION2 = 2
13
13
  ACL_REVISION3 = 3
14
14
  ACL_REVISION4 = 4
@@ -25,10 +25,86 @@ module Windows
25
25
  SECURITY_NON_UNIQUE_AUTHORITY = 4
26
26
  SECURITY_NT_AUTHORITY = 5
27
27
  SECURITY_RESOURCE_MANAGER_AUTHORITY = 9
28
+
29
+ SECURITY_NULL_RID = 0x00000000
30
+ SECURITY_WORLD_RID = 0x00000000
31
+ SECURITY_LOCAL_RID = 0x00000000
32
+ SECURITY_CREATOR_OWNER_RID = 0x00000000
33
+ SECURITY_CREATOR_GROUP_RID = 0x00000001
34
+ SECURITY_CREATOR_OWNER_SERVER_RID = 0x00000002
35
+ SECURITY_CREATOR_GROUP_SERVER_RID = 0x00000003
36
+ SECURITY_DIALUP_RID = 0x00000001
37
+ SECURITY_NETWORK_RID = 0x00000002
38
+ SECURITY_BATCH_RID = 0x00000003
39
+ SECURITY_INTERACTIVE_RID = 0x00000004
40
+ SECURITY_LOGON_IDS_RID = 0x00000005
41
+ SECURITY_LOGON_IDS_RID_COUNT = 3
42
+ SECURITY_SERVICE_RID = 0x00000006
43
+ SECURITY_ANONYMOUS_LOGON_RID = 0x00000007
44
+ SECURITY_PROXY_RID = 0x00000008
45
+
46
+ SECURITY_ENTERPRISE_CONTROLLERS_RID = 0x00000009
47
+ SECURITY_SERVER_LOGON_RID = SECURITY_ENTERPRISE_CONTROLLERS_RID
48
+ SECURITY_PRINCIPAL_SELF_RID = 0x0000000A
49
+ SECURITY_AUTHENTICATED_USER_RID = 0x0000000B
50
+ SECURITY_RESTRICTED_CODE_RID = 0x0000000C
51
+ SECURITY_TERMINAL_SERVER_RID = 0x0000000D
52
+ SECURITY_REMOTE_LOGON_RID = 0x0000000E
53
+ SECURITY_THIS_ORGANIZATION_RID = 0x0000000F
54
+ SECURITY_LOCAL_SYSTEM_RID = 0x00000012
55
+ SECURITY_LOCAL_SERVICE_RID = 0x00000013
56
+ SECURITY_NETWORK_SERVICE_RID = 0x00000014
57
+ SECURITY_NT_NON_UNIQUE = 0x00000015
58
+ SECURITY_NT_NON_UNIQUE_SUB_AUTH_COUNT = 3
59
+
60
+ SECURITY_BUILTIN_DOMAIN_RID = 0x00000020
61
+ SECURITY_PACKAGE_BASE_RID = 0x00000040
62
+ SECURITY_PACKAGE_RID_COUNT = 2
63
+ SECURITY_PACKAGE_NTLM_RID = 0x0000000A
64
+ SECURITY_PACKAGE_SCHANNEL_RID = 0x0000000E
65
+ SECURITY_PACKAGE_DIGEST_RID = 0x00000015
66
+ SECURITY_MAX_ALWAYS_FILTERED = 0x000003E7
67
+ SECURITY_MIN_NEVER_FILTERED = 0x000003E8
68
+
69
+ SECURITY_OTHER_ORGANIZATION_RID = 0x000003E8
70
+ FOREST_USER_RID_MAX = 0x000001F3
71
+ DOMAIN_USER_RID_ADMIN = 0x000001F4
72
+ DOMAIN_USER_RID_GUEST = 0x000001F5
73
+ DOMAIN_USER_RID_KRBTGT = 0x000001F6
74
+ DOMAIN_USER_RID_MAX = 0x000003E7
75
+ DOMAIN_GROUP_RID_ADMINS = 0x00000200
76
+ DOMAIN_GROUP_RID_USERS = 0x00000201
77
+ DOMAIN_GROUP_RID_GUESTS = 0x00000202
78
+ DOMAIN_GROUP_RID_COMPUTERS = 0x00000203
79
+ DOMAIN_GROUP_RID_CONTROLLERS = 0x00000204
80
+ DOMAIN_GROUP_RID_CERT_ADMINS = 0x00000205
81
+ DOMAIN_GROUP_RID_SCHEMA_ADMINS = 0x00000206
82
+ DOMAIN_GROUP_RID_ENTERPRISE_ADMINS = 0x00000207
83
+ DOMAIN_GROUP_RID_POLICY_ADMINS = 0x00000208
84
+ DOMAIN_ALIAS_RID_ADMINS = 0x00000220
85
+ DOMAIN_ALIAS_RID_USERS = 0x00000221
86
+ DOMAIN_ALIAS_RID_GUESTS = 0x00000222
87
+ DOMAIN_ALIAS_RID_POWER_USERS = 0x00000223
88
+ DOMAIN_ALIAS_RID_ACCOUNT_OPS = 0x00000224
89
+ DOMAIN_ALIAS_RID_SYSTEM_OPS = 0x00000225
90
+ DOMAIN_ALIAS_RID_PRINT_OPS = 0x00000226
91
+ DOMAIN_ALIAS_RID_BACKUP_OPS = 0x00000227
92
+ DOMAIN_ALIAS_RID_REPLICATOR = 0x00000228
93
+ DOMAIN_ALIAS_RID_RAS_SERVERS = 0x00000229
94
+
95
+ DOMAIN_ALIAS_RID_PREW2KCOMPACCESS = 0x0000022A
96
+ DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS = 0x0000022B
97
+ DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS = 0x0000022C
98
+ DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS = 0x0000022D
99
+ DOMAIN_ALIAS_RID_MONITORING_USERS = 0x0000022E
100
+ DOMAIN_ALIAS_RID_LOGGING_USERS = 0x0000022F
101
+ DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS = 0x00000230
102
+ DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS = 0x00000231
103
+ DOMAIN_ALIAS_RID_DCOM_USERS = 0x00000232
28
104
 
29
- GENERIC_RIGHTS_MASK = 4026597376
30
- GENERIC_RIGHTS_CHK = 4026531840
31
- REST_RIGHTS_MASK = 2097151
105
+ GENERIC_RIGHTS_MASK = 0xF0010000
106
+ GENERIC_RIGHTS_CHK = 0xF0000000
107
+ REST_RIGHTS_MASK = 0x001FFFFF
32
108
 
33
109
  TOKEN_READ = 131080
34
110
  TOKEN_WRITE = 131296
@@ -49,21 +125,208 @@ module Windows
49
125
  SE_PRIVILEGE_ENABLED = 0x00000002
50
126
  SE_PRIVILEGE_REMOVED = 0X00000004
51
127
  SE_PRIVILEGE_USED_FOR_ACCESS = 0x80000000
128
+
129
+ ACCESS_MIN_MS_ACE_TYPE = 0x0
130
+ ACCESS_ALLOWED_ACE_TYPE = 0x0
131
+ ACCESS_DENIED_ACE_TYPE = 0x1
132
+ SYSTEM_AUDIT_ACE_TYPE = 0x2
133
+ SYSTEM_ALARM_ACE_TYPE = 0x3
134
+ ACCESS_MAX_MS_V2_ACE_TYPE = 0x3
135
+ ACCESS_ALLOWED_COMPOUND_ACE_TYPE = 0x4
136
+ ACCESS_MAX_MS_V3_ACE_TYPE = 0x4
137
+ ACCESS_MIN_MS_OBJECT_ACE_TYPE = 0x5
138
+ ACCESS_ALLOWED_OBJECT_ACE_TYPE = 0x5
139
+ ACCESS_DENIED_OBJECT_ACE_TYPE = 0x6
140
+ SYSTEM_AUDIT_OBJECT_ACE_TYPE = 0x7
141
+ SYSTEM_ALARM_OBJECT_ACE_TYPE = 0x8
142
+ ACCESS_MAX_MS_OBJECT_ACE_TYPE = 0x8
143
+ ACCESS_MAX_MS_V4_ACE_TYPE = 0x8
144
+ ACCESS_MAX_MS_ACE_TYPE = 0x8
145
+ ACCESS_ALLOWED_CALLBACK_ACE_TYPE = 0x9
146
+ ACCESS_DENIED_CALLBACK_ACE_TYPE = 0xA
147
+ ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE = 0xB
148
+ ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE = 0xC
149
+ SYSTEM_AUDIT_CALLBACK_ACE_TYPE = 0xD
150
+ SYSTEM_ALARM_CALLBACK_ACE_TYPE = 0xE
151
+ SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE = 0xF
152
+ SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE = 0x10
153
+ ACCESS_MAX_MS_V5_ACE_TYPE = 0x10
154
+ OBJECT_INHERIT_ACE = 0x1
155
+ CONTAINER_INHERIT_ACE = 0x2
156
+ NO_PROPAGATE_INHERIT_ACE = 0x4
157
+ INHERIT_ONLY_ACE = 0x8
158
+ INHERITED_ACE = 0x10
159
+ VALID_INHERIT_FLAGS = 0x1F
160
+ SUCCESSFUL_ACCESS_ACE_FLAG = 0x40
161
+ FAILED_ACCESS_ACE_FLAG = 0x80
162
+
163
+ # Standard Access Rights
164
+ DELETE = 0x00010000
165
+ READ_CONTROL = 0x20000
166
+ WRITE_DAC = 0x40000
167
+ WRITE_OWNER = 0x80000
168
+ SYNCHRONIZE = 0x100000
169
+ STANDARD_RIGHTS_REQUIRED = 0xf0000
170
+ STANDARD_RIGHTS_READ = 0x20000
171
+ STANDARD_RIGHTS_WRITE = 0x20000
172
+ STANDARD_RIGHTS_EXECUTE = 0x20000
173
+ STANDARD_RIGHTS_ALL = 0x1F0000
174
+ SPECIFIC_RIGHTS_ALL = 0xFFFF
175
+ ACCESS_SYSTEM_SECURITY = 0x1000000
176
+ MAXIMUM_ALLOWED = 0x2000000
177
+ GENERIC_READ = 0x80000000
178
+ GENERIC_WRITE = 0x40000000
179
+ GENERIC_EXECUTE = 0x20000000
180
+ GENERIC_ALL = 0x10000000
181
+
182
+ # Enum SidNameUse
183
+ SidTypeUser = 1
184
+ SidTypeGroup = 2
185
+ SidTypeDomain = 3
186
+ SidTypeAlias = 4
187
+ SidTypeWellKnownGroup = 5
188
+ SidTypeDeletedAccount = 6
189
+ SidTypeInvalid = 7
190
+ SidTypeUnknown = 8
191
+ SidTypeComputer = 9
192
+
193
+ # Enum TokenInformationClass
194
+ TokenUser = 1
195
+ TokenGroups = 2
196
+ TokenPrivileges = 3
197
+ TokenOwner = 4
198
+ TokenPrimaryGroup = 5
199
+ TokenDefaultDacl = 6
200
+ TokenSource = 7
201
+ TokenType = 8
202
+ TokenImpersonationLevel = 9
203
+ TokenStatistics = 10
204
+ TokenRestrictedSids = 11
205
+ TokenSessionId = 12
206
+ TokenGroupsAndPrivileges = 13
207
+ TokenSessionReference = 14
208
+ TokenSandBoxInert = 15
209
+ TokenAuditPolicy = 16
210
+ TokenOrigin = 17
211
+ TokenElevationType = 18
212
+ TokenLinkedToken = 19
213
+ TokenElevation = 20
214
+ TokenHasRestrictions = 21
215
+ TokenAccessInformation = 22
216
+ TokenVirtualizationAllowed = 23
217
+ TokenVirtualizationEnabled = 24
218
+ TokenIntegrityLevel = 25
219
+ TokenUIAccess = 26
220
+ TokenMandatoryPolicy = 27
221
+ TokenLogonSid = 28
222
+ MaxTokenInfoClass = 29
223
+
224
+ # Enum WellKnownSidType
225
+ WinNullSid = 0
226
+ WinWorldSid = 1
227
+ WinLocalSid = 2
228
+ WinCreatorOwnerSid = 3
229
+ WinCreatorGroupSid = 4
230
+ WinCreatorOwnerServerSid = 5
231
+ WinCreatorGroupServerSid = 6
232
+ WinNtAuthoritySid = 7
233
+ WinDialupSid = 8
234
+ WinNetworkSid = 9
235
+ WinBatchSid = 10
236
+ WinInteractiveSid = 11
237
+ WinServiceSid = 12
238
+ WinAnonymousSid = 13
239
+ WinProxySid = 14
240
+ WinEnterpriseControllersSid = 15
241
+ WinSelfSid = 16
242
+ WinAuthenticatedUserSid = 17
243
+ WinRestrictedCodeSid = 18
244
+ WinTerminalServerSid = 19
245
+ WinRemoteLogonIdSid = 20
246
+ WinLogonIdsSid = 21
247
+ WinLocalSystemSid = 22
248
+ WinLocalServiceSid = 23
249
+ WinNetworkServiceSid = 24
250
+ WinBuiltinDomainSid = 25
251
+ WinBuiltinAdministratorsSid = 26
252
+ WinBuiltinUsersSid = 27
253
+ WinBuiltinGuestsSid = 28
254
+ WinBuiltinPowerUsersSid = 29
255
+ WinBuiltinAccountOperatorsSid = 30
256
+ WinBuiltinSystemOperatorsSid = 31
257
+ WinBuiltinPrintOperatorsSid = 32
258
+ WinBuiltinBackupOperatorsSid = 33
259
+ WinBuiltinReplicatorSid = 34
260
+ WinBuiltinPreWindows2000CompatibleAccessSid = 35
261
+ WinBuiltinRemoteDesktopUsersSid = 36
262
+ WinBuiltinNetworkConfigurationOperatorsSid = 37
263
+ WinAccountAdministratorSid = 38
264
+ WinAccountGuestSid = 39
265
+ WinAccountKrbtgtSid = 40
266
+ WinAccountDomainAdminsSid = 41
267
+ WinAccountDomainUsersSid = 42
268
+ WinAccountDomainGuestsSid = 43
269
+ WinAccountComputersSid = 44
270
+ WinAccountControllersSid = 45
271
+ WinAccountCertAdminsSid = 46
272
+ WinAccountSchemaAdminsSid = 47
273
+ WinAccountEnterpriseAdminsSid = 48
274
+ WinAccountPolicyAdminsSid = 49
275
+ WinAccountRasAndIasServersSid = 50
276
+ WinNTLMAuthenticationSid = 51
277
+ WinDigestAuthenticationSid = 52
278
+ WinSChannelAuthenticationSid = 53
279
+ WinThisOrganizationSid = 54
280
+ WinOtherOrganizationSid = 55
281
+ WinBuiltinIncomingForestTrustBuildersSid = 56
282
+ WinBuiltinPerfMonitoringUsersSid = 57
283
+ WinBuiltinPerfLoggingUsersSid = 58
284
+ WinBuiltinAuthorizationAccessSid = 59
285
+ WinBuiltinTerminalServerLicenseServersSid = 60
286
+ WinBuiltinDCOMUsersSid = 61
287
+ WinBuiltinIUsersSid = 62
288
+ WinIUserSid = 63
289
+ WinBuiltinCryptoOperatorsSid = 64
290
+ WinUntrustedLabelSid = 65
291
+ WinLowLabelSid = 66
292
+ WinMediumLabelSid = 67
293
+ WinHighLabelSid = 68
294
+ WinSystemLabelSid = 69
295
+ WinWriteRestrictedCodeSid = 70
296
+ WinCreatorOwnerRightsSid = 71
297
+ WinCacheablePrincipalsGroupSid = 72
298
+ WinNonCacheablePrincipalsGroupSid = 73
299
+ WinEnterpriseReadonlyControllersSid = 74
300
+ WinAccountReadonlyControllersSid = 75
301
+ WinBuiltinEventLogReadersGroup = 76
302
+ WinNewEnterpriseReadonlyControllersSid = 77
303
+ WinBuiltinCertSvcDComAccessGroup = 78
52
304
 
305
+ # Enum AclInformationClass
306
+ AclRevisionInformation = 1
307
+ AclSizeInformation = 2
308
+
53
309
  API.new('AccessCheck', 'PLLPPLPP', 'B', 'advapi32')
54
310
  API.new('AddAce', 'PLLLL', 'B', 'advapi32')
55
311
  API.new('AdjustTokenGroups', 'LLPLPP', 'B', 'advapi32')
56
312
  API.new('AdjustTokenPrivileges', 'LLPLPP', 'B', 'advapi32')
313
+ API.new('AllocateAndInitializeSid', 'PLLLLLLLLLP', 'B', 'advapi32')
57
314
  API.new('CheckTokenMembership', 'LPP', 'B', 'advapi32')
58
315
  API.new('CopySid', 'LLP', 'B', 'advapi32')
59
- API.new('ConvertSidToStringSid', 'PL', 'B', 'advapi32')
316
+ API.new('ConvertSidToStringSid', 'LP', 'B', 'advapi32')
60
317
  API.new('ConvertSecurityDescriptorToStringSecurityDescriptor', 'PLLPP', 'B', 'advapi32')
61
318
  API.new('ConvertStringSecurityDescriptorToSecurityDescriptor', 'PLPP', 'B', 'advapi32')
62
- API.new('ConvertStringSidToSid', 'PL', 'B', 'advapi32')
319
+ API.new('ConvertStringSidToSid', 'LP', 'B', 'advapi32')
63
320
  API.new('CreateRestrictedToken', 'LLLPLPLPP', 'B', 'advapi32')
64
321
  API.new('DuplicateToken', 'LPP', 'B', 'advapi32')
65
322
  API.new('DuplicateTokenEx', 'LLPLLP', 'B', 'advapi32')
323
+ API.new('EqualDomainSid', 'PPP', 'B', 'advapi32')
324
+ API.new('EqualPrefixSid', 'PP', 'B', 'advapi32')
325
+ API.new('EqualSid', 'PP', 'B', 'advapi32')
326
+ API.new('FindFirstFreeAce', 'PP', 'B', 'advapi32')
327
+ API.new('FreeSid', 'P', 'L', 'advapi32')
66
328
  API.new('GetAce', 'LLP', 'B', 'advapi32')
329
+ API.new('GetAclInformation', 'PPLI', 'B', 'advapi32')
67
330
  API.new('GetFileSecurity', 'PLPLP', 'B', 'advapi32')
68
331
  API.new('GetLengthSid', 'P', 'L', 'advapi32')
69
332
  API.new('GetSecurityDescriptorControl', 'PPP', 'B', 'advapi32')
@@ -73,11 +336,26 @@ module Windows
73
336
  API.new('GetSecurityDescriptorOwner', 'PPI', 'B', 'advapi32')
74
337
  API.new('GetSecurityDescriptorRMControl', 'PP', 'L', 'advapi32')
75
338
  API.new('GetSecurityDescriptorSacl', 'PIPI', 'B', 'advapi32')
339
+ API.new('GetSecurityInfo', 'LLLPPPPP', 'L', 'advapi32')
340
+ API.new('GetTokenInformation', 'LLPLP', 'B', 'advapi32')
341
+ API.new('GetSidIdentifierAuthority', 'P', 'L', 'advapi32')
342
+ API.new('GetSidLengthRequired', 'I', 'L', 'advapi32')
343
+ API.new('GetSidSubAuthority', 'PL', 'L', 'advapi32')
344
+ API.new('GetSidSubAuthorityCount', 'P', 'L', 'advapi32')
345
+ API.new('GetUserObjectSecurity', 'LPPLP', 'B', 'user32')
346
+ API.new('GetWindowsAccountDomainSid', 'PPP', 'B', 'advapi32')
76
347
  API.new('InitializeAcl', 'PLL', 'B', 'advapi32')
77
348
  API.new('InitializeSecurityDescriptor', 'PL', 'B', 'advapi32')
349
+ API.new('InitializeSid', 'PPI', 'B', 'advapi32')
350
+ API.new('IsTokenRestricted', 'L', 'B', 'advapi32')
351
+ API.new('IsValidAcl', 'P', 'B', 'advapi32')
78
352
  API.new('IsValidSecurityDescriptor', 'P', 'B', 'advapi32')
353
+ API.new('IsValidSid', 'P', 'B', 'advapi32')
354
+ API.new('IsWellKnownSid', 'PI', 'B', 'advapi32')
79
355
  API.new('LookupAccountName', 'PPPPPPP', 'B', 'advapi32')
80
356
  API.new('LookupAccountSid', 'PLPPPPP', 'B', 'advapi32')
357
+ API.new('LookupPrivilegeDisplayName', 'PPPPP', 'B', 'advapi32')
358
+ API.new('LookupPrivilegeName', 'PPPP', 'B', 'advapi32')
81
359
  API.new('LookupPrivilegeValue', 'PPP', 'B', 'advapi32')
82
360
  API.new('OpenProcessToken', 'LLP', 'B', 'advapi32')
83
361
  API.new('OpenThreadToken', 'LLLP', 'B', 'advapi32')
@@ -87,7 +365,15 @@ module Windows
87
365
  API.new('SetSecurityDescriptorOwner', 'PPI', 'B', 'advapi32')
88
366
  API.new('SetSecurityDescriptorRMControl', 'PP', 'L', 'advapi32')
89
367
  API.new('SetSecurityDescriptorSacl', 'PIPI', 'B', 'advapi32')
368
+ API.new('SetSecurityInfo', 'LLLPPPP', 'L', 'advapi32')
90
369
  API.new('SetThreadToken', 'PL', 'B', 'advapi32')
91
370
  API.new('SetTokenInformation', 'LLPL', 'B', 'advapi32')
371
+
372
+ # Windows XP or later
373
+ begin
374
+ API.new('CreateWellKnownSid', 'IPPP', 'B', 'advapi32')
375
+ rescue LoadError
376
+ # Do nothing. It's up to you to check for it.
377
+ end
92
378
  end
93
379
  end
@@ -1,5 +1,4 @@
1
1
  require 'windows/api'
2
- include Windows
3
2
 
4
3
  module Windows
5
4
  module Service
data/lib/windows/shell.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'windows/api'
2
- include Windows
3
2
 
4
3
  module Windows
5
4
  module Shell
@@ -141,6 +140,10 @@ module Windows
141
140
  API.new('ExtractIcon', 'LPI', 'L', 'shell32')
142
141
  API.new('ExtractIconEx', 'PIPPI', 'I', 'shell32')
143
142
  API.new('FindExecutable', 'PPP', 'L', 'shell32')
143
+ API.new('GetAllUsersProfileDirectory', 'PP', 'B', 'userenv')
144
+ API.new('GetDefaultUserProfileDirectory', 'PP', 'B', 'userenv')
145
+ API.new('GetProfilesDirectory', 'PP', 'B', 'userenv')
146
+ API.new('GetUserProfileDirectory', 'LPP', 'B', 'userenv')
144
147
  API.new('ShellAbout', 'LPPL', 'I', 'shell32')
145
148
  API.new('SHBrowseForFolder', 'P', 'P', 'shell32')
146
149
  API.new('SHChangeNotify', 'LILL', 'V', 'shell32')
data/lib/windows/sound.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'windows/api'
2
- include Windows
3
2
 
4
3
  module Windows
5
4
  module Sound
@@ -1,5 +1,4 @@
1
1
  require 'windows/api'
2
- include Windows
3
2
 
4
3
  module Windows
5
4
  module Synchronize
@@ -1,5 +1,4 @@
1
1
  require 'windows/api'
2
- include Windows
3
2
 
4
3
  module Windows
5
4
  module SystemInfo
@@ -1,5 +1,4 @@
1
1
  require 'windows/api'
2
- include Windows
3
2
 
4
3
  module Windows
5
4
  module Thread
data/lib/windows/time.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'windows/api'
2
- include Windows
3
2
 
4
3
  # In general you will want to use this module with Windows::National because
5
4
  # it contains the various LOCALE and TIME constants.
@@ -1,6 +1,5 @@
1
1
  require 'windows/api'
2
2
  require 'windows/msvcrt/string'
3
- include Windows
4
3
 
5
4
  module Windows
6
5
  module Unicode
@@ -1,5 +1,4 @@
1
1
  require 'windows/api'
2
- include Windows
3
2
 
4
3
  module Windows
5
4
  module Volume
@@ -0,0 +1,89 @@
1
+ require 'windows/api'
2
+
3
+ module Windows
4
+ module Window
5
+ module Dialog
6
+ API.auto_namespace = 'Windows::Window::Dialog'
7
+ API.auto_constant = true
8
+ API.auto_method = true
9
+ API.auto_unicode = true
10
+
11
+ MB_OK = 0x00000000
12
+ MB_OKCANCEL = 0x00000001
13
+ MB_ABORTRETRYIGNORE = 0x00000002
14
+ MB_YESNOCANCEL = 0x00000003
15
+ MB_YESNO = 0x00000004
16
+ MB_RETRYCANCEL = 0x00000005
17
+ MB_CANCELTRYCONTINUE = 0x00000006
18
+ MB_ICONHAND = 0x00000010
19
+ MB_ICONQUESTION = 0x00000020
20
+ MB_ICONEXCLAMATION = 0x00000030
21
+ MB_ICONASTERISK = 0x00000040
22
+ MB_USERICON = 0x00000080
23
+ MB_ICONWARNING = MB_ICONEXCLAMATION
24
+ MB_ICONERROR = MB_ICONHAND
25
+ MB_ICONINFORMATION = MB_ICONASTERISK
26
+ MB_ICONSTOP = MB_ICONHAND
27
+ MB_DEFBUTTON1 = 0x00000000
28
+ MB_DEFBUTTON2 = 0x00000100
29
+ MB_DEFBUTTON3 = 0x00000200
30
+ MB_DEFBUTTON4 = 0x00000300
31
+ MB_APPLMODAL = 0x00000000
32
+ MB_SYSTEMMODAL = 0x00001000
33
+ MB_TASKMODAL = 0x00002000
34
+ MB_HELP = 0x00004000
35
+ MB_NOFOCUS = 0x00008000
36
+ MB_SETFOREGROUND = 0x00010000
37
+ MB_DEFAULT_DESKTOP_ONLY = 0x00020000
38
+ MB_TOPMOST = 0x00040000
39
+ MB_RIGHT = 0x00080000
40
+ MB_RTLREADING = 0x00100000
41
+ MB_SERVICE_NOTIFICATION = 0x00200000 # Assume Win2k or later
42
+ MB_SERVICE_NOTIFICATION_NT3X = 0x00040000
43
+ MB_TYPEMASK = 0x0000000F
44
+ MB_ICONMASK = 0x000000F0
45
+ MB_DEFMASK = 0x00000F00
46
+ MB_MODEMASK = 0x00003000
47
+ MB_MISCMASK = 0x0000C000
48
+
49
+ API.new('CreateDialogIndirectParam', 'LPLKL', 'L', 'user32')
50
+ API.new('CreateDialogParam', 'LPLKL', 'L', 'user32')
51
+ API.new('DialogBoxIndirectParam', 'LPLKL', 'P', 'user32')
52
+ API.new('DialogBoxParam', 'LPLKL', 'P', 'user32')
53
+ API.new('EndDialog', 'LP', 'B', 'user32')
54
+ API.new('GetDialogBaseUnits', 'V', 'L', 'user32')
55
+ API.new('GetDlgCtrlID', 'L', 'I', 'user32')
56
+ API.new('GetDlgItem', 'LI', 'L', 'user32')
57
+ API.new('GetDlgItemInt', 'LIPI', 'I', 'user32')
58
+ API.new('GetDlgItemText', 'LIPI', 'I', 'user32')
59
+ API.new('GetNextDlgGroupItem', 'LLI', 'L', 'user32')
60
+ API.new('GetNextDlgTabItem', 'LLI', 'L', 'user32')
61
+ API.new('IsDialogMessage', 'LP', 'B', 'user32')
62
+ API.new('MapDialogRect', 'LP', 'B', 'user32')
63
+ API.new('MessageBox', 'LPPI', 'I', 'user32')
64
+ API.new('MessageBoxEx', 'LPPII', 'I', 'user32')
65
+ API.new('MessageBoxIndirect', 'P', 'I', 'user32')
66
+ API.new('SendDlgItemMessage', 'LIILL', 'L', 'user32')
67
+ API.new('SetDlgItemInt', 'LIII', 'L', 'user32')
68
+ API.new('SetDlgItemText', 'LIP', 'B', 'user32')
69
+
70
+ # Macros from WinUser.h
71
+
72
+ def CreateDialog(hInstance, lpName, hParent, lpDialogFunc)
73
+ CreateDialogParam.call(hInstance, lpName, hParent, lpDialogFunc, 0)
74
+ end
75
+
76
+ def CreateDialogIndirect(hInst, lpTemp, hPar, lpDialFunc)
77
+ CreateDialogIndirectParam.call(hInst, lpTemp, hPar, lpDialFunc, 0)
78
+ end
79
+
80
+ def DialogBox(hInstance, lpTemp, hParent, lpDialogFunc)
81
+ DialogBoxParam.call(hInstance, lpTemp, hParent, lpDialogFunc, 0)
82
+ end
83
+
84
+ def DialogBoxIndirect(hInst, lpTemp, hParent, lpDialogFunc)
85
+ DialogBoxParamIndirect.call(hInst, lpTemp, hParent, lpDialogFunc, 0)
86
+ end
87
+ end
88
+ end
89
+ end