To program a System Service you need to see ADTF System SDK!
Also an example but more in a supported and productive purpose: