Win2000XP2003 * password detector

xiaoxiao2021-03-06  149

Under Win98, for the password box of other programs, we can use the SendMessage function to frame this password box.

The command of WM_Gettext gets the contents of this password box. But since 2000, Microsoft's security awareness seems to be strong.

Use this command to use the ordinary window, but it doesn't work for the password box.

Many similar procedures are obtained by establishing a dynamic link library, but they are too much trouble, in fact

There is a simpler practice. That is the next command to it, remove its password box attribute, and then get its content, the most

After restoring the properties of its password box.

{Item: Win2000 / XP / 2003 * Password Detector Author: hunter hunter@shenTong.com.cn Date: January 18, 2004} Unit Upassword;

Interface

Uses Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Stdctrls, ExtCtrls

type TfrmPassword = class (TForm) edPassword: TEdit; // display the password text boxes Timer1: TTimer; // timer procedure Timer1Timer (Sender: TObject); private {Private declarations} public {Public declarations} end;

Var FRMPassword: tfrmpassword;

IMPLEMENTATION

{$ R * .dfm}

Procedure tFRMPassword.timer1timer (sero); var s: pchar; i, n: integer; p: tpoint; h: integer; c: integer; begin getcursorpos (p); // Get the current cursor position h: = WindowFromPoint (p); // When the handle of the window at the cursor N: = getWindowlong (H, GWL_Style); // Take the attribute IF of the window (n and $ 20) <> 0 THEN BEGIN / / Judgment whether it is a password box C: = SendMessage (H, EM_GETPASSWORDCHAR, 0, 0); // Get password box Current characters such as '*' and other PostMessage (h, em_setpasswordchar, 0); // Set the character of the password box is empty, that is, remove the password box Password properties,

// Be sure to use PostMessage, not use SendMessage, use the latter invalid I: = sendMessage (h, wm_gettextLength, 0); Inc (i); // Get the length of the password string GetMem (s, i) ; // Distribute SENDMESSAGE (h, wm_gettext, i, longint (s)); // Get password string edpassword.text: = s; // Put your password in the text box PostMessage (h, em_setpasswordchar, c, 0 ); // Restore the original password properties freeMem (s) ;? // Release the memory END; END;

End.

转载请注明原文地址:https://www.9cbs.com/read-127972.html

New Post(0)