From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,d0077c2a3f44fc09 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Port LPT + ADA (whta do I wrong?) Date: Sat, 4 Dec 2004 21:20:21 +0100 Organization: cbb software GmbH Message-ID: <1gr5159dmj2vk.5tkxiw6kxrmv.dlg@40tude.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Trace: individual.net oGLwBSWHIQjny6faaV3tdAuMANwjs4PwJzPeLnPqKODVwGix4= User-Agent: 40tude_Dialog/2.0.12.1 Xref: g2news1.google.com comp.lang.ada:6760 Date: 2004-12-04T21:20:21+01:00 List-Id: On Sat, 4 Dec 2004 19:05:44 +0100, S�awo - MIR wrote: > Maybe someone tell me what do I wrong (??), or maybe everything is wrong ;-) Only Hungarian notation is wrong! (:-)) > These are the fragments of my code: > > Variables: > > hLPT : Win32.Winnt.HANDLE; > struktura : Win32.Winbase.LPOVERLAPPED; ^^^^^^^^^^^^^^ This is a pointer! I presume (depending on the Win32 bindings, you are using) it should be: struktura : aliased Win32.Winbase.OVERLAPPED; > read : aliased DWORD; > > type LPT1_Bajt is record > Busy : boolean; > ACK : boolean; > Paper : boolean; > Sel : boolean; > Error : boolean; > Trzy_z : boolean; > end record; > > for LPT1_Bajt use record > Busy at 0 range 7..7; --pin 11 (zanegowany) > ACK at 0 range 6..6; --pin 10 > Paper at 0 range 5..5; --pin 12 > Sel at 0 range 4..4; --pim 13 > Error at 0 range 3..3; --pin 15 > Trzy_z at 0 range 0..2; --trzy zera na poczatku > end record; > > Reading from LPT Port: > > st : aliased LPT1_Bajt; > > struktura.OffsetHigh := 16#379#; > > !!!! In this place (after compiling, building and runnig it) appears an > error: "CONSTRAINT_ERROR access check failed" !!!! Yes, because structura = null > if Win32.Winbase.Readfile(hLPT, st'address, Dword(1), read'access, > struktura) = That should be structura'Access, accordingly. > Win32.False then > Put_Line ("Nie udalo sie odpalic LPT"); > raise LPT_Error; > end if; > > Opening LPT port: > > hLPT := Win32.Winbase.CreateFile ( CP ("LPT1" & ASCII.Nul), > Win32.Winnt.GENERIC_READ, > 0, > null, > Win32.Winbase.OPEN_EXISTING, > Win32.Winbase.FILE_FLAG_OVERLAPPED, > System.Null_Address); -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de