Windows Registry เป็นฐานข้อมูลเก็บการตั้งค่าระบบ ฮาร์ดแวร์ ซอฟต์แวร์ User preferences เป็นต้น แทนไฟล์ .INI เก่าที่กระจายอยู่ทั่วระบบ
โครงสร้าง Registry
5 Root Keys:
- HKEY_CLASSES_ROOT (HKCR) - File associations, COM objects
- HKEY_CURRENT_USER (HKCU) - Settings ของ User ปัจจุบัน
- HKEY_LOCAL_MACHINE (HKLM) - Settings ระดับเครื่อง (All users)
- HKEY_USERS (HKU) - Profiles ทุก User
- HKEY_CURRENT_CONFIG (HKCC) - Hardware profile ปัจจุบัน
Root Keys มี Subkeys (อาจมี Subkeys ย่อย) และมี Default Value อย่างน้อย 1 ค่า Key + Subkeys + Values = Hive
Hive files เก็บใน C:\Windows\System32\config\ โหลดเข้าหน่วยความจำตอน Boot/Logon
Data Types ใน Registry
- REG_SZ - String (Unicode/ANSI)
- REG_BINARY - Binary data (0/1)
- REG_DWORD - 32-bit number (0 to 2³²)
- REG_QWORD - 64-bit number
- REG_MULTI_SZ - Multiple strings
- REG_EXPAND_SZ - String มี Environment variable (เช่น %SystemRoot%)
Registry Virtualization (Vista+)
ป้องกันแอปเขียน System folders / Machine-wide keys (HKLM\Software) โดย Redirect ไป HKCR\VirtualStore\Machine\Software แบบเงียบๆ (UAC ใช้ฟีเจอร์นี้) ช่วย Security และป้องกัน Registry Bloat
Kernel Transaction Manager รองรับ Transactional Registry (Rollback) สำหรับ Developers
Registry Editor (regedit)
เครื่องมือหลักจัดการ Registry ไม่มี Confirm prompt** การเปลี่ยนแปลงมีผลทันที ต้องระมัดระวัง
Key สำคัญ: HKLM\System\CurrentControlSet (Backup ไว้สำหรับ Last Known Good Configuration)
อ่านเพิ่มเติม: ซ่อม Registry เสีย, Backup/Restore, Monitor Changes, Registry Tweaks, Emojis in Registry path