Hallchen,

als erstes zum beispiel: es fhrt eine als typ "BINRES" enthaltene BAT-datei,
die nach C:\Test.bat extrahiert wird aus. und zwar wird sie einmal aus der
beiliegenden DLL und einmal aus der EXE selbst extrahiert.

also, nachdem ich nun zu BINRES schon mehr als einmal nachfragen erhalten habe,
habe ich beschlossen eine kurzerlrung zum source dazuzustellen.

also hier erstmal die funktion:

--------------------------------------------------------------------------------
function ExtractResTo(Instance: hInst; BinResName, NewPath, ResType: string):
  boolean;
(*******************************************************************************
 Function:   ExtractResTo
 Returns:    Boolean (true=success)
 Version:    Function version 3.0

 Parameters
 Instance:   is the instance handle of the module containing the resource. if not
             current module, use LLoadLibrary() and FreeLibrary() to load and free
             the module containing the resource.
 BinResName: is the name of the resource to extract. this would even work with
             icons, cursors, texts, yaddayadda ...
 NewPath:    path of the file to create from the resource (where to put the
             file)
 ResType:    resource type. pre-defined values can be found in Windows.pas
             e.g. RT_RCDATA
 *******************************************************************************)
var
  ResSize,
    HG,
    HI,
    SizeWritten,
    hFileWrite: Cardinal;
begin
  result := false;
  HI := FindResource(Instance, @binresname[1], @ResType[1]);
  if HI <> 0 then begin
    HG := LoadResource(Instance, HI);
    if HG <> 0 then
    try
      ResSize := SizeOfResource(Instance, HI);
      hFileWrite := CreateFile(@newpath[1], GENERIC_READ or GENERIC_WRITE,
        FILE_SHARE_READ or FILE_SHARE_WRITE, nil, CREATE_ALWAYS,
        FILE_ATTRIBUTE_ARCHIVE, 0);
      if hFileWrite <> INVALID_HANDLE_VALUE then
      try
        result := (WriteFile(hFileWrite, LockResource(HG)^, ResSize,
          SizeWritten, nil) and (SizeWritten = ResSize));
      finally
        CloseHandle(hFileWrite);
      end;
    except;
    end;
  end;
end;
--------------------------------------------------------------------------------

UND WEITER, der rckgabewert gibt den erfolg an. TRUE = Erfolg.

als parameter werden verlangt, das instanzenhandle des moduls (Instance;
hInstance wenn die ressource im gleichen modul liegt wie der aufrufende code),
der name der ressource (BinResName), der pfad in den die ressource gespeichert
werden soll.

