I would like someone to verify if I am correct or not and if im wrong can you tell me the right address
============================================= Function
Private Sub GetHandle()
On Error GoTo Err
Dim hwnd As Long
Dim pid As Long
Dim str As String * 1
hwnd = FindWindow("SWarClass", vbNullString)
If (hwnd = 0) Then
pHandle = 0
Exit Sub
End If
GetWindowThreadProcessId hwnd, pid
pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
If (pHandle = 0) Then
pHandle = 0
Exit Sub
End If
Err:
End Sub
============================================= Function
============================================= Function
Dim sValue As String * 1, sValue2 As String * 1
GetHandle
If pHandle = 0 Then Exit Sub
============================================= Verify This If Wrong
ReadProcessMemory pHandle, "&H6A489C", sValue2, 1, 0& 'unit
ReadProcessMemory pHandle, "&H651834", sValue, 1, 0& ' cursor
ReadProcessMemory pHandle, "&H6B6D9C", sValue2, 1, 0& 'text
============================================= Verify This If Wrong
============================================= Function
&H6A489C etc are longs, why are you passing them as strings?
And you're not capturing your errors, take that out and find out if it's wrong yourself.
Ew. I'd suggest dll injection.
Quote from: warz on May 18, 2006, 06:07 PM
Ew. I'd suggest dll injection.
Which is very difficult in vb. If you choose to use DLL injection, I suggest using a dll made in C/C++.
Quote from: Tazo on May 18, 2006, 06:59 PM
Quote from: warz on May 18, 2006, 06:07 PM
Ew. I'd suggest dll injection.
Which is very difficult in vb. If you choose to use DLL injection, I suggest using a dll made in C/C++.
Depends how you meter difficulty... it's not very hard for me
Quote
Depends how you meter difficulty... it's not very hard for me
All the COM involved is a slight bit difficult if you ask me...
Quote from: Tazo on May 18, 2006, 06:59 PM
Quote from: warz on May 18, 2006, 06:07 PM
Ew. I'd suggest dll injection.
Which is very difficult in vb. If you choose to use DLL injection, I suggest using a dll made in C/C++.
The actual dll injection is very easy, in visual basic. It's just a few API calls. See my visual basic demo source code at www.rafm.org - but the dll being injected would most likely work best if in C/C++.
I revamped the first function for you, fixing a few things. Due to my lack of VB installed, or even Windows for that matter, it's untested, but it should work.
Fixes:
1. Variable declarations - str is declared and not used.
2. If statements - instead of doing four lines (start, action, action, end), why not just use your label and jump to that in one line?
3. Default values - remember that numbers are initalized to 0, booleans to false (at least, in Java), and Strings to "". You don't need to assign a 0 value to a number when it already has that value.
4. Last but not least, indent. Unless of course SMF killed your code (place it within [code.][/.code] tags, minus the ".")
Private Sub getHandle()
On Error Goto Err
Dim HWnd As Long, PID As Long
HWnd = FindWindow("SWarClass", vbNullString)
If HWnd = 0 Then Goto Err 'Window not found
Call GetWindowThreadProcessId(HWnd, PID)
pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, PID)
Err:
'// No action is needed
End Sub
Quote from: J on May 18, 2006, 08:14 PM
I revamped the first function for you, fixing a few things. Due to my lack of VB installed, or even Windows for that matter, it's untested, but it should work.
Fixes:
1. Variable declarations - str is declared and not used. pHandle is used and not declared.
2. If statements - instead of doing four lines (start, action, action, end), why not just use your label and jump to that in one line?
3. Default values - remember that numbers are initalized to 0, booleans to false (at least, in Java), and Strings to "". You don't need to assign a 0 value to a number when it already has that value.
4. Last but not least, indent. Unless of course SMF killed your code (place it within [code.][/.code] tags, minus the ".")
Private Sub getHandle()
On Error Goto Err
Dim HWnd As Long, PID As Long, pHandle As Long
HWnd = FindWindow("SWareClass", vbNullString)
If HWnd = 0 Then Goto Err 'Window not found
Call GetWindowThreadProcessId(HWnd, PID)
pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, PID)
Err:
'// No action is needed
End Sub
Ofcourse, you'd probably want pHandle to be a global variable, or return the value of pHandle when the function ends. Because, this function really doesn't accomplish anything otherwise. Also, 'SWareClass'? :-p
Fixed. SWareClass was a typo, and I didn't realize that pHandle was global until later and forgot to go back to change it.
EDIT -
That's a nice advantage of Java - it's class variables are accessed by this.varName so you can tell right away if it's local or class.
Well, I wouldn't make pHandle global. Since this functions purpose is to get a handle, according to the function name, I'd just make it "as long" and return the value.
Private Sub getHandle() as long
On Error Goto Err
Dim hWnd As Long, PID As Long, retValue as long
hWnd = FindWindow("SWarClass", vbNullString)
If (hWnd = 0) then
exit function
end if
retValue = GetWindowThreadProcessId(hWnd, PID)
if (retValue = 0) then
exit function
end if
getHandle = OpenProcess(PROCESS_ALL_ACCESS, False, PID)
End Sub
Quote from: warz on May 19, 2006, 08:42 AM
Private Sub getHandle() as long
As something with a return value, isn't it appropriate to declare it as a Function rather than as a Sub?
got yer dun
Quote from: MyndFyre[vL] on May 19, 2006, 11:22 AM
Quote from: warz on May 19, 2006, 08:42 AM
Private Sub getHandle() as long
As something with a return value, isn't it appropriate to declare it as a Function rather than as a Sub?
Correct, I don't think that's legal in VB either.
Sub's in VB6 have no return value, thus you can't declare a type for a non-existent return value. That is what a function is for.
It would be:
Private Function getHandle() as long
On Error Goto Err
Dim hWnd As Long, PID As Long, retValue as long
hWnd = FindWindow("SWarClass", vbNullString)
If hWnd <> 0 Then
retValue = GetWindowThreadProcessId(hWnd, PID)
If retValue <> 0 Then
getHandle = OpenProcess(PROCESS_ALL_ACCESS, False, PID)
Exit Function
End If
End If
Err:
getHandle = 0
End Function
Quote from: J on May 18, 2006, 08:14 PM
I revamped the first function for you, fixing a few things. Due to my lack of VB installed, or even Windows for that matter, it's untested, but it should work.
Fixes:
1. Variable declarations - str is declared and not used.
2. If statements - instead of doing four lines (start, action, action, end), why not just use your label and jump to that in one line?
3. Default values - remember that numbers are initalized to 0, booleans to false (at least, in Java), and Strings to "". You don't need to assign a 0 value to a number when it already has that value.
4. Last but not least, indent. Unless of course SMF killed your code (place it within [code.][/.code] tags, minus the ".")
Private Sub getHandle()
On Error Goto Err
Dim HWnd As Long, PID As Long
HWnd = FindWindow("SWarClass", vbNullString)
If HWnd = 0 Then Goto Err 'Window not found
Call GetWindowThreadProcessId(HWnd, PID)
pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, PID)
Err:
'// No action is needed
End Sub
You shoulden't use Err as a linefeed in VB6.
If you're going to capture errors, CAPTURE them. Using "On Error Goto label" and having nothing after "label" is almost as bad as using "On Error Resume Next".
yupper
What is this program supposed to do?
anti-hack which i got done