Hi All,
I have a legacy Delphi 7 project which works fine in D7, but it gives these 
errors in Lazarus 0.9.31.
Options changed, recompiling clean with -BHint: Start of reading config file 
/etc/fpc.cfgHint: End of reading config file /etc/fpc.cfgFree Pascal Compiler 
version 2.4.2-0 [2010/11/11] for i386Copyright (c) 1993-2010 by Florian 
KlaempflTarget OS: Linux for i386Compiling Project1.lprCompiling 
DVDregion1.pasDVDregion1.pas(62,13) Error: Identifier not found 
"ZeroMemory"DVDregion1.pas(63,21) Error: Identifier not found 
"GetDriveType"DVDregion1.pas(65,23) Error: Identifier not found 
"DRIVE_CDROM"DVDregion1.pas(76,28) Error: Identifier not found 
"DeviceIoControl"DVDregion1.pas(115) Fatal: There were 4 errors compiling 
module, stopping   

unit DVDregion1;
{$MODE Delphi}
interface
uses  LCLIntf, LCLType, LMessages, Classes, SysUtils, Forms, StdCtrls, Controls;
type  DVD_REGION = record    CopySystem,      RegionData, // current media 
region    SystemRegion, // current drive region    ResetCount: Byte;  end;  
PDVD_REGION = ^DVD_REGION;
const  IOCTL_DVD_GET_REGION = $335014;
type  TForm1 = class(TForm)    Memo1: TMemo;    Button1: TButton;    procedure 
Button1Click(Sender: TObject);  private    { Private declarations }  public    
{ Public declarations }  end;
var  Form1: TForm1;
implementation
{$R *.lfm}
procedure TForm1.Button1Click(Sender: TObject);const  drive_letter = 'H:';  
RegionStrings: array[0..8] of string = (    ' 0 --- No Region Code - works in 
any DVD player',    ' 1 --- United States of America, Canada',    ' 2 --- 
Europe, France, Greece, Turkey, Egypt, Arabia, Japan and South Africa',    ' 3 
--- Korea, Thailand, Vietnam, Borneo and Indonesia',    ' 4 --- Australia, New 
Zealand, Mexico, the Caribbean, and South America',    ' 5 --- India, Africa, 
Russia and former USSR countries',    ' 6 --- Peoples Republic of China',    ' 
7 --- Unused',    ' 8 --- Airlines and Cruise Ships');var  handle: THandle;  
rv, Region2Check: Integer;  region: DVD_REGION;  dw: DWORD;  status: Boolean;  
Mask: byte;begin  Memo1.Clear;  ZeroMemory(@region, SizeOf(DVD_REGION));  rv := 
GetDriveType(drive_letter);
  if rv = DRIVE_CDROM then    Memo1.Lines.Add('Drive is a CD/DVD drive');
  handle := FileCreate('\\.\' + drive_letter); { *Converted from CreateFile*  }
  if handle = INVALID_HANDLE_VALUE then  begin    Memo1.Lines.Add('Cannot open 
the drive');    Exit;  end;
  status := DeviceIoControl(    handle, // handle to device    
IOCTL_DVD_GET_REGION, // dwIoControlCode    nil, // lpInBuffer    0, // 
nInBufferSize    @region, // output buffer    SizeOf(DVD_REGION), // buffer 
size    dw, // number of bytes returned    nil);
  if not status then  begin    FileClose(handle); { *Converted from 
CloseHandle*  }    Memo1.Lines.Add('DevIoControl Failed');    Exit;  end;
  Memo1.Lines.Add('The Region and Code for this DVD :');  Memo1.Lines.Add('');  
Memo1.Lines.Add('Code - Region');
  if region.RegionData and $3F = 0 then    Memo1.Lines.Add(RegionStrings[0])  
else  begin    Mask := 1;    for Region2Check := 1 to 8 do    begin      if 
region.RegionData and Mask = 0 then        
Memo1.Lines.Add(RegionStrings[Region2Check]);      Mask := Mask shl 1;    end;  
end;
  FileClose(handle); { *Converted from CloseHandle*  }end;
end.
Best Regards,Peter E Williams

                                          
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to