📄 get_password.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0071)http://go18.163.com/_NTES/~delfan/cn/delphi/tips/other/get_password.htm -->
<HTML><HEAD><TITLE>欢迎来到Delphi Fans</TITLE><!-- #BeginTemplate "/Templates/tips-other.dwt" --><!-- #BeginEditable "doctitle" --><!-- #EndEditable -->
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<STYLE type=text/css></STYLE>
<LINK href="get_password.files/css.css" rel=stylesheet>
<META content=Delphi,tips,控件,原码,下载,学习 name=keywords>
<SCRIPT language=JavaScript>
if (!document.layers&&!document.all)
event="test"
function showtip2(current,e,text){
if (document.all&&document.readyState=="complete"){
document.all.tooltip2.innerHTML='<marquee style="border:1px solid black">'+text+'</marquee>'
document.all.tooltip2.style.pixelLeft=event.clientX+document.body.scrollLeft+10
document.all.tooltip2.style.pixelTop=event.clientY+document.body.scrollTop+10
document.all.tooltip2.style.visibility="visible"}
else if (document.layers){
document.tooltip2.document.nstip.document.write('<b>'+text+'</b>')
document.tooltip2.document.nstip.document.close()
document.tooltip2.document.nstip.left=0
currentscroll=setInterval("scrolltip()",100)
document.tooltip2.left=e.pageX+10
document.tooltip2.top=e.pageY+10
document.tooltip2.visibility="show"}}
function hidetip2(){
if (document.all)
document.all.tooltip2.style.visibility="hidden"
else if (document.layers){
clearInterval(currentscroll)
document.tooltip2.visibility="hidden"}}
function scrolltip(){
if (document.tooltip2.document.nstip.left>=-document.tooltip2.document.nstip.document.width)
document.tooltip2.document.nstip.left-=5
else
document.tooltip2.document.nstip.left=150}
</SCRIPT>
<SCRIPT language=JavaScript>
function YY_Layerfx(yyleft,yytop,yyfnx,yyfny,yydiv,yybilder,yyloop,yyto,yycnt,yystep) { //v1.2
if ((document.layers)||(document.all)){
with (Math) {yynextx= eval(yyfnx)}
with (Math) {yynexty= eval(yyfny)}
yycnt=(yyloop && yycnt>=yystep*yybilder)?0:yycnt+yystep;
if (document.layers){
eval(yydiv+".top="+(yynexty+yytop))
eval(yydiv+".left="+(yynextx+yyleft)) }
if (document.all){
eval("yydiv=yydiv.replace(/.layers/gi, '.all')");
eval(yydiv+".style.pixelTop="+(yynexty+yytop));
eval(yydiv+".style.pixelLeft="+(yynextx+yyleft)); }
argStr='YY_Layerfx('+yyleft+','+yytop+',"'+yyfnx+'","'+yyfny+'","'+yydiv+'",'+yybilder+','+yyloop+','+yyto+','+yycnt+','+yystep+')';
if (yycnt<=yystep*yybilder){eval(yydiv+".yyto=setTimeout(argStr,yyto)");} }}
function YY_Mousetrace(evnt) {
if (yyns4)
{if (evnt.pageX) {yy_ml=evnt.pageX; yy_mt=evnt.pageY;} }
else{
yy_ml=(event.clientX + document.body.scrollLeft);
yy_mt=(event.clientY + document.body.scrollTop);}
if (yy_tracescript)eval(yy_tracescript)}
</SCRIPT>
<SCRIPT language=JavaScript>
function PopWin()
{
var PopWin = window.open("new.htm","PopWin","toolbar=no,directries=no,scrollBars=yes,height=350,width=400");
}
</SCRIPT>
<META content="MSHTML 5.00.2614.3500" name=GENERATOR></HEAD>
<BODY aLink=#ff0000 bgColor=#ff9966 link=#cc0000 text=#333333 vLink=#3333cc>
<TABLE align=center border=0 height=60 width=753>
<TBODY>
<TR>
<TD height=2 width="35%"><IMG height=45
src="get_password.files/Delphi%20Fans.gif" width=168></TD>
<TD colSpan=2 height=2 width="65%">
<P align=center><IFRAME height=63 marginHeight=0 marginWidth=0 name=ads
scrolling=no src="res://C:\WINDOWS\SYSTEM\SHDOCLC.DLL/http_404.htm"
width=470></IFRAME></P></TD></TR></TBODY></TABLE>
<TABLE align=center border=0 cellPadding=0 cellSpacing=0 width=753>
<TBODY>
<TR>
<TD bgColor=#0033cc height=22 width="16%">
<DIV align=center><A
href="http://go18.163.com/_NTES/~delfan/cn/delphi/index.html"><FONT
color=#ffcccc><B>首页</B></FONT></A></DIV></TD>
<TD bgColor=#00cc00 height=22 width="16%">
<DIV align=center><B>技巧集</B></DIV></TD>
<TD bgColor=#0033cc height=22 width="16%">
<DIV align=center><B><A
href="http://go18.163.com/_NTES/~delfan/cn/delphi/components/index.htm"><FONT
color=#ffcccc><B>控制集</B></FONT></A></B></DIV></TD>
<TD bgColor=#0033cc height=22 width="17%">
<DIV align=center><B><A
href="http://go18.163.com/_NTES/~delfan/cn/delphi/download/index.htm"><FONT
color=#ffcccc><B>下载区</B></FONT></A></B></DIV></TD>
<TD bgColor=#0033cc height=22 width="16%">
<DIV align=center><B><A href="http://delfan.abc.yesite.com/"
target=_blank><FONT
color=#ffcccc><B>讨论区</B></FONT></A></B></DIV></TD></TR></TBODY></TABLE>
<TABLE align=center border=1 cellPadding=0 cellSpacing=0 height=27 width=753>
<TBODY>
<TR>
<TD width="20%">
<DIV align=center><IMG border=0 height=1
src="get_password.files/serve.gif" width=1 NOSAVE> <A
href="http://service.bfast.com/bfast/click?bfmid=6902732&siteid=32984096&bfpage=home"
target=_top>NetRadio Homepage</A></DIV></TD>
<TD width="20%">
<DIV align=center><IMG border=0 height=1
src="F:\YinXin\李国智的文档\Password.files\get_password.files\serve(1).gif"
width=1 NOSAVE> <A
href="http://service.bfast.com/bfast/click?bfmid=7279965&siteid=32984090&bfpage=hometextlink1"
target=_top>About.com</A></DIV></TD>
<TD width="20%">
<DIV align=center><IMG border=0 height=1
src="F:\YinXin\李国智的文档\Password.files\get_password.files\serve(2).gif"
width=1 NOSAVE> <A
href="http://service.bfast.com/bfast/click?bfmid=327627&bfsiteid=32984081&bfpage=text01"
target=_top>Send FREE Online Greetings!</A></DIV></TD>
<TD width="21%">
<DIV align=center><A
href="http://click.linksynergy.com/fs-bin/stat?id=J9ZVZDaFsWw&offerid=14543.10000002&type=3&subid=0">Advanced
Virus Protection</A><IMG border=0 height=1
src="get_password.files/show.gif" width=1></DIV></TD>
<TD width="19%">
<DIV align=center><A
href="http://click.linksynergy.com/fs-bin/stat?id=J9ZVZDaFsWw&offerid=7660.8&type=3&subid=0">100%
Free Auto</A><IMG border=0 height=1
src="F:\YinXin\李国智的文档\Password.files\get_password.files\show(1).gif"
width=1></DIV></TD></TR></TBODY></TABLE>
<P align=center><B><FONT color=#cc0000>·</FONT><A
href="http://go18.163.com/_NTES/~delfan/cn/delphi/tips/internet/index.htm"
onmouseover="MM_openBrWindow('','','')">Internet相关</A> <FONT
color=#cc0000>·</FONT></B><A
href="http://go18.163.com/_NTES/~delfan/cn/delphi/tips/Form/index.htm">Form相关</A><B>
<FONT color=#cc0000>·</FONT><A
href="http://go18.163.com/_NTES/~delfan/cn/delphi/tips/image/index.htm"
onmouseover="MM_openBrWindow('','','')">图形图象</A> <FONT
color=#cc0000>·</FONT></B><A
href="http://go18.163.com/_NTES/~delfan/cn/delphi/tips/api/index.htm">Windows
API</A><B> <FONT color=#cc0000>·</FONT><A
href="http://go18.163.com/_NTES/~delfan/cn/delphi/tips/threads/index.htm"
onmouseover="MM_openBrWindow('','','')">多线程</A> <FONT color=#cc0000>·</FONT><A
href="http://go18.163.com/_NTES/~delfan/cn/delphi/tips/database/index.htm"
onmouseover="MM_openBrWindow('','','')">数据库</A> <FONT color=#cc0000>·</FONT><A
href="http://go18.163.com/_NTES/~delfan/cn/delphi/tips/windows/index.htm"
onmouseover="MM_openBrWindow('','','')">Window相关</A> <FONT
color=#cc0000>·</FONT></B><A
href="http://go18.163.com/_NTES/~delfan/cn/delphi/tips/pascal/index.htm"
onmouseover="MM_openBrWindow('','','')">Object Pascal</A><B> <FONT
color=#cc0000>·</FONT></B>其他</P>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=753>
<TBODY>
<TR>
<TD><A href="http://delfan.yeah.net/"
onmousedown="this.style.behavior='url(#default#homepage)';this.setHomePage('http://ddrfan.yeah.net/');"
style="BEHAVIOR: url(#default#homepage)" target=_blank><IMG
align=absBottom border=0 height=20 src="get_password.files/home.gif"
width=24>设为首页</A></TD>
<TD>
<DIV align=right><A href="http://delfan.yeah.net/"
onmousedown="this.style.behavior='url(#default#homepage)';this.setHomePage('http://ddrfan.yeah.net/');"
style="BEHAVIOR: url(#default#homepage)" target=_blank></A><A
href="javascript:window.external.AddFavorite('http://delfan.yeah.net','Delphi%20Fans')"><IMG
align=absBottom border=0 height=20 src="get_password.files/favor.gif"
width=24>加入收藏</A></DIV></TD></TR></TBODY></TABLE>
<DIV align=left>
<P align=right><B>请大家在看文章的时候帮我<FONT
color=#cc0066>点</FONT>一下上面的广告 ,Thanks</B></P>
<P align=center><BR><SPAN style="FONT-FAMILY: " 宋体; font-size: 9pt><SPAN
class=unnamed1><B><!-- #BeginEditable "title" -->
<P align=center>谈谈使用delphi读取获取密码缓存 <!-- #EndEditable --></B></SPAN></SPAN></P>
<P> </P>
<TABLE align=center height=156 width="92%">
<TBODY>
<TR>
<TD height=154>
<P><!-- #BeginEditable "content" -->
<P>谈谈使用delphi读取获取密码缓存 </P>
<P>通常而言,可以使用象pwltool.exe这样的工具来获取存于.pwl中的密码,但
有的时候也想自己动手试一试编程的乐趣,于是拜访了pwltool.exe作者的主页,
根据其中的一些资料,使用delphi编写了一个最简易的密码缓存读取程序。注意,程序只能读取本机当前用户的密码缓存信息。实际上,该程序是调用了mpr.dll中未公开的WNetEnumCachedPasswords函数
来取得缓存信息的 特献上此文,望众高手能挖掘更深层次的核心,以自由博爱之精神将知识共享。</P>
<P>unit test; </P>
<P>interface </P>
<P>uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dia logs, StdCtrls, shellApi; </P>
<P>type </P>
<P>PPASSWORD_CACHE_ENTRY=^TPASSWORD_CACHE_ENTRY; </P>
<P>TPASSWORD_CACHE_ENTRY=packed record </P>
<P>cbEntry: word; //password entry的字节长度 </P>
<P>cbResource: word; //resource name的字节长度 </P>
<P>cbPassword: word; //password的字节长度 </P>
<P>iEntry: byte; //entry index </P>
<P>nType: byte; //type of entry </P>
<P>abResource : array[0..200] of char; //start of resource name //password
immediately follows re source name </P>
<P>end; </P>
<P>type </P>
<P>TForm1 = class(TForm) </P>
<P>Memo1: TMemo; </P>
<P>Button1: TButton; </P>
<P>Button2: TButton; </P>
<P>Button3: TButton; </P>
<P>Button4: TButton; </P>
<P>procedure Button1Click(Sender: TObject); </P>
<P>procedure FormCreate(Sender: TObject); </P>
<P>procedure Button2Click(Sender: TObject); </P>
<P>procedure Button3Click(Sender: TObject); </P>
<P>procedure Button4Click(Sender: TObject); </P>
<P>private </P>
<P>{ Private declarations } </P>
<P>public { Public declarations } </P>
<P>end; </P>
<P>var Form1: TForm1; Passwordcount:integer; buffer1: array[0..200] of
char; </P>
<P>implementation </P>
<P>{$R *.DFM} </P>
<P>function WNetEnumCachedPasswords(para0: pointer; para1:word; para2: by
te; para3:pointer; para4: dword): word; stdcall; external 'mpr.dll' na me
'WNetEnumCachedPasswords'; </P>
<P>function pce(x:PPASSWORD_CACHE_ENTRY;y:dword):boolean;stdcall; </P>
<P>begin </P>
<P>passwordcount:=passwordcount+1; </P>
<P>move(x.abResource,buffer1,x.cbResource); </P>
<P>if x.cbResource<50 then </P>
<P>fillchar(buffer1[x.cbResource],50-x.cbResource,#32);
move(x.abResource[x.cbResource],buffer1[50],x.cbPassword); </P>
<P>buffer1[x.cbPassword+50]:=#0; </P>
<P>Form1.Memo1.Lines.Add(buffer1);</P>
<P>Result:=true; </P>
<P>end; </P>
<P> </P>
<P>procedure TForm1.Button1Click(Sender: TObject); </P>
<P>begin </P>
<P>passwordcount:=0; </P>
<P>Memo1.Lines.Clear; </P>
<P>Memo1.Font.Color:=clBlack; </P>
<P>WNetEnumCachedPasswords(nil,0,255,@pce,0); </P>
<P>Memo1.Lines.Add('---------------------------------------------------
---------'); Memo1.Lines.Add(format('当前用户共有%d个密码资源缓存',[passwordcount ]));
</P>
<P>end; </P>
<P> </P>
<P>procedure TForm1.FormCreate(Sender: TObject); </P>
<P>begin </P>
<P>passwordcount:=0; </P>
<P>Memo1.Lines.Clear; </P>
<P>Memo1.Font.Color:=clBlack; </P>
<P>WNetEnumCachedPasswords(nil,0,255,@pce,0); </P>
<P>Memo1.Lines.Add('---------------------------------------------------
---------'); Memo1.Lines.Add(format('当前用户共有%d个密码资源缓存',[passwordcount ]));
</P>
<P>end; </P>
<P>procedure TForm1.Button2Click(Sender: TObject); </P>
<P>begin </P>
<P>Memo1.Lines.clear; </P>
<P>Memo1.Font.Color:=clRed; Memo1.Lines.Add(' 我们通常允许Windows替我们把各类密码(如上网帐号
,密码等)存入系统,这当然方便了我们的使用。但是,您必须知道,那些“保 密”的信息其实一点也不保密。'); </P>
<P>Memo1.Lines.Add(' 这里只使用了一个标准的Windows Api程序,就能知道 您保存在机器里的大部分密码。'); </P>
<P>Memo1.Lines.Add(' 本程序属免费性质,允许您将其任意拷贝,传播,您也
可直接使用或修改其中代码。尽管已经对程序进行了测试,但我不保证您在自己 的机器上运行时不发生故障。特申明:作者不对由于运行本程序而导致的任何后
果负责!'); </P>
<P>Memo1.Lines.Add(' 不管您从何种渠道取得本程序,我都要求您合法地使用
本程序,如您不能做到,请立刻删除本程序,谢谢您的合作'); </P>
<P>Memo1.Lines.Add(''); </P>
<P>Memo1.Lines.Add(' ------ 版权所有,翻版不究;合法使用,慎防违法! ------'); </P>
<P>end; </P>
<P> </P>
<P>procedure TForm1.Button3Click(Sender: TObject); </P>
<P>begin </P>
<P>ShellExecute( Handle, 'open', 'mailto:hzcbb@163.net','','',SHOW_FULL
SCREEN ); </P>
<P>end; </P>
<P> </P>
<P>procedure TForm1.Button4Click(Sender: TObject); </P>
<P>begin </P>
<P>close; </P>
<P>end; </P>
<P>end. </P><!-- #EndEditable -->
<P></P></TD></TR></TBODY></TABLE>
<P align=left>
<SCRIPT language=JavaScript src="get_password.files/counter.htm"></SCRIPT>
</P>
<P align=center>
<SCRIPT language=JavaScript src="get_password.files/online.asp"></SCRIPT>
</P>
<P align=center>
<SCRIPT language=JavaScript1.1 src="get_password.files/textclick"></SCRIPT>
</P>
<P align=center>©Copyright DelphiFans</P>
<P align=center>All Rights Reserved</P></DIV><!-- #EndTemplate --></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -