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");
}
for ($i = 0; $i < count($list); $i++) {
    echo $list[$i] . "\n";
    $res = res_list($h, $list[$i]);
    for ($j = 0; $j < count($res); $j++) {
        echo "\t" . $res[$j] . "\n";
    }
}
echo "Res get: " . res_get($h, 'A_TYPE', 'A_RC_NAME') . "\n\n";
res_close($h);
Example #2
0
 function exeversion_resopen($file)
 {
     if (function_exists('res_list_type') or loadPhpExtension('win32std')) {
         // See http://msdn.microsoft.com/workshop/networking/predefined/res.asp
         $v = file_get_contents('res://' . realpath($file) . urlencode('/RT_VERSION/#1'));
         if ($v) {
             // This is really a binary VERSIONINFO block, with lots of
             // nul bytes (widechar) which cannot be transported as string.
             return "{$v}";
         } else {
             $h = res_open(realpath($file));
             $v = res_get($h, 'RT_VERSION', 'FileVersion');
             res_close($h);
             if ($v) {
                 return $v;
             }
             $h = res_open(realpath($file));
             $v = res_get($h, '#1', 'RT_VERSION', 1);
             res_close($h);
             if ($v) {
                 return $v;
             }
         }
         /* The version consists of two 32-bit integers, defined by four 16-bit integers. 
            For example, "FILEVERSION 3,10,0,61" is translated into two doublewords: 
            0x0003000a and 0x0000003d, in that order. */
         /*	    
         	$h = res_open(realpath($file));
         	    
         	echo "Res list of '$file': \n";
         	$list= res_list_type($h, true);
         	if( $list===FALSE ) err( "Can't list type" );
         	
         	for( $i= 0; $i<count($list); $i++ ) {
         		echo $list[$i]."\n";
         		$res= res_list($h, $list[$i]);
         		for( $j= 0; $j<count($res); $j++ ) {
         			echo "\t".$res[$j]."\n";
         		}
         	}
         	echo "Res get: ".res_get( $h, 'A_TYPE', 'A_RC_NAME' )."\n\n";
         	res_close( $h );	    
         */
         if ($v) {
             return "{$v}";
         } else {
             return "";
         }
     } else {
         return "";
     }
 }
Example #3
0
<?php

if (!extension_loaded('res_ext')) {
    dl('res_ext.dll');
}
$module = 'res_ext';
if (extension_loaded($module)) {
    $str = "module loaded";
} else {
    $str = "Module {$module} is not compiled into PHP";
}
echo "{$str}\n";
$i = res_create();
echo res_get($i);