Module: Windows::Process

Defined in:
lib/windows/process.rb

Constant Summary collapse

PROCESS_ALL_ACCESS =
0x1F0FFF
PROCESS_CREATE_PROCESS =
0x0080
PROCESS_CREATE_THREAD =
0x0002
PROCESS_DUP_HANDLE =
0x0040
PROCESS_QUERY_INFORMATION =
0x0400
PROCESS_QUERY_LIMITED_INFORMATION =
0x1000
PROCESS_SET_QUOTA =
0x0100
PROCESS_SET_INFORMATION =
0x0200
PROCESS_SUSPEND_RESUME =
0x0800
PROCESS_TERMINATE =
0x0001
PROCESS_VM_OPERATION =
0x0008
PROCESS_VM_READ =
0x0010
PROCESS_VM_WRITE =
0x0020
SYNCHRONIZE =
1048576
STILL_ACTIVE =
259
ABOVE_NORMAL_PRIORITY_CLASS =
0x00008000
BELOW_NORMAL_PRIORITY_CLASS =
0x00004000
HIGH_PRIORITY_CLASS =
0x00000080
IDLE_PRIORITY_CLASS =
0x00000040
NORMAL_PRIORITY_CLASS =
0x00000020
REALTIME_PRIORITY_CLASS =
0x00000100
CREATE_BREAKAWAY_FROM_JOB =

Process creation flags

0x01000000
CREATE_DEFAULT_ERROR_MODE =
0x04000000
CREATE_NEW_CONSOLE =
0x00000010
CREATE_NEW_PROCESS_GROUP =
0x00000200
CREATE_NO_WINDOW =
0x08000000
CREATE_PRESERVE_CODE_AUTHZ_LEVEL =
0x02000000
CREATE_SEPARATE_WOW_VDM =
0x00000800
CREATE_SHARED_WOW_VDM =
0x00001000
CREATE_SUSPENDED =
0x00000004
CREATE_UNICODE_ENVIRONMENT =
0x00000400
DEBUG_ONLY_THIS_PROCESS =
0x00000002
DEBUG_PROCESS =
0x00000001
DETACHED_PROCESS =
0x00000008
STARTF_USESHOWWINDOW =
0x00000001
STARTF_USESIZE =
0x00000002
STARTF_USEPOSITION =
0x00000004
STARTF_USECOUNTCHARS =
0x00000008
STARTF_USEFILLATTRIBUTE =
0x00000010
STARTF_RUNFULLSCREEN =
0x00000020
STARTF_FORCEONFEEDBACK =
0x00000040
STARTF_FORCEOFFFEEDBACK =
0x00000080
STARTF_USESTDHANDLES =
0x00000100
STARTF_USEHOTKEY =
0x00000200
CreateProcess =
Win32API.new('kernel32', 'CreateProcess', 'LPLLLLLPPP', 'I')
CreateRemoteThread =
Win32API.new('kernel32', 'CreateRemoteThread', 'LPLLPLP', 'L')
CreateThread =
Win32API.new('kernel32', 'CreateThread', 'PLPPLP', 'L')
ExitProcess =
Win32API.new('kernel32', 'ExitProcess', 'L', 'V')
GetCommandLine =
Win32API.new('kernel32', 'GetCommandLine', 'V', 'P')
GetCurrentProcess =
Win32API.new('kernel32', 'GetCurrentProcess', 'V', 'L')
GetCurrentProcessId =
Win32API.new('kernel32', 'GetCurrentProcessId', 'V', 'L')
GetEnvironmentStrings =
Win32API.new('kernel32', 'GetEnvironmentStrings', 'V', 'L')
GetEnvironmentVariable =
Win32API.new('kernel32', 'GetEnvironmentVariable', 'PPL', 'L')
GetExitCodeProcess =
Win32API.new('kernel32', 'GetExitCodeProcess', 'LP', 'I')
GetPriorityClass =
Win32API.new('kernel32', 'GetPriorityClass', 'L', 'L')
GetProcessTimes =
Win32API.new('kernel32', 'GetProcessTimes', 'LPPPP', 'I')
GetStartupInfo =
Win32API.new('kernel32', 'GetStartupInfo', 'P', 'V')
OpenProcess =
Win32API.new('kernel32', 'OpenProcess', 'LIL', 'L')
SetEnvironmentVariable =
Win32API.new('kernel32', 'SetEnvironmentVariable', 'PP', 'I')
Sleep =
Win32API.new('kernel32', 'Sleep', 'L', 'V')
SleepEx =
Win32API.new('kernel32', 'SleepEx', 'LI', 'L')
TerminateProcess =
Win32API.new('kernel32', 'TerminateProcess', 'LL', 'I')
WaitForInputIdle =
Win32API.new('user32', 'WaitForInputIdle', 'LL', 'L')

