windows-pr 0.3.0-mswin32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ module Windows
2
+ module Limits
3
+ MINCHAR = 0x80
4
+ MAXCHAR = 0x7f
5
+ MINSHORT = 0x8000
6
+ MAXSHORT = 0x7fff
7
+ MINLONG = 0x80000000
8
+ MAXLONG = 0x7fffffff
9
+ MAXBYTE = 0xff
10
+ MAXWORD = 0xffff
11
+ MAXDWORD = 0xffffffff
12
+ end
13
+ end
@@ -0,0 +1,92 @@
1
+ ######################################################################
2
+ # memory.rb
3
+ #
4
+ # Includes the following functions:
5
+ #
6
+ # GlobalAlloc()
7
+ # GlobalDiscard()
8
+ # GlobalFlags()
9
+ # GlobalFree()
10
+ # GlobalHandle()
11
+ # GlobalLock()
12
+ # GlobalMemoryStatus()
13
+ # GlobalMemoryStatusEx()
14
+ # GlobalReAlloc()
15
+ # GlobalSize()
16
+ # GlobalUnlock()
17
+ #
18
+ # Defines the following constants:
19
+ #
20
+ # GHND
21
+ # GMEM_FIXED
22
+ # GMEM_MOVABLE
23
+ # GMEM_ZEROINIT
24
+ # GPTR
25
+ ######################################################################
26
+ require 'Win32API'
27
+
28
+ module Windows
29
+ module Memory
30
+ GHND = 0x0042
31
+ GMEM_FIXED = 0x0000
32
+ GMEM_MOVABLE = 0002
33
+ GMEM_ZEROINIT = 0x0040
34
+ GPTR = 0x0040
35
+
36
+ GlobalAlloc = Win32API.new('kernel32', 'GlobalAlloc', 'II', 'I')
37
+ GlobalDiscard = Win32API.new('kernel32', 'GlobalDiscard', 'I', 'I')
38
+ GlobalFlags = Win32API.new('kernel32', 'GlobalFlags', 'I', 'I')
39
+ GlobalFree = Win32API.new('kernel32', 'GlobalFree', 'I', 'I')
40
+ GlobalHandle = Win32API.new('kernel32', 'GlobalHandle', 'P', 'I')
41
+ GlobalLock = Win32API.new('kernel32', 'GlobalLock', 'I', 'P')
42
+ GlobalMemoryStatus = Win32API.new('kernel32', 'GlobalMemoryStatus', 'P', 'V')
43
+ GlobalMemoryStatusEx = Win32API.new('kernel32', 'GlobalMemoryStatus', 'P', 'V')
44
+ GlobalReAlloc = Win32API.new('kernel32', 'GlobalReAlloc', 'III', 'I')
45
+ GlobalSize = Win32API.new('kernel32', 'GlobalSize', 'I', 'I')
46
+ GlobalUnlock = Win32API.new('kernel32', 'GlobalUnlock', 'I', 'I')
47
+
48
+ def GlobalAlloc(flags, bytes)
49
+ GlobalAlloc.call(flags, bytes)
50
+ end
51
+
52
+ def GlobalDiscard(handle)
53
+ GlobalDiscard.call(handle)
54
+ end
55
+
56
+ def GlobalFlags(handle)
57
+ GlobalFlags.call(handle)
58
+ end
59
+
60
+ def GlobalFree(handle)
61
+ GlobalFree.call(handle)
62
+ end
63
+
64
+ def GlobalHandle(handle)
65
+ GlobalHandle.call(handle)
66
+ end
67
+
68
+ def GlobalLock(handle)
69
+ GlobalHandle.call(handle)
70
+ end
71
+
72
+ def GlobalMemoryStatus(buf)
73
+ GlobalMemoryStatus.call(buf)
74
+ end
75
+
76
+ def GlobalMemoryStatusEx(buf)
77
+ GlobalMemoryStatusEx.call(buf)
78
+ end
79
+
80
+ def GlobalReAlloc(handle, bytes, flags)
81
+ GlobalReAlloc.call(handle, bytes, flags)
82
+ end
83
+
84
+ def GlobalSize(handle)
85
+ GlobalSize.call(handle)
86
+ end
87
+
88
+ def GlobalUnlock(handle)
89
+ GlobalUnlock.call(handle)
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,48 @@
1
+ require 'Win32API'
2
+
3
+ module Windows
4
+ module MSVCRT
5
+ module Buffer
6
+ Memcpy = Win32API.new('msvcrt', 'memcpy', 'PLL', 'P')
7
+ Memccpy = Win32API.new('msvcrt', '_memccpy', 'PPIL', 'P')
8
+ Memchr = Win32API.new('msvcrt', 'memchr', 'PIL', 'P')
9
+ Memcmp = Win32API.new('msvcrt', 'memcmp', 'PPL', 'I')
10
+ Memicmp = Win32API.new('msvcrt', '_memicmp', 'PPL', 'I')
11
+ Memmove = Win32API.new('msvcrt', 'memmove', 'PPL', 'P')
12
+ Memset = Win32API.new('msvcrt', 'memset', 'PLL', 'L')
13
+ Swab = Win32API.new('msvcrt', '_swab', 'PPI', 'V')
14
+
15
+ def memcpy(dest, src, size)
16
+ Memcpy.call(dest, src, size)
17
+ end
18
+
19
+ def memccpy(dest, src, char, count)
20
+ Memccpy.call(dest, src, char, count)
21
+ end
22
+
23
+ def memchr(buf, char, count)
24
+ Memchr.call(buf, char, count)
25
+ end
26
+
27
+ def memcmp(buf1, buf2, count)
28
+ Memcmp.call(buf1, buf2, count)
29
+ end
30
+
31
+ def memicmp(buf1, buf2, count)
32
+ Memicmp.call(buf1, buf2, count)
33
+ end
34
+
35
+ def memmove(dest, src, count)
36
+ Memmove.call(dest, src, count)
37
+ end
38
+
39
+ def memset(dest, char, count)
40
+ Memset.call(dest, char, count)
41
+ end
42
+
43
+ def swab(src, dest, count)
44
+ Swab.call(src, dest, count)
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,18 @@
1
+ require 'Win32API'
2
+
3
+ module Windows
4
+ module MSVCRT
5
+ module File
6
+ Stat = Win32API.new('msvcrt', '_stat', 'PP', 'I')
7
+ Stat64 = Win32API.new('msvcrt', '_stat64', 'PP', 'I')
8
+
9
+ def stat(path, buffer)
10
+ Stat.call(path, buffer)
11
+ end
12
+
13
+ def stat64(path, buffer)
14
+ Stat64.call(path, buffer)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,372 @@
1
+ ######################################################################
2
+ # path.rb
3
+ #
4
+ # Defines the following functions:
5
+ #
6
+ # PathAddBackslash()
7
+ # PathAddExtension()
8
+ # PathAppend()
9
+ # PathBuildRoot()
10
+ # PathCanonicalize()
11
+ # PathCombine()
12
+ # PathCommonPrefix()
13
+ # PathCompactPath()
14
+ # PathCompactPathEx()
15
+ # PathCreateFromUrl()
16
+ # PathFileExists()
17
+ # PathFindExtension()
18
+ # PathFindFileName()
19
+ # PathFindNextComponent()
20
+ # PathFindOnPath()
21
+ # PathFindSuffixArray()
22
+ # PathGetArgs()
23
+ # PathGetCharType()
24
+ # PathGetDriveNumber()
25
+ # PathIsContentType()
26
+ # PathIsDirectory()
27
+ # PathIsDirectoryEmpty()
28
+ # PathIsFileSpec()
29
+ # PathIsHTMLFile() - BROKEN
30
+ # PathIsLFNFileSpec()
31
+ # PathIsNetworkPath()
32
+ # PathIsPrefix()
33
+ # PathIsRelative()
34
+ # PathIsRoot()
35
+ # PathIsSameRoot()
36
+ # PathIsSystemFolder()
37
+ # PathIsUNC()
38
+ # PathIsUNCServer()
39
+ # PathIsUNCServerShare()
40
+ # PathIsURL()
41
+ # PathMakePretty()
42
+ # PathMakeSystemFolder()
43
+ # PathMatchSpec()
44
+ # PathParseIconLocation()
45
+ # PathQuoteSpaces()
46
+ # PathRelativePathTo()
47
+ # PathRemoveArgs()
48
+ # PathRemoveBackslash()
49
+ # PathRemoveBlanks()
50
+ # PathRemoveExtension()
51
+ # PathRemoveFileSpec()
52
+ # PathRenameExtension()
53
+ # PathSearchAndQualify()
54
+ # PathSetDlgItemPath()
55
+ # PathSkipRoot()
56
+ # PathStripPath()
57
+ # PathStripToRoot()
58
+ # PathUndecorate()
59
+ # PathUnExpandEnvStrings()
60
+ # PathUnmakeSystemFolder()
61
+ # PathUnquoteSpaces()
62
+ #
63
+ # Defines the following constants:
64
+ #
65
+ # GCT_INVALID
66
+ # GCT_LFNCHAR
67
+ # GCT_SHORTCHAR
68
+ # GCT_WILD
69
+ # GCT_SEPARATOR
70
+ #
71
+ # Notes:
72
+ #
73
+ # The PathIsHTMLFile() function does not appear to be exported in the
74
+ # shlwapi.dll file that is currently (March, 2006) shipped with the
75
+ # free compiler libs from Microsoft.
76
+ ######################################################################
77
+ require 'Win32API'
78
+
79
+ module Windows
80
+ module Path
81
+ # These constants are for use by the PathGetCharType() function.
82
+ GCT_INVALID = 0x0000 # The character is not valid in a path.
83
+ GCT_LFNCHAR = 0x0001 # The character is valid in a long file name.
84
+ GCT_SHORTCHAR = 0x0002 # The character is valid in a short (8.3) file name.
85
+ GCT_WILD = 0x0004 # The character is a wildcard character.
86
+ GCT_SEPARATOR = 0x0008 # The character is a path separator.
87
+
88
+ PathAddBackslash = Win32API.new('shlwapi', 'PathAddBackslash', 'P', 'P')
89
+ PathAddExtension = Win32API.new('shlwapi', 'PathAddExtension', 'PP', 'I')
90
+ PathAppend = Win32API.new('shlwapi', 'PathAppend', 'PP', 'I')
91
+ PathBuildRoot = Win32API.new('shlwapi', 'PathBuildRoot', 'PI', 'P')
92
+ PathCanonicalize = Win32API.new('shlwapi', 'PathCanonicalize', 'PP', 'I')
93
+ PathCombine = Win32API.new('shlwapi', 'PathCombine', 'PPP', 'P')
94
+ PathCommonPrefix = Win32API.new('shlwapi', 'PathCommonPrefix', 'PPP', 'I')
95
+ PathCompactPath = Win32API.new('shlwapi', 'PathCompactPath', 'PPI', 'I')
96
+ PathCompactPathEx = Win32API.new('shlwapi', 'PathCompactPathEx', 'PPIL', 'I')
97
+ PathCreateFromUrl = Win32API.new('shlwapi', 'PathCreateFromUrl', 'PPPL', 'L')
98
+ PathFileExists = Win32API.new('shlwapi', 'PathFileExists', 'P', 'I')
99
+ PathFindExtension = Win32API.new('shlwapi', 'PathFindExtension', 'P', 'P')
100
+ PathFindFileName = Win32API.new('shlwapi', 'PathFindFileName', 'P', 'P')
101
+
102
+ PathFindNextComponent = Win32API.new('shlwapi', 'PathFindNextComponent', 'P', 'P')
103
+ PathFindOnPath = Win32API.new('shlwapi', 'PathFindOnPath', 'PP', 'I')
104
+ PathFindSuffixArray = Win32API.new('shlwapi', 'PathFindSuffixArray', 'PPI', 'P')
105
+ PathGetArgs = Win32API.new('shlwapi', 'PathGetArgs', 'P', 'P')
106
+ PathGetCharType = Win32API.new('shlwapi', 'PathGetCharType', 'P', 'I')
107
+ PathGetDriveNumber = Win32API.new('shlwapi', 'PathGetDriveNumber', 'P', 'I')
108
+ PathIsContentType = Win32API.new('shlwapi', 'PathIsContentType', 'PP', 'I')
109
+ PathIsDirectory = Win32API.new('shlwapi', 'PathIsDirectory', 'P', 'I')
110
+ PathIsDirectoryEmpty = Win32API.new('shlwapi', 'PathIsDirectoryEmpty', 'P', 'I')
111
+ PathIsFileSpec = Win32API.new('shlwapi', 'PathIsFileSpec', 'P', 'I')
112
+ #PathIsHTMLFile = Win32API.new('shlwapi', 'PathIsHTMLFile', 'P', 'I')
113
+ PathIsLFNFileSpec = Win32API.new('shlwapi', 'PathIsLFNFileSpec', 'P', 'I')
114
+ PathIsNetworkPath = Win32API.new('shlwapi', 'PathIsNetworkPath', 'P', 'I')
115
+ PathIsPrefix = Win32API.new('shlwapi', 'PathIsPrefix', 'PP', 'I')
116
+ PathIsRelative = Win32API.new('shlwapi', 'PathIsRelative', 'P', 'I')
117
+ PathIsRoot = Win32API.new('shlwapi', 'PathIsRoot', 'P', 'I')
118
+ PathIsSameRoot = Win32API.new('shlwapi', 'PathIsSameRoot', 'PP', 'I')
119
+ PathIsSystemFolder = Win32API.new('shlwapi', 'PathIsSystemFolder', 'PL', 'I')
120
+ PathIsUNC = Win32API.new('shlwapi', 'PathIsUNC', 'P', 'I')
121
+ PathIsUNCServer = Win32API.new('shlwapi', 'PathIsUNCServer', 'P', 'I')
122
+ PathIsUNCServerShare = Win32API.new('shlwapi', 'PathIsUNCServerShare','P','I')
123
+ PathIsURL = Win32API.new('shlwapi', 'PathIsURL', 'P', 'I')
124
+ PathMakePretty = Win32API.new('shlwapi', 'PathMakePretty', 'P', 'I')
125
+ PathMakeSystemFolder = Win32API.new('shlwapi', 'PathMakeSystemFolder', 'P', 'I')
126
+ PathMatchSpec = Win32API.new('shlwapi', 'PathMatchSpec', 'PP', 'I')
127
+ PathParseIconLocation = Win32API.new('shlwapi', 'PathParseIconLocation', 'P', 'I')
128
+ PathQuoteSpaces = Win32API.new('shlwapi', 'PathQuoteSpaces', 'P', 'V')
129
+ PathRelativePathTo = Win32API.new('shlwapi', 'PathRelativePathTo', 'PPLPL', 'I')
130
+ PathRemoveArgs = Win32API.new('shlwapi', 'PathRemoveArgs', 'P', 'V')
131
+ PathRemoveBackslash = Win32API.new('shlwapi', 'PathRemoveBackslash', 'P', 'P')
132
+ PathRemoveBlanks = Win32API.new('shlwapi', 'PathRemoveBlanks', 'P', 'V')
133
+ PathRemoveExtension = Win32API.new('shlwapi', 'PathRemoveExtension', 'P','V')
134
+ PathRemoveFileSpec = Win32API.new('shlwapi', 'PathRemoveFileSpec', 'P', 'L')
135
+ PathRenameExtension = Win32API.new('shlwapi', 'PathRenameExtension', 'PP','I')
136
+ PathSearchAndQualify = Win32API.new('shlwapi', 'PathSearchAndQualify', 'PPI', 'I')
137
+ PathSetDlgItemPath = Win32API.new('shlwapi', 'PathSetDlgItemPath', 'LIP', 'V')
138
+ PathSkipRoot = Win32API.new('shlwapi', 'PathSkipRoot', 'P', 'P')
139
+ PathStripPath = Win32API.new('shlwapi', 'PathStripPath', 'P', 'V')
140
+ PathStripToRoot = Win32API.new('shlwapi', 'PathStripToRoot', 'P', 'I')
141
+ PathUndecorate = Win32API.new('shlwapi', 'PathUndecorate', 'P', 'V')
142
+ PathUnExpandEnvStrings = Win32API.new('shlwapi', 'PathUnExpandEnvStrings', 'PPI', 'I')
143
+ PathUnmakeSystemFolder = Win32API.new('shlwapi', 'PathUnmakeSystemFolder', 'P', 'I')
144
+ PathUnquoteSpaces = Win32API.new('shlwapi', 'PathUnquoteSpaces', 'P', 'V')
145
+
146
+ def PathAddBackslash(path)
147
+ PathAddBackslash.call(path)
148
+ end
149
+
150
+ def PathAddExtension(path, ext)
151
+ PathAddExtension.call(path, ext) > 0
152
+ end
153
+
154
+ def PathAppend(path, more)
155
+ PathAppend.call(path, more) > 0
156
+ end
157
+
158
+ def PathBuildRoot(root, drive)
159
+ PathBuildRoot.call(root, drive)
160
+ end
161
+
162
+ def PathCanonicalize(dst, src)
163
+ PathCanonicalize.call(dst, src)
164
+ end
165
+
166
+ def PathCombine(dest, dir, file)
167
+ PathCombine.call(dest, dir, file)
168
+ end
169
+
170
+ def PathCommonPrefix(path1, path2, buf)
171
+ PathCommonPrefix.call(path1, path2, buf)
172
+ end
173
+
174
+ def PathCompactPath(handle, path, px_width)
175
+ PathCompactPath.call(handle, path, px_width) > 0
176
+ end
177
+
178
+ def PathCompactPathEx(out, src, max, flags = nil)
179
+ PathCompactPathEx.call(out, src, max, flags) > 0
180
+ end
181
+
182
+ def PathCreateFromUrl(url, path, path_size, reserved = nil)
183
+ PathCreateFromUrl.call(url, path, path_size, reserved) >= 0
184
+ end
185
+
186
+ def PathFileExists(path)
187
+ PathFileExists.call(path) > 0
188
+ end
189
+
190
+ def PathFindExtension(path)
191
+ PathFindExtension.call(path)
192
+ end
193
+
194
+ def PathFindFileName(path)
195
+ PathFindFileName.call(path)
196
+ end
197
+
198
+ def PathFindNextComponent(path)
199
+ PathFindNextComponent.call(path)
200
+ end
201
+
202
+ def PathFindOnPath(file, dirs)
203
+ PathFindOnPath.call(file, dirs)
204
+ end
205
+
206
+ def PathFindSuffixArray(path, suffix_array, suffix_size)
207
+ PathFindSuffixArray.call(path, suffix_array, suffix_size)
208
+ end
209
+
210
+ def PathGetArgs(path)
211
+ PathGetArgs.call(path)
212
+ end
213
+
214
+ def PathGetCharType(char)
215
+ PathGetCharType.call(char)
216
+ end
217
+
218
+ def PathGetDriveNumber(path)
219
+ PathGetDriveNumber.call(path)
220
+ end
221
+
222
+ def PathIsContentType(path, content_type)
223
+ PathIsContentType.call(path, content_type) > 0
224
+ end
225
+
226
+ def PathIsDirectory(path)
227
+ PathIsDirectory.call(path) > 0
228
+ end
229
+
230
+ def PathIsDirectoryEmpty(path)
231
+ PathIsDirectoryEmpty.call(path) > 0
232
+ end
233
+
234
+ def PathIsFileSpec(path)
235
+ PathIsFileSpec.call(path) > 0
236
+ end
237
+
238
+ # This appears to be broken with the current MSVC distro. Use
239
+ # PathIsContentType instead.
240
+ #def PathIsHTMLFile(path)
241
+ # PathIsHTMLFile.call(path)
242
+ #end
243
+
244
+ def PathIsLFNFileSpec(path)
245
+ PathIsLFNFileSpec.call(path) > 0
246
+ end
247
+
248
+ def PathIsNetworkPath(path)
249
+ PathIsNetworkPath.call(path) > 0
250
+ end
251
+
252
+ def PathIsPrefix(prefix, path)
253
+ PathIsPrefix.call(prefix, path) > 0
254
+ end
255
+
256
+ def PathIsRelative(path)
257
+ PathIsRelative.call(path) > 0
258
+ end
259
+
260
+ def PathIsRoot(path)
261
+ PathIsRoot.call(path) > 0
262
+ end
263
+
264
+ def PathIsSameRoot(path1, path2)
265
+ PathIsSameRoot.call(path1, path2) > 0
266
+ end
267
+
268
+ def PathIsSystemFolder(path)
269
+ PathIsSystemFolder.call(path) > 0
270
+ end
271
+
272
+ def PathIsUNC(path)
273
+ PathIsUNC.call(path) > 0
274
+ end
275
+
276
+ def PathIsUNCServer(path)
277
+ PathIsUNCServer.call(path) > 0
278
+ end
279
+
280
+ def PathIsUNCServerShare(path)
281
+ PathIsUNCServerShare.call(path) > 0
282
+ end
283
+
284
+ def PathIsURL(path)
285
+ PathIsURL.call(path) > 0
286
+ end
287
+
288
+ def PathMakePretty(path)
289
+ PathMakePretty.call(path) > 0
290
+ end
291
+
292
+ def PathMakeSystemFolder(path)
293
+ PathMakeSystemFolder.call(path) > 0
294
+ end
295
+
296
+ def PathMatchSpec(path, spec)
297
+ PathMatchSpec.call(path, spec) > 0
298
+ end
299
+
300
+ def PathParseIconLocation(path)
301
+ PathParseIconLocation.call(path)
302
+ end
303
+
304
+ def PathQuoteSpaces(path)
305
+ PathQuoteSpaces.call(path)
306
+ end
307
+
308
+ def PathRelativePathTo(path, from, from_attr, to, to_attr)
309
+ PathRelativePathTo.call(path, from, from_attr, to, to_attr) > 0
310
+ end
311
+
312
+ def PathRemoveArgs(path)
313
+ PathRemoveArgs.call(path)
314
+ end
315
+
316
+ def PathRemoveBackslash(path)
317
+ PathRemoveBackslash.call(path)
318
+ end
319
+
320
+ def PathRemoveBlanks(path)
321
+ PathRemoveBlanks.call(path)
322
+ end
323
+
324
+ def PathRemoveExtension(path)
325
+ PathRemoveExtension.call(path)
326
+ end
327
+
328
+ def PathRemoveFileSpec(path)
329
+ PathRemoveFileSpec.call(path) > 0
330
+ end
331
+
332
+ def PathRenameExtension(path, ext)
333
+ PathRenameExtension.call(path, ext) > 0
334
+ end
335
+
336
+ def PathSearchAndQualify(path, full_path, full_path_size)
337
+ PathSearchAndQualify.call(path, full_path, full_path_size) > 0
338
+ end
339
+
340
+ def PathSetDlgItemPath(handle, id, path)
341
+ PathSetDlgItemPath.call(handle, id, path)
342
+ end
343
+
344
+ def PathSkipRoot(path)
345
+ PathSkipRoot.call(path)
346
+ end
347
+
348
+ def PathStripPath(path)
349
+ PathStripPath.call(path)
350
+ end
351
+
352
+ def PathStripToRoot(path)
353
+ PathStripToRoot.call(path) > 0
354
+ end
355
+
356
+ def PathUndecorate(path)
357
+ PathUndecorate.call(path)
358
+ end
359
+
360
+ def PathUnExpandEnvStrings(path, buf, buf_size)
361
+ PathUnExpandEnvStrings.call(path, buf, buf_size) > 0
362
+ end
363
+
364
+ def PathUnmakeSystemFolder(path)
365
+ PathUnmakeSystemFolder.call(path) > 0
366
+ end
367
+
368
+ def PathUnquoteSpaces(path)
369
+ PathUnquoteSpaces.call(path)
370
+ end
371
+ end
372
+ end
@@ -0,0 +1,89 @@
1
+ require 'Win32API'
2
+
3
+ module Windows
4
+ module Security
5
+ ACL_REVISION = 2
6
+ ACL_REVISION2 = 2
7
+ ACL_REVISION3 = 3
8
+ ACL_REVISION4 = 4
9
+ ALLOW_ACE_LENGTH = 62
10
+ DACL_SECURITY_INFORMATION = 4
11
+ SE_DACL_PRESENT = 4
12
+ SECURITY_DESCRIPTOR_MIN_LENGTH = 20
13
+ SECURITY_DESCRIPTOR_REVISION = 1
14
+
15
+ GENERIC_RIGHTS_MASK = 4026597376
16
+ GENERIC_RIGHTS_CHK = 4026531840
17
+ REST_RIGHTS_MASK = 2097151
18
+
19
+ AddAce = Win32API.new('advapi32', 'AddAce', 'PLLLL', 'I')
20
+ CopySid = Win32API.new('advapi32', 'CopySid', 'LLP', 'I')
21
+ GetAce = Win32API.new('advapi32', 'GetAce', 'LLP', 'I')
22
+ GetFileSecurity = Win32API.new('advapi32', 'GetFileSecurity', 'PLPLP', 'I')
23
+ GetLengthSid = Win32API.new('advapi32', 'GetLengthSid', 'P', 'L')
24
+
25
+ GetSecurityDescriptorControl = Win32API.new('advapi32', 'GetSecurityDescriptorControl', 'PPP', 'I')
26
+ GetSecurityDescriptorDacl = Win32API.new('advapi32', 'GetSecurityDescriptorDacl', 'PPPP', 'I')
27
+
28
+ InitializeAcl = Win32API.new('advapi32', 'InitializeAcl', 'PLL', 'I')
29
+ InitializeSecurityDescriptor = Win32API.new('advapi32', 'InitializeSecurityDescriptor', 'PL', 'I')
30
+
31
+ LookupAccountName = Win32API.new('advapi32', 'LookupAccountName', 'PPPPPPP', 'I')
32
+ LookupAccountSid = Win32API.new('advapi32', 'LookupAccountSid', 'PLPPPPP', 'I')
33
+
34
+ SetFileSecurity = Win32API.new('advapi32', 'SetFileSecurity', 'PPP', 'I')
35
+ SetSecurityDescriptorDacl = Win32API.new('advapi32', 'SetSecurityDescriptorDacl', 'PIPI', 'I')
36
+
37
+ def AddAce(acl, rev, index, list, length)
38
+ AddAce.call(acl, rev, index, list, length) != 0
39
+ end
40
+
41
+ def CopySid(sid_length, sid_buf, sid_source)
42
+ CopySid.call(sid_length, sid_buf, sid_source) != 0
43
+ end
44
+
45
+ def GetAce(acl, index, ace)
46
+ GetAce.call(acl, index, ace) != 0
47
+ end
48
+
49
+ def GetFileSecurity(file, info, descriptor, length, nlength)
50
+ GetFileSecurity.call(file, info, descriptor, length, nlength) != 0
51
+ end
52
+
53
+ def GetLengthSid(sid)
54
+ GetLengthSid.call(sid)
55
+ end
56
+
57
+ def GetSecurityDescriptorControl(descriptor, control, revision)
58
+ GetSecurityDescriptorControl.call(descriptor, control, revision) != 0
59
+ end
60
+
61
+ def GetSecurityDescriptorDacl(descriptor, dacl_present, dacl, default)
62
+ GetSecurityDescriptorDacl.call(descriptor, dacl_present, dacl, default) != 0
63
+ end
64
+
65
+ def InitializeAcl(acl, length, revision = ACL_REVISION)
66
+ InitializeAcl.call(acl, length, revision) != 0
67
+ end
68
+
69
+ def InitializeSecurityDescriptor(descriptor, revision = SECURITY_DESCRIPTOR_REVISION)
70
+ InitializeSecurityDescriptor.call(descriptor, revision) != 0
71
+ end
72
+
73
+ def LookupAccountName(sys, name, sid, sid_size, domain, domain_size, use)
74
+ LookupAccountName.call(sys, name, sid, sid_size, domain, domain_size, use) != 0
75
+ end
76
+
77
+ def LookupAccountSid(sys, sid, name, name_size, domain, domain_size, use)
78
+ LookupAccountSid.call(sys, sid, name, name_size, domain, domain_size, use) != 0
79
+ end
80
+
81
+ def SetFileSecurity(file, info, descriptor)
82
+ SetFileSecurity.call(file, info, descriptor) != 0
83
+ end
84
+
85
+ def SetSecurityDescriptorDacl(descriptor, present, dacl, default)
86
+ SetSecurityDescriptorDacl.call(descriptor, present, dacl, default) != 0
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,52 @@
1
+ ##############################################################################
2
+ # sound.rb
3
+ #
4
+ # Includes the following functions:
5
+ #
6
+ # Beep()
7
+ # PlaySound()
8
+ # WaveOutSetVolume()
9
+ # WaveOutGetVolume()
10
+ #
11
+ # Defines the following constants:
12
+ #
13
+ # SND_APPLICATION
14
+ # SND_ALIAS
15
+ # SND_ALIAS_ID
16
+ # SND_ASYNC
17
+ # SND_FILENAME
18
+ # SND_LOOP
19
+ # SND_MEMORY
20
+ # SND_NODEFAULT
21
+ # SND_NOSTOP
22
+ # SND_NOWAIT
23
+ # SND_PURGE
24
+ # SND_RESOURCE
25
+ # SND_SYNC
26
+ ##############################################################################
27
+ require 'Win32API'
28
+
29
+ module Windows
30
+ module Sound
31
+ SND_SYNC = 0x0000 # play synchronously (default)
32
+ SND_ASYNC = 0x0001 # play asynchronously
33
+ SND_NODEFAULT = 0x0002 # silence (!default) if sound not found
34
+ SND_MEMORY = 0x0004 # pszSound points to a memory file
35
+ SND_LOOP = 0x0008 # loop the sound until next sndPlaySound
36
+ SND_NOSTOP = 0x0010 # don't stop any currently playing sound
37
+
38
+ SND_NOWAIT = 8192 # don't wait if the driver is busy
39
+ SND_ALIAS = 65536 # name is a registry alias
40
+ SND_ALIAS_ID = 1114112 # alias is a predefined ID
41
+ SND_FILENAME = 131072 # name is file name
42
+ SND_RESOURCE = 262148 # name is resource name or atom
43
+
44
+ SND_PURGE = 0x0040 # purge non-static events for task
45
+ SND_APPLICATION = 0x0080 # look for application specific association
46
+
47
+ Beep = Win32API.new('kernel32', 'Beep', 'LL', 'I')
48
+ PlaySound = Win32API.new('winmm', 'PlaySound', 'PPL', 'I')
49
+ WaveOutSetVolume = Win32API.new('winmm', 'waveOutSetVolume', 'PL', 'I')
50
+ WaveOutGetVolume = Win32API.new('winmm', 'waveOutGetVolume', 'IP', 'I')
51
+ end
52
+ end