HKLMとHKCU Runキーについてのメモ

HKLMとHKCU Runキーについて以下のような記述を見かけた。

"Run" keys are simple and intuitive - they point to an executable file that will be launched either upon bootup (if within the HKLM hive) or upon user login (if within a user's NTUSER.DAT hive)

use the Local Machine registry locations instead of the Current User as the payload will executed every time that the system boots

これを見るとHKCUのRunキーはユーザーのログオン時に実行されて、HKLMのRunキーはマシンの起動時に実行されるような印象を受けるが(upon bootupとかsystem bootsとか書いてあるので)、HKLMとHKCU Runキーはどちらもユーザーのログオン時に実行される。

両者の違いとして、HKCU Runキーは特定のユーザーアカウントがログオンしたときにのみ実行されるが、HKLM Runキーはあらゆるユーザーアカウントのログオン時に実行される。

Windows 7にてHKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Runに以下のエントリを追加したところ、マシン起動時とログオン時の両方でtest.txtがメモ帳で開かれた。

以上。

Leave a Reply

Your email address will not be published. Required fields are marked *