himselfv / viper

Enhanced Windows Service manager application
29 stars 2 forks source link

TriggerList: Disable/Enable triggers #30

Closed himselfv closed 5 years ago

himselfv commented 5 years ago

Original report by me.

I want an ability to disable/enable triggers via right-click. The menu entry is already there, just grayed out.

Disabled triggers should still be visible, but crossed out/grayed.

Since there's no way to store disabled triggers with normal ones (IIRC?) the way to disable them would probably be to formally delete them but store all the info elsewhere.

There are several approaches:

  1. Manually move/rename the registry key. Advantages: Simple action; Guarantees to preserve the trigger exactly. Disadvantages: May require more rights than editing via SC API; Unclear how to notify SC API, especially on restore (deleting is still doable).

  2. Delete/recreate with SC API and export the original data as string (probably registry export format). Store it in some unrelated place.

  3. Delete/recreate with SC API , export the original data as string but store it as a full blown registry key with subkeys (equivalent to copying).

  4. Delete/recreate with SC API, but copy the original key as a key. On restoration, export the key as a key to regedit format, then import as we normally import regedit files.

himselfv commented 5 years ago

Mostly done. Triggers are removed from the SCM and stored in an identical format in

HKLM\Software\Viper\DisabledServices\Servicename\TriggerInfo\{ID}

ID is a random guid.