Source code of Windows XP (NT5)
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.3 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1992 - 1999
  3. Module Name:
  4. dispatch.h
  5. Abstract:
  6. Author:
  7. Michael Montague (mikemon) 11-Jun-1992
  8. Revision History:
  9. --*/
  10. #include <sysinc.h>
  11. #include <rpc.h>
  12. #include <rpcdcep.h>
  13. #include <dispatch.h>
  14. unsigned int
  15. DispatchToStubInC (
  16. IN RPC_DISPATCH_FUNCTION Stub,
  17. IN OUT PRPC_MESSAGE Message,
  18. OUT RPC_STATUS * ExceptionCode
  19. )
  20. /*++
  21. Routine Description:
  22. Dispatch a remote procedure call to a stub. This must be in C
  23. because cfront does not support try-except on MIPS.
  24. Arguments:
  25. Stub - Supplies the pointer to the function to dispatch to.
  26. Message - Supplies the request and returns the response.
  27. ExceptionCode - Returns the exception code if an exception
  28. occured.
  29. Return Value:
  30. A non-zero value will be returned in an exception occured.
  31. --*/
  32. {
  33. unsigned int ExceptionHappened = 0;
  34. RpcTryExcept
  35. {
  36. (*Stub)(Message);
  37. }
  38. // Return "non-fatal" errors to clients. Catching fatal errors
  39. // makes it harder to debug.
  40. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode()))
  41. {
  42. ExceptionHappened = 1;
  43. *ExceptionCode = RpcExceptionCode();
  44. ASSERT(*ExceptionCode != RPC_S_OK);
  45. }
  46. RpcEndExcept
  47. return(ExceptionHappened);
  48. }