Programming and Environmental Exceptions

Programmer exceptions are caused by providing incorrect parameters to a system call. Environmental exceptions occur when the environment cannot provide the requested resource, such as trying to allocate memory when none is available or trying to receive data from a mailbox where you do not have a handle.
 
By default, all exceptions are handled inline in the application’s source.
 
In the example the call returns a success or failure value and GetLastRtError is used to obtain the exception code.
If a system call returns a result that indicates an exception, all other output parameters of that system call are undefined.