windows-pr 0.2.0 → 0.5.3

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,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,183 @@
1
+ require 'Win32API'
2
+
3
+ module Windows
4
+ module Service
5
+ # SCM access rights
6
+ SC_MANAGER_ALL_ACCESS = 0xF003F
7
+ SC_MANAGER_CREATE_SERVICE = 0x0002
8
+ SC_MANAGER_CONNECT = 0x0001
9
+ SC_MANAGER_ENUMERATE_SERVICE = 0x0004
10
+ SC_MANAGER_LOCK = 0x0008
11
+ SC_MANAGER_MODIFY_BOOT_CONFIG = 0x0020
12
+ SC_MANAGER_QUERY_LOCK_STATUS = 0x0010
13
+ SC_STATUS_PROCESS_INFO = 0
14
+ SC_ENUM_PROCESS_INFO = 0
15
+
16
+ # Service control action types
17
+ SC_ACTION_NONE = 0
18
+ SC_ACTION_REBOOT = 1
19
+ SC_ACTION_RESTART = 2
20
+ SC_ACTION_RUN_COMMAND = 3
21
+
22
+ # Service access rights
23
+ SERVICE_ALL_ACCESS = 0xF01FF
24
+ SERVICE_CHANGE_CONFIG = 0x0002
25
+ SERVICE_ENUMERATE_DEPENDENTS = 0x0008
26
+ SERVICE_INTERROGATE = 0x0080
27
+ SERVICE_PAUSE_CONTINUE = 0x0040
28
+ SERVICE_QUERY_CONFIG = 0x0001
29
+ SERVICE_QUERY_STATUS = 0x0004
30
+ SERVICE_START = 0x0010
31
+ SERVICE_STOP = 0x0020
32
+ SERVICE_USER_DEFINED_CONTROL = 0x0100
33
+
34
+ # Service types
35
+ SERVICE_KERNEL_DRIVER = 0x00000001
36
+ SERVICE_FILE_SYSTEM_DRIVER = 0x00000002
37
+ SERVICE_ADAPTER = 0x00000004
38
+ SERVICE_RECOGNIZER_DRIVER = 0x00000008
39
+ SERVICE_WIN32_OWN_PROCESS = 0x00000010
40
+ SERVICE_WIN32_SHARE_PROCESS = 0x00000020
41
+ SERVICE_WIN32 = 0x00000030
42
+ SERVICE_INTERACTIVE_PROCESS = 0x00000100
43
+ SERVICE_DRIVER = 0x0000000B
44
+ SERVICE_TYPE_ALL = 0x0000013F
45
+
46
+ # Error control
47
+ SERVICE_ERROR_IGNORE = 0x00000000
48
+ SERVICE_ERROR_NORMAL = 0x00000001
49
+ SERVICE_ERROR_SEVERE = 0x00000002
50
+ SERVICE_ERROR_CRITICAL = 0x00000003
51
+
52
+ # Start types
53
+ SERVICE_BOOT_START = 0x00000000
54
+ SERVICE_SYSTEM_START = 0x00000001
55
+ SERVICE_AUTO_START = 0x00000002
56
+ SERVICE_DEMAND_START = 0x00000003
57
+ SERVICE_DISABLED = 0x00000004
58
+
59
+ # Service control
60
+ SERVICE_CONTROL_STOP = 0x00000001
61
+ SERVICE_CONTROL_PAUSE = 0x00000002
62
+ SERVICE_CONTROL_CONTINUE = 0x00000003
63
+ SERVICE_CONTROL_INTERROGATE = 0x00000004
64
+ SERVICE_CONTROL_PARAMCHANGE = 0x00000006
65
+ SERVICE_CONTROL_NETBINDADD = 0x00000007
66
+ SERVICE_CONTROL_NETBINDREMOVE = 0x00000008
67
+ SERVICE_CONTROL_NETBINDENABLE = 0x00000009
68
+ SERVICE_CONTROL_NETBINDDISABLE = 0x0000000A
69
+
70
+ # Service controls accepted
71
+ SERVICE_ACCEPT_STOP = 0x00000001
72
+ SERVICE_ACCEPT_PAUSE_CONTINUE = 0x00000002
73
+ SERVICE_ACCEPT_SHUTDOWN = 0x00000004
74
+ SERVICE_ACCEPT_PARAMCHANGE = 0x00000008
75
+ SERVICE_ACCEPT_NETBINDCHANGE = 0x00000010
76
+ SERVICE_ACCEPT_HARDWAREPROFILECHANGE = 0x00000020
77
+ SERVICE_ACCEPT_POWEREVENT = 0x00000040
78
+ SERVICE_ACCEPT_SESSIONCHANGE = 0x00000080
79
+
80
+ # Service states
81
+ SERVICE_ACTIVE = 0x00000001
82
+ SERVICE_INACTIVE = 0x00000002
83
+ SERVICE_STATE_ALL = 0x00000003
84
+
85
+ # Service current states
86
+ SERVICE_STOPPED = 0x00000001
87
+ SERVICE_START_PENDING = 0x00000002
88
+ SERVICE_STOP_PENDING = 0x00000003
89
+ SERVICE_RUNNING = 0x00000004
90
+ SERVICE_CONTINUE_PENDING = 0x00000005
91
+ SERVICE_PAUSE_PENDING = 0x00000006
92
+ SERVICE_PAUSED = 0x00000007
93
+
94
+ # Info levels
95
+ SERVICE_CONFIG_DESCRIPTION = 1
96
+ SERVICE_CONFIG_FAILURE_ACTIONS = 2
97
+ SERVICE_CONFIG_DELAYED_AUTO_START_INFO = 3
98
+ SERVICE_CONFIG_FAILURE_ACTIONS_FLAG = 4
99
+ SERVICE_CONFIG_SERVICE_SID_INFO = 5
100
+ SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO = 6
101
+ SERVICE_CONFIG_PRESHUTDOWN_INFO = 7
102
+
103
+ ChangeServiceConfig = Win32API.new('advapi32', 'ChangeServiceConfig', 'LLLLPPPPPPP', 'I')
104
+ ChangeServiceConfig2 = Win32API.new('advapi32', 'ChangeServiceConfig2', 'LLP', 'I')
105
+ CloseServiceHandle = Win32API.new('advapi32', 'CloseServiceHandle', 'L', 'I')
106
+ ControlService = Win32API.new('advapi32', 'ControlService', 'LLP', 'I')
107
+ CreateService = Win32API.new('advapi32', 'CreateService', 'LPPLLLLPPPPPP', 'L')
108
+ DeleteService = Win32API.new('advapi32', 'DeleteService', 'L', 'I')
109
+ EnumDependentServices = Win32API.new('advapi32', 'EnumDependentServices', 'LLPLPP', 'I')
110
+ EnumServicesStatus = Win32API.new('advapi32', 'EnumServicesStatus', 'LLLPLPPP', 'I')
111
+ EnumServicesStatusEx = Win32API.new('advapi32', 'EnumServicesStatusEx', 'LLLLPLPPPP', 'I')
112
+ GetServiceDisplayName = Win32API.new('advapi32', 'GetServiceDisplayName', 'LPPP', 'I')
113
+ GetServiceKeyName = Win32API.new('advapi32', 'GetServiceKeyName', 'LPPP', 'I')
114
+ LockServiceDatabase = Win32API.new('advapi32', 'LockServiceDatabase', 'L', 'L')
115
+ NotifyBootConfigStatus = Win32API.new('advapi32', 'NotifyBootConfigStatus', 'I', 'I')
116
+ OpenSCManager = Win32API.new('advapi32', 'OpenSCManager', 'PPL', 'L')
117
+ OpenService = Win32API.new('advapi32', 'OpenService', 'LPL', 'L')
118
+ QueryServiceConfig = Win32API.new('advapi32', 'QueryServiceConfig', 'LPLP', 'I')
119
+ QueryServiceConfig2 = Win32API.new('advapi32', 'QueryServiceConfig2', 'LLPLP', 'I')
120
+ QueryServiceLockStatus = Win32API.new('advapi32', 'QueryServiceLockStatus', 'LPLP', 'I')
121
+ QueryServiceStatus = Win32API.new('advapi32', 'QueryServiceStatus', 'LP', 'I')
122
+ QueryServiceStatusEx = Win32API.new('advapi32', 'QueryServiceStatusEx', 'LLPLP', 'I')
123
+ RegisterServiceCtrlHandler = Win32API.new('advapi32', 'RegisterServiceCtrlHandler', 'PP', 'L')
124
+ RegisterServiceCtrlHandlerEx = Win32API.new('advapi32', 'RegisterServiceCtrlHandlerEx', 'PPP', 'L')
125
+ SetServiceBits = Win32API.new('advapi32', 'SetServiceBits', 'LLII', 'I')
126
+ SetServiceStatus = Win32API.new('advapi32', 'SetServiceStatus', 'LP', 'I')
127
+ StartService = Win32API.new('advapi32', 'StartService', 'LLP', 'I')
128
+ StartServiceCtrlDispatcher = Win32API.new('advapi32', 'StartServiceCtrlDispatcher', 'P', 'I')
129
+ UnlockServiceDatabase = Win32API.new('advapi32', 'UnlockServiceDatabase', 'L', 'I')
130
+
131
+ def CloseServiceHandle(handle)
132
+ CloseServiceHandle.call(handle) != 0
133
+ end
134
+
135
+ def ControlService(service, control, status)
136
+ ControlService.call(service, control, status) != 0
137
+ end
138
+
139
+ def DeleteService(handle)
140
+ DeleteService.call(handle) != 0
141
+ end
142
+
143
+ def EnumServicesStatusEx(handle, info, s_type, s_state, services, size, bytes, s_returned, rhandle, grp)
144
+ EnumServicesStatusEx.call(handle, info, s_type, s_state, services, size, bytes, s_returned, rhandle, grp) != 0
145
+ end
146
+
147
+ def GetServiceDisplayName(handle, service, display, buf)
148
+ GetServiceDisplayName.call(handle, service, display, buf) != 0
149
+ end
150
+
151
+ def GetServiceKeyName(handle, display, service, buf)
152
+ GetServiceKeyName.call(handle, display, service, buf) != 0
153
+ end
154
+
155
+ def OpenSCManager(host, database, access)
156
+ OpenSCManager.call(host, database, access)
157
+ end
158
+
159
+ def OpenService(handle, service, access)
160
+ OpenService.call(handle, service, access)
161
+ end
162
+
163
+ def QueryServiceConfig(handle, buf, buf_size, bytes)
164
+ QueryServiceConfig.call(handle, buf, buf_size, bytes) != 0
165
+ end
166
+
167
+ def QueryServiceConfig2(handle, info, buf, buf_size, bytes)
168
+ QueryServiceConfig2.call(handle, info, buf, buf_size, bytes) != 0
169
+ end
170
+
171
+ def QueryServiceStatusEx(service, info, buf, size, bytes)
172
+ QueryServiceStatusEx.call(service, info, buf, size, bytes) != 0
173
+ end
174
+
175
+ def QueryStatusConfig2(service, info, buf, size, bytes)
176
+ QueryStatusConfig2.call(service, info, buf, size, bytes) != 0
177
+ end
178
+
179
+ def StartService(handle, num_vec, vec)
180
+ StartService.call(handle, num_vec, vec)
181
+ end
182
+ end
183
+ end
@@ -0,0 +1,88 @@
1
+ require 'Win32API'
2
+
3
+ module Windows
4
+ module Shell
5
+ # CSIDL constants
6
+ CSIDL_DESKTOP = 0x0000
7
+ CSIDL_INTERNET = 0x0001
8
+ CSIDL_PROGRAMS = 0x0002
9
+ CSIDL_CONTROLS = 0x0003
10
+ CSIDL_PRINTERS = 0x0004
11
+ CSIDL_PERSONAL = 0x0005
12
+ CSIDL_FAVORITES = 0x0006
13
+ CSIDL_STARTUP = 0x0007
14
+ CSIDL_RECENT = 0x0008
15
+ CSIDL_SENDTO = 0x0009
16
+ CSIDL_BITBUCKET = 0x000a
17
+ CSIDL_STARTMENU = 0x000b
18
+ CSIDL_MYDOCUMENTS = 0x000c
19
+ CSIDL_MYMUSIC = 0x000d
20
+ CSIDL_MYVIDEO = 0x000e
21
+ CSIDL_DESKTOPDIRECTORY = 0x0010
22
+ CSIDL_DRIVES = 0x0011
23
+ CSIDL_NETWORK = 0x0012
24
+ CSIDL_NETHOOD = 0x0013
25
+ CSIDL_FONTS = 0x0014
26
+ CSIDL_TEMPLATES = 0x0015
27
+ CSIDL_COMMON_STARTMENU = 0x0016
28
+ CSIDL_COMMON_PROGRAMS = 0X0017
29
+ CSIDL_COMMON_STARTUP = 0x0018
30
+ CSIDL_COMMON_FAVORITES = 0x001f
31
+ CSIDL_COMMON_DESKTOPDIRECTORY = 0x0019
32
+ CSIDL_APPDATA = 0x001a
33
+ CSIDL_PRINTHOOD = 0x001b
34
+ CSIDL_LOCAL_APPDATA = 0x001c
35
+ CSIDL_ALTSTARTUP = 0x001d
36
+ CSIDL_COMMON_ALTSTARTUP = 0x001e
37
+ CSIDL_INTERNET_CACHE = 0x0020
38
+ CSIDL_COOKIES = 0x0021
39
+ CSIDL_HISTORY = 0x0022
40
+ CSIDL_COMMON_APPDATA = 0x0023
41
+ CSIDL_WINDOWS = 0x0024
42
+ CSIDL_SYSTEM = 0x0025
43
+ CSIDL_PROGRAM_FILES = 0x0026
44
+ CSIDL_MYPICTURES = 0x0027
45
+ CSIDL_PROFILE = 0x0028
46
+ CSIDL_SYSTEMX86 = 0x0029
47
+ CSIDL_PROGRAM_FILESX86 = 0x002a
48
+ CSIDL_PROGRAM_FILES_COMMON = 0x002b
49
+ CSIDL_PROGRAM_FILES_COMMONX86 = 0x002c
50
+ CSIDL_COMMON_TEMPLATES = 0x002d
51
+ CSIDL_COMMON_DOCUMENTS = 0x002e
52
+ CSIDL_CONNECTIONS = 0x0031
53
+ CSIDL_COMMON_MUSIC = 0x0035
54
+ CSIDL_COMMON_PICTURES = 0x0036
55
+ CSIDL_COMMON_VIDEO = 0x0037
56
+ CSIDL_RESOURCES = 0x0038
57
+ CSIDL_RESOURCES_LOCALIZED = 0x0039
58
+ CSIDL_COMMON_OEM_LINKS = 0x003a
59
+ CSIDL_CDBURN_AREA = 0x003b
60
+ CSIDL_COMMON_ADMINTOOLS = 0x002f
61
+ CSIDL_ADMINTOOLS = 0x0030
62
+
63
+ # Return codes
64
+ S_FALSE = 1
65
+ E_FAIL = 2147500037
66
+ E_INVALIDARG = 2147483651
67
+
68
+ # Flags
69
+ SHGFP_TYPE_CURRENT = 0
70
+ SHGFP_TYPE_DEFAULT = 1
71
+
72
+ SHGetFolderPath = Win32API.new('shell32', 'SHGetFolderPath', 'LLLLP', 'L')
73
+ SHGetSpecialFolderLocation = Win32API.new('shell32', 'SHGetSpecialFolderLocation', 'LIP', 'L')
74
+ SHGetSpecialFolderPath = Win32API.new('shell32', 'SHGetSpecialFolderPath', 'LPLL','L')
75
+
76
+ def SHGetFolderPath(handle, folder, token, flags, path)
77
+ SHGetFolderPath.call(handle, folder, token, flags, path)
78
+ end
79
+
80
+ def SHGetSpecialFolderLocation(handle, folder, pidl)
81
+ SHGetSpecialFolderLocation.call(handle, folder, pidl)
82
+ end
83
+
84
+ def SHGetSpecialFolderPath(handle, path, folder, create)
85
+ SHGetSpecialFolderPath.call(handle, path, folder, create)
86
+ end
87
+ end
88
+ end
@@ -16,7 +16,6 @@
16
16
  # WaitForSingleObjectEx()
