C 程式開機自動執行

2021-05-26 19:10:01 字數 980 閱讀 7562

*/void main()

{char system[max_path]; //系統目錄路徑

char pathtofile[max_path]; //要開機執行的檔案的完整路徑

hmodule getmodh = getmodulehandle(null);

//得到當前執行檔案的全路徑

getmodulefilename(getmodh,pathtofile,sizeof(pathtofile));

//得到系統檔案所在目錄的路徑,如c:\windows\system32

getsystemdirectory(system,sizeof(system));

//形成要複製到的全路徑,如c:\windows\system32\yourvirus.exe

strcat(system,"\\yourvirus.exe");

//自我複製到目標路徑

copyfile(pathtofile,system,false);

//寫入登錄檔,以便開機自動執行

hkey hkey;

//開啟登錄檔:路徑如下

//heky_local_machine\software\microsoft\windows\currentversion\run

regopenkeyex(hkey_local_machine,

"software\\microsoft\\windows\\currentversion\\run",0,key_set_value,&hkey );

//新增乙個值,名稱隨意命名,值為要開機執行的檔案的完整路徑

regsetvalueex(hkey, "writing to the registry example",

0,reg_sz,(const unsigned char*)system,sizeof(system));

//關閉登錄檔:

regclosekey(hkey);

/*可以加入其他功能*/

Symbian程式的開機自動執行

開機自動執行 在s60 2.x上的開機自動執行有多種方法,這裡不在重複 在s60 3.0上的開機自動執行需要按一下步驟實現 1先建乙個uid3.rss的檔案 檔案內容如下 include resource startup item info test 其中executable name 的值為開機要...

WINCE開機自動執行指定程式

wince開始預設是執行explorer.exe,是在shell.reg中設定的 hkey local machine init launch50 explorer.exe depend50 hex 14,00,1e,00 因此只要在platform.reg或者project.reg中做類似的更改就...

WinCE 開機自動執行程式

s1 將應用程式和應用程式快捷方式新增到映像裡,再將快捷方式新增到startup目錄下,這樣當系統執行後應用程式就能自動執行 s2 直接替換wince的shell,即修改登錄檔 hkey local machine init launch50 explorer.exe depend50 hex 14...