|
- #include <windows.h>
- #include <stdio.h>
- int main()
- {
- HKEY hKey;
- char *Path,*Path2="c:\\windows\\notepad.exe --";
- LONG ret;
- ret=RegOpenKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",&hKey);
- if(ret)
- {
- printf("打开注册表项失败");
- return 0;
- }
- Path=new char[1024*1024];
- memset(Path,'p',1024*1024);
- memcpy(Path,Path2,strlen(Path2));
- ret=RegSetValueEx(hKey,"TEST",0,REG_SZ,(BYTE *)Path,strlen(Path));
- if(ret==0)
- {
- printf("写入成功");
- }
- else
- {
- printf("写入失败");
- }
- return 0;
- }
复制代码 转载:http://www.1314dhw.com/forum.php ... &extra=page%3D1 |
|