[Lazarus] Lazarus errors -- DVD procedure identifiers.

Daniel Franzini daniel.franzini at gmail.com
Thu Apr 7 22:20:51 CEST 2011


It seems that these functions and constants you are using are from Windows
unit.

Did you tried to include it in your uses clause?

2011/4/7 Peter Williams <pewilliams2010 at live.com>

>  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 -B
> Hint: Start of reading config file /etc/fpc.cfg
> Hint: End of reading config file /etc/fpc.cfg
> Free Pascal Compiler version 2.4.2-0 [2010/11/11] for i386
> Copyright (c) 1993-2010 by Florian Klaempfl
> Target OS: Linux for i386
> Compiling Project1.lpr
> Compiling DVDregion1.pas
> DVDregion1.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
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>


-- 
Daniel

"Let us change our traditional attitude to the construction of programs.
Instead of imagining that our main task is to instruct a computer what to
do, let us concentrate rather on explaining to human beings what we want a
computer to do." (Donald Knuth)

"Yes, technogeeks can be funny, even if only to each other." (
http://www.boogieonline.com/revolution/science/humor/)"

"Man is driven to create; I know I really love to create things. And while
I'm not good at painting, drawing, or music, I can write software."
(Yukihiro Matsumoto, a.k.a. ``Matz'')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110407/14947dec/attachment-0003.html>


More information about the Lazarus mailing list