windows-pr 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +444 -438
  3. data/MANIFEST +68 -65
  4. data/README +154 -153
  5. data/Rakefile +42 -37
  6. data/doc/conversion_guide.txt +37 -37
  7. data/lib/windows/clipboard.rb +61 -61
  8. data/lib/windows/com.rb +192 -192
  9. data/lib/windows/com/accessibility.rb +16 -16
  10. data/lib/windows/com/automation.rb +149 -149
  11. data/lib/windows/com/variant.rb +24 -24
  12. data/lib/windows/console.rb +114 -114
  13. data/lib/windows/debug.rb +35 -35
  14. data/lib/windows/device_io.rb +248 -248
  15. data/lib/windows/directory.rb +27 -27
  16. data/lib/windows/error.rb +504 -498
  17. data/lib/windows/eventlog.rb +80 -80
  18. data/lib/windows/file.rb +264 -264
  19. data/lib/windows/file_mapping.rb +25 -25
  20. data/lib/windows/filesystem.rb +15 -15
  21. data/lib/windows/gdi/bitmap.rb +65 -65
  22. data/lib/windows/gdi/device_context.rb +46 -46
  23. data/lib/windows/gdi/metafile.rb +40 -40
  24. data/lib/windows/gdi/painting_drawing.rb +115 -115
  25. data/lib/windows/handle.rb +23 -23
  26. data/lib/windows/library.rb +44 -44
  27. data/lib/windows/limits.rb +34 -34
  28. data/lib/windows/mailslot.rb +24 -24
  29. data/lib/windows/memory.rb +128 -128
  30. data/lib/windows/msvcrt/buffer.rb +75 -75
  31. data/lib/windows/msvcrt/directory.rb +31 -31
  32. data/lib/windows/msvcrt/file.rb +47 -47
  33. data/lib/windows/msvcrt/io.rb +73 -73
  34. data/lib/windows/msvcrt/string.rb +182 -182
  35. data/lib/windows/msvcrt/time.rb +169 -169
  36. data/lib/windows/national.rb +580 -580
  37. data/lib/windows/network/management.rb +525 -525
  38. data/lib/windows/network/snmp.rb +92 -92
  39. data/lib/windows/network/winsock.rb +128 -128
  40. data/lib/windows/nio.rb +50 -50
  41. data/lib/windows/ntfs/winternl.rb +117 -117
  42. data/lib/windows/path.rb +143 -143
  43. data/lib/windows/pipe.rb +42 -42
  44. data/lib/windows/process.rb +176 -176
  45. data/lib/windows/registry.rb +171 -171
  46. data/lib/windows/security.rb +479 -479
  47. data/lib/windows/security/authentication.rb +32 -32
  48. data/lib/windows/security/sspi.rb +153 -0
  49. data/lib/windows/service.rb +142 -142
  50. data/lib/windows/shell.rb +171 -171
  51. data/lib/windows/socket.rb +86 -86
  52. data/lib/windows/sound.rb +39 -39
  53. data/lib/windows/synchronize.rb +133 -133
  54. data/lib/windows/system_info.rb +229 -229
  55. data/lib/windows/thread.rb +64 -64
  56. data/lib/windows/time.rb +48 -48
  57. data/lib/windows/tool_helper.rb +36 -36
  58. data/lib/windows/unicode.rb +155 -155
  59. data/lib/windows/volume.rb +61 -61
  60. data/lib/windows/window.rb +81 -81
  61. data/lib/windows/window/classes.rb +59 -59
  62. data/lib/windows/window/dialog.rb +91 -91
  63. data/lib/windows/window/menu.rb +102 -102
  64. data/lib/windows/window/message.rb +297 -297
  65. data/lib/windows/window/properties.rb +20 -20
  66. data/lib/windows/window/timer.rb +19 -19
  67. data/lib/windows/wsa.rb +102 -102
  68. data/test/tc_clipboard.rb +41 -41
  69. data/test/tc_com.rb +32 -32
  70. data/test/tc_com_automation.rb +15 -15
  71. data/test/tc_console.rb +108 -108
  72. data/test/tc_debug.rb +48 -48
  73. data/test/tc_device_io.rb +29 -29
  74. data/test/tc_directory.rb +25 -25
  75. data/test/tc_error.rb +38 -38
  76. data/test/tc_eventlog.rb +58 -58
  77. data/test/tc_file.rb +67 -67
  78. data/test/tc_file_mapping.rb +38 -38
  79. data/test/tc_filesystem.rb +27 -27
  80. data/test/tc_gdi_bitmap.rb +25 -25
  81. data/test/tc_gdi_metafile.rb +23 -23
  82. data/test/tc_handle.rb +36 -36
  83. data/test/tc_library.rb +37 -37
  84. data/test/tc_limits.rb +34 -34
  85. data/test/tc_mailslot.rb +22 -22
  86. data/test/tc_memory.rb +44 -44
  87. data/test/tc_msvcrt_buffer.rb +63 -63
  88. data/test/tc_msvcrt_directory.rb +96 -96
  89. data/test/tc_msvcrt_file.rb +80 -80
  90. data/test/tc_msvcrt_io.rb +48 -48
  91. data/test/tc_msvcrt_string.rb +94 -94
  92. data/test/tc_msvcrt_time.rb +19 -19
  93. data/test/tc_national.rb +38 -38
  94. data/test/tc_network_management.rb +32 -32
  95. data/test/tc_network_snmp.rb +31 -31
  96. data/test/tc_network_winsock.rb +34 -34
  97. data/test/tc_nio.rb +32 -32
  98. data/test/tc_ntfs_winternl.rb +48 -48
  99. data/test/tc_path.rb +90 -90
  100. data/test/tc_pipe.rb +53 -53
  101. data/test/tc_process.rb +24 -24
  102. data/test/tc_registry.rb +29 -29
  103. data/test/tc_security.rb +104 -104
  104. data/test/tc_security_authentication.rb +34 -34
  105. data/test/tc_security_sspi.rb +23 -0
  106. data/test/tc_service.rb +57 -57
  107. data/test/tc_shell.rb +34 -34
  108. data/test/tc_socket.rb +20 -20
  109. data/test/tc_sound.rb +37 -37
  110. data/test/tc_synchronize.rb +75 -75
  111. data/test/tc_system_info.rb +33 -33
  112. data/test/tc_thread.rb +29 -29
  113. data/test/tc_time.rb +32 -32
  114. data/test/tc_tool_helper.rb +29 -29
  115. data/test/tc_unicode.rb +83 -83
  116. data/test/tc_volume.rb +47 -47
  117. data/test/tc_window.rb +45 -45
  118. data/test/tc_window_classes.rb +33 -33
  119. data/test/tc_window_dialog.rb +33 -33
  120. data/test/tc_window_menu.rb +29 -29
  121. data/test/tc_window_message.rb +33 -33
  122. data/test/tc_window_properties.rb +29 -29
  123. data/test/tc_window_timer.rb +29 -29
  124. data/test/tc_wsa.rb +19 -19
  125. data/windows-pr.gemspec +33 -34
  126. metadata +31 -32
