A forum for reverse engineering, OS internals and malware analysis 

Forum for discussion about user-mode development.
 #24838  by BrianKress
 Sun Jan 04, 2015 6:53 pm
Hi all,

I'm writing a program that loads from a win32 service and I'd like to be able to have my program startup before windows startup programs are loaded. I have noticed on xp that programs placed in the startup menu folder seem to load before mine and want your opinion as to how to best deal with this issue. I have seen startup delay programs but am wondering if there isn't a registry value that can force a delay or some other way to ensure that my program is loaded before windows startup registry and start menu items. My service is non interactive win32 set to autostart at the moment.
 #24839  by EP_X0FF
 Sun Jan 04, 2015 7:09 pm
Hello,

you can put your service in proper service group, see http://msdn.microsoft.com/en-us/library ... s.85).aspx
(key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ServiceGroupOrder)

and wait in service (ServiceStatus.dwControlsAccepted |= SERVICE_ACCEPT_SESSIONCHANGE must be set) handler for

dwControl is SERVICE_CONTROL_SESSIONCHANGE and dwEventType is WTS_SESSION_LOGON.