• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

Copy Protect a Floppy.

Hi Guy's,

This question must have been asked a 1000 times, but I will ask anyway.

Is it possible to protect a floppy disk so it cannot be copied after a certain date?.


300 Points for a solution.

Asw
0
Asw
Asked:
Asw
  • 3
  • 3
  • 2
  • +2
1 Solution
 
EpsylonCommented:
1001x no!
0
 
k6__Commented:
yes but nobody will post code here..
0
 
AswAuthor Commented:
Hi K2,

If you post me the code then the points
are yours.

andy@duralead.com

Asw
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
JaymolCommented:
Can you forward that to me too?

(jaymol@hotmail.com)

I've done some no-copy stuff before, but never this kind of thing.  If there is a way to do it, I wanna know!

Ta,

John.
0
 
intheCommented:
hi,
no one post code hehe:


you can use this first code to check the floppy serial number (just add a if date is up function)
taken from:

http://inthe.future.easyspace.com/delphi/floppy.html


unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}
function SerialNum(Drive : Char) : String;
var VolumeName : String;
SerialNumber : Integer;
a, b : Integer;
s : String;
begin
SetLength(VolumeName, MAX_PATH);
SerialNumber := 0;
s := Drive + ':\';
GetVolumeInformation(PChar(s), PChar(VolumeName), MAX_PATH,
@SerialNumber, a, b, nil, MAX_PATH);
{See help files for more info on GetVolumeInformation ,
it can be used on all drive types}
Result := Format('%2.2x', [SerialNumber]);  
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
//showmessage(serialnum('a');
if (serialnum('a') <> '1A1A12F6') then close else showmessage('program running from correct drive');
end;

end.







and can use this code to change the floppy serial number when date is up to stop the program running:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics,
  Controls, Forms, Dialogs, StdCtrls, ComCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

const
  VWin32_DIOC_DOS_Int25 = 2;  // direct read access
  VWin32_DIOC_DOS_Int26 = 3;  // direct write access

type
  TDevIoCtl_Reg = packed Record
  Reg_EBX   : DWord;
  Reg_EDX   : DWord;
  Reg_ECX   : DWord;
  Reg_EAX   : DWord;
  Reg_EDI   : DWord;
  Reg_ESI   : DWord;
  Reg_Flags : DWord;
end;

type
  TDiskIO = packed record
  StartSektor    : DWord;
  AnzahlSektoren : Word;
  PBuffer        : DWord;
end;

implementation

{$R *.DFM}


// read boot sector, change serial number, and
// write boot sector back

procedure TForm1.Button1Click(Sender: TObject);
var
  DevIoHandle   : THandle;
  BytesReturned : DWord;
  Reg           : TDevIoCtl_Reg;
  DiskIO        : TDiskIO;
  DatenBuffer   : Array [0..511] of Byte;   //  = 512 Bytes

  // The size of one sector can be found out with GetDiskFreeSpace
  // (normaly = 512 bytes, CD-ROMs = 2048 bytes).

begin

  // initialize DiskIO and Reg

  with DiskIO do
    begin
      StartSektor := 0;          //  from sector 0
      AnzahlSektoren := 1;       // read 1 sector
      PBuffer := DWord(@DatenBuffer);
    end;

  with Reg do
    begin
      Reg_EAX := 0;              // drive: 0 = A, 1 = B etc.
      Reg_EBX := DWord(@DiskIO);
      Reg_ECX := $FFFF;          //  use DiskIO
    end;

  // retrieve handle for DeviceIoControl

  DevIoHandle := CreateFile(
                 '\\.\vwin32',
                 Generic_Read,
                 File_Share_Read or File_Share_Write,
                 nil,
                 Open_Existing,
                 File_Attribute_Normal,
                 0);

  // only proceed, if handle is valid

  if DevIoHandle <> Invalid_Handle_Value then
    begin

      // direct read access

      DeviceIoControl(DevIoHandle,
                      VWin32_DIOC_DOS_Int25,
                      @Reg,
                      SizeOf(Reg),
                      @Reg,
                      SizeOf(Reg),
                      BytesReturned,
                      nil);

      // new serial number = $12345678

      DatenBuffer[39] := $78;
      DatenBuffer[40] := $56;
      DatenBuffer[41] := $34;
      DatenBuffer[42] := $12;
      // direct write access

      DeviceIoControl(DevIoHandle,
                      VWin32_DIOC_DOS_Int26,
                      @Reg,
                      SizeOf(Reg),
                      @Reg,
                      SizeOf(Reg),
                      BytesReturned,
                      nil);
      // release handle

      CloseHandle(DevIoHandle);
    end;
end;

end.



Hope it helps someone..
Regards Barry :-)
0
 
k6__Commented:
Sorry. I accidently answered my comment..
anyway the best way to protect the floppy
is to have direct access to it! so you
need components that it will give you
direct access to it ...
go to -> http://hey.to/ants

Now i think the rest can be done easly!

0
 
k6__Commented:
oh about can't be copied after some days
the answer is no... the only way is to
set into your program to stop functining
after some days... there are plenty
components that do this!
0
 
AswAuthor Commented:
Thanks K2,

But I was looking for some code.

Asw
0
 
AswAuthor Commented:
Hi Inthe,

Can you post a couple of lines as an
answer.

Many thanks

Asw
0
 
intheCommented:
ok cheers,
glad the routines helped :-)
Regards Barry
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now