$registry->SetQWORDValue(Registry::HKCU, $test_key, 'QWORDValue', 1); check_error(); // 3.f) Create the HKCU\TestRegistry\Values\StringValue key $registry->SetStringValue(Registry::HKCU, $test_key, 'StringValue', 'this is a sample string value'); check_error(); // 4.a) Create the HKCU\TestRegistry\Values\WShellStringValue key $registry->SetValue(Registry::HKCU, $test_key, 'WShellStringValue', 'this is a sample WSHELL string value', Registry::REG_SZ); check_error(); // 4.b) Create the HKCU\TestRegistry\Values\WShellExpandedStringValue key $registry->SetValue(Registry::HKCU, $test_key, 'WShellExpandedStringValue', 'this is a sample WSHELL expanded string value, WINDIR = %WINDIR%', Registry::REG_EXPAND_SZ); check_error(); // 4.c) Create the HKCU\TestRegistry\Values\WShellDWORDValue key $registry->SetValue(Registry::HKCU, $test_key, 'WShellDWORDValue', 0x1020304, Registry::REG_DWORD); check_error(); // 5) Enumerate all the values in the HKCU\TestRegistry\Values key with their type $keys = $registry->EnumValues(Registry::HKCU, $test_key, false); check_error(); echo "Created values :{$eol}"; foreach ($keys as $key => $type) { echo "{$tab}{$key} ({$type}){$eol}"; } // 6) Enumerate all the values in the HKCU\TestRegistry\Values key, using registry value objects $keys = $registry->EnumValuesEx(Registry::HKCU, $test_key); check_error(); echo "Created RegistryValue objects :{$eol}"; foreach ($keys as $value) { echo "{$tab}" . str_replace("{$eol}", "{$eol}{$tab}", print_r($value, true)); } // 7) Retrieve created key values - You must known the type of each key before doing that, or else use the GetValue() method, // which works only on REG_SZ, REG_EXPAND_SZ, REG_DWORD and REG_BINARY types. echo "Created values :{$eol}";