Brian 10 Posted May 20, 2017 Share Posted May 20, 2017 Is it possible to change process name of attached WoW process? Also, how would I get an IntPtr to the attached WoW process? Link to comment https://wrobot.eu/forums/topic/5922-possible-to-change-process-name-of-attached-wow-process/ Share on other sites More sharing options...
reapler 154 Posted May 21, 2017 Share Posted May 21, 2017 Hello, it's not possible to change the process name(on runtime => you can retaliate at msdn documentation) and you must specify which IntPtr do you mean: There are several IntPtr which you can get from the process but i belive you want the mainwindowhandle? or you can explain for what the IntPtr is needed. Edit: forgot to write that you can change the process name by simply rename wow.exe but it will doesn't affect the process name while it's running: Logging.Write(wManager.Wow.Memory.WowMemory.Memory.GetProcess().ProcessName); Link to comment https://wrobot.eu/forums/topic/5922-possible-to-change-process-name-of-attached-wow-process/#findComment-26956 Share on other sites More sharing options...
Brian 10 Posted May 22, 2017 Author Share Posted May 22, 2017 2 hours ago, reapler said: Hello, it's not possible to change the process name(on runtime => you can retaliate at msdn documentation) and you must specify which IntPtr do you mean: There are several IntPtr which you can get from the process but i belive you want the mainwindowhandle? or you can explain for what the IntPtr is needed. Edit: forgot to write that you can change the process name by simply rename wow.exe but it will doesn't affect the process name while it's running: Logging.Write(wManager.Wow.Memory.WowMemory.Memory.GetProcess().ProcessName); I need to change the process name and I can do it via [DllImport("user32.dll")] static extern void SetWindowText(IntPtr hWnd, string windowName); But I need to get the main window handle.. Also, wManger.WoW.Memory.WoWMemory.Memory.. no GetProcess exists, only serialize Link to comment https://wrobot.eu/forums/topic/5922-possible-to-change-process-name-of-attached-wow-process/#findComment-26957 Share on other sites More sharing options...
reapler 154 Posted May 22, 2017 Share Posted May 22, 2017 So, i wrote a method which works (at least for me): [DllImport("user32.dll")] static extern bool SetWindowText(IntPtr hWnd, string text); public void SetText(string processname, string text) { IntPtr mainWindowHandle = IntPtr.Zero; foreach (var obj in System.Diagnostics.Process.GetProcesses()) { //or you can search for other parameter / characteristics which wow contains but searching for processname is normaly enough if (obj.ProcessName == processname)// => in my case the executable in my wow folder is Wow.exe { Logging.Write("Process found: " + obj.ProcessName + "[" + obj.Id + "]."); mainWindowHandle = obj.MainWindowHandle; break; } } if (mainWindowHandle != IntPtr.Zero) { SetWindowText(mainWindowHandle, text); } else { Logging.Write("No process with the name '" +processname+"' was found.\nPlease check your executable's name."); } } usage: SetText("Wow","Hello World!"); but remember: processname != windowtext => the field "ProcessName" is read only so it can't be changed on running processes. If you really want to change the process' name, you can only influence it on startup or by creating a new process. Edit: this one gets the right one, if several processes exist: [DllImport("user32.dll")] static extern bool SetWindowText(IntPtr hWnd, string text); public void SetText(string processname, string text) { IntPtr mainWindowHandle = IntPtr.Zero; foreach (var obj in System.Diagnostics.Process.GetProcesses()) { if (obj.ProcessName == processname)// => in my case the executable in my wow folder is Wow.exe { if (wManager.Wow.Memory.PlayerName(obj.Id) == wManager.Wow.ObjectManager.ObjectManager.Me.Name) { Logging.Write("Process found: " + obj.ProcessName + "[" + obj.Id + "][" + wManager.Wow.ObjectManager.ObjectManager.Me.Name+ "]"); mainWindowHandle = obj.MainWindowHandle; break; } } } if (mainWindowHandle != IntPtr.Zero) { SetWindowText(mainWindowHandle, text); } else { Logging.Write("No process with the name '" +processname+"' was found.\nPlease check your executable's name."); } } Link to comment https://wrobot.eu/forums/topic/5922-possible-to-change-process-name-of-attached-wow-process/#findComment-26959 Share on other sites More sharing options...
Brian 10 Posted May 22, 2017 Author Share Posted May 22, 2017 1 hour ago, reapler said: So, i wrote a method which works (at least for me): [DllImport("user32.dll")] static extern bool SetWindowText(IntPtr hWnd, string text); public void SetText(string processname, string text) { IntPtr mainWindowHandle = IntPtr.Zero; foreach (var obj in System.Diagnostics.Process.GetProcesses()) { //or you can search for other parameter / characteristics which wow contains but searching for processname is normaly enough if (obj.ProcessName == processname)// => in my case the executable in my wow folder is Wow.exe { Logging.Write("Process found: " + obj.ProcessName + "[" + obj.Id + "]."); mainWindowHandle = obj.MainWindowHandle; break; } } if (mainWindowHandle != IntPtr.Zero) { SetWindowText(mainWindowHandle, text); } else { Logging.Write("No process with the name '" +processname+"' was found.\nPlease check your executable's name."); } } usage: SetText("Wow","Hello World!"); but remember: processname != windowtext => the field "ProcessName" is read only so it can't be changed on running processes. If you really want to change the process' name, you can only influence it on startup or by creating a new process. Edit: this one gets the right one, if several processes exist: [DllImport("user32.dll")] static extern bool SetWindowText(IntPtr hWnd, string text); public void SetText(string processname, string text) { IntPtr mainWindowHandle = IntPtr.Zero; foreach (var obj in System.Diagnostics.Process.GetProcesses()) { if (obj.ProcessName == processname)// => in my case the executable in my wow folder is Wow.exe { if (wManager.Wow.Memory.PlayerName(obj.Id) == wManager.Wow.ObjectManager.ObjectManager.Me.Name) { Logging.Write("Process found: " + obj.ProcessName + "[" + obj.Id + "][" + wManager.Wow.ObjectManager.ObjectManager.Me.Name+ "]"); mainWindowHandle = obj.MainWindowHandle; break; } } } if (mainWindowHandle != IntPtr.Zero) { SetWindowText(mainWindowHandle, text); } else { Logging.Write("No process with the name '" +processname+"' was found.\nPlease check your executable's name."); } } Thanks, I'll test later when Im available. The second method is exactly what I'm looking for! Link to comment https://wrobot.eu/forums/topic/5922-possible-to-change-process-name-of-attached-wow-process/#findComment-26960 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now