Leaked source code of windows server 2003
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.

81 lines
2.3 KiB

  1. /********************************************************************/
  2. /** Copyright(c) 1989 Microsoft Corporation. **/
  3. /********************************************************************/
  4. //***
  5. //
  6. // Filename: message.c
  7. //
  8. // Description: This module contains support routines for the message
  9. // category API's for the AFP server service. These routines
  10. // will be called by the RPC runtime.
  11. //
  12. // History:
  13. // July 21,1992. NarenG Created original version.
  14. //
  15. #include "afpsvcp.h"
  16. //**
  17. //
  18. // Call: AfpAdminrMessageSend
  19. //
  20. // Returns: NO_ERROR - success
  21. // ERROR_ACCESS_DENIED
  22. // non-zero returns from the IOCTL
  23. //
  24. // Description: This routine communicates with the AFP FSD to implement
  25. // the AfpAdminMessageSend function.
  26. //
  27. DWORD
  28. AfpAdminrMessageSend(
  29. IN AFP_SERVER_HANDLE hServer,
  30. IN PAFP_MESSAGE_INFO pAfpMessageInfo
  31. )
  32. {
  33. AFP_REQUEST_PACKET AfpSrp;
  34. DWORD dwAccessStatus=0;
  35. DWORD dwRetCode=0;
  36. PAFP_MESSAGE_INFO pAfpMessageInfoSR;
  37. DWORD cbAfpMessageInfoSRSize;
  38. // Check if caller has access
  39. //
  40. if ( dwRetCode = AfpSecObjAccessCheck( AFPSVC_ALL_ACCESS, &dwAccessStatus))
  41. {
  42. AFP_PRINT(( "SFMSVC: AfpAdminrMessageSend, AfpSecObjAccessCheck failed %ld\n",dwRetCode));
  43. AfpLogEvent( AFPLOG_CANT_CHECK_ACCESS, 0, NULL,
  44. dwRetCode, EVENTLOG_ERROR_TYPE );
  45. return( ERROR_ACCESS_DENIED );
  46. }
  47. if ( dwAccessStatus )
  48. {
  49. AFP_PRINT(( "SFMSVC: AfpAdminrMessageSend, AfpSecObjAccessCheck returned %ld\n",dwAccessStatus));
  50. return( ERROR_ACCESS_DENIED );
  51. }
  52. // Make this buffer self-relative.
  53. //
  54. if ( dwRetCode = AfpBufMakeFSDRequest((LPBYTE)pAfpMessageInfo,
  55. 0,
  56. AFP_MESSAGE_STRUCT,
  57. (LPBYTE*)&pAfpMessageInfoSR,
  58. &cbAfpMessageInfoSRSize ))
  59. return( dwRetCode );
  60. // Make IOCTL to set info
  61. // Set up request packet and make IOCTL to the FSD
  62. //
  63. AfpSrp.dwRequestCode = OP_MESSAGE_SEND;
  64. AfpSrp.dwApiType = AFP_API_TYPE_ADD;
  65. AfpSrp.Type.Add.pInputBuf = pAfpMessageInfoSR;
  66. AfpSrp.Type.Add.cbInputBufSize = cbAfpMessageInfoSRSize;
  67. dwRetCode = AfpServerIOCtrl( &AfpSrp );
  68. LocalFree( pAfpMessageInfoSR );
  69. return( dwRetCode );
  70. }