These should help: GMT_GUICMD_START_AS_CHECK, GMT_GUICMD_OPEN_SLOT_COVER, GMT_GUICMD_LOCK_OFF.
I didn't play much with them (they are Canon events sent at shutdown), but would be nice to have a core API that tells how the shutdown was done. The harder part is testing it on all models (it's not exactly something that can be automated, and is unlikely to be widely used, to get good testing coverage).