* Win32Ada and CreateProcess
@ 1997-07-10 0:00 Simon Johnston
1997-07-11 0:00 ` Kevin Radke
1997-07-11 0:00 ` Pascal Obry
0 siblings, 2 replies; 3+ messages in thread
From: Simon Johnston @ 1997-07-10 0:00 UTC (permalink / raw)
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;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Win32Ada and CreateProcess
1997-07-10 0:00 Win32Ada and CreateProcess Simon Johnston
@ 1997-07-11 0:00 ` Kevin Radke
1997-07-11 0:00 ` Pascal Obry
1 sibling, 0 replies; 3+ messages in thread
From: Kevin Radke @ 1997-07-11 0:00 UTC (permalink / raw)
In article <01bc8cfd$18b968f0$0100007f@skj_nb_02>,
Simon Johnston <skj@acm.org> wrote:
>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.
My first guess is that Command_Line needs to be null terminated, as
do most (if not all) strings passed to the win32 routines...
(Think C... :)
> fCreate := CreateProcess(lpApplicationName => null,
> lpCommandLine => Win32.Addr(Command_Line),
...
lpCommandLine => Win32.Addr(Command_Line & Ascii.NUL),
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Win32Ada and CreateProcess
1997-07-10 0:00 Win32Ada and CreateProcess Simon Johnston
1997-07-11 0:00 ` Kevin Radke
@ 1997-07-11 0:00 ` Pascal Obry
1 sibling, 0 replies; 3+ messages in thread
From: Pascal Obry @ 1997-07-11 0:00 UTC (permalink / raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1093 bytes --]
Simon,
You should have a look at my implementation of POSIX
for Win32. In the package POSIX_Process_Primitive there
is an implementation of Start_Process that use the
Win32 CreateProcess API.
This binding (POSIX for Win32) and others packages can
be downloaded from my homepage.
Hope this helps,
Pascal.
--
--|------------------------------------------------------------
--| Pascal Obry Team-Ada Member |
--| |
--| EDF-DER-IPN-SID- Ing�nierie des Syst�mes d'Informations |
--| |
--| Bureau G1-010 e-mail: pascal.obry@der.edfgdf.fr |
--| 1 Av G�n�ral de Gaulle voice : +33-1-47.65.50.91 |
--| 92141 Clamart CEDEX fax : +33-1-47.65.50.07 |
--| FRANCE |
--|------------------------------------------------------------
--|
--| http://ourworld.compuserve.com/homepages/pascal_obry
--|
--| "The best way to travel is by means of imagination"
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1997-07-11 0:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-07-10 0:00 Win32Ada and CreateProcess Simon Johnston
1997-07-11 0:00 ` Kevin Radke
1997-07-11 0:00 ` Pascal Obry
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox