The NetRemoteExec API runs a program located on a remote server.
Restrictions
This API can be called only from an OS/2 workstation, and objnamebuf must point to a redirected resource.
#include <netcons.h> #include <remutil.h> NetRemoteExec(reserved1, objnamebuf, objnamebufl, asyntraceflags, pArg, envpointer, returncodes, pgmPointer, reserved2, remexecflags); /* 16 bit */ Net32RemoteExec(reserved1, objnamebuf, objnamebufl, asyntraceflags, pArg, envpointer, returncodes, pgmPointer, reserved2, remexecflags); /* 32 bit */Parameters
reserved1
For more information about OS/2 signals, see the OS/2 Technical Library, Programming Guide Volume 1.
The following table lists the return codes most significant to this API.
(See API Return Codes for a complete
list of return codes.) ┌─────────────────────────────┬───────┬────────────────────────────────────────┐│SYMBOLICCONSTANT
│VALUE│MEANING │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_Success │ 0 │ No errors were encountered. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ ERROR_INVALID_PARAMETER │ 87 │ At least one parameter value is not
│
│ │ │ valid. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_InternalError │ 2140 │ An internal error has occurred. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_RunSrvPaused │ 2385 │ The run server you requested using the
│
│ │ │ NET RUN command is paused. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_ErrCommRunSrv │ 2389 │ An error occurred when communicating
│
│ │ │ with a run server. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_ErrConnRunSrv │ 2390 │ An error occurred when connecting to
a │
│ │ │ run server. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_ErrorExecingGhost │ 2391 │ An error occurred when starting a
│
│ │ │ background process. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_ShareNotFound │ 2392 │ The shared resource you are connected
│
│ │ │ to could not be found. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_PgmNotFound │ 2394 │ The program was not found. │
└─────────────────────────────┴───────┴────────────────────────────────────────┘
The NetRemoteExec function is a network extension of the OS/2 DosExecPgm function.
The executed process is run on the computer connected to the current drive of the caller. If the current drive of the caller is on a remote server, the child process is run on that server. If the current drive of the caller is a local drive, the child process is run locally.
The NetRemoteExec function requires that a remotely run process inherit
one of the following handles: ┌───────┬──────────────────────────────────────────────────────────────────────┐
│ HANDLE│ MEANING │
├───────┼──────────────────────────────────────────────────────────────────────┤
│ 0 │ Standard input (stdin) │
├───────┼──────────────────────────────────────────────────────────────────────┤
│ 1 │ Standard output (stdout) │
├───────┼──────────────────────────────────────────────────────────────────────┤
│ 2 │ Standard error (stderr) │
└───────┴──────────────────────────────────────────────────────────────────────┘
When this API initiates an asynchronous process, the process identification (PID) returned as the first word in the OS/2 data structure (pointed to by the returncodes parameter) is a valid local PID that represents the remote program. The PID can be passed to the OS/2 DosFlagProcess function to:
For information about: