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.

769 lines
25 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 "precomp.h"
  7. #pragma hdrstop
  8. /* Globals used throughout */
  9. DWORD nPropertyLevel = 1;
  10. BOOL fIsFlipped = FALSE;
  11. BOOL fIgnoreFlatPart = FALSE;
  12. BOOL fIgnorePointers = FALSE;
  13. DWORD Conformance = 0;
  14. BOOL fConformanceIsSet = FALSE;
  15. /* ======================================================================== *
  16. * Protocol Entry points for Interface IntraCluster
  17. * uuid=(e248d0b8-bf15-11cf-8c5e-08002bb49649)
  18. * ======================================================================== */
  19. VOID WINAPI IntraCluster_Register(HPROTOCOL);
  20. VOID WINAPI IntraCluster_Deregister(HPROTOCOL);
  21. LPBYTE WINAPI IntraCluster_RecognizeFrame(HFRAME, LPVOID, LPVOID, DWORD, DWORD, HPROTOCOL,
  22. DWORD, LPDWORD, LPHPROTOCOL, LPDWORD);
  23. LPBYTE WINAPI IntraCluster_AttachProperties(HFRAME, LPVOID, LPVOID, DWORD, DWORD, HPROTOCOL, DWORD, DWORD);
  24. DWORD WINAPI IntraCluster_FormatProperties(HFRAME, LPVOID, LPVOID, DWORD, LPPROPERTYINST);
  25. ENTRYPOINTS IntraCluster_EntryPoints =
  26. {
  27. IntraCluster_Register,
  28. IntraCluster_Deregister,
  29. IntraCluster_RecognizeFrame,
  30. IntraCluster_AttachProperties,
  31. IntraCluster_FormatProperties
  32. };
  33. HPROTOCOL hIntraCluster = NULL;
  34. /* ======================================================================== *
  35. * Protocol Entry points for Interface ExtroCluster
  36. * uuid=(e248d0b8-bf15-11cf-8c5e-08002bb49649)
  37. * ======================================================================== */
  38. VOID WINAPI ExtroCluster_Register(HPROTOCOL);
  39. VOID WINAPI ExtroCluster_Deregister(HPROTOCOL);
  40. LPBYTE WINAPI ExtroCluster_RecognizeFrame(HFRAME, LPVOID, LPVOID, DWORD, DWORD, HPROTOCOL,
  41. DWORD, LPDWORD, LPHPROTOCOL, LPDWORD);
  42. LPBYTE WINAPI ExtroCluster_AttachProperties(HFRAME, LPVOID, LPVOID, DWORD, DWORD, HPROTOCOL, DWORD, DWORD);
  43. DWORD WINAPI ExtroCluster_FormatProperties(HFRAME, LPVOID, LPVOID, DWORD, LPPROPERTYINST);
  44. ENTRYPOINTS ExtroCluster_EntryPoints =
  45. {
  46. ExtroCluster_Register,
  47. ExtroCluster_Deregister,
  48. ExtroCluster_RecognizeFrame,
  49. ExtroCluster_AttachProperties,
  50. ExtroCluster_FormatProperties
  51. };
  52. HPROTOCOL hExtroCluster = NULL;
  53. /* ======================================================================== *
  54. * Protocol Entry points for Interface clusapi
  55. * uuid=(b97db8b2-4c63-11cf-bff6-08002be23f2f)
  56. * ======================================================================== */
  57. VOID WINAPI Clusapi_Register(HPROTOCOL);
  58. VOID WINAPI Clusapi_Deregister(HPROTOCOL);
  59. LPBYTE WINAPI Clusapi_RecognizeFrame(HFRAME, LPVOID, LPVOID, DWORD, DWORD, HPROTOCOL,
  60. DWORD, LPDWORD, LPHPROTOCOL, LPDWORD);
  61. LPBYTE WINAPI Clusapi_AttachProperties(HFRAME, LPVOID, LPVOID, DWORD, DWORD, HPROTOCOL, DWORD, DWORD);
  62. DWORD WINAPI Clusapi_FormatProperties(HFRAME, LPVOID, LPVOID, DWORD, LPPROPERTYINST);
  63. ENTRYPOINTS Clusapi_EntryPoints =
  64. {
  65. Clusapi_Register,
  66. Clusapi_Deregister,
  67. Clusapi_RecognizeFrame,
  68. Clusapi_AttachProperties,
  69. Clusapi_FormatProperties
  70. };
  71. HPROTOCOL hclusapi = NULL;
  72. /* ======================================================================== *
  73. * Protocol Entry points for Interface JoinVersion
  74. * uuid=(6e17aaa0-1a47-11d1-98bd-0000f875292e)
  75. * ======================================================================== */
  76. VOID WINAPI JoinVersion_Register(HPROTOCOL);
  77. VOID WINAPI JoinVersion_Deregister(HPROTOCOL);
  78. LPBYTE WINAPI JoinVersion_RecognizeFrame(HFRAME, LPVOID, LPVOID, DWORD, DWORD, HPROTOCOL,
  79. DWORD, LPDWORD, LPHPROTOCOL, LPDWORD);
  80. LPBYTE WINAPI JoinVersion_AttachProperties(HFRAME, LPVOID, LPVOID, DWORD, DWORD, HPROTOCOL, DWORD, DWORD);
  81. DWORD WINAPI JoinVersion_FormatProperties(HFRAME, LPVOID, LPVOID, DWORD, LPPROPERTYINST);
  82. ENTRYPOINTS JoinVersion_EntryPoints =
  83. {
  84. JoinVersion_Register,
  85. JoinVersion_Deregister,
  86. JoinVersion_RecognizeFrame,
  87. JoinVersion_AttachProperties,
  88. JoinVersion_FormatProperties
  89. };
  90. HPROTOCOL hJoinVersion = NULL;
  91. /* ======================================================================== *
  92. * Function DllMain called at loading and unloading time
  93. * ======================================================================== */
  94. DWORD Attached = 0;
  95. BOOL WINAPI DLLEntry(HANDLE hInstance, ULONG Command, LPVOID Reserved)
  96. {
  97. if ( Command == DLL_PROCESS_ATTACH )
  98. {
  99. if ( Attached++ == 0 )
  100. {
  101. hIntraCluster = CreateProtocol("R_INTRACLUSTER", &IntraCluster_EntryPoints, ENTRYPOINTS_SIZE);
  102. hExtroCluster = CreateProtocol("R_EXTROCLUSTER", &ExtroCluster_EntryPoints, ENTRYPOINTS_SIZE);
  103. hclusapi = CreateProtocol("R_CLUSAPI", &Clusapi_EntryPoints, ENTRYPOINTS_SIZE);
  104. hJoinVersion = CreateProtocol("R_JOINVERSION", &JoinVersion_EntryPoints, ENTRYPOINTS_SIZE);
  105. }
  106. }
  107. if ( Command == DLL_PROCESS_DETACH )
  108. {
  109. if ( --Attached == 0 )
  110. {
  111. DestroyProtocol(hIntraCluster);
  112. DestroyProtocol(hExtroCluster);
  113. DestroyProtocol(hclusapi);
  114. DestroyProtocol(hJoinVersion);
  115. }
  116. }
  117. return TRUE;
  118. }
  119. /* ======================================================================== *
  120. * Implementation of the entry point functions for each interface
  121. * ======================================================================== */
  122. /*
  123. * Interface IntraCluster, protocol RPC_IntraCluster:
  124. */
  125. VOID WINAPI IntraCluster_Register(HPROTOCOL hProtocol)
  126. {
  127. register DWORD i;
  128. CreatePropertyDatabase(hProtocol, nIntraClusterGenProps + nIntraClusterPrivProps);
  129. for (i = 0; i < nIntraClusterGenProps; ++i)
  130. {
  131. AddProperty(hProtocol, &IntraCluster_GenProps[i]);
  132. }
  133. for (i = 0; i < nIntraClusterPrivProps; ++i)
  134. {
  135. AddProperty(hProtocol, &IntraCluster_PrivProps[i]);
  136. }
  137. }
  138. VOID WINAPI IntraCluster_Deregister(HPROTOCOL hProtocol)
  139. {
  140. DestroyPropertyDatabase(hProtocol);
  141. }
  142. LPBYTE WINAPI IntraCluster_RecognizeFrame(HFRAME hFrame,
  143. LPBYTE MacFrame,
  144. LPBYTE lpFrame,
  145. DWORD MacType,
  146. DWORD FrameLength,
  147. HPROTOCOL hPreviousProtocol,
  148. DWORD hPreviousProtocolOffset,
  149. LPDWORD ProtocolStatusCode,
  150. LPHPROTOCOL hNextProtocol,
  151. LPDWORD InstData)
  152. {
  153. HPROTOCOL hNext=NULL; // next protocol to hand off to...
  154. WORD nStubLength;
  155. *ProtocolStatusCode = PROTOCOL_STATUS_CLAIMED;
  156. #ifdef SSP_DECODE
  157. // IF MSRPC VERSION == 4 AND AUTHPROTID !=0 THEN PASS OFF TO SSP
  158. if((*(MacFrame + hPreviousProtocolOffset) == 4) &&
  159. (*(MacFrame + hPreviousProtocolOffset + 78))) {
  160. hNext = GetProtocolFromName("SSP");
  161. if(hNext) {
  162. *ProtocolStatusCode = PROTOCOL_STATUS_NEXT_PROTOCOL;
  163. *hNextProtocol = hNext;
  164. nStubLength = *((LPWORD)(MacFrame + hPreviousProtocolOffset + 74));
  165. return(lpFrame + nStubLength);
  166. }
  167. }
  168. #endif
  169. return(NULL);
  170. }
  171. DWORD WINAPI IntraCluster_FormatProperties(HFRAME hFrame,
  172. LPBYTE MacFrame,
  173. LPBYTE lpFrame,
  174. DWORD nPropertyInsts,
  175. LPPROPERTYINST lpInst)
  176. {
  177. while (nPropertyInsts--)
  178. {
  179. ((FORMAT)lpInst->lpPropertyInfo->InstanceData)(lpInst);
  180. lpInst++;
  181. }
  182. return(NMERR_SUCCESS);
  183. }
  184. LPBYTE WINAPI IntraCluster_AttachProperties(HFRAME hFrame,
  185. LPBYTE MacFrame,
  186. LPBYTE lpFrame,
  187. DWORD MacType,
  188. DWORD FrameLength,
  189. HPROTOCOL hPreviousProtocol,
  190. DWORD hPreviousProtocolOffset,
  191. DWORD InstData)
  192. {
  193. CHAR AuthenticationProtocolID = 0;
  194. WORD nRPCLength;
  195. CHAR AuthenticationLevel;
  196. DWORD procedureNum = InstData & PROCNUM_MASK;
  197. // IF THE MSRPC VERSION IS 4 LOOK FOR SECURITY TRAILER
  198. if(*(MacFrame + hPreviousProtocolOffset) == 4) {
  199. AuthenticationProtocolID = *(MacFrame + hPreviousProtocolOffset + 78);
  200. nRPCLength = *((LPWORD)(MacFrame + hPreviousProtocolOffset + 74));
  201. AuthenticationLevel = *(lpFrame + nRPCLength);
  202. }
  203. // CHECK FOR ENCRYPTION
  204. if(AuthenticationProtocolID && (AuthenticationLevel == 6)) {
  205. AttachPropertyInstance(hFrame,
  206. IntraCluster_GenProps[GENPROP_ENCRYPTED].hProperty,
  207. nRPCLength,
  208. lpFrame, 0, 0, 0);
  209. }
  210. else if ( procedureNum < NUM_INTRACLUSTERPROCS ) {
  211. BOOL isRequest = ((InstData & RPC_REQUEST_MASK) != 0);
  212. DWORD summaryDataSize = sizeof(DWORD);
  213. PDWORD frameData = (PDWORD)lpFrame;
  214. DWORD summaryData[2];
  215. LPSTR callNameString;
  216. dprintf("INTRA: procNum = %d, isReq = %d, instdata = %08X\n", procedureNum, isRequest, InstData );
  217. InstData &= ( RPC_REQUEST_MASK | PROCNUM_MASK );
  218. InstData |= ( INTRACLUSTER_INDEX << INTERFACE_INDEX_SHIFT );
  219. summaryData[0] = InstData;
  220. //
  221. // mild hack to get Gum sequence number into summary data
  222. //
  223. switch ( procedureNum ) {
  224. case GUMQUEUELOCKINGUPDATE_PROC:
  225. if ( !isRequest ) {
  226. dprintf("GumQueueLockingUpdate resp: %d\n", frameData[0]);
  227. summaryData[1] = frameData[0];
  228. summaryDataSize += sizeof( DWORD );
  229. }
  230. break;
  231. case GUMATTEMPTJOINUPDATE_PROC:
  232. if ( isRequest ) {
  233. dprintf("GumAttemptJoinUpdate req: %d\n", frameData[3]);
  234. summaryData[1] = frameData[3];
  235. summaryDataSize += sizeof( DWORD );
  236. }
  237. break;
  238. case GUMUNLOCKUPDATE_PROC:
  239. if ( isRequest ) {
  240. dprintf("GumUnlockUpdate req: %d\n", frameData[1]);
  241. summaryData[1] = frameData[1];
  242. summaryDataSize += sizeof( DWORD );
  243. }
  244. break;
  245. case GUMUPDATENODE_PROC:
  246. if ( isRequest ) {
  247. dprintf("GumUpdateNode req: %d\n", frameData[2]);
  248. summaryData[1] = frameData[2];
  249. summaryDataSize += sizeof( DWORD );
  250. }
  251. break;
  252. case GUMJOINUPDATENODE_PROC:
  253. if ( isRequest ) {
  254. dprintf("GumJoinUpdateNode req: %d\n", frameData[3]);
  255. summaryData[1] = frameData[3];
  256. summaryDataSize += sizeof( DWORD );
  257. }
  258. break;
  259. case GUMGETNODESEQUENCE_PROC:
  260. if ( !isRequest ) {
  261. dprintf("GumGetNodeSequence resp: %d\n", frameData[0]);
  262. summaryData[1] = frameData[0];
  263. summaryDataSize += sizeof( DWORD );
  264. }
  265. break;
  266. case GUMATTEMPTLOCKINGUPDATE_PROC:
  267. if ( isRequest ) {
  268. dprintf("GumAttemptLockingUpdate req: %d\n", frameData[3]);
  269. summaryData[1] = frameData[3];
  270. summaryDataSize += sizeof( DWORD );
  271. }
  272. break;
  273. }
  274. AttachPropertyInstanceEx(hFrame,
  275. IntraCluster_GenProps[GENPROP_SUMMARY].hProperty,
  276. FrameLength, lpFrame, summaryDataSize, &summaryData, 0, 0, 0);
  277. //
  278. // get the name of the interface and attach it as a hidden property
  279. //
  280. callNameString = GET_PROCEDURE_NAME( INTRACLUSTER_INDEX, procedureNum );
  281. AttachPropertyInstanceEx(hFrame,
  282. IntraCluster_GenProps[GENPROP_CALLNAME].hProperty,
  283. FrameLength, lpFrame, strlen( callNameString ), callNameString, 0, 15, 0);
  284. if ( summaryDataSize > sizeof( DWORD )) {
  285. AttachPropertyInstanceEx(hFrame,
  286. IntraCluster_PrivProps[INTRACLUS_PROP_SEQNUMBER].hProperty,
  287. FrameLength,
  288. lpFrame,
  289. sizeof( DWORD ),
  290. &summaryData[1],
  291. 0, 1, 0);
  292. }
  293. }
  294. else {
  295. AttachPropertyInstance(hFrame,
  296. IntraCluster_GenProps[GENPROP_ERROR_BAD_OPCODE].hProperty,
  297. FrameLength,
  298. lpFrame, 0, 0, 0);
  299. }
  300. return(NULL);
  301. }
  302. /*
  303. * Interface ExtroCluster, protocol RPC_ExtroCluster:
  304. */
  305. VOID WINAPI ExtroCluster_Register(HPROTOCOL hProtocol)
  306. {
  307. register DWORD i;
  308. CreatePropertyDatabase(hProtocol, nExtroClusterGenProps);
  309. for (i = 0; i < nExtroClusterGenProps; ++i)
  310. {
  311. AddProperty(hProtocol, &ExtroCluster_GenProps[i]);
  312. }
  313. }
  314. VOID WINAPI ExtroCluster_Deregister(HPROTOCOL hProtocol)
  315. {
  316. DestroyPropertyDatabase(hProtocol);
  317. }
  318. LPBYTE WINAPI ExtroCluster_RecognizeFrame(HFRAME hFrame,
  319. LPBYTE MacFrame,
  320. LPBYTE lpFrame,
  321. DWORD MacType,
  322. DWORD FrameLength,
  323. HPROTOCOL hPreviousProtocol,
  324. DWORD hPreviousProtocolOffset,
  325. LPDWORD ProtocolStatusCode,
  326. LPHPROTOCOL hNextProtocol,
  327. LPDWORD InstData)
  328. {
  329. HPROTOCOL hNext=NULL; // next protocol to hand off to...
  330. WORD nStubLength;
  331. *ProtocolStatusCode = PROTOCOL_STATUS_CLAIMED;
  332. #ifdef SSP_DECODE
  333. // IF MSRPC VERSION == 4 AND AUTHPROTID !=0 THEN PASS OFF TO SSP
  334. if((*(MacFrame + hPreviousProtocolOffset) == 4) &&
  335. (*(MacFrame + hPreviousProtocolOffset + 78))) {
  336. hNext = GetProtocolFromName("SSP");
  337. if(hNext) {
  338. *ProtocolStatusCode = PROTOCOL_STATUS_NEXT_PROTOCOL;
  339. *hNextProtocol = hNext;
  340. nStubLength = *((LPWORD)(MacFrame + hPreviousProtocolOffset + 74));
  341. return(lpFrame + nStubLength);
  342. }
  343. }
  344. #endif
  345. return(NULL);
  346. }
  347. DWORD WINAPI ExtroCluster_FormatProperties(HFRAME hFrame,
  348. LPBYTE MacFrame,
  349. LPBYTE lpFrame,
  350. DWORD nPropertyInsts,
  351. LPPROPERTYINST lpInst)
  352. {
  353. while (nPropertyInsts--) {
  354. ((FORMAT)lpInst->lpPropertyInfo->InstanceData)(lpInst);
  355. lpInst++;
  356. }
  357. return(NMERR_SUCCESS);
  358. }
  359. LPBYTE WINAPI ExtroCluster_AttachProperties(HFRAME hFrame,
  360. LPBYTE MacFrame,
  361. LPBYTE lpFrame,
  362. DWORD MacType,
  363. DWORD FrameLength,
  364. HPROTOCOL hPreviousProtocol,
  365. DWORD hPreviousProtocolOffset,
  366. DWORD InstData)
  367. {
  368. CHAR AuthenticationProtocolID = 0;
  369. WORD nRPCLength;
  370. CHAR AuthenticationLevel;
  371. DWORD procedureNum = InstData & PROCNUM_MASK;
  372. // IF THE MSRPC VERSION IS 4 LOOK FOR SECURITY TRAILER
  373. if(*(MacFrame + hPreviousProtocolOffset) == 4) {
  374. AuthenticationProtocolID = *(MacFrame + hPreviousProtocolOffset + 78);
  375. nRPCLength = *((LPWORD)(MacFrame + hPreviousProtocolOffset + 74));
  376. AuthenticationLevel = *(lpFrame + nRPCLength);
  377. }
  378. // CHECK FOR ENCRYPTION
  379. if(AuthenticationProtocolID && (AuthenticationLevel == 6)) {
  380. AttachPropertyInstance(hFrame,
  381. ExtroCluster_GenProps[GENPROP_ENCRYPTED].hProperty,
  382. nRPCLength,
  383. lpFrame, 0, 0, 0);
  384. }
  385. else if ( procedureNum < NUM_EXTROCLUSTERPROCS ) {
  386. LPSTR callNameString;
  387. InstData &= ( RPC_REQUEST_MASK | PROCNUM_MASK );
  388. InstData |= ( EXTROCLUSTER_INDEX << INTERFACE_INDEX_SHIFT );
  389. dprintf("EXTRO: procNum = %d, instdata = %08X\n", procedureNum, InstData );
  390. AttachPropertyInstanceEx(hFrame,
  391. ExtroCluster_GenProps[GENPROP_SUMMARY].hProperty,
  392. FrameLength, lpFrame, sizeof(DWORD), &InstData, 0, 0, 0);
  393. //
  394. // get the name of the interface and attach it as a hidden property
  395. //
  396. callNameString = GET_PROCEDURE_NAME( EXTROCLUSTER_INDEX, procedureNum );
  397. AttachPropertyInstanceEx(hFrame,
  398. ExtroCluster_GenProps[GENPROP_CALLNAME].hProperty,
  399. FrameLength, lpFrame, strlen( callNameString ), callNameString, 0, 15, 0);
  400. } else {
  401. AttachPropertyInstance(hFrame,
  402. ExtroCluster_GenProps[GENPROP_ERROR_BAD_OPCODE].hProperty,
  403. FrameLength,
  404. lpFrame, 0, 0, 0);
  405. }
  406. return(NULL);
  407. }
  408. /*
  409. * Interface clusapi, protocol RPC_clusapi:
  410. */
  411. VOID WINAPI
  412. Clusapi_Register(
  413. HPROTOCOL hProtocol
  414. )
  415. {
  416. register DWORD i;
  417. CreatePropertyDatabase(hProtocol, nClusapiGenProps);
  418. for (i = 0; i < nClusapiGenProps; ++i)
  419. {
  420. AddProperty(hProtocol, &Clusapi_GenProps[i]);
  421. }
  422. }
  423. VOID WINAPI
  424. Clusapi_Deregister(
  425. HPROTOCOL hProtocol
  426. )
  427. {
  428. DestroyPropertyDatabase(hProtocol);
  429. }
  430. LPBYTE WINAPI
  431. Clusapi_RecognizeFrame(
  432. HFRAME hFrame,
  433. LPBYTE MacFrame,
  434. LPBYTE lpFrame,
  435. DWORD MacType,
  436. DWORD FrameLength,
  437. HPROTOCOL hPreviousProtocol,
  438. DWORD hPreviousProtocolOffset,
  439. LPDWORD ProtocolStatusCode,
  440. LPHPROTOCOL hNextProtocol,
  441. LPDWORD InstData
  442. )
  443. {
  444. HPROTOCOL hNext=NULL; // next protocol to hand off to...
  445. WORD nStubLength;
  446. *ProtocolStatusCode = PROTOCOL_STATUS_CLAIMED;
  447. #ifdef SSP_DECODE
  448. // IF MSRPC VERSION == 4 AND AUTHPROTID !=0 THEN PASS OFF TO SSP
  449. if((*(MacFrame + hPreviousProtocolOffset) == 4) &&
  450. (*(MacFrame + hPreviousProtocolOffset + 78))) {
  451. hNext = GetProtocolFromName("SSP");
  452. if(hNext) {
  453. *ProtocolStatusCode = PROTOCOL_STATUS_NEXT_PROTOCOL;
  454. *hNextProtocol = hNext;
  455. nStubLength = *((LPWORD)(MacFrame + hPreviousProtocolOffset + 74));
  456. return(lpFrame + nStubLength);
  457. }
  458. }
  459. #endif
  460. return(NULL);
  461. }
  462. DWORD WINAPI
  463. Clusapi_FormatProperties(
  464. HFRAME hFrame,
  465. LPBYTE MacFrame,
  466. LPBYTE lpFrame,
  467. DWORD nPropertyInsts,
  468. LPPROPERTYINST lpInst
  469. )
  470. {
  471. while (nPropertyInsts--) {
  472. ((FORMAT)lpInst->lpPropertyInfo->InstanceData)(lpInst);
  473. lpInst++;
  474. }
  475. return(NMERR_SUCCESS);
  476. }
  477. LPBYTE WINAPI
  478. Clusapi_AttachProperties(
  479. HFRAME hFrame,
  480. LPBYTE MacFrame,
  481. LPBYTE lpFrame,
  482. DWORD MacType,
  483. DWORD FrameLength,
  484. HPROTOCOL hPreviousProtocol,
  485. DWORD hPreviousProtocolOffset,
  486. DWORD InstData
  487. )
  488. {
  489. CHAR AuthenticationProtocolID = 0;
  490. WORD nRPCLength;
  491. CHAR AuthenticationLevel;
  492. DWORD procedureNum = InstData & PROCNUM_MASK;
  493. // IF THE MSRPC VERSION IS 4 LOOK FOR SECURITY TRAILER
  494. if(*(MacFrame + hPreviousProtocolOffset) == 4) {
  495. AuthenticationProtocolID = *(MacFrame + hPreviousProtocolOffset + 78);
  496. nRPCLength = *((LPWORD)(MacFrame + hPreviousProtocolOffset + 74));
  497. AuthenticationLevel = *(lpFrame + nRPCLength);
  498. }
  499. // CHECK FOR ENCRYPTION
  500. if(AuthenticationProtocolID && (AuthenticationLevel == 6)) {
  501. AttachPropertyInstance(hFrame,
  502. Clusapi_GenProps[GENPROP_ENCRYPTED].hProperty,
  503. nRPCLength,
  504. lpFrame, 0, 0, 0);
  505. }
  506. else if ( procedureNum < NUM_CLUSAPIPROCS ) {
  507. LPSTR callNameString;
  508. InstData &= ( RPC_REQUEST_MASK | PROCNUM_MASK );
  509. InstData |= ( CLUSAPI_INDEX << INTERFACE_INDEX_SHIFT );
  510. dprintf("CLUSAPI: procNum = %d, instdata = %08X\n", procedureNum, InstData );
  511. AttachPropertyInstanceEx(hFrame,
  512. Clusapi_GenProps[GENPROP_SUMMARY].hProperty,
  513. FrameLength, lpFrame, sizeof(DWORD), &InstData, 0, 0, 0);
  514. //
  515. // get the name of the interface and attach it as a hidden property
  516. //
  517. callNameString = GET_PROCEDURE_NAME( CLUSAPI_INDEX, procedureNum );
  518. AttachPropertyInstanceEx(hFrame,
  519. Clusapi_GenProps[GENPROP_CALLNAME].hProperty,
  520. FrameLength, lpFrame, strlen( callNameString ), callNameString, 0, 15, 0);
  521. } else {
  522. AttachPropertyInstance(hFrame,
  523. Clusapi_GenProps[GENPROP_ERROR_BAD_OPCODE].hProperty,
  524. FrameLength,
  525. lpFrame, 0, 0, 0);
  526. }
  527. return(NULL);
  528. }
  529. /*
  530. * Interface JoinVersion, protocol RPC_JoinVersion:
  531. */
  532. VOID WINAPI JoinVersion_Register(HPROTOCOL hProtocol)
  533. {
  534. register DWORD i;
  535. CreatePropertyDatabase(hProtocol, nJoinVersionGenProps);
  536. for (i = 0; i < nJoinVersionGenProps; ++i)
  537. {
  538. AddProperty(hProtocol, &JoinVersion_GenProps[i]);
  539. }
  540. }
  541. VOID WINAPI JoinVersion_Deregister(HPROTOCOL hProtocol)
  542. {
  543. DestroyPropertyDatabase(hProtocol);
  544. }
  545. LPBYTE WINAPI
  546. JoinVersion_RecognizeFrame(
  547. HFRAME hFrame,
  548. LPBYTE MacFrame,
  549. LPBYTE lpFrame,
  550. DWORD MacType,
  551. DWORD FrameLength,
  552. HPROTOCOL hPreviousProtocol,
  553. DWORD hPreviousProtocolOffset,
  554. LPDWORD ProtocolStatusCode,
  555. LPHPROTOCOL hNextProtocol,
  556. LPDWORD InstData
  557. )
  558. {
  559. HPROTOCOL hNext=NULL; // next protocol to hand off to...
  560. WORD nStubLength;
  561. *ProtocolStatusCode = PROTOCOL_STATUS_CLAIMED;
  562. #ifdef SSP_DECODE
  563. // IF MSRPC VERSION == 4 AND AUTHPROTID !=0 THEN PASS OFF TO SSP
  564. if((*(MacFrame + hPreviousProtocolOffset) == 4) &&
  565. (*(MacFrame + hPreviousProtocolOffset + 78))) {
  566. hNext = GetProtocolFromName("SSP");
  567. if(hNext) {
  568. *ProtocolStatusCode = PROTOCOL_STATUS_NEXT_PROTOCOL;
  569. *hNextProtocol = hNext;
  570. nStubLength = *((LPWORD)(MacFrame + hPreviousProtocolOffset + 74));
  571. return(lpFrame + nStubLength);
  572. }
  573. }
  574. #endif
  575. return(NULL);
  576. }
  577. DWORD WINAPI
  578. JoinVersion_FormatProperties(
  579. HFRAME hFrame,
  580. LPBYTE MacFrame,
  581. LPBYTE lpFrame,
  582. DWORD nPropertyInsts,
  583. LPPROPERTYINST lpInst
  584. )
  585. {
  586. while (nPropertyInsts--) {
  587. ((FORMAT)lpInst->lpPropertyInfo->InstanceData)(lpInst);
  588. lpInst++;
  589. }
  590. return(NMERR_SUCCESS);
  591. }
  592. LPBYTE WINAPI
  593. JoinVersion_AttachProperties(
  594. HFRAME hFrame,
  595. LPBYTE MacFrame,
  596. LPBYTE lpFrame,
  597. DWORD MacType,
  598. DWORD FrameLength,
  599. HPROTOCOL hPreviousProtocol,
  600. DWORD hPreviousProtocolOffset,
  601. DWORD InstData
  602. )
  603. {
  604. CHAR AuthenticationProtocolID = 0;
  605. WORD nRPCLength;
  606. CHAR AuthenticationLevel;
  607. DWORD procedureNum = InstData & PROCNUM_MASK;
  608. // IF THE MSRPC VERSION IS 4 LOOK FOR SECURITY TRAILER
  609. if(*(MacFrame + hPreviousProtocolOffset) == 4) {
  610. AuthenticationProtocolID = *(MacFrame + hPreviousProtocolOffset + 78);
  611. nRPCLength = *((LPWORD)(MacFrame + hPreviousProtocolOffset + 74));
  612. AuthenticationLevel = *(lpFrame + nRPCLength);
  613. }
  614. // CHECK FOR ENCRYPTION
  615. if(AuthenticationProtocolID && (AuthenticationLevel == 6)) {
  616. AttachPropertyInstance(hFrame,
  617. JoinVersion_GenProps[GENPROP_ENCRYPTED].hProperty,
  618. nRPCLength,
  619. lpFrame, 0, 0, 0);
  620. }
  621. else if ( procedureNum < NUM_JOINVERSIONPROCS ) {
  622. LPSTR callNameString;
  623. InstData &= ( RPC_REQUEST_MASK | PROCNUM_MASK );
  624. InstData |= ( JOINVERSION_INDEX << INTERFACE_INDEX_SHIFT );
  625. dprintf("JOINVERSION: procNum = %d, instdata = %08X\n", procedureNum, InstData );
  626. AttachPropertyInstanceEx(hFrame,
  627. JoinVersion_GenProps[GENPROP_SUMMARY].hProperty,
  628. FrameLength, lpFrame, sizeof(DWORD), &InstData, 0, 0, 0);
  629. //
  630. // get the name of the interface and attach it as a hidden property
  631. //
  632. callNameString = GET_PROCEDURE_NAME( JOINVERSION_INDEX, procedureNum );
  633. AttachPropertyInstanceEx(hFrame,
  634. JoinVersion_GenProps[GENPROP_CALLNAME].hProperty,
  635. FrameLength, lpFrame, strlen( callNameString ), callNameString, 0, 15, 0);
  636. } else {
  637. AttachPropertyInstance(hFrame,
  638. JoinVersion_GenProps[GENPROP_ERROR_BAD_OPCODE].hProperty,
  639. FrameLength,
  640. lpFrame, 0, 0, 0);
  641. }
  642. return(NULL);
  643. }