Uso de la devolución de llamada para mostrar los nombres de archivos de la descompresión externa dll (Inno Setup)

Originalmente preguntadoaquí, pero se le pidió que lo presentara como una pregunta aparte.

Tengo la siguiente dll codificada en C a continuación que estoy usando en un instalador Inno Setup para extraer archivos de juegos. Este es un instalador de reemplazo para un juego que originalmente usó un instalador de 16 bits y los archivos se copian de un CD-ROM. Me gustaría poder usarInnoTools InnoCallback para mostrar los nombres de archivos extraídos usando mi dll, pero como esta es mi primera incursión en la codificación C, no tengo idea de cómo hacerlo. Un ejemplo de esta funcionalidad se puede encontrar aquí:http://freearc.org/InnoSetup.aspx

Me gustaría poder configurar WizardForm.FilenameLabel.Caption usando el nombre de archivo de mi dll externo.

Secciones relevantes de mi script Inno Setup:

function VolEx( filename, outputpath: String ): Integer; external 'VolEx@files:volex.dll stdcall';

(DriveLetter es la ruta para el CD-ROM, es decir, "D: \", por lo que la salida actualmente muestra "D: \ world \ archive.vol". La salida a la que aspiro es "C: \ game-path \ world \ archive \ archivo.ext ")

procedure VolExtract();
begin
  if not DirExists(WizardDirValue() + '\' + Worlds[w]) then
  begin
    CreateDir(WizardDirValue() + '\' + Worlds[w]);
  end;
  for n := 0 to 3 do begin
    WizardForm.FilenameLabel.Caption := DriveLetter + Worlds[w] + '\' + Reslists[n] + '.vol';

    if VolEx(DriveLetter + Worlds[w] + '\' + Reslists[n] + '.vol', WizardDirValue() + '\' + Worlds[w] + '\' + Reslists[n]) <> 0 then
    begin
      // Handle Fail
      MsgBox(CustomMessage('FileErr'), mbInformation, MB_OK);
      WizardForm.Close;
    end;

VolEx.c (incluye blast.c y blast.h desde aquí:https://github.com/madler/zlib/tree/master/contrib/blast)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <sys/stat.h>
#include <time.h>
#include <utime.h>
#include "blast.h"

#define local static
#define VOLID "RESLIST"

struct inbuf {
    unsigned long left;
    unsigned char *buf;
    unsigned size;
    FILE *in;
};

struct stat statbuf;
time_t mtime;
time_t voltime;
struct utimbuf new_times;

local unsigned inf(void *how, unsigned char **buf)
{
    unsigned len;
    struct inbuf *inb = how;

    len = inb->size > inb->left ? inb->left : inb->size;
    len = fread(inb->buf, 1, len, inb->in);
    inb->left -= len;
    *buf = inb->buf;
    return len;
}

local int outf(void *how, unsigned char *buf, unsigned len)
{
    return fwrite(buf, 1, len, (FILE *)how) != len;
}

#define BUFSIZE 16384   /* must fit in unsigned */

local int extract(char *name, unsigned long len, FILE *in, const char *path, time_t prevtime)
{
    int err;
    FILE *out;
    struct inbuf inb;
    unsigned char buf[BUFSIZE];

    inb.left = len;
    inb.buf = buf;
    inb.size = BUFSIZE;
    inb.in = in;
    mkdir(path);
    char outPath[strlen(path) + 20];
    strcpy(outPath, path);
    strcat(outPath, "\\");
    strcat(outPath, name);
    out = fopen(outPath, "wb");
    if (out == NULL)
        return 2;
    err = blast(inf, &inb, outf, out);
    fclose(out);
    if (stat(outPath, &statbuf) < 0) {
        perror(outPath);
        return 1;
    }
    mtime = statbuf.st_mtime; /* seconds since the epoch */

    new_times.actime = statbuf.st_atime; /* keep atime unchanged */
    new_times.modtime = prevtime;    /* set mtime to current time */
    if (utime(outPath, &new_times) < 0) {
        perror(outPath);
        return 1;
    }
    return err;
}

int __stdcall __declspec(dllexport) VolEx(const char *filename, const char *outputpath)
{
    FILE *in = fopen(filename,"rb");
    unsigned long off, next;
    int err;
    unsigned char head[24];

    if (stat(filename, &statbuf) < 0) {
        perror(filename);
        return 1;
    }
    voltime = statbuf.st_mtime; /* seconds since the epoch */

    if (fread(head, 1, 8, in) != 8 || memcmp(head, VOLID, 8)) {
        /* fprintf(stderr, "not the expected .vol format\n"); */
        return 1;
    }
    off = 8;
    while ((next = fread(head, 1, 24, in)) == 24) {
        off += 24;
        next = head[20] + (head[21] << 8) + ((unsigned long)(head[22]) << 16) +
           ((unsigned long)(head[23]) << 24);

        head[20] = 0;
        err = extract((char *)head, next - off, in, outputpath, voltime);
        if (err) {
            /* fprintf(stderr, "extraction error %d on %s\n", err, head); */
            return 1;
        }
        off = next;
    }
    /* if (next)
        fprintf(stderr, "%lu bytes ignored at the end\n", next); */
    return 0;
}

Respuestas a la pregunta(1)

Su respuesta a la pregunta