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.

258 lines
7.5 KiB

  1. /*
  2. * This file is generated by the automatic RPC Parser generator. (Version 0.21)
  3. *
  4. * Created on 04/09/97 at 00:00:13.
  5. */
  6. #include "skeleton.h"
  7. #include "database.h"
  8. #include "funcs.h"
  9. /* Globals used throughout */
  10. DWORD nPropertyLevel = 1;
  11. BOOL fIsFlipped = FALSE;
  12. BOOL fIgnoreFlatPart = FALSE;
  13. BOOL fIgnorePointers = FALSE;
  14. DWORD Conformance = 0;
  15. BOOL fConformanceIsSet = FALSE;
  16. /* ======================================================================== *
  17. * Protocol Entry points for Interface resmon
  18. * uuid=(e76ea56d-453f-11cf-bfec-08002be23f2f)
  19. * ======================================================================== */
  20. VOID WINAPI resmon_Register(HPROTOCOL);
  21. VOID WINAPI resmon_Deregister(HPROTOCOL);
  22. LPBYTE WINAPI resmon_RecognizeFrame(HFRAME, LPVOID, LPVOID, DWORD, DWORD, HPROTOCOL,
  23. DWORD, LPDWORD, LPHPROTOCOL, LPDWORD);
  24. LPBYTE WINAPI resmon_AttachProperties(HFRAME, LPVOID, LPVOID, DWORD, DWORD, HPROTOCOL, DWORD, DWORD);
  25. DWORD WINAPI resmon_FormatProperties(HFRAME, LPVOID, LPVOID, DWORD, LPPROPERTYINST);
  26. ENTRYPOINTS resmon_EntryPoints =
  27. {
  28. resmon_Register,
  29. resmon_Deregister,
  30. resmon_RecognizeFrame,
  31. resmon_AttachProperties,
  32. resmon_FormatProperties
  33. };
  34. HPROTOCOL hresmon = NULL;
  35. /* ======================================================================== *
  36. * Function DLLEntry called at loading and unloading time
  37. * ======================================================================== */
  38. DWORD Attached = 0;
  39. BOOL WINAPI DLLEntry(HANDLE hInstance, ULONG Command, LPVOID Reserved)
  40. {
  41. if ( Command == DLL_PROCESS_ATTACH )
  42. {
  43. if ( Attached++ == 0 )
  44. {
  45. hresmon = CreateProtocol("R_RESMON", &resmon_EntryPoints, ENTRYPOINTS_SIZE);
  46. }
  47. }
  48. if ( Command == DLL_PROCESS_DETACH )
  49. {
  50. if ( --Attached == 0 )
  51. {
  52. DestroyProtocol(hresmon);
  53. }
  54. }
  55. return TRUE;
  56. }
  57. /* ======================================================================== *
  58. * Implementation of the entry point functions for each interface
  59. * ======================================================================== */
  60. /*
  61. * Interface resmon, protocol RPC_resmon:
  62. * uuid=(e76ea56d-453f-11cf-bfec-08002be23f2f)
  63. */
  64. VOID WINAPI resmon_Register(HPROTOCOL hProtocol)
  65. {
  66. register DWORD i;
  67. CreatePropertyDatabase(hProtocol, nresmonProperties);
  68. for (i = 0; i < nresmonProperties; ++i)
  69. {
  70. AddProperty(hProtocol, &resmon_Database[i]);
  71. }
  72. }
  73. VOID WINAPI resmon_Deregister(HPROTOCOL hProtocol)
  74. {
  75. DestroyPropertyDatabase(hProtocol);
  76. }
  77. LPBYTE WINAPI resmon_RecognizeFrame(HFRAME hFrame,
  78. LPBYTE MacFrame,
  79. LPBYTE lpFrame,
  80. DWORD MacType,
  81. DWORD FrameLength,
  82. HPROTOCOL hPreviousProtocol,
  83. DWORD hPreviousProtocolOffset,
  84. LPDWORD ProtocolStatusCode,
  85. LPHPROTOCOL hNextProtocol,
  86. LPDWORD InstData)
  87. {
  88. HPROTOCOL hNext=NULL; // next protocol to hand off to...
  89. WORD nStubLength;
  90. *ProtocolStatusCode = PROTOCOL_STATUS_CLAIMED;
  91. // IF MSRPC VERSION == 4 AND AUTHPROTID !=0 THEN PASS OFF TO SSP
  92. if((*(MacFrame + hPreviousProtocolOffset) == 4) && (*(MacFrame + hPreviousProtocolOffset + 78)))
  93. {
  94. hNext = GetProtocolFromName("SSP");
  95. if(hNext)
  96. {
  97. *ProtocolStatusCode = PROTOCOL_STATUS_NEXT_PROTOCOL;
  98. *hNextProtocol = hNext;
  99. nStubLength = *((LPWORD)(MacFrame + hPreviousProtocolOffset + 74));
  100. return(lpFrame + nStubLength);
  101. }
  102. }
  103. return(NULL);
  104. }
  105. DWORD WINAPI resmon_FormatProperties(HFRAME hFrame,
  106. LPBYTE MacFrame,
  107. LPBYTE lpFrame,
  108. DWORD nPropertyInsts,
  109. LPPROPERTYINST lpInst)
  110. {
  111. while (nPropertyInsts--)
  112. {
  113. ((FORMAT)lpInst->lpPropertyInfo->InstanceData)(lpInst);
  114. lpInst++;
  115. }
  116. return(BHERR_SUCCESS);
  117. }
  118. LPBYTE WINAPI resmon_AttachProperties(HFRAME hFrame,
  119. LPBYTE MacFrame,
  120. LPBYTE lpFrame,
  121. DWORD MacType,
  122. DWORD FrameLength,
  123. HPROTOCOL hPreviousProtocol,
  124. DWORD hPreviousProtocolOffset,
  125. DWORD InstData)
  126. {
  127. CHAR AuthenticationProtocolID = 0;
  128. WORD nRPCLength;
  129. CHAR AuthenticationLevel;
  130. nPropertyLevel = 1;
  131. fIgnoreFlatPart = FALSE;
  132. fIgnorePointers = FALSE;
  133. Conformance = 0;
  134. fConformanceIsSet = FALSE;
  135. // IF THE MSRPC VERSION IS 4 LOOK FOR SECURITY TRAILER
  136. if(*(MacFrame + hPreviousProtocolOffset) == 4)
  137. {
  138. AuthenticationProtocolID = *(MacFrame + hPreviousProtocolOffset + 78);
  139. nRPCLength = *((LPWORD)(MacFrame + hPreviousProtocolOffset + 74));
  140. AuthenticationLevel = *(lpFrame + nRPCLength);
  141. }
  142. // CHECK FOR ENCRYPTION
  143. if(AuthenticationProtocolID && (AuthenticationLevel == 6))
  144. {
  145. AttachPropertyInstance(hFrame,
  146. resmon_Database[I0_ENCRYPTED].hProperty,
  147. nRPCLength,
  148. lpFrame, 0, 0, 0);
  149. }
  150. else
  151. {
  152. switch (InstData & 0xffffL)
  153. {
  154. case 0:
  155. /* Handler for procedure RmCreateResource() */
  156. resmon_RmCreateResource_AttachProperties(hFrame, lpFrame, FrameLength, 0, InstData);
  157. break;
  158. case 1:
  159. /* Handler for procedure RmCloseResource() */
  160. resmon_RmCloseResource_AttachProperties(hFrame, lpFrame, FrameLength, 0, InstData);
  161. break;
  162. case 2:
  163. /* Handler for procedure RmChangeResourceParams() */
  164. resmon_RmChangeResourceParams_AttachProperties(hFrame, lpFrame, FrameLength, 0, InstData);
  165. break;
  166. case 3:
  167. /* Handler for procedure RmOnlineResource() */
  168. resmon_RmOnlineResource_AttachProperties(hFrame, lpFrame, FrameLength, 0, InstData);
  169. break;
  170. case 4:
  171. /* Handler for procedure RmOfflineResource() */
  172. resmon_RmOfflineResource_AttachProperties(hFrame, lpFrame, FrameLength, 0, InstData);
  173. break;
  174. case 5:
  175. /* Handler for procedure RmTerminateResource() */
  176. resmon_RmTerminateResource_AttachProperties(hFrame, lpFrame, FrameLength, 0, InstData);
  177. break;
  178. case 6:
  179. /* Handler for procedure RmArbitrateResource() */
  180. resmon_RmArbitrateResource_AttachProperties(hFrame, lpFrame, FrameLength, 0, InstData);
  181. break;
  182. case 7:
  183. /* Handler for procedure RmReleaseResource() */
  184. resmon_RmReleaseResource_AttachProperties(hFrame, lpFrame, FrameLength, 0, InstData);
  185. break;
  186. case 8:
  187. /* Handler for procedure RmNotifyChanges() */
  188. resmon_RmNotifyChanges_AttachProperties(hFrame, lpFrame, FrameLength, 0, InstData);
  189. break;
  190. case 9:
  191. /* Handler for procedure RmFailResource() */
  192. resmon_RmFailResource_AttachProperties(hFrame, lpFrame, FrameLength, 0, InstData);
  193. break;
  194. case 10:
  195. /* Handler for procedure RmShutdownProcess() */
  196. resmon_RmShutdownProcess_AttachProperties(hFrame, lpFrame, FrameLength, 0, InstData);
  197. break;
  198. case 11:
  199. /* Handler for procedure RmResourceControl() */
  200. resmon_RmResourceControl_AttachProperties(hFrame, lpFrame, FrameLength, 0, InstData);
  201. break;
  202. case 12:
  203. /* Handler for procedure RmResourceTypeControl() */
  204. resmon_RmResourceTypeControl_AttachProperties(hFrame, lpFrame, FrameLength, 0, InstData);
  205. break;
  206. default:
  207. /* Error: bad OpCode */
  208. AttachPropertyInstance(hFrame,
  209. resmon_Database[I0_ERROR_BAD_OPCODE].hProperty,
  210. FrameLength,
  211. lpFrame, 0, 0, 0);
  212. }
  213. }
  214. return(NULL);
  215. }