17
17
  # WaitForMultipleObjects()
18
18
  # WaitForMultipleObjectsEx()
19
- # WaitForInputIdle()
20
19
  #
21
20
  # Defines the the following constants:
22
21
  #
@@ -30,7 +29,7 @@
30
29
  #
31
30
  # Add the rest of the synchronization functions.
32
31
  #######################################################################
33
- require "Win32API"
32
+ require 'Win32API'
34
33
 
35
34
  module Windows
36
35
  module Synchronize
@@ -39,23 +38,124 @@ module Windows
39
38
  WAIT_TIMEOUT = 0x102
40
39
  WAIT_ABANDONED = 128
41
40
  WAIT_FAILED = 0xFFFFFFFF
41
+
42
+ # Wake mask constants
43
+ QS_ALLEVENTS = 0x04BF
44
+ QS_ALLINPUT = 0x04FF
45
+ QS_ALLPOSTMESSAGE = 0x0100
46
+ QS_HOTKEY = 0x0080
47
+ QS_INPUT = 0x407
48
+ QS_KEY = 0x0001
49
+ QS_MOUSE = 0x0006
50
+ QS_MOUSEBUTTON = 0x0004
51
+ QS_MOUSEMOVE = 0x0002
52
+ QS_PAINT = 0x0020
53
+ QS_POSTMESSAGE = 0x0008
54
+ QS_RAWINPUT = 0x0400
55
+ QS_SENDMESSAGE = 0x0040
56
+ QS_TIMER = 0x0010
57
+
58
+ # Wait type constants
59
+ MWMO_ALERTABLE = 0x0002
60
+ MWMO_INPUTAVAILABLE = 0x0004
61
+ MWMO_WAITALL = 0x0001
62
+
63
+ # Access rights
64
+ EVENT_ALL_ACCESS = 0x1F0003
65
+ EVENT_MODIFY_STATE = 0x0002
66
+ MUTEX_ALL_ACCESS = 0x1F0001
67
+ MUTEX_MODIFY_STATE = 0x0001
68
+ SEMAPHORE_ALL_ACCESS = 0x1F0003
69
+ SEMAPHORE_MODIFY_STATE = 0x0002
42
70
 
