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.
- data/CHANGES +15 -0
- data/MANIFEST +9 -1
- data/lib/windows/clipboard.rb +1 -2
- data/lib/windows/com/automation.rb +58 -0
- data/lib/windows/com.rb +0 -1
- data/lib/windows/console.rb +0 -1
- data/lib/windows/debug.rb +0 -1
- data/lib/windows/device_io.rb +0 -1
- data/lib/windows/error.rb +37 -32
- data/lib/windows/eventlog.rb +5 -6
- data/lib/windows/file.rb +10 -36
- data/lib/windows/file_mapping.rb +0 -1
- data/lib/windows/filesystem.rb +0 -1
- data/lib/windows/gdi/bitmap.rb +0 -1
- data/lib/windows/gdi/device_context.rb +0 -1
- data/lib/windows/gdi/painting_drawing.rb +0 -1
- data/lib/windows/handle.rb +0 -1
- data/lib/windows/library.rb +0 -1
- data/lib/windows/memory.rb +0 -1
- data/lib/windows/msvcrt/buffer.rb +0 -1
- data/lib/windows/msvcrt/directory.rb +8 -9
- data/lib/windows/msvcrt/file.rb +0 -1
- data/lib/windows/msvcrt/io.rb +0 -1
- data/lib/windows/msvcrt/string.rb +0 -1
- data/lib/windows/msvcrt/time.rb +0 -1
- data/lib/windows/national.rb +0 -1
- data/lib/windows/network/management.rb +523 -0
- data/lib/windows/network/snmp.rb +90 -0
- data/lib/windows/network/winsock.rb +126 -0
- data/lib/windows/nio.rb +0 -1
- data/lib/windows/ntfs/file.rb +58 -0
- data/lib/windows/path.rb +105 -38
- data/lib/windows/pipe.rb +0 -1
- data/lib/windows/security.rb +292 -6
- data/lib/windows/service.rb +0 -1
- data/lib/windows/shell.rb +4 -1
- data/lib/windows/sound.rb +0 -1
- data/lib/windows/synchronize.rb +0 -1
- data/lib/windows/system_info.rb +0 -1
- data/lib/windows/thread.rb +0 -1
- data/lib/windows/time.rb +0 -1
- data/lib/windows/unicode.rb +0 -1
- data/lib/windows/volume.rb +0 -1
- data/lib/windows/window/dialog.rb +89 -0
- data/lib/windows/window/message.rb +289 -0
- data/lib/windows/window/properties.rb +18 -0
- data/lib/windows/window/timer.rb +17 -0
- data/lib/windows/window.rb +0 -1
- data/test/tc_com.rb +17 -19
- data/test/tc_msvcrt_directory.rb +57 -27
- data/test/tc_msvcrt_string.rb +74 -18
- data/windows-pr.gemspec +4 -5
- metadata +33 -15
@@ -0,0 +1,523 @@
|
|
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
|
+
NERR_Success = 0
|
15
|
+
NERR_BASE = 2100
|
16
|
+
NERR_NetNotStarted = NERR_BASE + 2
|
17
|
+
NERR_UnknownServer = NERR_BASE + 3
|
18
|
+
NERR_ShareMem = NERR_BASE + 4
|
19
|
+
NERR_NoNetworkResource = NERR_BASE + 5
|
20
|
+
NERR_RemoteOnly = NERR_BASE + 6
|
21
|
+
NERR_DevNotRedirected = NERR_BASE + 7
|
22
|
+
NERR_AlreadyLoggedOn = NERR_BASE + 100
|
23
|
+
NERR_NotLoggedOn = NERR_BASE + 101
|
24
|
+
NERR_BadUsername = NERR_BASE + 102
|
25
|
+
NERR_BadPassword = NERR_BASE + 103
|
26
|
+
NERR_UnableToAddName_W = NERR_BASE + 104
|
27
|
+
NERR_UnableToAddName_F = NERR_BASE + 105
|
28
|
+
NERR_UnableToDelName_W = NERR_BASE + 106
|
29
|
+
NERR_UnableToDelName_F = NERR_BASE + 107
|
30
|
+
NERR_LogonsPaused = NERR_BASE + 109
|
31
|
+
NERR_LogonServerConflict = NERR_BASE + 110
|
32
|
+
NERR_LogonNoUserPath = NERR_BASE + 111
|
33
|
+
NERR_LogonScriptError = NERR_BASE + 112
|
34
|
+
NERR_StandaloneLogon = NERR_BASE + 114
|
35
|
+
NERR_LogonServerNotFound = NERR_BASE + 115
|
36
|
+
NERR_LogonDomainExists = NERR_BASE + 116
|
37
|
+
NERR_NonValidatedLogon = NERR_BASE + 117
|
38
|
+
NERR_ACFNotFound = NERR_BASE + 119
|
39
|
+
NERR_GroupNotFound = NERR_BASE + 120
|
40
|
+
NERR_UserNotFound = NERR_BASE + 121
|
41
|
+
NERR_ResourceNotFound = NERR_BASE + 122
|
42
|
+
NERR_GroupExists = NERR_BASE + 123
|
43
|
+
NERR_UserExists = NERR_BASE + 124
|
44
|
+
NERR_ResourceExists = NERR_BASE + 125
|
45
|
+
NERR_NotPrimary = NERR_BASE + 126
|
46
|
+
NERR_ACFNotLoaded = NERR_BASE + 127
|
47
|
+
NERR_ACFNoRoom = NERR_BASE + 128
|
48
|
+
NERR_ACFFileIOFail = NERR_BASE + 129
|
49
|
+
NERR_ACFTooManyLists = NERR_BASE + 130
|
50
|
+
NERR_UserLogon = NERR_BASE + 131
|
51
|
+
NERR_ACFNoParent = NERR_BASE + 132
|
52
|
+
NERR_CanNotGrowSegment = NERR_BASE + 133
|
53
|
+
NERR_SpeGroupOp = NERR_BASE + 134
|
54
|
+
NERR_NotInCache = NERR_BASE + 135
|
55
|
+
NERR_UserInGroup = NERR_BASE + 136
|
56
|
+
NERR_UserNotInGroup = NERR_BASE + 137
|
57
|
+
NERR_AccountUndefined = NERR_BASE + 138
|
58
|
+
NERR_AccountExpired = NERR_BASE + 139
|
59
|
+
NERR_InvalidWorkstation = NERR_BASE + 140
|
60
|
+
NERR_InvalidLogonHours = NERR_BASE + 141
|
61
|
+
NERR_PasswordExpired = NERR_BASE + 142
|
62
|
+
NERR_PasswordCantChange = NERR_BASE + 143
|
63
|
+
NERR_PasswordHistConflict = NERR_BASE + 144
|
64
|
+
NERR_PasswordTooShort = NERR_BASE + 145
|
65
|
+
NERR_PasswordTooRecent = NERR_BASE + 146
|
66
|
+
NERR_InvalidDatabase = NERR_BASE + 147
|
67
|
+
NERR_DatabaseUpToDate = NERR_BASE + 148
|
68
|
+
NERR_SyncRequired = NERR_BASE + 149
|
69
|
+
NERR_UseNotFound = NERR_BASE + 150
|
70
|
+
NERR_BadAsgType = NERR_BASE + 151
|
71
|
+
NERR_DeviceIsShared = NERR_BASE + 152
|
72
|
+
|
73
|
+
MAX_PREFERRED_LENGTH = -1
|
74
|
+
|
75
|
+
# Taken from LMServer.h
|
76
|
+
SV_TYPE_WORKSTATION = 0x00000001
|
77
|
+
SV_TYPE_SERVER = 0x00000002
|
78
|
+
SV_TYPE_SQLSERVER = 0x00000004
|
79
|
+
SV_TYPE_DOMAIN_CTRL = 0x00000008
|
80
|
+
SV_TYPE_DOMAIN_BAKCTRL = 0x00000010
|
81
|
+
SV_TYPE_TIME_SOURCE = 0x00000020
|
82
|
+
SV_TYPE_AFP = 0x00000040
|
83
|
+
SV_TYPE_NOVELL = 0x00000080
|
84
|
+
SV_TYPE_DOMAIN_MEMBER = 0x00000100
|
85
|
+
SV_TYPE_PRINTQ_SERVER = 0x00000200
|
86
|
+
SV_TYPE_DIALIN_SERVER = 0x00000400
|
87
|
+
SV_TYPE_XENIX_SERVER = 0x00000800
|
88
|
+
SV_TYPE_SERVER_UNIX = SV_TYPE_XENIX_SERVER
|
89
|
+
SV_TYPE_NT = 0x00001000
|
90
|
+
SV_TYPE_WFW = 0x00002000
|
91
|
+
SV_TYPE_SERVER_MFPN = 0x00004000
|
92
|
+
SV_TYPE_SERVER_NT = 0x00008000
|
93
|
+
SV_TYPE_POTENTIAL_BROWSER = 0x00010000
|
94
|
+
SV_TYPE_BACKUP_BROWSER = 0x00020000
|
95
|
+
SV_TYPE_MASTER_BROWSER = 0x00040000
|
96
|
+
SV_TYPE_DOMAIN_MASTER = 0x00080000
|
97
|
+
SV_TYPE_SERVER_OSF = 0x00100000
|
98
|
+
SV_TYPE_SERVER_VMS = 0x00200000
|
99
|
+
SV_TYPE_WINDOWS = 0x00400000
|
100
|
+
SV_TYPE_DFS = 0x00800000
|
101
|
+
SV_TYPE_CLUSTER_NT = 0x01000000
|
102
|
+
SV_TYPE_TERMINALSERVER = 0x02000000
|
103
|
+
SV_TYPE_CLUSTER_VS_NT = 0x04000000
|
104
|
+
SV_TYPE_DCE = 0x10000000
|
105
|
+
SV_TYPE_ALTERNATE_XPORT = 0x20000000
|
106
|
+
SV_TYPE_LOCAL_LIST_ONLY = 0x40000000
|
107
|
+
SV_TYPE_DOMAIN_ENUM = 0x80000000
|
108
|
+
SV_TYPE_ALL = 0xFFFFFFFF
|
109
|
+
|
110
|
+
API.new('NetAlertRaise', 'PPL', 'L', 'netapi32')
|
111
|
+
API.new('NetAlertRaiseEx', 'PPLP', 'L', 'netapi32')
|
112
|
+
API.new('NetApiBufferAllocate', 'LP', 'L', 'netapi32')
|
113
|
+
API.new('NetApiBufferFree', 'P', 'L', 'netapi32')
|
114
|
+
API.new('NetApiBufferReallocate', 'PLP', 'L', 'netapi32')
|
115
|
+
API.new('NetApiBufferSize', 'PP', 'L', 'netapi32')
|
116
|
+
API.new('NetGetAnyDCName', 'PPP', 'L', 'netapi32')
|
117
|
+
API.new('NetGetDCName', 'PPP', 'L', 'netapi32')
|
118
|
+
API.new('NetGetDisplayInformationIndex', 'PLPP', 'L', 'netapi32')
|
119
|
+
API.new('NetGetJoinableOUs', 'PPPPPP', 'L', 'netapi32')
|
120
|
+
API.new('NetGetJoinInformation', 'PPP', 'L', 'netapi32')
|
121
|
+
API.new('NetGroupAdd', 'PLPP', 'L', 'netapi32')
|
122
|
+
API.new('NetGroupAddUser', 'PPP', 'L', 'netapi32')
|
123
|
+
API.new('NetGroupDel', 'PP', 'L', 'netapi32')
|
124
|
+
API.new('NetGroupDelUser', 'PPP', 'L', 'netapi32')
|
125
|
+
API.new('NetGroupEnum', 'PLPLPPP', 'L', 'netapi32')
|
126
|
+
API.new('NetGroupGetInfo', 'PPLP', 'L', 'netapi32')
|
127
|
+
API.new('NetGroupGetUsers', 'PPLPLPPP', 'L', 'netapi32')
|
128
|
+
API.new('NetGroupSetInfo', 'PPLPP', 'L', 'netapi32')
|
129
|
+
API.new('NetGroupSetUsers', 'PPLPL', 'L', 'netapi32')
|
130
|
+
API.new('NetJoinDomain', 'PPPPPL', 'L', 'netapi32')
|
131
|
+
API.new('NetLocalGroupAdd', 'PLPP', 'L', 'netapi32')
|
132
|
+
API.new('NetLocalGroupAddMembers', 'PPLPL', 'L', 'netapi32')
|
133
|
+
API.new('NetLocalGroupDel', 'PP', 'L', 'netapi32')
|
134
|
+
API.new('NetLocalGroupDelMembers', 'PPLPL', 'L', 'netapi32')
|
135
|
+
API.new('NetLocalGroupEnum', 'PLPLPPP', 'L', 'netapi32')
|
136
|
+
API.new('NetLocalGroupGetInfo', 'PPLP', 'L', 'netapi32')
|
137
|
+
API.new('NetLocalGroupGetMembers', 'PPLPLPPP', 'L', 'netapi32')
|
138
|
+
API.new('NetLocalGroupSetInfo', 'PPLPP', 'L', 'netapi32')
|
139
|
+
API.new('NetLocalGroupSetMembers', 'PPLPP', 'L', 'netapi32')
|
140
|
+
API.new('NetMessageBufferSend', 'PPPPL', 'L', 'netapi32')
|
141
|
+
API.new('NetMessageNameAdd', 'PP', 'L', 'netapi32')
|
142
|
+
API.new('NetMessageNameDel', 'PP', 'L', 'netapi32')
|
143
|
+
API.new('NetMessageNameEnum', 'PLPLPPP', 'L', 'netapi32')
|
144
|
+
API.new('NetMessageNameGetInfo', 'PPLP', 'L', 'netapi32')
|
145
|
+
API.new('NetQueryDisplayInformation', 'PLLLLPP', 'L', 'netapi32')
|
146
|
+
API.new('NetRemoteComputerSupports', 'PLP', 'L', 'netapi32')
|
147
|
+
API.new('NetRemoteTOD', 'PP', 'L', 'netapi32')
|
148
|
+
API.new('NetRenameMachineInDomain', 'PPPPL', 'L', 'netapi32')
|
149
|
+
API.new('NetScheduleJobAdd', 'PPP', 'L', 'netapi32')
|
150
|
+
API.new('NetScheduleJobDel', 'PLL', 'L', 'netapi32')
|
151
|
+
API.new('NetScheduleJobEnum', 'PPLPPP', 'L', 'netapi32')
|
152
|
+
API.new('NetScheduleJobGetInfo', 'PLP', 'L', 'netapi32')
|
153
|
+
API.new('NetServerComputerNameAdd', 'PPP', 'L', 'netapi32')
|
154
|
+
API.new('NetServerComputerNameDel', 'PP', 'L', 'netapi32')
|
155
|
+
API.new('NetServerDiskEnum', 'PLPLPPP', 'L', 'netapi32')
|
156
|
+
API.new('NetServerEnum', 'PLPLPPLPP', 'L', 'netapi32')
|
157
|
+
API.new('NetServerGetInfo', 'PLP', 'L', 'netapi32')
|
158
|
+
API.new('NetServerSetInfo', 'PLPP', 'L', 'netapi32')
|
159
|
+
API.new('NetServerTransportAdd', 'PLP', 'L', 'netapi32')
|
160
|
+
API.new('NetServerTransportAddEx', 'PLP', 'L', 'netapi32')
|
161
|
+
API.new('NetServerTransportDel', 'PLP', 'L', 'netapi32')
|
162
|
+
API.new('NetServerTransportEnum', 'PLPLPPP', 'L', 'netapi32')
|
163
|
+
API.new('NetUnjoinDomain', 'PPPL', 'L', 'netapi32')
|
164
|
+
API.new('NetUseAdd', 'PLPP', 'L', 'netapi32')
|
165
|
+
API.new('NetUseDel', 'PPL', 'L', 'netapi32')
|
166
|
+
API.new('NetUseEnum', 'PLPLPPP', 'L', 'netapi32')
|
167
|
+
API.new('NetUseGetInfo', 'PPLP', 'L', 'netapi32')
|
168
|
+
API.new('NetUserAdd', 'PLPP', 'L', 'netapi32')
|
169
|
+
API.new('NetUserChangePassword', 'PPPP', 'L', 'netapi32')
|
170
|
+
API.new('NetUserDel', 'PP', 'L', 'netapi32')
|
171
|
+
API.new('NetUserEnum', 'PLLPLPPP', 'L', 'netapi32')
|
172
|
+
API.new('NetUserGetGroups', 'PPLPLPP', 'L', 'netapi32')
|
173
|
+
API.new('NetUserGetInfo', 'PPLP', 'L', 'netapi32')
|
174
|
+
API.new('NetUserGetLocalGroups', 'PPLLPLPP', 'L', 'netapi32')
|
175
|
+
API.new('NetUserModalsGet', 'PLP', 'L', 'netapi32')
|
176
|
+
API.new('NetUserModalsSet', 'PLPP', 'L', 'netapi32')
|
177
|
+
API.new('NetUserSetGroups', 'PPLPL', 'L', 'netapi32')
|
178
|
+
API.new('NetUserSetInfo', 'PPLPP', 'L', 'netapi32')
|
179
|
+
API.new('NetValidateName', 'PPPPP', 'L', 'netapi32')
|
180
|
+
API.new('NetWkstaGetInfo', 'PLP', 'L', 'netapi32')
|
181
|
+
API.new('NetWkstaSetInfo', 'PLPP', 'L', 'netapi32')
|
182
|
+
API.new('NetWkstaTransportAdd', 'PLPP', 'L', 'netapi32')
|
183
|
+
API.new('NetWkstaTransportDel', 'PPL', 'L', 'netapi32')
|
184
|
+
API.new('NetWkstaTransportEnum', 'PLPLPPP', 'L', 'netapi32')
|
185
|
+
API.new('NetWkstaUserEnum', 'PLPLPPP', 'L', 'netapi32')
|
186
|
+
API.new('NetWkstaUserGetInfo', 'PLP', 'L', 'netapi32')
|
187
|
+
API.new('NetWkstaUserSetInfo', 'PPLP', 'L', 'netapi32')
|
188
|
+
|
189
|
+
# Windows XP or later.
|
190
|
+
begin
|
191
|
+
API.new('GetNetScheduleAccountInformation', 'PLP', 'L', 'mstask')
|
192
|
+
API.new('SetNetScheduleAccountInformation', 'PPP', 'L', 'netapi32')
|
193
|
+
rescue Exception
|
194
|
+
# Do nothing. Not supported on current platform.
|
195
|
+
end
|
196
|
+
|
197
|
+
def NetAlertRaise(name, buf, bufsize)
|
198
|
+
NetAlertRaise.call(name, buf, bufsize) == NERR_Success
|
199
|
+
end
|
200
|
+
|
201
|
+
def NetAlertRaiseEx(name, data, size, service)
|
202
|
+
NetAlertRaiseEx.call(name, data, size, service) == NERR_Success
|
203
|
+
end
|
204
|
+
|
205
|
+
def NetApiBufferAllocate(num_bytes, buf)
|
206
|
+
NetApiBufferAllocate.call(num_bytes, buf) == NERR_Success
|
207
|
+
end
|
208
|
+
|
209
|
+
def NetApiBufferFree(buf)
|
210
|
+
NetApiBufferFree.call(buf) == NERR_Success
|
211
|
+
end
|
212
|
+
|
213
|
+
def NetApiBufferReallocate(old_buf, count, new_buf)
|
214
|
+
NetApiBufferReallocate.call(old_buf, count, new_buf) == NERR_Success
|
215
|
+
end
|
216
|
+
|
217
|
+
def NetApiBufferSize(buf, count)
|
218
|
+
NetApiBufferSize.call(buf, count) == NERR_Success
|
219
|
+
end
|
220
|
+
|
221
|
+
def NetGetAnyDCName(server, domain, buf)
|
222
|
+
NetGetAnyDCName.call(server, domain, buf) == NERR_Success
|
223
|
+
end
|
224
|
+
|
225
|
+
def NetGetDCName(server, domain, buf)
|
226
|
+
NetGetDCName.call(server, domain, buf) == NERR_Success
|
227
|
+
end
|
228
|
+
|
229
|
+
def NetGetDisplayInformationIndex(server, level, prefix, index)
|
230
|
+
NetGetDisplayInformationIndex.call(server, level, prefix, index) == NERR_Success
|
231
|
+
end
|
232
|
+
|
233
|
+
def NetGetJoinableOUs(server, domain, account, password, count, ous)
|
234
|
+
NetGetJoinableOUs.call(server, domain, account, password, count, ous) == NERR_Success
|
235
|
+
end
|
236
|
+
|
237
|
+
def NetGetJoinInformation(server, buf, buf_type)
|
238
|
+
NetGetJoinInformation.call(server, buf, buf_type) == NERR_Success
|
239
|
+
end
|
240
|
+
|
241
|
+
def NetGroupAdd(server, level, buf, err)
|
242
|
+
NetGroupAdd.call(server, level, buf, err).call == NERR_Success
|
243
|
+
end
|
244
|
+
|
245
|
+
def NetGroupAddUser(server, group, user)
|
246
|
+
NetGroupAddUser.call(server, group, user) == NERR_Success
|
247
|
+
end
|
248
|
+
|
249
|
+
def NetGroupDel(server, group)
|
250
|
+
NetGroupDel.call(server, group) == NERR_Success
|
251
|
+
end
|
252
|
+
|
253
|
+
def NetGroupDelUser(server, group, user)
|
254
|
+
NetGroupDelUser.call(server, group, user) == NERR_Success
|
255
|
+
end
|
256
|
+
|
257
|
+
def NetGroupEnum(server, level, buf, max, entries, total_entries, resume)
|
258
|
+
NetGroupEnum.call(server, level, buf, max, entries, total_entries, resume) == NERR_Success
|
259
|
+
end
|
260
|
+
|
261
|
+
def NetGroupGetInfo(server, group, level, buf)
|
262
|
+
NetGroupGetInfo.call(server, group, level, buf) == NERR_Success
|
263
|
+
end
|
264
|
+
|
265
|
+
def NetGroupGetUsers(server, group, level, buf, max, entries, total_entries, resume)
|
266
|
+
NetGroupGetUsers.call(server, group, level, buf, max, entries, total_entries, resume) == NERR_Success
|
267
|
+
end
|
268
|
+
|
269
|
+
def NetGroupSetInfo(server, group, level, buf, err)
|
270
|
+
NetGroupSetInfo.call(server, group, level, buf, err) == NERR_Success
|
271
|
+
end
|
272
|
+
|
273
|
+
def NetGroupSetUsers(server, group, level, buf, total)
|
274
|
+
NetGroupSetUsers.call(server, group, level, buf, total) == NERR_Success
|
275
|
+
end
|
276
|
+
|
277
|
+
def NetJoinDomain(server, domain, account_ou, account, password, opts)
|
278
|
+
NetJoinDomain.call(server, domain, account_ou, account, password, opts) == NERR_Success
|
279
|
+
end
|
280
|
+
|
281
|
+
def NetLocalGroupAdd(server, level, buf, err)
|
282
|
+
NetLocalGroupAdd.call(server, level, buf, err) == NERR_Success
|
283
|
+
end
|
284
|
+
|
285
|
+
def NetLocalGroupAddMembers(server, group, level, buf, total)
|
286
|
+
NetLocalGroupAddMembers.call(server, group, level, buf, total) == NERR_Success
|
287
|
+
end
|
288
|
+
|
289
|
+
def NetLocalGroupDel(server, group)
|
290
|
+
NetLocalGroupDel.call(server, group) == NERR_Success
|
291
|
+
end
|
292
|
+
|
293
|
+
def NetLocalGroupDelMembers(server, group, level, buf, total)
|
294
|
+
NetLocalGroupDelMembers.call(server, group, level, buf, total) == NERR_Success
|
295
|
+
end
|
296
|
+
|
297
|
+
def NetLocalGroupEnum(server, level, buf, max, entries, total_entries, resume)
|
298
|
+
NetLocalGroupEnum.call(server, level, buf, max, entries, total_entries, resume) == NERR_Success
|
299
|
+
end
|
300
|
+
|
301
|
+
def NetLocalGroupGetInfo(server, group, level, buf)
|
302
|
+
NetLocalGroupGetInfo.call(server, group, level, buf) == NERR_Success
|
303
|
+
end
|
304
|
+
|
305
|
+
def NetLocalGroupGetMembers(server, group, level, buf, max, entries, total_entries, resume)
|
306
|
+
NetLocalGroupGetMembers.call(server, group, level, buf, max, entries, total_entries, resume) == NERR_Success
|
307
|
+
end
|
308
|
+
|
309
|
+
def NetLocalGroupSetInfo(server, group, level, buf, err)
|
310
|
+
NetLocalGroupSetInfo.call(server, group, level, buf, err) == NERR_Success
|
311
|
+
end
|
312
|
+
|
313
|
+
def NetLocalGroupSetMembers(server, group, level, buf, total)
|
314
|
+
NetLocalGroupSetMembers.call(server, group, level, buf, total) == NERR_Success
|
315
|
+
end
|
316
|
+
|
317
|
+
def NetMessageBufferSend(server, msg, from, buf, bufsize)
|
318
|
+
NetMessageBufferSend.call(server, msg, from, buf, bufsize) == NERR_Success
|
319
|
+
end
|
320
|
+
|
321
|
+
def NetMessageNameAdd(server, msg)
|
322
|
+
NetMessageNameAdd.call(server, msg) == NERR_Success
|
323
|
+
end
|
324
|
+
|
325
|
+
def NetMessageNameDel(server, msg)
|
326
|
+
NetMessageNameDel.call(server, msg) == NERR_Success
|
327
|
+
end
|
328
|
+
|
329
|
+
def NetMessageNameEnum(server, level, buf, max, entries, total_entries, resume)
|
330
|
+
NetMessageNameEnum.call(server, level, buf, max, entries, total_entries, resume) == NERR_Success
|
331
|
+
end
|
332
|
+
|
333
|
+
def NetMessageNameGetInfo(server, msg, level, buf)
|
334
|
+
NetMessageNameGetInfo.call(server, msg, level, buf) == NERR_Success
|
335
|
+
end
|
336
|
+
|
337
|
+
def NetQueryDisplayInformation(server, level, index, entries, max, count, buf)
|
338
|
+
NetQueryDisplayInformation.call(server, level, index, entries, max, count, buf) == NERR_Success
|
339
|
+
end
|
340
|
+
|
341
|
+
def NetRemoteComputerSupports(server, level, index, entries, max, count, buf)
|
342
|
+
NetRemoteComputerSupports.call(server, level, index, entries, max, count, buf) == NERR_Success
|
343
|
+
end
|
344
|
+
|
345
|
+
def NetRemoteTOD(server, buf)
|
346
|
+
NetRemoteTOD.call(server, buf) == NERR_Success
|
347
|
+
end
|
348
|
+
|
349
|
+
def NetRenameMachineInDomain(server, machine, account, password, options)
|
350
|
+
NetRenameMachineInDomain.call(server, machine, account, password, options) == NERR_Success
|
351
|
+
end
|
352
|
+
|
353
|
+
def NetScheduleJobAdd(server, buf, job)
|
354
|
+
NetScheduleJobAdd.call(server, buf, job) == NERR_Success
|
355
|
+
end
|
356
|
+
|
357
|
+
def NetScheduleJobDel(server, min, max)
|
358
|
+
NetScheduleJobDel.call(server, min, max) == NERR_Success
|
359
|
+
end
|
360
|
+
|
361
|
+
def NetScheduleJobEnum(server, buf, max, entries, total_entries, resume)
|
362
|
+
NetScheduleJobEnum.call(server, buf, max, entries, total_entries, resume) == NERR_Success
|
363
|
+
end
|
364
|
+
|
365
|
+
def NetScheduleJobGetInfo(server, job, buf)
|
366
|
+
NetScheduleJobGetInfo.call(server, job, buf) == NERR_Success
|
367
|
+
end
|
368
|
+
|
369
|
+
def NetServerComputerNameAdd(server, em_domain, em_server)
|
370
|
+
NetServerComputerNameAdd.call(server, em_domain, em_server) == NERR_Success
|
371
|
+
end
|
372
|
+
|
373
|
+
def NetServerComputerNameDel(server, em_server)
|
374
|
+
NetServerComputerNameDel.call(server, em_server) == NERR_Success
|
375
|
+
end
|
376
|
+
|
377
|
+
def NetServerDiskEnum(server, level, buf, maxlen, entries, total_entries, resume)
|
378
|
+
NetServerDiskEnum.call(server, level, buf, maxlen, entries, total_entries, resume) == NERR_Success
|
379
|
+
end
|
380
|
+
|
381
|
+
def NetServerEnum(server, level, ptr, maxlen, num, total, stype, domain, handle)
|
382
|
+
NetServerEnum.call(server, level, ptr, maxlen, num, total, stype, domain, handle) == NERR_Success
|
383
|
+
end
|
384
|
+
|
385
|
+
def NetServerGetInfo(server, level, buf)
|
386
|
+
NetServerGetInfo.call(server, level, buf) == NERR_Success
|
387
|
+
end
|
388
|
+
|
389
|
+
def NetServerSetInfo(server, level, buf, error)
|
390
|
+
NetServerSetInfo.call(server, level, buf, error) == NERR_Success
|
391
|
+
end
|
392
|
+
|
393
|
+
def NetServerTransportAdd(server, level, buf)
|
394
|
+
NetServerTransportAdd.call(server, level, buf) == NERR_Success
|
395
|
+
end
|
396
|
+
|
397
|
+
def NetServerTransportAddEx(server, level, buf)
|
398
|
+
NetServerTransportAddEx.call(server, level, buf) == NERR_Success
|
399
|
+
end
|
400
|
+
|
401
|
+
def NetServerTransportDel(server, level, buf)
|
402
|
+
NetServerTransportDel.call(server, level, buf) == NERR_Success
|
403
|
+
end
|
404
|
+
|
405
|
+
def NetServerTransportEnum(server, level, buf, maxlen, entries, total_entries, resume)
|
406
|
+
NetServerTransportEnum.call(server, level, buf, maxlen, entries, total_entries, resume) == NERR_Success
|
407
|
+
end
|
408
|
+
|
409
|
+
def NetUnjoinDomain(server, account, password, options)
|
410
|
+
NetUnjoinDomain.call(server, account, password, options) == NERR_Success
|
411
|
+
end
|
412
|
+
|
413
|
+
def NetUseAdd(server, level, buf, error)
|
414
|
+
NetUseAdd.call(server, level, buf, error) == NERR_Success
|
415
|
+
end
|
416
|
+
|
417
|
+
def NetUseDel(server, name, conn)
|
418
|
+
NetUseDel.call(server, name, conn) == NERR_Success
|
419
|
+
end
|
420
|
+
|
421
|
+
def NetUseEnum(server, level, buf, max, entries, total_entries, resume)
|
422
|
+
NetUseEnum.call(server, level, buf, max, entries, total_entries, resume) == NERR_Success
|
423
|
+
end
|
424
|
+
|
425
|
+
def NetUseGetInfo(server, name, level, buf)
|
426
|
+
NetUseGetInfo.call(server, name, level, buf) == NERR_Success
|
427
|
+
end
|
428
|
+
|
429
|
+
def NetUserAdd(server, level, buf, error)
|
430
|
+
NetUserAdd.call(server, level, buf, error) == NERR_Success
|
431
|
+
end
|
432
|
+
|
433
|
+
def NetUserChangePassword(domain, user, old, new)
|
434
|
+
NetUserChangePassword.call(domain, user, old, new) == NERR_Success
|
435
|
+
end
|
436
|
+
|
437
|
+
def NetUserDel(server, user)
|
438
|
+
NetUserDel.call(server, user) == NERR_Success
|
439
|
+
end
|
440
|
+
|
441
|
+
def NetUserEnum(server, level, filter, buf, max, entries, total_entries, resume)
|
442
|
+
NetUserEnum.call(server, level, filter, buf, max, entries, total_entries, resume) == NERR_Success
|
443
|
+
end
|
444
|
+
|
445
|
+
def NetUserGetGroups(server, user, level, buf, max, entries, total_entries)
|
446
|
+
NetUserGetGroups.call(server, user, level, buf, max, entries, total_entries) == NERR_Success
|
447
|
+
end
|
448
|
+
|
449
|
+
def NetUserGetInfo(server, user, level, buf)
|
450
|
+
NetUserGetInfo.call(server, user, level, buf) == NERR_Success
|
451
|
+
end
|
452
|
+
|
453
|
+
def NetUserGetLocalGroups(server, user, level, flags, buf, max, entries, total_entries)
|
454
|
+
NetUserGetLocalGroups.call(server, user, level, flags, buf, max, entries, total_entries) == NERR_Success
|
455
|
+
end
|
456
|
+
|
457
|
+
def NetUserModalsGet(server, level, buf)
|
458
|
+
NetUserModalsGet.call(server, level, buf) == NERR_Success
|
459
|
+
end
|
460
|
+
|
461
|
+
def NetUserModalsSet(server, level, buf, error)
|
462
|
+
NetUserModalsSet.call(server, level, buf, error) == NERR_Success
|
463
|
+
end
|
464
|
+
|
465
|
+
def NetUserSetGroups(server, user, level, buf, num)
|
466
|
+
NetUserSetGroups.call(server, user, level, buf, num) == NERR_Success
|
467
|
+
end
|
468
|
+
|
469
|
+
def NetUserSetInfo(server, user, level, buf, error)
|
470
|
+
NetUserSetInfo.call(server, user, level, buf, error) == NERR_Success
|
471
|
+
end
|
472
|
+
|
473
|
+
def NetValidateName(server, name, account, password, name_type)
|
474
|
+
NetValidateName.call(server, name, account, password, name_type) == NERR_Success
|
475
|
+
end
|
476
|
+
|
477
|
+
def NetWkstaGetInfo(server, level, buf)
|
478
|
+
NetWkstaGetInfo.call(server, level, buf) == NERR_Success
|
479
|
+
end
|
480
|
+
|
481
|
+
def NetWkstaSetInfo(server, level, buf, error)
|
482
|
+
NetWkstaSetInfo.call(server, level, buf, error) == NERR_Success
|
483
|
+
end
|
484
|
+
|
485
|
+
def NetWkstaTransportAdd(server, level, buf, error)
|
486
|
+
NetWkstaTransportAdd.call(server, level, buf, error) == NERR_Success
|
487
|
+
end
|
488
|
+
|
489
|
+
def NetWkstaTransportDel(server, name, cond)
|
490
|
+
NetWkstaTransportDel.call(server, name, cond) == NERR_Success
|
491
|
+
end
|
492
|
+
|
493
|
+
def NetWkstaTransportEnum(server, level, buf, maxlen, entries, total_entries, resume)
|
494
|
+
NetWkstaTransportEnum.call(server, level, buf, maxlen, entries, total_entries, resume) == NERR_Success
|
495
|
+
end
|
496
|
+
|
497
|
+
def NetWkstaUserEnum(server, level, buf, maxlen, entries, total_entries, resume)
|
498
|
+
NetWkstaUserEnum.call(server, level, buf, maxlen, entries, total_entries, resume) == NERR_Success
|
499
|
+
end
|
500
|
+
|
501
|
+
def NetWkstaUserGetInfo(res, level, buf)
|
502
|
+
NetWkstaUserGetInfo.call(res, level, buf) == NERR_Success
|
503
|
+
end
|
504
|
+
|
505
|
+
def NetWkstaUserSetInfo(res, level, buf, error)
|
506
|
+
NetWkstaUserSetInfo.call(res, level, buf, error) == NERR_Success
|
507
|
+
end
|
508
|
+
|
509
|
+
# Windows XP or later
|
510
|
+
begin
|
511
|
+
def GetNetScheduleAccountInformation(server, num_chars, chars)
|
512
|
+
GetNetScheduleAccountInformation.call(server, num_chars, chars) == NERR_Success
|
513
|
+
end
|
514
|
+
|
515
|
+
def SetNetScheduleAccountInformation(server, account, password)
|
516
|
+
SetNetScheduleAccountInformation.call(server, account, password) == NERR_Success
|
517
|
+
end
|
518
|
+
rescue Exception
|
519
|
+
# Do nothing. It's up to you to check for their existence.
|
520
|
+
end
|
521
|
+
end
|
522
|
+
end
|
523
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'windows/api'
|
2
|
+
|
3
|
+
module Windows
|
4
|
+
module Network
|
5
|
+
module SNMP
|
6
|
+
API.auto_namespace = 'Windows::Network::SNMP'
|
7
|
+
API.auto_constant = true
|
8
|
+
API.auto_method = true
|
9
|
+
API.auto_unicode = false
|
10
|
+
|
11
|
+
SNMPAPI_FAILURE = 0
|
12
|
+
SNMPAPI_SUCCESS = 1
|
13
|
+
SNMPAPI_ALLOC_ERROR = 2
|
14
|
+
SNMPAPI_CONTEXT_INVALID = 3
|
15
|
+
SNMPAPI_CONTEXT_UNKNOWN = 4
|
16
|
+
SNMPAPI_ENTITY_INVALID = 5
|
17
|
+
SNMPAPI_ENTITY_UNKNOWN = 6
|
18
|
+
SNMPAPI_INDEX_INVALID = 7
|
19
|
+
SNMPAPI_NOOP = 8
|
20
|
+
SNMPAPI_OID_INVALID = 9
|
21
|
+
SNMPAPI_OPERATION_INVALID = 10
|
22
|
+
SNMPAPI_OUTPUT_TRUNCATED = 11
|
23
|
+
SNMPAPI_PDU_INVALID = 12
|
24
|
+
SNMPAPI_SESSION_INVALID = 13
|
25
|
+
SNMPAPI_SYNTAX_INVALID = 14
|
26
|
+
SNMPAPI_VBL_INVALID = 15
|
27
|
+
SNMPAPI_MODE_INVALID = 16
|
28
|
+
SNMPAPI_SIZE_INVALID = 17
|
29
|
+
SNMPAPI_NOT_INITIALIZED = 18
|
30
|
+
SNMPAPI_MESSAGE_INVALID = 19
|
31
|
+
SNMPAPI_HWND_INVALID = 20
|
32
|
+
SNMPAPI_OTHER_ERROR = 99
|
33
|
+
SNMPAPI_TL_NOT_INITIALIZED = 100
|
34
|
+
SNMPAPI_TL_NOT_SUPPORTED = 101
|
35
|
+
SNMPAPI_TL_NOT_AVAILABLE = 102
|
36
|
+
SNMPAPI_TL_RESOURCE_ERROR = 103
|
37
|
+
SNMPAPI_TL_UNDELIVERABLE = 104
|
38
|
+
SNMPAPI_TL_SRC_INVALID = 105
|
39
|
+
SNMPAPI_TL_INVALID_PARAM = 106
|
40
|
+
SNMPAPI_TL_IN_USE = 107
|
41
|
+
SNMPAPI_TL_TIMEOUT = 108
|
42
|
+
SNMPAPI_TL_PDU_TOO_BIG = 109
|
43
|
+
SNMPAPI_TL_OTHER = 199
|
44
|
+
|
45
|
+
SNMPAPI_TRANSLATED = 0
|
46
|
+
SNMPAPI_UNTRANSLATED_V1 = 1
|
47
|
+
SNMPAPI_UNTRANSLATED_V2 = 2
|
48
|
+
SNMPAPI_NO_SUPPORT = 0
|
49
|
+
SNMPAPI_V1_SUPPORT = 1
|
50
|
+
SNMPAPI_V2_SUPPORT = 2
|
51
|
+
SNMPAPI_M2M_SUPPORT = 3
|
52
|
+
SNMPAPI_OFF = 0
|
53
|
+
SNMPAPI_ON = 1
|
54
|
+
|
55
|
+
API.new('SnmpCancelMsg', 'LI', 'I', 'wsnmp32')
|
56
|
+
API.new('SnmpCleanup', 'V', 'I', 'wsnmp32')
|
57
|
+
API.new('SnmpClose', 'L', 'I', 'wsnmp32')
|
58
|
+
API.new('SnmpContextToStr', 'LP', 'I', 'wsnmp32')
|
59
|
+
API.new('SnmpDecodeMsg', 'LPPPPP', 'I', 'wsnmp32')
|
60
|
+
API.new('SnmpEncodeMsg', 'LLLLLP', 'I', 'wsnmp32')
|
61
|
+
API.new('SnmpEntityToStr', 'LLP', 'I', 'wsnmp32')
|
62
|
+
API.new('SnmpFreeContext', 'L', 'I', 'wsnmp32')
|
63
|
+
API.new('SnmpFreeDescriptor', 'LP', 'I', 'wsnmp32')
|
64
|
+
API.new('SnmpFreeEntity', 'L', 'I', 'wsnmp32')
|
65
|
+
API.new('SnmpGetLastError', 'L', 'I', 'wsnmp32')
|
66
|
+
API.new('SnmpListen', 'LL', 'I', 'wsnmp32')
|
67
|
+
API.new('SnmpOidCompare', 'PPLP', 'I', 'wsnmp32')
|
68
|
+
API.new('SnmpOidCopy', 'PP', 'I', 'wsnmp32')
|
69
|
+
API.new('SnmpOidToStr', 'PLP', 'I', 'wsnmp32')
|
70
|
+
API.new('SnmpOpen', 'LL', 'L', 'wsnmp32')
|
71
|
+
API.new('SnmpRecvMsg', 'LPPPP', 'I', 'wsnmp32')
|
72
|
+
API.new('SnmpRegister', 'LLLLPL', 'I', 'wsnmp32')
|
73
|
+
API.new('SnmpSendMsg', 'LLLLL', 'I', 'wsnmp32')
|
74
|
+
API.new('SnmpSetPort', 'LL', 'I', 'wsnmp32')
|
75
|
+
API.new('SnmpStartup', 'PPPPP', 'I', 'wsnmp32')
|
76
|
+
API.new('SnmpStrToContext', 'LP', 'I', 'wsnmp32')
|
77
|
+
API.new('SnmpStrToEntity', 'LP', 'I', 'wsnmp32')
|
78
|
+
API.new('SnmpStrToOid', 'PP', 'I', 'wsnmp32')
|
79
|
+
|
80
|
+
# Windows 2003 Server or later and/or WinSNMP 2.0 or later
|
81
|
+
begin
|
82
|
+
API.new('SnmpCreateSession', 'LLKP', 'wsnmp32')
|
83
|
+
API.new('SnmpCleanupEx', 'V', 'I', 'wsnmp32')
|
84
|
+
API.new('SnmpStartupEx', 'PPPPP', 'L', 'wsnmp32')
|
85
|
+
rescue Exception
|
86
|
+
# Do nothing. It's up to you to check for their existence.
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|