1
2 unit Unit1;
3
4 interface
5
6 uses
7 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
8 Dialogs, StdCtrls;
9
10 type
11 TForm1 = class(TForm)
12 Button1: TButton;
13 OpenDialog1: TOpenDialog;
14 procedure Button1Click(Sender: TObject);
15 private
16 { Private declarations }
17 public
18 { Public declarations }
19 end;
20
21 var
22 Form1: TForm1;
23
24 implementation
25
26 {$R *.dfm}
27
28 procedure RemoveCDXByte( dbFile : string );
29 const
30 Value: Byte = 0;
31 CDXoffSet = 28;
32 var
33 F: file of Byte;
34 handle: integer;
35 buffer:Char;
36 begin
37
38 handle := FileOpen( dbFile,fmOpenReadWrite+fmShareExclusive );
39
40 if( handle > 0 ) then
41 begin
42 try
43 FileSeek( handle,CDXoffSet,0 );
44 FileRead( handle,buffer,1);
45 if ( buffer = #1 ) then //checks if index marker exists
46 begin
47 FileSeek( handle,CDXoffSet,0);
48 buffer := #0; //sets detach marker file
49 FileWrite( handle,buffer,1 );//writes detach marker in table file
50 end;
51 finally
52 FileClose(handle);
53 end;
54 end;
55
56 end;
57
58
59 procedure TForm1.Button1Click(Sender: TObject);
60 begin
61 if OpenDialog1.Execute then begin
62 RemoveCDXByte( OpenDialog1.FileName);
63 end;
64
65 end;
66
67 end.
|