[C#] Questions about sro_client

12/26/2011 19:06 eXoz0rd#1
Hello guys, as i learned some JAVA and C# now i decided to do some stuff for silkroad, just for fun..
My questions are, how i can attach my program to silkroad client, for example, im doing a simple autoclicker i want to attach it to client and allow him to press keys ONLY in silkroad window, that means i can minimize silkroad window and program wont be pressing keys in windows, just in silkroad window..
I started to code that and i have a little problem with sro_Client..
Code:
Process[] procs = Process.GetProcessesByName("sro_client");
            foreach (Process p in procs)
            { 
                IntPtr pFoundWindow = p.MainWindowHandle;
                p.CloseMainWindow();
                }
            }
This should close my window, but it does not.. Same as
Code:
SendKeys.Send("{ENTER}")
doesn't send any information to silkroad client
12/28/2011 17:06 eXoz0rd#2
Guys, can you answer a simple question? How to integrate with silkroad client by C# program?
12/28/2011 17:09 Schickl#3
did you try it with rsro or isro?
because you know, isro has hackshield
12/28/2011 18:09 eXoz0rd#4
Yep i know it has, i tried it with PlaySro client - means Vsro client.. Probably ill need to do this by packets as i guess?..
Code:
const UInt32 WM_KEYDOWN = 0x0100;
        const int VK_RETURN = 0x0D;
        const int jeden = 0x44;
        [DllImport("user32.dll")]
        static extern bool PostMessage(IntPtr hWnd, UInt32 Msg, int wParam, int lParam);


        public void writing()
        {
       
          Process[] processes = Process.GetProcessesByName("sro_client");

          foreach (Process proc in processes)
                    {
                        PostMessage(proc.MainWindowHandle, WM_KEYDOWN, jeden, 0);
                        PostMessage(proc.MainWindowHandle, WM_KEYDOWN, VK_RETURN, 0);
                    }


                }
It's a simple code, should add a number 1 and press enter.. (It works in shit such as Tibia - without any hackshields etc.)..
12/29/2011 09:38 lesderid#5
Are you sure PlaySRO doesn't use XTrap? That might cause problems too.
12/29/2011 11:24 Schickl#6
Just try it at rsro
12/29/2011 11:58 eXoz0rd#7
Quote:
Originally Posted by lesderid View Post
Are you sure PlaySRO doesn't use XTrap? That might cause problems too.
Well im not sure.. They may use XTrap.. Ok since they are secured, is there any way to break that? i mean, many bots are working on those versions, even if they are secured.. Im wondering how? Packets?
12/30/2011 00:25 kevin_owner#8
Most of the bots work with packets so if you do it right xtrap won´t notice it. But if you try to mess with the memory xtrap can detect it. I´m not sure what works and what doesn´t if xtrap is enabled since I´m a not newb at the game hacking thing.
12/30/2011 00:36 eXoz0rd#9
Well im sure that's the security of client.. Im totally newbie in packets etc.. Seems that i need to start learning that :p.. Now making a simple Autoclicker with a simple fuctions seems to be more complicated ever :)..
12/30/2011 08:25 jremy#10
You have to use sro_client's "Edit" handle, eg:

Code:
HWND mainHwnd = FindWindowA(0, "SRO_Client");
HWND childHwnd = FindWindowExA(mainHwnd, 0, "Edit", 0);

PostMessage(childHwnd, WM_KEYDOWN, VK_RETURN, 0);
12/30/2011 23:03 eXoz0rd#11
Code:
const UInt32 WM_KEYDOWN = 0x0100;
		const int VK_RETURN = 0x0D;
		const int VK_F8 = 0x77;
		const int VK_F9 = 0x78;
		const int A = 0x41;
		[DllImport("user32.dll")]
		static extern bool PostMessage(IntPtr hWnd, UInt32 Msg, int wParam, int lParam);
		[DllImport("USER32.DLL", CharSet = CharSet.Unicode)]
		public static extern IntPtr FindWindow(string lpClassName,
			string lpWindowName);
		[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
		public static extern IntPtr FindWindowEx(IntPtr hwNd, IntPtr chhwNd, string lclassName, string windowTitle);

		static void Main(string[ ] args) {
			try {
			IntPtr mainWindow = FindWindow(null, "SRO_Client");
			if (mainWindow == IntPtr.Zero) 
			{
				Console.WriteLine("Nie znaleziono okna silkroad'a");
				return;
			}
				IntPtr childWindow = FindWindowEx(mainWindow, IntPtr.Zero ,"Edit", null);
				PostMessage(childWindow, WM_KEYDOWN, VK_RETURN, 0);
				PostMessage(mainWindow, WM_KEYDOWN, VK_F8, 0);
				PostMessage(childWindow, WM_KEYDOWN, VK_F9, 0);
				PostMessage(childWindow, WM_KEYDOWN, A, 0);
				PostMessage(mainWindow, WM_KEYDOWN, A, 0);
			} catch 
			{
				Console.WriteLine("Nie dziala");
			}
		}
	}
}
I wrote that kind of code, probably wrong, but u can make corrects, anyway.. Code is sending informations to MainWindow, but it seems to do not send or even find childWindow..
01/06/2012 18:16 lesderid#12
Quote:
Originally Posted by jremy View Post
You have to use sro_client's "Edit" handle, eg:

Code:
HWND mainHwnd = FindWindowA(0, "SRO_Client");
HWND childHwnd = FindWindowExA(mainHwnd, 0, "Edit", 0);

PostMessage(childHwnd, WM_KEYDOWN, VK_RETURN, 0);
That's not true as long as the control has focus.