mirror of https://github.com/lianthony/NT4.0
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.1 KiB
71 lines
1.1 KiB
/* --------------------------------------------------------------------
|
|
|
|
File : excptest.cxx
|
|
|
|
Description :
|
|
|
|
Test the RPC exception handling mechanism.
|
|
|
|
History :
|
|
|
|
mikemon 01-11-90 Initial creation.
|
|
|
|
-------------------------------------------------------------------- */
|
|
|
|
#include <rpcapi.h>
|
|
#include <rpcexcpt.h>
|
|
#include <stdio.h>
|
|
|
|
|
|
void
|
|
RaiseException (
|
|
int doit
|
|
)
|
|
{
|
|
if (doit)
|
|
RpcRaiseException(doit);
|
|
}
|
|
|
|
void
|
|
TryFinallyTest (
|
|
int doit
|
|
)
|
|
{
|
|
RpcTryFinally
|
|
{
|
|
RaiseException(doit);
|
|
}
|
|
RpcFinally
|
|
{
|
|
printf("Finally Clause %d\n",RpcAbnormalTermination());
|
|
}
|
|
RpcEndFinally
|
|
}
|
|
|
|
int
|
|
PrintException (
|
|
int exception
|
|
)
|
|
{
|
|
printf("PrintException : %d\n",exception);
|
|
return(exception);
|
|
}
|
|
|
|
int
|
|
main (
|
|
int argc,
|
|
unsigned char * argv[]
|
|
)
|
|
{
|
|
TryFinallyTest(0);
|
|
|
|
RpcTryExcept
|
|
{
|
|
TryFinallyTest(1);
|
|
}
|
|
RpcExcept(PrintException(RpcExceptionCode()))
|
|
{
|
|
printf("Caught Exception in main : %d\n",RpcExceptionCode());
|
|
}
|
|
RpcEndExcept
|
|
}
|