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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,72a0bc6240d264e3 X-Google-Attributes: gid103376,public From: "Jeffrey D. Cherry" Subject: Re: Access and alias Date: 2000/04/05 Message-ID: <38EBAC6E.FDB88D36@utech.net>#1/1 X-Deja-AN: 607250532 Content-Transfer-Encoding: 7bit References: <86d7o5ae23.fsf@ppp-169-201.villette.club-internet.fr> To: NANCY HEHIR X-Accept-Language: en,pdf Content-Type: text/plain; charset=us-ascii X-Trace: azure.impulse.net 954969212 192 207.154.67.102 Organization: Logicon MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-04-05T00:00:00+00:00 List-Id: I haven't tested the following procedure, but it should work. You'll have to supply the necessary code to modify the device control block fields the way you want. The procedure also demonstrates one way of using the Win32 API without resorting to 'address attributes. I prefer this method since it explicitly shows that I'm performing an unchecked operation, and messing around with addresses. Let me know if/how it works. -- file Change_Comm_State.ads with Win32.Winbase; with Win32.Winnt; procedure Change_Comm_State( Handle : in Win32.Winnt.HANDLE; Status : out Win32.DWORD); -- file Change_Comm_State.adb with Win32.Winerror; procedure Change_Comm_State( Handle : in Win32.Winnt.HANDLE; Status : out Win32.DWORD) is use type Win32.BOOL; Device_Control_Block : aliased Win32.Winbase.DCB; Result : Win32.BOOL; begin -- Change_Comm_State Status := Win32.Winerror.NO_ERROR; -- Get the current state of the comm device. Result := Win32.Winbase.GetCommState(Handle, Device_Control_Block'unchecked_access); if Result = Win32.FALSE then Status := Win32.Winbase.GetLastError; else -- Modify Device_Control_Block as necessary. -- Set the comm device state. Result := Win32.Winbase.SetCommState(Handle, Device_Control_Block'unchecked_access); if Result = Win32.FALSE then Status := Win32.Winbase.GetLastError; end if; end if; end Change_Comm_State; -- Regards, Jeffrey D. Cherry Senior IV&V Analyst Logicon Space and Information Operations Logicon Inc. a Northrop Grumman company