예제 #1
0
function update_resource($file, $section, $name, $data, $lang = null)
{
    $res = "res://{$file}/{$section}/{$name}";
    if (!res_set($file, $section, $name, $data, $lang)) {
        err("Can't update '{$res}'\n");
    }
    echo "Updated '{$res}";
    if (isset($lang)) {
        echo "/{$lang}";
    }
    echo "' with " . strlen($data) . " bytes\n";
}
예제 #2
0
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");
}
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";
예제 #3
0
    $icon_group .= pack("S", $icon_count);
    for ($i = 0; $i < $icon_count; $i++) {
        $icon_group .= pack("C", $icons[$i][width]);
        $icon_group .= pack("C", $icons[$i][height]);
        $icon_group .= pack("C", $icons[$i][colors]);
        $icon_group .= pack("C", 0);
        // "RESERVED"
        $icon_group .= pack("S", $icons[$i][planes]);
        $icon_group .= pack("S", $icons[$i][bitcount]);
        $icon_group .= pack("L", $icons[$i][size]);
        $icon_group .= pack("S", $i + 1);
    }
    print "Updating icon...";
    res_set($outfile, "RT_GROUP_ICON", "#1", $icon_group);
    for ($i = 0; $i < $icon_count; $i++) {
        $worked = res_set($outfile, RT_ICON, "#" . ($i + 1), $icons[$i][data]);
    }
    print "done\n";
}
if ($option_compress) {
    print "Compressing final exe..\n";
    $upx = file_get_contents("upx.exe");
    $f = fopen("bamcompile_upx.exe", "w");
    fwrite($f, $upx);
    fclose($f);
    $stub = file_get_contents("stub.exe");
    exec("bamcompile_upx -9 {$outfile}", $out, $ret);
    if ($ret > 0) {
        print "Compression failed! Is upx.exe available?\n";
    } else {
        print "Compression done\n";