帮忙看看这段得到WINDOWS密码的程序(100分)

  • 主题发起人 主题发起人 borger
  • 开始时间 开始时间
B

borger

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,forms,<br>&nbsp; Dialogs, StdCtrls,shellapi;<br><br>type<br>&nbsp; &nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; ListBox1: TListBox;<br>&nbsp; &nbsp; Button1: TButton;<br>&nbsp; &nbsp; procedure Button1Click(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; hmpr:thandle;<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br>const <br>Count: Integer = 0;<br><br>function wnetenumcachedpasswords(lp:lpstr;w:word;b:byte;pc:pchar;dw:dword):word;stdcall;<br><br>implementation<br><br>{$R *.dfm}<br>&nbsp;function wnetenumcachedpasswords(lp:lpstr;w:word;b:byte;pc:pchar;dw:dword):word;<br>&nbsp;external mpr name'wnetenumcachedpasswords';<br>&nbsp;type <br>PWinPassword = ^TWinPassword;<br>TWinPassword = record <br>EntrySize: Word; <br>ResourceSize: Word; <br>PasswordSize: Word; <br>EntryIndex: Byte;<br>EntryType: Byte;<br>PasswordC: Char; <br>end; <br><br><br>function AddPassword(WinPassword: PWinPassword; dw: DWord): LongBool; stdcall;<br>var <br>Password: String; <br>PC: Array[0..$FF] of Char;<br>begin<br>inc(Count);<br>Move(winpassword.PasswordC, PC, WinPassword.ResourceSize);<br>PC[WinPassword.ResourceSize] := #0; <br>CharToOem(PC, PC);<br>Password := StrPas(PC);<br>Move(WinPassword.PasswordC, PC, WinPassword.PasswordSize + WinPassword.ResourceSize); <br>Move(PC[WinPassword.ResourceSize], PC, WinPassword.PasswordSize);<br>PC[WinPassword.PasswordSize] := #0;<br>CharToOem(PC, PC);<br>Password := Password + ': ' + StrPas(PC);<br>form1.ListBox1.Items.Add(password);<br>result:=true;<br>end;<br><br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br>&nbsp;if WNetEnumCachedPasswords(nil, 0, $FF, @AddPassword, 0) &lt;&gt; 0 then<br>application.MessageBox('maybe user is not logon','is a error',mb_ok or mb_iconWarning)<br>else<br>if count=0 then<br>listbox1.Items.Add('不能得到密码');<br>end;<br><br>end.<br><br><br><br>在inc(Count);这里提示:<br>left side cannot be assigned to<br>我应该如何修改呢?
 
Inc()的参数必须是变量,而你的Count定义为Const,肯定是不行的。
 
后退
顶部