Example #1
0
 function __destruct()
 {
     if ($this->r) {
         reg_close_key($this->r);
         $this->r = false;
     }
 }
 function stdapi_registry_close_key($req, &$pkt)
 {
     if (is_windows() and is_callable('reg_open_key')) {
         global $registry_handles;
         my_print("doing stdapi_registry_close_key");
         $key_id_tlv = packet_get_tlv($req, TLV_TYPE_ROOT_KEY);
         $key_id = $key_id_tlv['value'];
         reg_close_key($registry_handles[$key_id]);
         deregister_registry_key($key_id);
         return ERROR_SUCCESS;
     } else {
         return ERROR_FAILURE;
     }
 }
$strMainKey = 'Control Panel';
$mainKey = reg_open_key(HKEY_CURRENT_USER, $strMainKey);
if (!$mainKey) {
    err("Can't open '{$strMainKey}' !");
}
echo "'{$strMainKey}' Key opened\n\nKeys:\n";
print_r(reg_enum_key($mainKey));
for ($i = 0; $key = reg_enum_key($mainKey, $i); $i++) {
    echo "\t{$key}\n";
}
echo "\nValues:\n";
print_r(reg_enum_value($mainKey));
for ($i = 0; $value = reg_enum_value($mainKey, $i); $i++) {
    echo "\t{$value}=" . reg_get_value($mainKey, $value) . "\n";
}
reg_close_key($mainKey);
/* Res exemple */
$file = realpath('test_resourceDll.dll');
if (empty($file)) {
    err('The res exemple need a file !');
}
res_set($file, 'A_TYPE', 'A_RC_NAME', 'The time: ' . date('d-m-Y h:i'));
echo "Res Stream read: " . file_get_contents('res://' . $file . '/A_TYPE/A_RC_NAME') . "\n\n";
$h = res_open($file);
if (!$h) {
    err("can't open " . $file);
}
echo "Res list of '{$file}': \n";
$list = res_list_type($h, true);
if ($list === FALSE) {
    err("Can't list type");