@@ -1,525 +1,525 @@
1
- require 'windows/api'
2
-
3
- # I don't use the Boolean flag for the return types of these methods because
4
- # they succeed, not fail, if the return value is 0.
5
- #
6
- module Windows
7
- module Network
8
- module Management
9
- API.auto_namespace = 'Windows::Network::Management'
10
- API.auto_constant = true
11
- API.auto_method = false
12
- API.auto_unicode = false
13
-
14
- private
15
-
16
- NERR_Success = 0
17
- NERR_BASE = 2100
18
- NERR_NetNotStarted = NERR_BASE + 2
19
- NERR_UnknownServer = NERR_BASE + 3
20
- NERR_ShareMem = NERR_BASE + 4
21
- NERR_NoNetworkResource = NERR_BASE + 5
22
- NERR_RemoteOnly = NERR_BASE + 6
23
- NERR_DevNotRedirected = NERR_BASE + 7
24
- NERR_AlreadyLoggedOn = NERR_BASE + 100
25
- NERR_NotLoggedOn = NERR_BASE + 101
26
- NERR_BadUsername = NERR_BASE + 102
27
- NERR_BadPassword = NERR_BASE + 103
28
- NERR_UnableToAddName_W = NERR_BASE + 104
29
- NERR_UnableToAddName_F = NERR_BASE + 105
30
- NERR_UnableToDelName_W = NERR_BASE + 106
31
- NERR_UnableToDelName_F = NERR_BASE + 107
32
- NERR_LogonsPaused = NERR_BASE + 109
33
- NERR_LogonServerConflict = NERR_BASE + 110
34
- NERR_LogonNoUserPath = NERR_BASE + 111
35
- NERR_LogonScriptError = NERR_BASE + 112
36
- NERR_StandaloneLogon = NERR_BASE + 114
37
- NERR_LogonServerNotFound = NERR_BASE + 115
38
- NERR_LogonDomainExists = NERR_BASE + 116
39
- NERR_NonValidatedLogon = NERR_BASE + 117
40
- NERR_ACFNotFound = NERR_BASE + 119
41
- NERR_GroupNotFound = NERR_BASE + 120
42
- NERR_UserNotFound = NERR_BASE + 121
43
- NERR_ResourceNotFound = NERR_BASE + 122
44
- NERR_GroupExists = NERR_BASE + 123
45
- NERR_UserExists = NERR_BASE + 124
46
- NERR_ResourceExists = NERR_BASE + 125
47
- NERR_NotPrimary = NERR_BASE + 126
48
- NERR_ACFNotLoaded = NERR_BASE + 127
49
- NERR_ACFNoRoom = NERR_BASE + 128
50
- NERR_ACFFileIOFail = NERR_BASE + 129
51
- NERR_ACFTooManyLists = NERR_BASE + 130
52
- NERR_UserLogon = NERR_BASE + 131
53
- NERR_ACFNoParent = NERR_BASE + 132
54
- NERR_CanNotGrowSegment = NERR_BASE + 133
55
- NERR_SpeGroupOp = NERR_BASE + 134
56
- NERR_NotInCache = NERR_BASE + 135
57
- NERR_UserInGroup = NERR_BASE + 136
58
- NERR_UserNotInGroup = NERR_BASE + 137
59
- NERR_AccountUndefined = NERR_BASE + 138
60
- NERR_AccountExpired = NERR_BASE + 139
61
- NERR_InvalidWorkstation = NERR_BASE + 140
62
- NERR_InvalidLogonHours = NERR_BASE + 141
63
- NERR_PasswordExpired = NERR_BASE + 142
64
- NERR_PasswordCantChange = NERR_BASE + 143
65
- NERR_PasswordHistConflict = NERR_BASE + 144
66
- NERR_PasswordTooShort = NERR_BASE + 145
67
- NERR_PasswordTooRecent = NERR_BASE + 146
68
- NERR_InvalidDatabase = NERR_BASE + 147
69
- NERR_DatabaseUpToDate = NERR_BASE + 148
70
- NERR_SyncRequired = NERR_BASE + 149
71
- NERR_UseNotFound = NERR_BASE + 150
72
- NERR_BadAsgType = NERR_BASE + 151
73
- NERR_DeviceIsShared = NERR_BASE + 152
74
-
75
- MAX_PREFERRED_LENGTH = 0xFFFFFFFF
76
-
77
- # Taken from LMServer.h
78
- SV_TYPE_WORKSTATION = 0x00000001
79
- SV_TYPE_SERVER = 0x00000002
80
- SV_TYPE_SQLSERVER = 0x00000004
81
- SV_TYPE_DOMAIN_CTRL = 0x00000008
82
- SV_TYPE_DOMAIN_BAKCTRL = 0x00000010
83
- SV_TYPE_TIME_SOURCE = 0x00000020
84
- SV_TYPE_AFP = 0x00000040
85
- SV_TYPE_NOVELL = 0x00000080
86
- SV_TYPE_DOMAIN_MEMBER = 0x00000100
87
- SV_TYPE_PRINTQ_SERVER = 0x00000200
88
- SV_TYPE_DIALIN_SERVER = 0x00000400
89
- SV_TYPE_XENIX_SERVER = 0x00000800
90
- SV_TYPE_SERVER_UNIX = SV_TYPE_XENIX_SERVER
91
- SV_TYPE_NT = 0x00001000
92
- SV_TYPE_WFW = 0x00002000
93
- SV_TYPE_SERVER_MFPN = 0x00004000
94
- SV_TYPE_SERVER_NT = 0x00008000
95
- SV_TYPE_POTENTIAL_BROWSER = 0x00010000
96
- SV_TYPE_BACKUP_BROWSER = 0x00020000
97
- SV_TYPE_MASTER_BROWSER = 0x00040000
98
- SV_TYPE_DOMAIN_MASTER = 0x00080000
99
- SV_TYPE_SERVER_OSF = 0x00100000
100
- SV_TYPE_SERVER_VMS = 0x00200000
101
- SV_TYPE_WINDOWS = 0x00400000
102
- SV_TYPE_DFS = 0x00800000
103
- SV_TYPE_CLUSTER_NT = 0x01000000
104
- SV_TYPE_TERMINALSERVER = 0x02000000
105
- SV_TYPE_CLUSTER_VS_NT = 0x04000000
106
- SV_TYPE_DCE = 0x10000000
107
- SV_TYPE_ALTERNATE_XPORT = 0x20000000
108
- SV_TYPE_LOCAL_LIST_ONLY = 0x40000000
109
- SV_TYPE_DOMAIN_ENUM = 0x80000000
110
- SV_TYPE_ALL = 0xFFFFFFFF
111
-
112
- API.new('NetAlertRaise', 'SPL', 'L', 'netapi32')
113
- API.new('NetAlertRaiseEx', 'SPLS', 'L', 'netapi32')
114
- API.new('NetApiBufferAllocate', 'LP', 'L', 'netapi32')
115
- API.new('NetApiBufferFree', 'P', 'L', 'netapi32')
116
- API.new('NetApiBufferReallocate', 'PLP', 'L', 'netapi32')
117
- API.new('NetApiBufferSize', 'PP', 'L', 'netapi32')
118
- API.new('NetGetAnyDCName', 'SSP', 'L', 'netapi32')
119
- API.new('NetGetDCName', 'SSP', 'L', 'netapi32')
120
- API.new('NetGetDisplayInformationIndex', 'SLPP', 'L', 'netapi32')
121
- API.new('NetGetJoinableOUs', 'SSSSPP', 'L', 'netapi32')
122
- API.new('NetGetJoinInformation', 'SPP', 'L', 'netapi32')
123
- API.new('NetGroupAdd', 'SLPP', 'L', 'netapi32')
124
- API.new('NetGroupAddUser', 'SSS', 'L', 'netapi32')
125
- API.new('NetGroupDel', 'SS', 'L', 'netapi32')
126
- API.new('NetGroupDelUser', 'SSS', 'L', 'netapi32')
127
- API.new('NetGroupEnum', 'SLPLPPP', 'L', 'netapi32')
128
- API.new('NetGroupGetInfo', 'SSLP', 'L', 'netapi32')
129
- API.new('NetGroupGetUsers', 'SSLPLPPP', 'L', 'netapi32')
130
- API.new('NetGroupSetInfo', 'SSLPP', 'L', 'netapi32')
131
- API.new('NetGroupSetUsers', 'SSLPL', 'L', 'netapi32')
132
- API.new('NetJoinDomain', 'SSSSSL', 'L', 'netapi32')
133
- API.new('NetLocalGroupAdd', 'SLPP', 'L', 'netapi32')
134
- API.new('NetLocalGroupAddMembers', 'SSLPL', 'L', 'netapi32')
135
- API.new('NetLocalGroupDel', 'SS', 'L', 'netapi32')
136
- API.new('NetLocalGroupDelMembers', 'SSLPL', 'L', 'netapi32')
137
- API.new('NetLocalGroupEnum', 'SLPLPPP', 'L', 'netapi32')
138
- API.new('NetLocalGroupGetInfo', 'SSLP', 'L', 'netapi32')
139
- API.new('NetLocalGroupGetMembers', 'SSLPLPPP', 'L', 'netapi32')
140
- API.new('NetLocalGroupSetInfo', 'SSLPP', 'L', 'netapi32')
141
- API.new('NetLocalGroupSetMembers', 'SSLPP', 'L', 'netapi32')
142
- API.new('NetMessageBufferSend', 'SSSPL', 'L', 'netapi32')
143
- API.new('NetMessageNameAdd', 'SS', 'L', 'netapi32')
144
- API.new('NetMessageNameDel', 'SS', 'L', 'netapi32')
145
- API.new('NetMessageNameEnum', 'SLPLPPP', 'L', 'netapi32')
146
- API.new('NetMessageNameGetInfo', 'SSLP', 'L', 'netapi32')
147
- API.new('NetQueryDisplayInformation', 'SLLLLPP', 'L', 'netapi32')
148
- API.new('NetRemoteComputerSupports', 'SLP', 'L', 'netapi32')
149
- API.new('NetRemoteTOD', 'SP', 'L', 'netapi32')
150
- API.new('NetRenameMachineInDomain', 'SSSSL', 'L', 'netapi32')
151
- API.new('NetScheduleJobAdd', 'SPP', 'L', 'netapi32')
152
- API.new('NetScheduleJobDel', 'SLL', 'L', 'netapi32')
153
- API.new('NetScheduleJobEnum', 'SPLPPP', 'L', 'netapi32')
154
- API.new('NetScheduleJobGetInfo', 'SLP', 'L', 'netapi32')
155
- API.new('NetServerComputerNameAdd', 'SSS', 'L', 'netapi32')
156
- API.new('NetServerComputerNameDel', 'SS', 'L', 'netapi32')
157
- API.new('NetServerDiskEnum', 'SLPLPPP', 'L', 'netapi32')
158
- API.new('NetServerEnum', 'SLPLPPLPP', 'L', 'netapi32')
159
- API.new('NetServerGetInfo', 'SLP', 'L', 'netapi32')
160
- API.new('NetServerSetInfo', 'SLPP', 'L', 'netapi32')
161
- API.new('NetServerTransportAdd', 'SLP', 'L', 'netapi32')
162
- API.new('NetServerTransportAddEx', 'SLP', 'L', 'netapi32')
163
- API.new('NetServerTransportDel', 'SLP', 'L', 'netapi32')
164
- API.new('NetServerTransportEnum', 'SLPLPPP', 'L', 'netapi32')
165
- API.new('NetUnjoinDomain', 'SSSL', 'L', 'netapi32')
166
- API.new('NetUseAdd', 'SLPP', 'L', 'netapi32')
167
- API.new('NetUseDel', 'SSL', 'L', 'netapi32')
168
- API.new('NetUseEnum', 'SLPLPPP', 'L', 'netapi32')
169
- API.new('NetUseGetInfo', 'SSLP', 'L', 'netapi32')
170
- API.new('NetUserAdd', 'SLPP', 'L', 'netapi32')
171
- API.new('NetUserChangePassword', 'SSSS', 'L', 'netapi32')
172
- API.new('NetUserDel', 'SS', 'L', 'netapi32')
173
- API.new('NetUserEnum', 'SLLPLPPP', 'L', 'netapi32')
174
- API.new('NetUserGetGroups', 'SSLPLPP', 'L', 'netapi32')
175
- API.new('NetUserGetInfo', 'SSLP', 'L', 'netapi32')
176
- API.new('NetUserGetLocalGroups', 'SSLLPLPP', 'L', 'netapi32')
177
- API.new('NetUserModalsGet', 'SLP', 'L', 'netapi32')
178
- API.new('NetUserModalsSet', 'SLPP', 'L', 'netapi32')
179
- API.new('NetUserSetGroups', 'SSLPL', 'L', 'netapi32')
180
- API.new('NetUserSetInfo', 'SSLPP', 'L', 'netapi32')
181
- API.new('NetValidateName', 'SSSSP', 'L', 'netapi32')
182
- API.new('NetWkstaGetInfo', 'SLP', 'L', 'netapi32')
183
- API.new('NetWkstaSetInfo', 'SLPP', 'L', 'netapi32')
184
- API.new('NetWkstaTransportAdd', 'SLPP', 'L', 'netapi32')
185
- API.new('NetWkstaTransportDel', 'SSL', 'L', 'netapi32')
186
- API.new('NetWkstaTransportEnum', 'SLPLPPP', 'L', 'netapi32')
187
- API.new('NetWkstaUserEnum', 'SLPLPPP', 'L', 'netapi32')
188
- API.new('NetWkstaUserGetInfo', 'PLP', 'L', 'netapi32')
189
- API.new('NetWkstaUserSetInfo', 'PPLP', 'L', 'netapi32')
190
-
191
- # Windows XP or later.
192
- begin
193
- API.new('GetNetScheduleAccountInformation', 'PLP', 'L', 'mstask')
194
- API.new('SetNetScheduleAccountInformation', 'PPP', 'L', 'netapi32')
195
- rescue Win32::API::LoadLibraryError
196
- # Do nothing. Not supported on current platform.
197
- end
198
-
199
- def NetAlertRaise(name, buf, bufsize)
200
- NetAlertRaise.call(name, buf, bufsize) == NERR_Success
201
- end
202
-
203
- def NetAlertRaiseEx(name, data, size, service)
204
- NetAlertRaiseEx.call(name, data, size, service) == NERR_Success
205
- end
206
-
207
- def NetApiBufferAllocate(num_bytes, buf)
208
- NetApiBufferAllocate.call(num_bytes, buf) == NERR_Success
209
- end
210
-
211
- def NetApiBufferFree(buf)
212
- NetApiBufferFree.call(buf) == NERR_Success
213
- end
214
-
215
- def NetApiBufferReallocate(old_buf, count, new_buf)
216
- NetApiBufferReallocate.call(old_buf, count, new_buf) == NERR_Success
217
- end
218
-
219
- def NetApiBufferSize(buf, count)
220
- NetApiBufferSize.call(buf, count) == NERR_Success
221
- end
222
-
223
- def NetGetAnyDCName(server, domain, buf)
224
- NetGetAnyDCName.call(server, domain, buf) == NERR_Success
225
- end
226
-
227
- def NetGetDCName(server, domain, buf)
228
- NetGetDCName.call(server, domain, buf) == NERR_Success
229
- end
230
-
231
- def NetGetDisplayInformationIndex(server, level, prefix, index)
232
- NetGetDisplayInformationIndex.call(server, level, prefix, index) == NERR_Success
233
- end
234
-
235
- def NetGetJoinableOUs(server, domain, account, password, count, ous)
236
- NetGetJoinableOUs.call(server, domain, account, password, count, ous) == NERR_Success
237
- end
238
-
239
- def NetGetJoinInformation(server, buf, buf_type)
240
- NetGetJoinInformation.call(server, buf, buf_type) == NERR_Success
241
- end
242
-
243
- def NetGroupAdd(server, level, buf, err)
244
- NetGroupAdd.call(server, level, buf, err).call == NERR_Success
245
- end
246
-
247
- def NetGroupAddUser(server, group, user)
248
- NetGroupAddUser.call(server, group, user) == NERR_Success
249
- end
250
-
251
- def NetGroupDel(server, group)
252
- NetGroupDel.call(server, group) == NERR_Success
253
- end
254
-
255
- def NetGroupDelUser(server, group, user)
256
- NetGroupDelUser.call(server, group, user) == NERR_Success
257
- end
258
-
259
- def NetGroupEnum(server, level, buf, max, entries, total_entries, resume)
260
- NetGroupEnum.call(server, level, buf, max, entries, total_entries, resume) == NERR_Success
261
- end
262
-
263
- def NetGroupGetInfo(server, group, level, buf)
264
- NetGroupGetInfo.call(server, group, level, buf) == NERR_Success
265
- end
266
-
267
- def NetGroupGetUsers(server, group, level, buf, max, entries, total_entries, resume)
268
- NetGroupGetUsers.call(server, group, level, buf, max, entries, total_entries, resume) == NERR_Success
269
- end
270
-
271
- def NetGroupSetInfo(server, group, level, buf, err)
272
- NetGroupSetInfo.call(server, group, level, buf, err) == NERR_Success
273
- end
274
-
275
- def NetGroupSetUsers(server, group, level, buf, total)
276
- NetGroupSetUsers.call(server, group, level, buf, total) == NERR_Success
277
- end
278
-
279
- def NetJoinDomain(server, domain, account_ou, account, password, opts)
280
- NetJoinDomain.call(server, domain, account_ou, account, password, opts) == NERR_Success
281
- end
282
-
283
- def NetLocalGroupAdd(server, level, buf, err)
284
- NetLocalGroupAdd.call(server, level, buf, err) == NERR_Success
285
- end
286
-
287
- def NetLocalGroupAddMembers(server, group, level, buf, total)
288
- NetLocalGroupAddMembers.call(server, group, level, buf, total) == NERR_Success
289
- end
290
-
291
- def NetLocalGroupDel(server, group)
292
- NetLocalGroupDel.call(server, group) == NERR_Success
293
- end
294
-
295
- def NetLocalGroupDelMembers(server, group, level, buf, total)
296
- NetLocalGroupDelMembers.call(server, group, level, buf, total) == NERR_Success
297
- end
298
-
299
- def NetLocalGroupEnum(server, level, buf, max, entries, total_entries, resume)
300
- NetLocalGroupEnum.call(server, level, buf, max, entries, total_entries, resume) == NERR_Success
301
- end
302
-
303
- def NetLocalGroupGetInfo(server, group, level, buf)
304
- NetLocalGroupGetInfo.call(server, group, level, buf) == NERR_Success
305
- end
306
-
307
- def NetLocalGroupGetMembers(server, group, level, buf, max, entries, total_entries, resume)
308
- NetLocalGroupGetMembers.call(server, group, level, buf, max, entries, total_entries, resume) == NERR_Success
309
- end
310
-
311
- def NetLocalGroupSetInfo(server, group, level, buf, err)
312
- NetLocalGroupSetInfo.call(server, group, level, buf, err) == NERR_Success
313
- end
314
-
315
- def NetLocalGroupSetMembers(server, group, level, buf, total)
316
- NetLocalGroupSetMembers.call(server, group, level, buf, total) == NERR_Success
317
- end
318
-
319
- def NetMessageBufferSend(server, msg, from, buf, bufsize)
320
- NetMessageBufferSend.call(server, msg, from, buf, bufsize) == NERR_Success
321
- end
322
-
323
- def NetMessageNameAdd(server, msg)
324
- NetMessageNameAdd.call(server, msg) == NERR_Success
325
- end
326
-
327
- def NetMessageNameDel(server, msg)
328
- NetMessageNameDel.call(server, msg) == NERR_Success
329
- end
330
-
331
- def NetMessageNameEnum(server, level, buf, max, entries, total_entries, resume)
332
- NetMessageNameEnum.call(server, level, buf, max, entries, total_entries, resume) == NERR_Success
333
- end
334
-
335
- def NetMessageNameGetInfo(server, msg, level, buf)
336
- NetMessageNameGetInfo.call(server, msg, level, buf) == NERR_Success
337
- end
338
-
339
- def NetQueryDisplayInformation(server, level, index, entries, max, count, buf)
340
- NetQueryDisplayInformation.call(server, level, index, entries, max, count, buf) == NERR_Success
341
- end
342
-
343
- def NetRemoteComputerSupports(server, level, index, entries, max, count, buf)
344
- NetRemoteComputerSupports.call(server, level, index, entries, max, count, buf) == NERR_Success
345
- end
346
-
347
- def NetRemoteTOD(server, buf)
348
- NetRemoteTOD.call(server, buf) == NERR_Success
349
- end
350
-
351
- def NetRenameMachineInDomain(server, machine, account, password, options)
352
- NetRenameMachineInDomain.call(server, machine, account, password, options) == NERR_Success
353
- end
354
-
355
- def NetScheduleJobAdd(server, buf, job)
356
- NetScheduleJobAdd.call(server, buf, job) == NERR_Success
357
- end
358
-
359
- def NetScheduleJobDel(server, min, max)
360
- NetScheduleJobDel.call(server, min, max) == NERR_Success
361
- end
362
-
363
- def NetScheduleJobEnum(server, buf, max, entries, total_entries, resume)
364
- NetScheduleJobEnum.call(server, buf, max, entries, total_entries, resume) == NERR_Success
365
- end
366
-
367
- def NetScheduleJobGetInfo(server, job, buf)
368
- NetScheduleJobGetInfo.call(server, job, buf) == NERR_Success
369
- end
370
-
371
- def NetServerComputerNameAdd(server, em_domain, em_server)
372
- NetServerComputerNameAdd.call(server, em_domain, em_server) == NERR_Success
373
- end
374
-
375
- def NetServerComputerNameDel(server, em_server)
376
- NetServerComputerNameDel.call(server, em_server) == NERR_Success
377
- end
378
-
379
- def NetServerDiskEnum(server, level, buf, maxlen, entries, total_entries, resume)
380
- NetServerDiskEnum.call(server, level, buf, maxlen, entries, total_entries, resume) == NERR_Success
381
- end
382
-
383
- def NetServerEnum(server, level, ptr, maxlen, num, total, stype, domain, handle)
384
- NetServerEnum.call(server, level, ptr, maxlen, num, total, stype, domain, handle) == NERR_Success
385
- end
386
-
387
- def NetServerGetInfo(server, level, buf)
388
- NetServerGetInfo.call(server, level, buf) == NERR_Success
389
- end
390
-
391
- def NetServerSetInfo(server, level, buf, error)
392
- NetServerSetInfo.call(server, level, buf, error) == NERR_Success
393
- end
394
-
395
- def NetServerTransportAdd(server, level, buf)
396
- NetServerTransportAdd.call(server, level, buf) == NERR_Success
397
- end
398
-
399
- def NetServerTransportAddEx(server, level, buf)
400
- NetServerTransportAddEx.call(server, level, buf) == NERR_Success
401
- end
402
-
403
- def NetServerTransportDel(server, level, buf)
404
- NetServerTransportDel.call(server, level, buf) == NERR_Success
405
- end
406
-
407
- def NetServerTransportEnum(server, level, buf, maxlen, entries, total_entries, resume)
408
- NetServerTransportEnum.call(server, level, buf, maxlen, entries, total_entries, resume) == NERR_Success
409
- end
410
-
411
- def NetUnjoinDomain(server, account, password, options)
412
- NetUnjoinDomain.call(server, account, password, options) == NERR_Success
413
- end
414
-
415
- def NetUseAdd(server, level, buf, error)
416
- NetUseAdd.call(server, level, buf, error) == NERR_Success
417
- end
418
-
419
- def NetUseDel(server, name, conn)
420
- NetUseDel.call(server, name, conn) == NERR_Success
421
- end
422
-
423
- def NetUseEnum(server, level, buf, max, entries, total_entries, resume)
424
- NetUseEnum.call(server, level, buf, max, entries, total_entries, resume) == NERR_Success
425
- end
426
-
427
- def NetUseGetInfo(server, name, level, buf)
428
- NetUseGetInfo.call(server, name, level, buf) == NERR_Success
429
- end
430
-
431
- def NetUserAdd(server, level, buf, error)
432
- NetUserAdd.call(server, level, buf, error) == NERR_Success
433
- end
434
-
435
- def NetUserChangePassword(domain, user, old, new)
436
- NetUserChangePassword.call(domain, user, old, new) == NERR_Success
437
- end
438
-
439
- def NetUserDel(server, user)
440
- NetUserDel.call(server, user) == NERR_Success
441
- end
442
-
443
- def NetUserEnum(server, level, filter, buf, max, entries, total_entries, resume)
444
- NetUserEnum.call(server, level, filter, buf, max, entries, total_entries, resume) == NERR_Success
445
- end
446
-
447
- def NetUserGetGroups(server, user, level, buf, max, entries, total_entries)
448
- NetUserGetGroups.call(server, user, level, buf, max, entries, total_entries) == NERR_Success
449
- end
450
-
451
- def NetUserGetInfo(server, user, level, buf)
452
- NetUserGetInfo.call(server, user, level, buf) == NERR_Success
453
- end
454
-
455
- def NetUserGetLocalGroups(server, user, level, flags, buf, max, entries, total_entries)
456
- NetUserGetLocalGroups.call(server, user, level, flags, buf, max, entries, total_entries) == NERR_Success
457
- end
458
-
459
- def NetUserModalsGet(server, level, buf)
460
- NetUserModalsGet.call(server, level, buf) == NERR_Success
461
- end
462
-
463
- def NetUserModalsSet(server, level, buf, error)
464
- NetUserModalsSet.call(server, level, buf, error) == NERR_Success
465
- end
466
-
467
- def NetUserSetGroups(server, user, level, buf, num)
468
- NetUserSetGroups.call(server, user, level, buf, num) == NERR_Success
469
- end
470
-
471
- def NetUserSetInfo(server, user, level, buf, error)
472
- NetUserSetInfo.call(server, user, level, buf, error) == NERR_Success
473
- end
474
-
475
- def NetValidateName(server, name, account, password, name_type)
476
- NetValidateName.call(server, name, account, password, name_type) == NERR_Success
477
- end
478
-
479
- def NetWkstaGetInfo(server, level, buf)
480
- NetWkstaGetInfo.call(server, level, buf) == NERR_Success
481
- end
482
-
483
- def NetWkstaSetInfo(server, level, buf, error)
484
- NetWkstaSetInfo.call(server, level, buf, error) == NERR_Success
485
- end
486
-
487
- def NetWkstaTransportAdd(server, level, buf, error)
488
- NetWkstaTransportAdd.call(server, level, buf, error) == NERR_Success
489
- end
490
-
491
- def NetWkstaTransportDel(server, name, cond)
492
- NetWkstaTransportDel.call(server, name, cond) == NERR_Success
493
- end
494
-
495
- def NetWkstaTransportEnum(server, level, buf, maxlen, entries, total_entries, resume)
496
- NetWkstaTransportEnum.call(server, level, buf, maxlen, entries, total_entries, resume) == NERR_Success
497
- end
498
-
499
- def NetWkstaUserEnum(server, level, buf, maxlen, entries, total_entries, resume)
500
- NetWkstaUserEnum.call(server, level, buf, maxlen, entries, total_entries, resume) == NERR_Success
501
- end
502
-
503
- def NetWkstaUserGetInfo(res, level, buf)
504
- NetWkstaUserGetInfo.call(res, level, buf) == NERR_Success
505
- end
506
-
507
- def NetWkstaUserSetInfo(res, level, buf, error)
508
- NetWkstaUserSetInfo.call(res, level, buf, error) == NERR_Success
509
- end
510
-
511
- # Windows XP or later
512
- begin
513
- def GetNetScheduleAccountInformation(server, num_chars, chars)
514
- GetNetScheduleAccountInformation.call(server, num_chars, chars) == NERR_Success
515
- end
516
-
517
- def SetNetScheduleAccountInformation(server, account, password)
518
- SetNetScheduleAccountInformation.call(server, account, password) == NERR_Success
519
- end
520
- rescue Win32::API::LoadLibraryError
521
- # Do nothing. It's up to you to check for their existence.
522
- end
523
- end
524
- end
525
- end
1
+ require 'windows/api'
2
+
3
+ # I don't use the Boolean flag for the return types of these methods because
4
+ # they succeed, not fail, if the return value is 0.
5
+ #
6
+ module Windows
7
+ module Network
8
+ module Management
9
+ API.auto_namespace = 'Windows::Network::Management'
10
+ API.auto_constant = true
11
+ API.auto_method = false
12
+ API.auto_unicode = false
13
+
14
+ private
15
+
16
+ NERR_Success = 0
17
+ NERR_BASE = 2100
18
+ NERR_NetNotStarted = NERR_BASE + 2
19
+ NERR_UnknownServer = NERR_BASE + 3
20
+ NERR_ShareMem = NERR_BASE + 4
21
+ NERR_NoNetworkResource = NERR_BASE + 5
22
+ NERR_RemoteOnly = NERR_BASE + 6
23
+ NERR_DevNotRedirected = NERR_BASE + 7
24
+ NERR_AlreadyLoggedOn = NERR_BASE + 100
25
+ NERR_NotLoggedOn = NERR_BASE + 101
26
+ NERR_BadUsername = NERR_BASE + 102
27
+ NERR_BadPassword = NERR_BASE + 103
28
+ NERR_UnableToAddName_W = NERR_BASE + 104
29
+ NERR_UnableToAddName_F = NERR_BASE + 105
30
+ NERR_UnableToDelName_W = NERR_BASE + 106
31
+ NERR_UnableToDelName_F = NERR_BASE + 107
32
+ NERR_LogonsPaused = NERR_BASE + 109
33
+ NERR_LogonServerConflict = NERR_BASE + 110
34
+ NERR_LogonNoUserPath = NERR_BASE + 111
35
+ NERR_LogonScriptError = NERR_BASE + 112
36
+ NERR_StandaloneLogon = NERR_BASE + 114
37
+ NERR_LogonServerNotFound = NERR_BASE + 115
38
+ NERR_LogonDomainExists = NERR_BASE + 116
39
+ NERR_NonValidatedLogon = NERR_BASE + 117
40
+ NERR_ACFNotFound = NERR_BASE + 119
41
+ NERR_GroupNotFound = NERR_BASE + 120
42
+ NERR_UserNotFound = NERR_BASE + 121
43
+ NERR_ResourceNotFound = NERR_BASE + 122
44
+ NERR_GroupExists = NERR_BASE + 123
45
+ NERR_UserExists = NERR_BASE + 124
46
+ NERR_ResourceExists = NERR_BASE + 125
47
+ NERR_NotPrimary = NERR_BASE + 126
48
+ NERR_ACFNotLoaded = NERR_BASE + 127
49
+ NERR_ACFNoRoom = NERR_BASE + 128
50
+ NERR_ACFFileIOFail = NERR_BASE + 129
51
+ NERR_ACFTooManyLists = NERR_BASE + 130
52
+ NERR_UserLogon = NERR_BASE + 131
53
+ NERR_ACFNoParent = NERR_BASE + 132
54
+ NERR_CanNotGrowSegment = NERR_BASE + 133
55
+ NERR_SpeGroupOp = NERR_BASE + 134
56
+ NERR_NotInCache = NERR_BASE + 135
57
+ NERR_UserInGroup = NERR_BASE + 136
58
+ NERR_UserNotInGroup = NERR_BASE + 137
59
+ NERR_AccountUndefined = NERR_BASE + 138
60
+ NERR_AccountExpired = NERR_BASE + 139
61
+ NERR_InvalidWorkstation = NERR_BASE + 140
62
+ NERR_InvalidLogonHours = NERR_BASE + 141
63
+ NERR_PasswordExpired = NERR_BASE + 142
64
+ NERR_PasswordCantChange = NERR_BASE + 143
65
+ NERR_PasswordHistConflict = NERR_BASE + 144
66
+ NERR_PasswordTooShort = NERR_BASE + 145
67
+ NERR_PasswordTooRecent = NERR_BASE + 146
68
+ NERR_InvalidDatabase = NERR_BASE + 147
69
+ NERR_DatabaseUpToDate = NERR_BASE + 148
70
+ NERR_SyncRequired = NERR_BASE + 149
71
+ NERR_UseNotFound = NERR_BASE + 150
72
+ NERR_BadAsgType = NERR_BASE + 151
73
+ NERR_DeviceIsShared = NERR_BASE + 152
74
+
75
+ MAX_PREFERRED_LENGTH = 0xFFFFFFFF
76
+
77
+ # Taken from LMServer.h
78
+ SV_TYPE_WORKSTATION = 0x00000001
79
+ SV_TYPE_SERVER = 0x00000002
80
+ SV_TYPE_SQLSERVER = 0x00000004
81
+ SV_TYPE_DOMAIN_CTRL = 0x00000008
82
+ SV_TYPE_DOMAIN_BAKCTRL = 0x00000010
83
+ SV_TYPE_TIME_SOURCE = 0x00000020
84
+ SV_TYPE_AFP = 0x00000040
85
+ SV_TYPE_NOVELL = 0x00000080
86
+ SV_TYPE_DOMAIN_MEMBER = 0x00000100
87
+ SV_TYPE_PRINTQ_SERVER = 0x00000200
88
+ SV_TYPE_DIALIN_SERVER = 0x00000400
89
+ SV_TYPE_XENIX_SERVER = 0x00000800
90
+ SV_TYPE_SERVER_UNIX = SV_TYPE_XENIX_SERVER
91
+ SV_TYPE_NT = 0x00001000
92
+ SV_TYPE_WFW = 0x00002000
93
+ SV_TYPE_SERVER_MFPN = 0x00004000
94
+ SV_TYPE_SERVER_NT = 0x00008000
95
+ SV_TYPE_POTENTIAL_BROWSER = 0x00010000
96
+ SV_TYPE_BACKUP_BROWSER = 0x00020000
97
+ SV_TYPE_MASTER_BROWSER = 0x00040000
98
+ SV_TYPE_DOMAIN_MASTER = 0x00080000
99
+ SV_TYPE_SERVER_OSF = 0x00100000
100
+ SV_TYPE_SERVER_VMS = 0x00200000
101
+ SV_TYPE_WINDOWS = 0x00400000
102
+ SV_TYPE_DFS = 0x00800000
103
+ SV_TYPE_CLUSTER_NT = 0x01000000
104
+ SV_TYPE_TERMINALSERVER = 0x02000000
105
+ SV_TYPE_CLUSTER_VS_NT = 0x04000000
106
+ SV_TYPE_DCE = 0x10000000
107
+ SV_TYPE_ALTERNATE_XPORT = 0x20000000
108
+ SV_TYPE_LOCAL_LIST_ONLY = 0x40000000
109
+ SV_TYPE_DOMAIN_ENUM = 0x80000000
110
+ SV_TYPE_ALL = 0xFFFFFFFF
111
+
112
+ API.new('NetAlertRaise', 'SPL', 'L', 'netapi32')
113
+ API.new('NetAlertRaiseEx', 'SPLS', 'L', 'netapi32')
114
+ API.new('NetApiBufferAllocate', 'LP', 'L', 'netapi32')
115
+ API.new('NetApiBufferFree', 'P', 'L', 'netapi32')
116
+ API.new('NetApiBufferReallocate', 'PLP', 'L', 'netapi32')
117
+ API.new('NetApiBufferSize', 'PP', 'L', 'netapi32')
118
+ API.new('NetGetAnyDCName', 'SSP', 'L', 'netapi32')
119
+ API.new('NetGetDCName', 'SSP', 'L', 'netapi32')
120
+ API.new('NetGetDisplayInformationIndex', 'SLPP', 'L', 'netapi32')
121
+ API.new('NetGetJoinableOUs', 'SSSSPP', 'L', 'netapi32')
122
+ API.new('NetGetJoinInformation', 'SPP', 'L', 'netapi32')
123
+ API.new('NetGroupAdd', 'SLPP', 'L', 'netapi32')
124
+ API.new('NetGroupAddUser', 'SSS', 'L', 'netapi32')
125
+ API.new('NetGroupDel', 'SS', 'L', 'netapi32')
126
+ API.new('NetGroupDelUser', 'SSS', 'L', 'netapi32')
127
+ API.new('NetGroupEnum', 'SLPLPPP', 'L', 'netapi32')
128
+ API.new('NetGroupGetInfo', 'SSLP', 'L', 'netapi32')
129
+ API.new('NetGroupGetUsers', 'SSLPLPPP', 'L', 'netapi32')
130
+ API.new('NetGroupSetInfo', 'SSLPP', 'L', 'netapi32')
131
+ API.new('NetGroupSetUsers', 'SSLPL', 'L', 'netapi32')
132
+ API.new('NetJoinDomain', 'SSSSSL', 'L', 'netapi32')
133
+ API.new('NetLocalGroupAdd', 'SLPP', 'L', 'netapi32')
134
+ API.new('NetLocalGroupAddMembers', 'SSLPL', 'L', 'netapi32')
135
+ API.new('NetLocalGroupDel', 'SS', 'L', 'netapi32')
136
+ API.new('NetLocalGroupDelMembers', 'SSLPL', 'L', 'netapi32')
137
+ API.new('NetLocalGroupEnum', 'SLPLPPP', 'L', 'netapi32')
138
+ API.new('NetLocalGroupGetInfo', 'SSLP', 'L', 'netapi32')
139
+ API.new('NetLocalGroupGetMembers', 'SSLPLPPP', 'L', 'netapi32')
140
+ API.new('NetLocalGroupSetInfo', 'SSLPP', 'L', 'netapi32')
141
+ API.new('NetLocalGroupSetMembers', 'SSLPP', 'L', 'netapi32')
142
+ API.new('NetMessageBufferSend', 'SSSPL', 'L', 'netapi32')
143
+ API.new('NetMessageNameAdd', 'SS', 'L', 'netapi32')
144
+ API.new('NetMessageNameDel', 'SS', 'L', 'netapi32')
145
+ API.new('NetMessageNameEnum', 'SLPLPPP', 'L', 'netapi32')
146
+ API.new('NetMessageNameGetInfo', 'SSLP', 'L', 'netapi32')
147
+ API.new('NetQueryDisplayInformation', 'SLLLLPP', 'L', 'netapi32')
148
+ API.new('NetRemoteComputerSupports', 'SLP', 'L', 'netapi32')
149
+ API.new('NetRemoteTOD', 'SP', 'L', 'netapi32')
150
+ API.new('NetRenameMachineInDomain', 'SSSSL', 'L', 'netapi32')
151
+ API.new('NetScheduleJobAdd', 'SPP', 'L', 'netapi32')
152
+ API.new('NetScheduleJobDel', 'SLL', 'L', 'netapi32')
153
+ API.new('NetScheduleJobEnum', 'SPLPPP', 'L', 'netapi32')
154
+ API.new('NetScheduleJobGetInfo', 'SLP', 'L', 'netapi32')
155
+ API.new('NetServerComputerNameAdd', 'SSS', 'L', 'netapi32')
156
+ API.new('NetServerComputerNameDel', 'SS', 'L', 'netapi32')
157
+ API.new('NetServerDiskEnum', 'SLPLPPP', 'L', 'netapi32')
158
+ API.new('NetServerEnum', 'SLPLPPLPP', 'L', 'netapi32')
159
+ API.new('NetServerGetInfo', 'SLP', 'L', 'netapi32')
160
+ API.new('NetServerSetInfo', 'SLPP', 'L', 'netapi32')
161
+ API.new('NetServerTransportAdd', 'SLP', 'L', 'netapi32')
162
+ API.new('NetServerTransportAddEx', 'SLP', 'L', 'netapi32')
163
+ API.new('NetServerTransportDel', 'SLP', 'L', 'netapi32')
164
+ API.new('NetServerTransportEnum', 'SLPLPPP', 'L', 'netapi32')
165
+ API.new('NetUnjoinDomain', 'SSSL', 'L', 'netapi32')
166
+ API.new('NetUseAdd', 'SLPP', 'L', 'netapi32')
167
+ API.new('NetUseDel', 'SSL', 'L', 'netapi32')
168
+ API.new('NetUseEnum', 'SLPLPPP', 'L', 'netapi32')
169
+ API.new('NetUseGetInfo', 'SSLP', 'L', 'netapi32')
170
+ API.new('NetUserAdd', 'SLPP', 'L', 'netapi32')
171
+ API.new('NetUserChangePassword', 'SSSS', 'L', 'netapi32')
172
+ API.new('NetUserDel', 'SS', 'L', 'netapi32')
173
+ API.new('NetUserEnum', 'SLLPLPPP', 'L', 'netapi32')
174
+ API.new('NetUserGetGroups', 'SSLPLPP', 'L', 'netapi32')
175
+ API.new('NetUserGetInfo', 'SSLP', 'L', 'netapi32')
176
+ API.new('NetUserGetLocalGroups', 'SSLLPLPP', 'L', 'netapi32')
177
+ API.new('NetUserModalsGet', 'SLP', 'L', 'netapi32')
178
+ API.new('NetUserModalsSet', 'SLPP', 'L', 'netapi32')
179
+ API.new('NetUserSetGroups', 'SSLPL', 'L', 'netapi32')
180
+ API.new('NetUserSetInfo', 'SSLPP', 'L', 'netapi32')
181
+ API.new('NetValidateName', 'SSSSP', 'L', 'netapi32')
182
+ API.new('NetWkstaGetInfo', 'SLP', 'L', 'netapi32')
183
+ API.new('NetWkstaSetInfo', 'SLPP', 'L', 'netapi32')
184
+ API.new('NetWkstaTransportAdd', 'SLPP', 'L', 'netapi32')
185
+ API.new('NetWkstaTransportDel', 'SSL', 'L', 'netapi32')
186
+ API.new('NetWkstaTransportEnum', 'SLPLPPP', 'L', 'netapi32')
187
+ API.new('NetWkstaUserEnum', 'SLPLPPP', 'L', 'netapi32')
188
+ API.new('NetWkstaUserGetInfo', 'PLP', 'L', 'netapi32')
189
+ API.new('NetWkstaUserSetInfo', 'PPLP', 'L', 'netapi32')
190
+
191
+ # Windows XP or later.
192
+ begin
193
+ API.new('GetNetScheduleAccountInformation', 'PLP', 'L', 'mstask')
194
+ API.new('SetNetScheduleAccountInformation', 'PPP', 'L', 'netapi32')
195
+ rescue Win32::API::LoadLibraryError
196
+ # Do nothing. Not supported on current platform.
197
+ end
198
+
199
+ def NetAlertRaise(name, buf, bufsize)
200
+ NetAlertRaise.call(name, buf, bufsize) == NERR_Success
201
+ end
202
+
203
+ def NetAlertRaiseEx(name, data, size, service)
204
+ NetAlertRaiseEx.call(name, data, size, service) == NERR_Success
205
+ end
206
+
207
+ def NetApiBufferAllocate(num_bytes, buf)
208
+ NetApiBufferAllocate.call(num_bytes, buf) == NERR_Success
209
+ end
210
+
211
+ def NetApiBufferFree(buf)
212
+ NetApiBufferFree.call(buf) == NERR_Success
213
+ end
214
+
215
+ def NetApiBufferReallocate(old_buf, count, new_buf)
216
+ NetApiBufferReallocate.call(old_buf, count, new_buf) == NERR_Success
217
+ end
218
+
219
+ def NetApiBufferSize(buf, count)
220
+ NetApiBufferSize.call(buf, count) == NERR_Success
221
+ end
222
+
223
+ def NetGetAnyDCName(server, domain, buf)
224
+ NetGetAnyDCName.call(server, domain, buf) == NERR_Success
225
+ end
226
+
227
+ def NetGetDCName(server, domain, buf)
228
+ NetGetDCName.call(server, domain, buf) == NERR_Success
229
+ end
230
+
231
+ def NetGetDisplayInformationIndex(server, level, prefix, index)
232
+ NetGetDisplayInformationIndex.call(server, level, prefix, index) == NERR_Success
233
+ end
234
+
235
+ def NetGetJoinableOUs(server, domain, account, password, count, ous)
236
+ NetGetJoinableOUs.call(server, domain, account, password, count, ous) == NERR_Success
237
+ end
238
+
239
+ def NetGetJoinInformation(server, buf, buf_type)
240
+ NetGetJoinInformation.call(server, buf, buf_type) == NERR_Success
241
+ end
242
+
243
+ def NetGroupAdd(server, level, buf, err)
244
+ NetGroupAdd.call(server, level, buf, err).call == NERR_Success
245
+ end
246
+
247
+ def NetGroupAddUser(server, group, user)
248
+ NetGroupAddUser.call(server, group, user) == NERR_Success
249
+ end
250
+
251
+ def NetGroupDel(server, group)
252
+ NetGroupDel.call(server, group) == NERR_Success
253
+ end
254
+
255
+ def NetGroupDelUser(server, group, user)
256
+ NetGroupDelUser.call(server, group, user) == NERR_Success
257
+ end
258
+
259
+ def NetGroupEnum(server, level, buf, max, entries, total_entries, resume)
260
+ NetGroupEnum.call(server, level, buf, max, entries, total_entries, resume) == NERR_Success
261
+ end
262
+
263
+ def NetGroupGetInfo(server, group, level, buf)
264
+ NetGroupGetInfo.call(server, group, level, buf) == NERR_Success
265
+ end
266
+
267
+ def NetGroupGetUsers(server, group, level, buf, max, entries, total_entries, resume)
268
+ NetGroupGetUsers.call(server, group, level, buf, max, entries, total_entries, resume) == NERR_Success
269
+ end
270
+
271
+ def NetGroupSetInfo(server, group, level, buf, err)
272
+ NetGroupSetInfo.call(server, group, level, buf, err) == NERR_Success
273
+ end
274
+
275
+ def NetGroupSetUsers(server, group, level, buf, total)
276
+ NetGroupSetUsers.call(server, group, level, buf, total) == NERR_Success
277
+ end
278
+
279
+ def NetJoinDomain(server, domain, account_ou, account, password, opts)
280
+ NetJoinDomain.call(server, domain, account_ou, account, password, opts) == NERR_Success
281
+ end
282
+
283
+ def NetLocalGroupAdd(server, level, buf, err)
284
+ NetLocalGroupAdd.call(server, level, buf, err) == NERR_Success
285
+ end
286
+
287
+ def NetLocalGroupAddMembers(server, group, level, buf, total)
288
+ NetLocalGroupAddMembers.call(server, group, level, buf, total) == NERR_Success
289
+ end
290
+
291
+ def NetLocalGroupDel(server, group)
292
+ NetLocalGroupDel.call(server, group) == NERR_Success
293
+ end
294
+
295
+ def NetLocalGroupDelMembers(server, group, level, buf, total)
296
+ NetLocalGroupDelMembers.call(server, group, level, buf, total) == NERR_Success
297
+ end
298
+
299
+ def NetLocalGroupEnum(server, level, buf, max, entries, total_entries, resume)
300
+ NetLocalGroupEnum.call(server, level, buf, max, entries, total_entries, resume) == NERR_Success
301
+ end
302
+
303
+ def NetLocalGroupGetInfo(server, group, level, buf)
304
+ NetLocalGroupGetInfo.call(server, group, level, buf) == NERR_Success
305
+ end
306
+
307
+ def NetLocalGroupGetMembers(server, group, level, buf, max, entries, total_entries, resume)
308
+ NetLocalGroupGetMembers.call(server, group, level, buf, max, entries, total_entries, resume) == NERR_Success
309
+ end
310
+
311
+ def NetLocalGroupSetInfo(server, group, level, buf, err)
312
+ NetLocalGroupSetInfo.call(server, group, level, buf, err) == NERR_Success
313
+ end
314
+
315
+ def NetLocalGroupSetMembers(server, group, level, buf, total)
316
+ NetLocalGroupSetMembers.call(server, group, level, buf, total) == NERR_Success
317
+ end
318
+
319
+ def NetMessageBufferSend(server, msg, from, buf, bufsize)
320
+ NetMessageBufferSend.call(server, msg, from, buf, bufsize) == NERR_Success
321
+ end
322
+
323
+ def NetMessageNameAdd(server, msg)
324
+ NetMessageNameAdd.call(server, msg) == NERR_Success
325
+ end
326
+
327
+ def NetMessageNameDel(server, msg)
328
+ NetMessageNameDel.call(server, msg) == NERR_Success
329
+ end
330
+
331
+ def NetMessageNameEnum(server, level, buf, max, entries, total_entries, resume)
332
+ NetMessageNameEnum.call(server, level, buf, max, entries, total_entries, resume) == NERR_Success
333
+ end
334
+
335
+ def NetMessageNameGetInfo(server, msg, level, buf)
336
+ NetMessageNameGetInfo.call(server, msg, level, buf) == NERR_Success
337
+ end
338
+
339
+ def NetQueryDisplayInformation(server, level, index, entries, max, count, buf)
340
+ NetQueryDisplayInformation.call(server, level, index, entries, max, count, buf) == NERR_Success
341
+ end
342
+
343
+ def NetRemoteComputerSupports(server, level, index, entries, max, count, buf)
344
+ NetRemoteComputerSupports.call(server, level, index, entries, max, count, buf) == NERR_Success
345
+ end
346
+
347
+ def NetRemoteTOD(server, buf)
348
+ NetRemoteTOD.call(server, buf) == NERR_Success
349
+ end
350
+
351
+ def NetRenameMachineInDomain(server, machine, account, password, options)
352
+ NetRenameMachineInDomain.call(server, machine, account, password, options) == NERR_Success
353
+ end
354
+
355
+ def NetScheduleJobAdd(server, buf, job)
356
+ NetScheduleJobAdd.call(server, buf, job) == NERR_Success
357
+ end
358
+
359
+ def NetScheduleJobDel(server, min, max)
360
+ NetScheduleJobDel.call(server, min, max) == NERR_Success
361
+ end
362
+
363
+ def NetScheduleJobEnum(server, buf, max, entries, total_entries, resume)
364
+ NetScheduleJobEnum.call(server, buf, max, entries, total_entries, resume) == NERR_Success
365
+ end
366
+
367
+ def NetScheduleJobGetInfo(server, job, buf)
368
+ NetScheduleJobGetInfo.call(server, job, buf) == NERR_Success
369
+ end
370
+
371
+ def NetServerComputerNameAdd(server, em_domain, em_server)
372
+ NetServerComputerNameAdd.call(server, em_domain, em_server) == NERR_Success
373
+ end
374
+
375
+ def NetServerComputerNameDel(server, em_server)
376
+ NetServerComputerNameDel.call(server, em_server) == NERR_Success
377
+ end
378
+
379
+ def NetServerDiskEnum(server, level, buf, maxlen, entries, total_entries, resume)
380
+ NetServerDiskEnum.call(server, level, buf, maxlen, entries, total_entries, resume) == NERR_Success
381
+ end
382
+
383
+ def NetServerEnum(server, level, ptr, maxlen, num, total, stype, domain, handle)
384
+ NetServerEnum.call(server, level, ptr, maxlen, num, total, stype, domain, handle) == NERR_Success
385
+ end
386
+
387
+ def NetServerGetInfo(server, level, buf)
388
+ NetServerGetInfo.call(server, level, buf) == NERR_Success
389
+ end
390
+
391
+ def NetServerSetInfo(server, level, buf, error)
392
+ NetServerSetInfo.call(server, level, buf, error) == NERR_Success
393
+ end
394
+
395
+ def NetServerTransportAdd(server, level, buf)
396
+ NetServerTransportAdd.call(server, level, buf) == NERR_Success
397
+ end
398
+
399
+ def NetServerTransportAddEx(server, level, buf)
400
+ NetServerTransportAddEx.call(server, level, buf) == NERR_Success
401
+ end
402
+
403
+ def NetServerTransportDel(server, level, buf)
404
+ NetServerTransportDel.call(server, level, buf) == NERR_Success
405
+ end
406
+
407
+ def NetServerTransportEnum(server, level, buf, maxlen, entries, total_entries, resume)
408
+ NetServerTransportEnum.call(server, level, buf, maxlen, entries, total_entries, resume) == NERR_Success
409
+ end
410
+
411
+ def NetUnjoinDomain(server, account, password, options)
412
+ NetUnjoinDomain.call(server, account, password, options) == NERR_Success
413
+ end
414
+
415
+ def NetUseAdd(server, level, buf, error)
416
+ NetUseAdd.call(server, level, buf, error) == NERR_Success
417
+ end
418
+
419
+ def NetUseDel(server, name, conn)
420
+ NetUseDel.call(server, name, conn) == NERR_Success
421
+ end
422
+
423
+ def NetUseEnum(server, level, buf, max, entries, total_entries, resume)
424
+ NetUseEnum.call(server, level, buf, max, entries, total_entries, resume) == NERR_Success
425
+ end
426
+
427
+ def NetUseGetInfo(server, name, level, buf)
428
+ NetUseGetInfo.call(server, name, level, buf) == NERR_Success
429
+ end
430
+
431
+ def NetUserAdd(server, level, buf, error)
432
+ NetUserAdd.call(server, level, buf, error) == NERR_Success
433
+ end
434
+
435
+ def NetUserChangePassword(domain, user, old, new)
436
+ NetUserChangePassword.call(domain, user, old, new) == NERR_Success
437
+ end
438
+
439
+ def NetUserDel(server, user)
440
+ NetUserDel.call(server, user) == NERR_Success
441
+ end
442
+
443
+ def NetUserEnum(server, level, filter, buf, max, entries, total_entries, resume)
444
+ NetUserEnum.call(server, level, filter, buf, max, entries, total_entries, resume) == NERR_Success
445
+ end
446
+
447
+ def NetUserGetGroups(server, user, level, buf, max, entries, total_entries)
448
+ NetUserGetGroups.call(server, user, level, buf, max, entries, total_entries) == NERR_Success
449
+ end
450
+
451
+ def NetUserGetInfo(server, user, level, buf)
452
+ NetUserGetInfo.call(server, user, level, buf) == NERR_Success
453
+ end
454
+
455
+ def NetUserGetLocalGroups(server, user, level, flags, buf, max, entries, total_entries)
456
+ NetUserGetLocalGroups.call(server, user, level, flags, buf, max, entries, total_entries) == NERR_Success
457
+ end
458
+
459
+ def NetUserModalsGet(server, level, buf)
460
+ NetUserModalsGet.call(server, level, buf) == NERR_Success
461
+ end
462
+
463
+ def NetUserModalsSet(server, level, buf, error)
464
+ NetUserModalsSet.call(server, level, buf, error) == NERR_Success
465
+ end
466
+
467
+ def NetUserSetGroups(server, user, level, buf, num)
468
+ NetUserSetGroups.call(server, user, level, buf, num) == NERR_Success
469
+ end
470
+
471
+ def NetUserSetInfo(server, user, level, buf, error)
472
+ NetUserSetInfo.call(server, user, level, buf, error) == NERR_Success
473
+ end
474
+
475
+ def NetValidateName(server, name, account, password, name_type)
476
+ NetValidateName.call(server, name, account, password, name_type) == NERR_Success
477
+ end
478
+
479
+ def NetWkstaGetInfo(server, level, buf)
480
+ NetWkstaGetInfo.call(server, level, buf) == NERR_Success
481
+ end
482
+
483
+ def NetWkstaSetInfo(server, level, buf, error)
484
+ NetWkstaSetInfo.call(server, level, buf, error) == NERR_Success
485
+ end
486
+
487
+ def NetWkstaTransportAdd(server, level, buf, error)
488
+ NetWkstaTransportAdd.call(server, level, buf, error) == NERR_Success
489
+ end
490
+
491
+ def NetWkstaTransportDel(server, name, cond)
492
+ NetWkstaTransportDel.call(server, name, cond) == NERR_Success
493
+ end
494
+
495
+ def NetWkstaTransportEnum(server, level, buf, maxlen, entries, total_entries, resume)
496
+ NetWkstaTransportEnum.call(server, level, buf, maxlen, entries, total_entries, resume) == NERR_Success
497
+ end
498
+
499
+ def NetWkstaUserEnum(server, level, buf, maxlen, entries, total_entries, resume)
500
+ NetWkstaUserEnum.call(server, level, buf, maxlen, entries, total_entries, resume) == NERR_Success
501
+ end
502
+
503
+ def NetWkstaUserGetInfo(res, level, buf)
504
+ NetWkstaUserGetInfo.call(res, level, buf) == NERR_Success
505
+ end
506
+
507
+ def NetWkstaUserSetInfo(res, level, buf, error)
508
+ NetWkstaUserSetInfo.call(res, level, buf, error) == NERR_Success
509
+ end
510
+
511
+ # Windows XP or later
512
+ begin
513
+ def GetNetScheduleAccountInformation(server, num_chars, chars)
514
+ GetNetScheduleAccountInformation.call(server, num_chars, chars) == NERR_Success
515
+ end
516
+
517
+ def SetNetScheduleAccountInformation(server, account, password)
518
+ SetNetScheduleAccountInformation.call(server, account, password) == NERR_Success
519
+ end
520
+ rescue Win32::API::LoadLibraryError
521
+ # Do nothing. It's up to you to check for their existence.
522
+ end
523
+ end
524
+ end
525
+ end