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=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1eb55e589296c3fa,start X-Google-Attributes: gid103376,public From: "Simon Johnston" Subject: Win32Ada and CreateProcess Date: 1997/07/10 Message-ID: <01bc8cfd$18b968f0$0100007f@skj_nb_02>#1/1 X-Deja-AN: 255900253 Organization: Dimensions Plus Ltd Newsgroups: comp.lang.ada Date: 1997-07-10T00:00:00+00:00 List-Id: Can anyone help here. I am using ObjectAda 7.1 and am trying to use the Win32 API CreateProcess function. I have copied code from an existing C++ application which I know works but every time it runs I get a Win32 error 2, which is ERROR_FILE_NOT_FOUND. Included below is the beginning of the package including the relevant procedure. This is beginning to annoy me so rather than tear out my hair I thought I would ask around. with System; use System; with Interfaces.C; use Interfaces.C; with Win32; use Win32; with Win32.Winnt; use Win32.Winnt; with Win32.Winbase; use Win32.Winbase; with Win32.Winuser; use Win32.Winuser; package body Process_Control is function memset (Destination : in Win32.PVOID; Fill : in Interfaces.C.int; Length : in Interfaces.C.size_t) return Win32.PVOID; pragma Import(C, memset, "memset"); procedure Execute (Command_Line : in String; Environment : in String := ""; Process : out Process_Id) is dwError : DWORD; fCreate : Win32.BOOL; StartInfo: aliased STARTUPINFO; ProcInfo : aliased PROCESS_INFORMATION; pTemp : PVOID; begin pTemp := memset(StartInfo'Address, 0, StartInfo'Size / 8); StartInfo.cb := StartInfo'Size / 8; StartInfo.wShowWindow := SW_SHOW; fCreate := CreateProcess(lpApplicationName => null, lpCommandLine => Win32.Addr(Command_Line), lpProcessAttributes => null, lpThreadAttributes => null, bInheritHandles => Win32.TRUE, dwCreationFlags => (CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS), lpEnvironment => null, lpCurrentDirectory => null, lpStartupInfo => StartInfo'Unchecked_Access, lpProcessInformation => ProcInfo'Unchecked_Access); if fCreate = Win32.FALSE then dwError := GetLastError; raise Not_Executable; end if; end Execute; with StandardDisclaimer; use StandardDisclaimer; package Sig is --,--------------------------------------------------------------. --|Simon K. Johnston - Windows NT Consultant |Dimensions + Ltd | --|------------------------------------------|150 Minories | --|Telephone: +44 (0)171 2642144 |London | --|Fax : +44 (0)171 2642145 |EC3N 1LS | --|Mail URI : mailto:skj@acm.org |United Kingdom | --|WWW URI : http://www.DimensionsPlus.Com | | --`--------------------------------------------------------------' end Sig;