TSwitch
29th July 2002, 22:04
I need to create a process of a program, and this program needs to have a starting directory passed to it, because it won't know where it's data files are otherwise...
Oh, but it gets worse...
This is for a bot for Ragnarok Online, and... *gulp* well, the thing is, my bot is, well ALL bots for RO seem to be written in...
<tiny voice>vb</tiny voice>
My code for that looks like this:
Private Declare Function CreateProcessA Lib "kernel32" ( _
ByVal lpApplicationName As Long, _
ByVal lpCommandLine As String, _
lpProcessAttributes As SECURITY_ATTRIBUTES, _
lpThreadAttributes As SECURITY_ATTRIBUTES, _
ByVal bInheritHandles As Long, _
ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, _
ByVal lpCurrentDirectory As String, _
lpStartupInfo As STARTUPINFO, _
lpProcessInformation As PROCESS_INFORMATION) As Long
and in clsAppRedir.Redir(byref sCmd as string)...
If CreateProcessA(0&, sCmd, sa, sa, 1&, NORMAL_PRIORITY_CLASS, _
0&, sDir, start, proc) <> 1 Then
'There was code here that doesn't matter.
RaiseEvent Error("Could not create the process to redirect.")
GoTo doneRedirShell
End If
The variable sa is a SECURITY_ATTRIBUTES type, just like in the win32 sdk. 'start' is a STARTUPINFO type and proc is a PROCESS_INFORMATION type.
If you need any more info/code, let me know. Thanks in advance for your help.
Flamers, stave off carpal tunnel syndrome and save it for some true 1D10T. I know c/c++, but i dont care to **** my way through expression parsing, which i suck at.
Oh, but it gets worse...
This is for a bot for Ragnarok Online, and... *gulp* well, the thing is, my bot is, well ALL bots for RO seem to be written in...
<tiny voice>vb</tiny voice>
My code for that looks like this:
Private Declare Function CreateProcessA Lib "kernel32" ( _
ByVal lpApplicationName As Long, _
ByVal lpCommandLine As String, _
lpProcessAttributes As SECURITY_ATTRIBUTES, _
lpThreadAttributes As SECURITY_ATTRIBUTES, _
ByVal bInheritHandles As Long, _
ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, _
ByVal lpCurrentDirectory As String, _
lpStartupInfo As STARTUPINFO, _
lpProcessInformation As PROCESS_INFORMATION) As Long
and in clsAppRedir.Redir(byref sCmd as string)...
If CreateProcessA(0&, sCmd, sa, sa, 1&, NORMAL_PRIORITY_CLASS, _
0&, sDir, start, proc) <> 1 Then
'There was code here that doesn't matter.
RaiseEvent Error("Could not create the process to redirect.")
GoTo doneRedirShell
End If
The variable sa is a SECURITY_ATTRIBUTES type, just like in the win32 sdk. 'start' is a STARTUPINFO type and proc is a PROCESS_INFORMATION type.
If you need any more info/code, let me know. Thanks in advance for your help.
Flamers, stave off carpal tunnel syndrome and save it for some true 1D10T. I know c/c++, but i dont care to **** my way through expression parsing, which i suck at.