Search code examples
c++windowswinapiregistrywindows-explorer

How to tell if my process was started from Windows autorun key?


I'm curious if there's a way to know from within my process if it was started from a Windows autorun key?

This one: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run

EDIT: After posting this question, I discovered that evidently there's a way to find out. Process Explorer knows it somehow:

enter image description here

Or does it simply scan the registry, looking for a match?


Solution

  • Typically you would do this by arranging that the command line for your autorun registry key passed a special argument to indicate that you were starting from autorun. That's your only viable option.