-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugs report! #1
Comments
Hi CreateAndInject, Thanks for your report. The support for this ticket is now handled on the official forum: http://binarysharp.com/topic/21-bugs-report/ Cheers, |
Suggestion - handle null on dispose.
|
Hey! Some updates on this bug. Point 4 fixed in the develop branch. I keep you informed about the windows issues. |
Perhaps you could check the some unique thing to the first window int he collection (the real "main window") and if it does not match the main window returned by the native api (due to it being the the last active toplevel window, return the other window? If I understand the issue right.. |
1.window.Mouse.MoveTo(0, 0);
If the "window" is a child control, mouse can not move correctly!
2.If an application has 2+ top level windows, WindowFactory.RemoteWindows can not collect all!
Maybe should support "TopLevelWindows" property, and "MainWindow" is just the first visible one in collections.
3.Why don't support a "Parent" property in RemoteWindow?
public string ReadString(IntPtr address, Encoding encoding, bool isRelative = true, int maxLength = 0x200)
{
string str = encoding.GetString(this.ReadBytes(address, maxLength, isRelative));
int index = str.IndexOf('\0');
return str.Substring(0, index);
return index==-1?str:str.Substring(0,index);//If don't find "\0" in maxLength, just return it.
}
var sharp = new MemorySharp(Process.GetCurrentProcess());
sharp["kernel32"]["MessageBoxW"].Execute(0, "Hey", "Title", 0);
this code contains so many errors
(1) kernel32 => user32
(2)sharp["user32"]["MessageBoxW"].Execute(0, "Hey", "Title", 0);
will throw an exception.
should: sharp["user32"]["MessageBoxW"].Execute(CallingConventions.Stdcall,0, "Hey", "Title", 0);
(3)MessageBoxW can not work normally, MessageBoxA can.
(4)sharp["user32"]["MessageBoxA"].Execute(CallingConventions.Stdcall,0, "汉字", "Title", 0);
If the string contains non-latin character, such as Chinese, this code can not work correctly.
I must do it like this:
//my process
(1).sharp["user32"]["MessageBoxA"].Execute(CallingConventions.Stdcall, 0, Marshal.StringToHGlobalAnsi("汉字"), "Title", 0);
(2).sharp["user32"]["MessageBoxW"].Execute(CallingConventions.Stdcall, 0, Marshal.StringToHGlobalUni("汉字"), Marshal.StringToHGlobalUni("Title"), 0);
//remote process
(3).
var bytes = Encoding.GetEncoding("gb2312").GetBytes("汉字");
Array.Resize(ref bytes, bytes.Length + 1);
RemoteAllocation ra = ms.Memory.Allocate(bytes.Length);
ra.Write(bytes);
sharp["user32"]["MessageBoxA"].Execute(CallingConventions.Stdcall, 0, ra.BaseAddress, "Title", 1);
I think MemorySharp should support:
RemoteAllocation/Inptr Write/WriteString (data)
{
}
not need pass in address as paramter and the method will alloc proper size and return the address.(like Marshal.StringToHGlobalAnsi)
The text was updated successfully, but these errors were encountered: