capturing output from Win32::AdminMisc::CreateProcessAsUser 
Author Message
 capturing output from Win32::AdminMisc::CreateProcessAsUser

I am using the Win32::AdminMisc::CreateProcessAsUser and trying to get
the results of the command line process back into my script (similar
to using backticks). This is what I am trying.  It executes the
process OK but I do not get the output of the program output to STDOUT
as I am trying.

Has anyone done this?  I cannot use backticks because I need to
specify a timeout for the process.....

$input_handle = Win32::AdminMisc::GetStdHandle(STD_INPUT_HANDLE);
$output_handle = Win32::AdminMisc::GetStdHandle(STD_OUTPUT_HANDLE);
$error_handle = Win32::AdminMisc::GetStdHandle(STD_ERROR_HANDLE);

$Process = "c:\\NETSVC OracleOraHome81HTTPServer \\\\mycomputer
/query";

$Result = Win32::AdminMisc::CreateProcessAsUser(
$Process,
"Flags" => CREATE_NEW_CONSOLE,
"XSize" => 640,
"YSize" => 400,
"X" => 200,
"Y" => 175,
"XBuffer" => 80,
"YBuffer" => 175,
"Show" => SW_SHOW,
"StdInput" => $input_handle,
"StdOutput" => $output_handle,
"StdError" => $error_handle,
"Title" => "Title: $User" . "'s $Process program",
"Fill" => BACKGROUND_BLUE |
FOREGROUND_RED |
FOREGROUND_BLUE |
FOREGROUND_INTENSITY |
FOREGROUND_GREEN,
);

if( $Result )
{
print "Successful! The new processes PID is $Result.\n";

Quote:
}else{

print "Failed.\n\tError: ", Error(), "\n";

Quote:
}

close QUERYFILE;

sub Error
{
return Win32::FormatMessage( Win32::GetLastError() );

Quote:
}



Sun, 16 May 2004 18:30:16 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Need help with Win32::AdminMisc::CreateProcess

2. Win32::AdminMisc::UserSetMiscAttributes (Was Re: Win32 UserCreate )

3. Win32::AdminMisc::UserSetMiscAttributes (Was Re: Win32 UserCreate )

4. Win32::AdminMisc::UserCheckPassword() problem

5. Win32::AdminMisc::GetDriveSpace and Active Server Pages

6. Win32::AdminMisc::UserSetMiscAttributes problem

7. Win32::AdminMisc::LogonAsUser()

8. Problems with Win32::AdminMisc::UserSetMiscAttributes on remote computers

9. The Win32::AdminMisc::GetDriveSpace function

10. Win32::AdminMisc::UserGetMiscAttributes

11. Problem with Win32::AdminMisc::GetDriveSpace

12. Win32::AdminMisc::LogonAsUser()

 

 
Powered by phpBB® Forum Software