windows-pr 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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,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
@@ -0,0 +1,61 @@
1
+ #######################################################################
2
+ # synchronize.rb
3
+ #
4
+ # Defines the following functions:
5
+ #
6
+ # CreateEvent()
7
+ # CreateMutex()
8
+ # CreateSemaphore()
9
+ # MsgWaitForMultipleObjects()
10
+ # MsgWaitForMultipleObjectsEx()
11
+ # OpenEvent()
12
+ # OpenMutex()
13
+ # OpenSemaphore()
14
+ # WaitForDebugEvent()
15
+ # WaitForSingleObject()
16
+ # WaitForSingleObjectEx()
17
+ # WaitForMultipleObjects()
18
+ # WaitForMultipleObjectsEx()
19
+ # WaitForInputIdle()
20
+ #
21
+ # Defines the the following constants:
22
+ #
23
+ # WAIT_ABANDONED
24
+ # WAIT_OBJECT_0
25
+ # WAIT_TIMEOUT
26
+ # WAIT_FAILED
27
+ # INFINITE
28
+ #
29
+ # TODO:
30
+ #
31
+ # Add the rest of the synchronization functions.
32
+ #######################################################################
33
+ require "Win32API"
34
+
35
+ module Windows
36
+ module Synchronize
37
+ INFINITE = 0xFFFFFFFF
38
+ WAIT_OBJECT_0 = 0
39
+ WAIT_TIMEOUT = 0x102
40
+ WAIT_ABANDONED = 128
41
+ WAIT_FAILED = 0xFFFFFFFF
42
+
43
+ CreateEvent = Win32API.new('kernel32', 'CreateEvent', 'PIIP', 'L')
44
+ CreateMutex = Win32API.new('kernel32', 'CreateMutex', 'PIP', 'L')
45
+ CreateSemaphore = Win32API.new('kernel32', 'CreateSemaphore', 'PLLP', 'L')
46
+
47
+ MsgWaitForMultipleObjects = Win32API.new('user32', 'MsgWaitForMultipleObjects', 'LPILL', 'L')
48
+ MsgWaitForMultipleObjectsEx = Win32API.new('user32', 'MsgWaitForMultipleObjectsEx', 'LPLLL', 'L')
49
+
50
+ OpenEvent = Win32API.new('kernel32', 'OpenEvent', 'LIP', 'L')
51
+ OpenMutex = Win32API.new('kernel32', 'OpenMutex', 'LIP', 'L')
52
+ OpenSemaphore = Win32API.new('kernel32', 'OpenSemaphore', 'LIP', 'L')
53
+
54
+ WaitForDebugEvent = Win32API.new('kernel32', 'WaitForDebugEvent', 'PL', 'I')
55
+ WaitForMultipleObjects = Win32API.new('kernel32', 'WaitForMultipleObjects', 'LPIL', 'L')
56
+ WaitForMultipleObjectsEx = Win32API.new('kernel32', 'WaitForMultipleObjectsEx', 'LPILI', 'L')
57
+ WaitForSingleObject = Win32API.new('kernel32', 'WaitForSingleObject', 'LL', 'L')
58
+ WaitForSingleObjectEx = Win32API.new('kernel32', 'WaitForSingleObjectEx', 'LLI', 'L')
59
+ WaitForInputIdle = Win32API.new('user32', 'WaitForInputIdle', 'LL', 'L')
60
+ end
61
+ end