43
71
  CreateEvent = Win32API.new('kernel32', 'CreateEvent', 'PIIP', 'L')
44
72
  CreateMutex = Win32API.new('kernel32', 'CreateMutex', 'PIP', 'L')
45
73
  CreateSemaphore = Win32API.new('kernel32', 'CreateSemaphore', 'PLLP', 'L')
74
+
75
+ GetOverlappedResult = Win32API.new('kernel32', 'GetOverlappedResult', 'LPPI', 'I')
46
76
 
47
77
  MsgWaitForMultipleObjects = Win32API.new('user32', 'MsgWaitForMultipleObjects', 'LPILL', 'L')
48
78
  MsgWaitForMultipleObjectsEx = Win32API.new('user32', 'MsgWaitForMultipleObjectsEx', 'LPLLL', 'L')
49
79
 
50
- OpenEvent = Win32API.new('kernel32', 'OpenEvent', 'LIP', 'L')
51
- OpenMutex = Win32API.new('kernel32', 'OpenMutex', 'LIP', 'L')
52
- OpenSemaphore = Win32API.new('kernel32', 'OpenSemaphore', 'LIP', 'L')
80
+ OpenEvent = Win32API.new('kernel32', 'OpenEvent', 'LIP', 'L')
81
+ OpenMutex = Win32API.new('kernel32', 'OpenMutex', 'LIP', 'L')
82
+ OpenSemaphore = Win32API.new('kernel32', 'OpenSemaphore', 'LIP', 'L')
83
+ ReleaseMutex = Win32API.new('kernel32', 'ReleaseMutex', 'L', 'I')
84
+ ReleaseSemaphore = Win32API.new('kernel32', 'ReleaseSemaphore', 'LLP', 'I')
85
+ ResetEvent = Win32API.new('kernel32', 'ResetEvent', 'L', 'I')
86
+ SetEvent = Win32API.new('kernel32', 'SetEvent', 'L', 'I')
53
87
 
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')
88
+ WaitForMultipleObjects = Win32API.new('kernel32', 'WaitForMultipleObjects', 'LPIL', 'L')
89
+ WaitForMultipleObjectsEx = Win32API.new('kernel32', 'WaitForMultipleObjectsEx', 'LPILI', 'L')
90
+ WaitForSingleObject = Win32API.new('kernel32', 'WaitForSingleObject', 'LL', 'L')
91
+ WaitForSingleObjectEx = Win32API.new('kernel32', 'WaitForSingleObjectEx', 'LLI', 'L')
92
+
93
+ def CreateEvent(attributes, reset, state, name)
94
+ CreateEvent.call(attributes, reset, state, name)
95
+ end
96
+
97
+ def CreateMutex(attributes, owner, name)
98
+ CreateMutex.call(attributes, owner, name)
99
+ end
100
+
101
+ def CreateSemaphore(attributes, initial, max, name)
102
+ CreateSemaphore.call(attributes, initial, max, name)
103
+ end
104
+
105
+ def GetOverlappedResult(handle, overlapped, bytes_transferred, wait)
106
+ GetOverlappedResult.call(handle, overlapped, bytes_transferred, wait)
107
+ end
108
+
109
+ def MsgWaitForMultipleObjects(count, handles, wait, milli, mask)
110
+ MsgWaitForMultipleObjects.call(count, handles, wait, milli, mask)
111
+ end
112
+
113
+ def MsgWaitForMultipleObjectsEx(count, handles, milli, mask, flags)
114
+ MsgWaitForMultipleObjectsEx.call(count, handles, milli, mask, flags)
115
+ end
116
+
117
+ def OpenSemaphore(access, handle, name)
118
+ OpenSemaphore.call(access, handle, name)
119
+ end
120
+
121
+ def OpenMutex(access, handle, name)
122
+ OpenMutex.call(access, handle, name)
123
+ end
124
+
125
+ def OpenEvent(access, handle, name)
126
+ OpenEvent.call(access, handle, name)
127
+ end
128
+
129
+ def ReleaseMutex(handle)
130
+ ReleaseMutex.call(handle) != 0
131
+ end
132
+
133
+ def ReleaseSemaphore(handle, release_count, previous_count)
134
+ ReleaseSemaphore.call(handle, release_count, previous_count) != 0
135
+ end
136
+
137
+ def ResetEvent(handle)
138
+ ResetEvent.call(handle) != 0
139
+ end
140
+
141
+ def SetEvent(handle)
142
+ SetEvent.call(handle) != 0
143
+ end
144
+
145
+ def WaitForMultipleObjects(count, handles, wait_all, milliseconds)
146
+ WaitForMultipleObjects.call(count, handles, wait_all, milliseconds)
147
+ end
148
+
149
+ def WaitForMultipleObjectsEx(count, handles, wait_all, milliseconds, alertable)
150
+ WaitForMultipleObjectsEx.call(count, handles, wait_all, milliseconds, alertable)
151
+ end
152
+
153
+ def WaitForSingleObject(handle, milliseconds)
154
+ WaitForSingleObject.call(handle, milliseconds)
155
+ end
156
+
157
+ def WaitForSingleObjectEx(handle, milliseconds, alertable)
158
+ WaitForSingleObject.call(handle, milliseconds, alertable)
159
+ end
60
160
  end
61
161
  end