Instance Method Summary collapse

Instance Method Details

#CreateProcess(app, cmd, pattr, tattr, handles, flags, env, dir, sinfo, pinfo) ⇒ Object



83
84
85
# File 'lib/windows/process.rb', line 83

def CreateProcess(app, cmd, pattr, tattr, handles, flags, env, dir, sinfo, pinfo)
   CreateProcess.call(app, cmd, pattr, tattr, handles, flags, env, dir, sinfo, pinfo) != 0
end

#CreateRemoteThread(handle, tattr, size, start, param, flags, tid) ⇒ Object



87
88
89
# File 'lib/windows/process.rb', line 87

def CreateRemoteThread(handle, tattr, size, start, param, flags, tid)
   CreateRemoteThread.call(handle, tattr, size, start, param, flags, tid)
end

#CreateThread(attr, size, addr, param, flags, id) ⇒ Object



91
92
93
# File 'lib/windows/process.rb', line 91

def CreateThread(attr, size, addr, param, flags, id)
   CreateThread.call(attr, size, addr, param, flags, id)
end

#ExitProcess(exit_code) ⇒ Object



95
96
97
# File 'lib/windows/process.rb', line 95

def ExitProcess(exit_code)
   ExitProcess.call(exit_code)
end

#GetCommandLineObject



99
100
101
# File 'lib/windows/process.rb', line 99

def GetCommandLine
   GetCommandLine.call
end

#GetCurrentProcessObject



103
104
105
# File 'lib/windows/process.rb', line 103

def GetCurrentProcess()
   GetCurrentProcess.call
end

#GetCurrentProcessIdObject



107
108
109
# File 'lib/windows/process.rb', line 107

def GetCurrentProcessId()
   GetCurrentProcessId.call
end

#GetEnvironmentStringsObject



111
112
113
# File 'lib/windows/process.rb', line 111

def GetEnvironmentStrings()
   GetEnvironmentStrings.call
end

#GetEnvironmentVariable(name, buffer, size) ⇒ Object



115
116
117
# File 'lib/windows/process.rb', line 115

def GetEnvironmentVariable(name, buffer, size)
   GetEnvironmentVariable.call(name, buffer, size)
end

#GetExitCodeProcess(handle, exit_code) ⇒ Object



119
120
121
# File 'lib/windows/process.rb', line 119

def GetExitCodeProcess(handle, exit_code)
   GetExitCodeProcess.call(handle, exit_code) != 0
end

#GetPriorityClass(handle) ⇒ Object



123
124
125
# File 'lib/windows/process.rb', line 123

def GetPriorityClass(handle)
   GetPriorityClass.call(handle)
end

#GetProcessTimes(handle, t_creation, t_exit, t_kernel, t_user) ⇒ Object



127
128
129
# File 'lib/windows/process.rb', line 127

def GetProcessTimes(handle, t_creation, t_exit, t_kernel, t_user)
   GetProcessTimes.call(handle, t_creation, t_exit, t_kernel, t_user) != 0
end

#GetStartupInfo(info_struct) ⇒ Object



131
132
133
# File 'lib/windows/process.rb', line 131

def GetStartupInfo(info_struct)
   GetStartupInfo.call(info_struct)
end

#OpenProcess(access, handle, pid) ⇒ Object



135
136
137
# File 'lib/windows/process.rb', line 135

def OpenProcess(access, handle, pid)
   OpenProcess.call(access, handle, pid)
end

#SetEnvironmentVariable(name, value) ⇒ Object



139
140
141
# File 'lib/windows/process.rb', line 139

def SetEnvironmentVariable(name, value)
   SetEnvironmentVariable.call(name, value)
end

#Sleep(milliseconds) ⇒ Object



143
144
145
# File 'lib/windows/process.rb', line 143

def Sleep(milliseconds)
   Sleep.call(milliseconds)
end

#SleepEx(milliseconds, alertable) ⇒ Object



147
148
149
# File 'lib/windows/process.rb', line 147

def SleepEx(milliseconds, alertable)
   SleepEx.call(milliseconds, alertable)
end

#TerminateProcess(handle, exit_code) ⇒ Object



151
152
153
# File 'lib/windows/process.rb', line 151

def TerminateProcess(handle, exit_code)
   TerminateProcess.call(handle, exit_code) != 0
end

#WaitForInputIdle(handle, milliseconds) ⇒ Object



155
156
157
# File 'lib/windows/process.rb', line 155

def WaitForInputIdle(handle, milliseconds)
   WaitForInputIdle.call(handle, milliseconds)
end