https://technet.microsoft.com/en-us/sysinternals/bb897447.aspx
http://www.rohitab.com/discuss/topic/39956-my-first-native-application/
以前没注意过这里。
HKLM\System\CurrentControlSet\Control\Session Manager\BootExecute
代价只是向这里写入一个路径,
为什么我就没有注意过这里。
代码:
内部使用Nt系列函数,而且要十分注意最后需要手动结束当前进程,否则它是不会自动结束的
1 #include <Windows.h> 2 #include <ntdef.h> 3 4 void NTAPI RtlInitUnicodeString(PUNICODE_STRING,PCWSTR); 5 6 NTSTATUS NTAPI NtDisplayString(PUNICODE_STRING); 7 NTSTATUS NTAPI NtDelayExecution(BOOLEAN,PLARGE_INTEGER); 8 NTSTATUS NTAPI NtTerminateProcess(HANDLE,NTSTATUS); 9 10 void NtProcessStartup() 11 { 12 UNICODE_STRING us; 13 LARGE_INTEGER delay; 14 15 delay.QuadPart=-10000000; 16 17 RtlInitUnicodeString(&us,L"Message from native application."); 18 NtDisplayString(&us); 19 NtDelayExecution(FALSE,&delay); 20 NtTerminateProcess((HANDLE)-1,0); 21 }