C # implementation View text box (such as * number password box)
I'm boring today, try to write the program with C # to see the password box (not limited to the password box, should be any text that can be used), you can see the code. Use C to make a super simple, so simple .. Using C # complex I am very, I don't want to use unsafe, I always feel that I don't simply use C with unsafe.
INT length = 300; INTPTR THANDLE = apis.getlocalWindow (); // Get the current mouse location of the control handle int address = apis.virtualallalk (process.getcurrentProcess (). Handle, 0, Length, 0x1000, 0x04); // In this process, the memory Apis.sendMessage (Thandle, 0x000D, New INTPTR (255), New INTPTR (Address)) is sent within this process; // Send a message to the target control, 0x000d is WM_GETTEXT, 255 means to save the returned value NEW INTPTR (address) refers to the address stored to address byte [] buf = new byte [length]; apis.ready (process.getcurrentProcess (). Handle, Address, BUF, Length, 0); // Read The content you just saved MessageBox.show (Encoding.default.getstring (buf)); // Show out.
The Apis starts, it is the API class library I wrote, the relevant statement is as follows: [DLLIMPORT ("User32.dll")] Public Static Extern INTPTR WindowFromPoint (Point LPPOIN);
[DllImport ( "user32.dll")] public static extern int GetCursorPos (out POINT lpPoint); public static IntPtr GetLocalWindow () // This is just the combination of the two bit {POINT point; GetCursorPos (out point); return WindowFromPoint (POINT);
// Do not add EX. Do not have the first handle parameter [DLLIMPORT ("kernel32.dll")] public static extern system.int32 VirtualaLalkEx (System.intptr HProcess, System.Int32 LPaddress, System.Int32 Dwsize, System.Ist32 .INT16 FLALLOCATIONTYPE, System.Int16 flprotect);
[DLLIMPORT ("User32.dll")] Public Static Extern INTPTR SENDMESSAGE (INTPTR HWND, INT MSG, INTPTR WPARAM, INTPTR LPARAM);
[DLLIMPORT ("kernel32.dll")] public static extern int tentprocessMemory (System.int32 lpBaseaddress, Byte [] lpbuffer, long nsize, long lpnumberofbyteswritten;
*********************************************************** **************** Because it is generally necessary to view external programs, with shortcuts, it is not a good way. C # is as follows: In the code of the initialization window, KEYMODIFIERS Modifiers = keymodifiers.windows; // Defined as WIN shortcuts, can also be defined as other .registerhotKey (Handle, 1001, Modifiers, Keys.v); // Give WIN V Distribution ID for 1001Override WndProcprotected Override Void WndProc Ref Message M) {Const Int WM_HOTKEY = 0x0312; Switch (M.MSG) {Case WM_HOTKEY: SWITCH (M.WParam.Toint32 ()) {CASE 1001: onhotkeyv (); Break; Default: Break;} Break;} Base .Wndproc (ref m);} Write the code I started in the onhotKeyv function.