CPB Mailing List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: serial number




At 11:57 PM 5/29/98 +0300, you wrote:
>thanks Steven Carlson...but i know how to GET this info...
>what i need is to SET !!! the serial number
>thanks anyway...
>
Here are some 16-bit assembler routines for Delphi 1 I used to use.  I
doubt these'll do the job on 95 and NT, but they're better than nothing, I
suppose.  Perhaps something in their bowels will point you in the right
direction.

{--------------------------------------------------------------------}
{ Returns 0 if successful, error code, otherwise.                    }
{--------------------------------------------------------------------}
function GetSerial(DiskNum: byte; var InfoBuf: TInfoBuffer): word;

assembler;
asm
  mov ah, 69h              { Operation is get disk info  }
  mov al, 00h
  mov bl, DiskNum          { Load Disk number            }
  push ds                  { Preserve DS                 }
  lds edx, InfoBuf         { Load address of InfoBuffer  }
  int 21h                  { Do it!                      }
  pop ds                   { Restore DS                  }
  jc @bad
  xor ax, ax               { Return 0 if successful      }
  @bad:
end;

{--------------------------------------------------------------------}
{ Returns 0 if successful, error code, otherwise.                    }
{--------------------------------------------------------------------}
function SetSerial(DiskNum: byte; var i: TInfoBuffer): word;

assembler;

asm
  mov ah, 69h
  mov al, 01h
  mov bl, DiskNum
  push ds
  lds dx, i
  int 21h
  pop ds
  jc @bad
  xor ax, ax
  @bad:
end;

Regards,

Michael





W Komornicki's Home Page | Main Index | Thread Index