Jak ma wyglądać kod źródłowy dll-ki, który ma nadpisać plikiem aaa.dll z C:\A plik aaa.dll znajdujący się w c:\Tmp
? hmm...
Za pomoc z góry dziękuję... :-) --Pozdrawiam
Pracuję w Delphi 6
Pracuję w Delphi 6
Na przyklad tak:
library Podmianka;
uses
SysUtils,
Classes;
function podmien (plik1, plik2 : pChar):boolean; stdcall;
//nadpisuje plik1 na plik 2
var
F, G: file of byte;
Buffer : string;
Count :integer;
begin
Result:=False;
if FileExists(plik1) then
begin
SetLength(Buffer, 16384);
if FileExists(plik2) then
DeleteFile(plik2);
Assign(F, plik1);
Assign(G, plik2);
Reset(F);
Rewrite(G);
repeat
BlockRead(F,Buffer[1],Length(Buffer),Count);
BlockWrite(G,Buffer[1],Count);
until Count=0;
CloseFile(F);
CloseFile(G);
Result:=True;
end;
end;
exports
podmien;
begin
end.
--Pawel
Delphi6