Posts: 285
Threads: 15
Joined: Nov 2011
Reputation:
12
Is it possible to read the console output from a script?
Posts: 1,323
Threads: 24
Joined: Nov 2010
Reputation:
91
Probably but why would you need that?
Posts: 285
Threads: 15
Joined: Nov 2011
Reputation:
12
Posts: 5,320
Threads: 300
Joined: Feb 2011
Reputation:
149
It's possible, Mine was able to do it.
You need to get the window offset and need to use some windows api functions though
Posts: 1,519
Threads: 107
Joined: Dec 2011
Reputation:
48
09-05-2012, 17:26
(This post was last modified: 09-05-2012, 18:43 by kokole.)
i am able to read the last used command in black ops console so its possible (commands like, +melee -melee or even dvars)
it was just some address
0x03536C5C for black ops, i will try to update this post if i find it for mw3
EDIT: cant find.
Posts: 285
Threads: 15
Joined: Nov 2011
Reputation:
12
I don't understand this offset thing can you tell me how to do this?
Posts: 5,320
Threads: 300
Joined: Feb 2011
Reputation:
149
09-06-2012, 13:43
(This post was last modified: 09-06-2012, 13:44 by JariZ.)
Code: unsafe string MW3Console
{
get
{
IntPtr form = *(IntPtr*)0x5933A50;
IntPtr txtbox = FindWindowEx(form, IntPtr.Zero, "Edit", null);
IntPtr console = FindWindowEx(form, txtbox, "Edit", null);
StringBuilder sb = new StringBuilder(9999999);
int result = SendMessageTimeout(
console,
0x0D /*WM_GETTEXT*/,
9999999,
sb,
10 /*SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG*/,
500,
IntPtr.Zero);
return sb.ToString();
}
}
[DllImport("user32.dll", EntryPoint = "FindWindow", CharSet = CharSet.Ansi)]
public static extern IntPtr FindWindow(string className, string windowName);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle);
[DllImport("User32.dll", SetLastError = true)]
public static extern int SendMessageTimeout(
IntPtr hWnd,
uint uMsg,
uint wParam,
StringBuilder lParam,
uint fuFlags,
uint uTimeout,
IntPtr lpdwResult);
The offset (line 5) is outdated and I got it from nukem.
I think (but not entirely sure) that barata's tool can tell you what it is.
Posts: 285
Threads: 15
Joined: Nov 2011
Reputation:
12
This worked for me
Code: unsafe string MW3Console
{
get
{
IntPtr form = FindWindow("IW5 WinConsole", "Call of Duty: Modern Warfare 3 Dedicated Server");
IntPtr txtbox = FindWindowEx(form,IntPtr.Zero,"Edit",null);
IntPtr console = FindWindowEx(form, txtbox, "Edit", null);
StringBuilder sb = new StringBuilder(9999999);
int result = SendMessageTimeout(
console,
0x0D /*WM_GETTEXT*/,
9999999,
sb,
10 /*SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG*/,
500,
IntPtr.Zero);
return sb.ToString();
}
}
[DllImport("user32.dll", EntryPoint = "FindWindow", CharSet = CharSet.Ansi)]
public static extern IntPtr FindWindow(string className, string windowName);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle);
[DllImport("User32.dll", SetLastError = true)]
public static extern int SendMessageTimeout(
IntPtr hWnd,
uint uMsg,
uint wParam,
StringBuilder lParam,
uint fuFlags,
uint uTimeout,
IntPtr lpdwResult);
|