registry.pl 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #
  2. # these are constants for use in accessing the NT Registry database.
  3. #
  4. #
  5. # standard access types
  6. #
  7. $READ_CONTROL = 0x00020000;
  8. $SYNCHRONIZE = 0x00100000;
  9. $STANDARD_RIGHTS_REQUIRED = 0x000F0000;
  10. $STANDARD_RIGHTS_READ = $READ_CONTROL;
  11. $STANDARD_RIGHTS_WRITE = $READ_CONTROL;
  12. $STANDARD_RIGHTS_EXECUTE = $READ_CONTROL;
  13. $STANDARD_RIGHTS_ALL = 0x001F0000;
  14. $SPECIFIC_RIGHTS_ALL = 0x0000FFFF;
  15. #
  16. # pre-defined registry keys
  17. #
  18. $HKEY_CLASSES_ROOT = 0x80000000;
  19. $HKEY_CURRENT_USER = 0x80000001;
  20. $HKEY_LOCAL_MACHINE = 0x80000002;
  21. $HKEY_USERS = 0x80000003;
  22. $HKEY_PERFORMANCE_DATA = 0x80000004;
  23. #
  24. # Open/Create Options
  25. #
  26. $REG_OPTION_RESERVED = 0x00000000; # Parameter is reserved
  27. $REG_OPTION_NON_VOLATILE = 0x00000000; # Key is preserved
  28. # when system is rebooted
  29. $REG_OPTION_VOLATILE = 0x00000001; # Key is not preserved
  30. # when system is rebooted
  31. $REG_OPTION_CREATE_LINK = 0x00000002; # Created key is a
  32. # symbolic link
  33. #
  34. # Key creation/open disposition
  35. #
  36. $REG_CREATED_NEW_KEY = 0x00000001; # New Registry Key created
  37. $REG_OPENED_EXISTING_KEY = 0x00000002; # Existing Key opened
  38. #
  39. # Key restore flags
  40. #
  41. $REG_WHOLE_HIVE_VOLATILE = 0x00000001; # Restore whole hive volatile
  42. $REG_REFRESH_HIVE = 0x00000002; # Unwind changes to last flush
  43. #
  44. # Notify filter values
  45. #
  46. $REG_NOTIFY_CHANGE_NAME = 0x00000001; # Create or delete (child)
  47. $REG_NOTIFY_CHANGE_ATTRIBUTES = 0x00000002;
  48. $REG_NOTIFY_CHANGE_LAST_SET = 0x00000004; # time stamp
  49. $REG_NOTIFY_CHANGE_SECURITY = 0x00000008;
  50. $REG_LEGAL_CHANGE_FILTER = $REG_NOTIFY_CHANGE_NAME |
  51. $REG_NOTIFY_CHANGE_ATTRIBUTES |
  52. $REG_NOTIFY_CHANGE_LAST_SET |
  53. $REG_NOTIFY_CHANGE_SECURITY;
  54. #
  55. #
  56. # Predefined Value Types.
  57. #
  58. $REG_NONE = 0; # No value type
  59. $REG_SZ = 1; # Unicode nul terminated string
  60. $REG_EXPAND_SZ = 2; # Unicode nul terminated string
  61. # (with environment variable references)
  62. $REG_BINARY = 3; # Free form binary
  63. $REG_DWORD = 4; # 32-bit number
  64. $REG_DWORD_LITTLE_ENDIAN = 4; # 32-bit number (same as REG_DWORD)
  65. $REG_DWORD_BIG_ENDIAN = 5; # 32-bit number
  66. $REG_LINK = 6; # Symbolic Link (unicode)
  67. $REG_MULTI_SZ = 7; # Multiple Unicode strings
  68. $REG_RESOURCE_LIST = 8; # Resource list in the resource map
  69. $REG_FULL_RESOURCE_DESCRIPTOR = 9;# Resource list in the hardware description
  70. #
  71. # Registry Specific Access Rights.
  72. #
  73. $KEY_QUERY_VALUE = 0x0001;
  74. $KEY_SET_VALUE = 0x0002;
  75. $KEY_CREATE_SUB_KEY = 0x0004;
  76. $KEY_ENUMERATE_SUB_KEYS = 0x0008;
  77. $KEY_NOTIFY = 0x0010;
  78. $KEY_CREATE_LINK = 0x0020;
  79. $KEY_READ = ($STANDARD_RIGHTS_READ |
  80. $KEY_QUERY_VALUE |
  81. $KEY_ENUMERATE_SUB_KEYS |
  82. $KEY_NOTIFY)
  83. &
  84. ~$SYNCHRONIZE;
  85. $KEY_WRITE = ($STANDARD_RIGHTS_WRITE |
  86. $KEY_SET_VALUE |
  87. $KEY_CREATE_SUB_KEY)
  88. &
  89. ~$SYNCHRONIZE;
  90. $KEY_EXECUTE = $KEY_READ & (~$SYNCHRONIZE);
  91. $KEY_ALL_ACCESS = ($STANDARD_RIGHTS_ALL |
  92. $KEY_QUERY_VALUE |
  93. $KEY_SET_VALUE |
  94. $KEY_CREATE_SUB_KEY |
  95. $KEY_ENUMERATE_SUB_KEYS |
  96. $KEY_NOTIFY |
  97. $KEY_CREATE_LINK)
  98. &
  99. (~$SYNCHRONIZE);
  100. 1;