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.

854 lines
21 KiB

  1. <outfile:stub.h>
  2. /***************************************************************************\\
  3. *
  4. * Generated by GIDL on $<date> at $<time>
  5. *
  6. * Stub class portion
  7. * Target = $<target>
  8. *
  9. \***************************************************************************/
  10. #pragma once
  11. #include "Gadget.h"
  12. // Forward Declarations
  13. <repeat:iClass,$<classes.count>>
  14. $<namespace.open>
  15. class $<class>;
  16. $<namespace.close>
  17. </repeat>
  18. //
  19. // Check that all functions return correct return values
  20. //
  21. <repeat:iClass,$<classes.count>>
  22. <repeat:iFunc,$<funcs.count>>
  23. <if:$<func.isInherited>=="false">
  24. <if:"$<func.return>"!="HRESULT">
  25. #error $<class.full>::$<func.short>() doesn't return an HRESULT.
  26. </if>
  27. </if> ; ! inherited
  28. </repeat> ; iFunc
  29. </repeat> ; iClass
  30. // Stub implementations
  31. <repeat:iClass,$<classes.count>>
  32. //---------------------------------------------------------------------------
  33. //
  34. // Stub class $<class.full>
  35. //
  36. $<namespace.open>
  37. <if:"$<super>"=="">
  38. class $<class> : public DUser::Gadget
  39. </if>
  40. <if:"$<super>"!="">
  41. class $<class> : public $<super.full>
  42. </if>
  43. {
  44. public:
  45. static BOOL Init();
  46. static inline $<class> * Build(DUser::Gadget::ConstructInfo * pciData = NULL)
  47. {
  48. $<class> * pctl = reinterpret_cast<$<class> *> (DUserBuildGadget(s_hclMe, pciData));
  49. return pctl;
  50. }
  51. static inline BOOL InstanceOf(const DUser::Gadget * pg)
  52. {
  53. return DUserInstanceOf(const_cast<DUser::Gadget *> (pg), s_hclMe);
  54. }
  55. static inline $<class> * Cast(const DUser::Gadget * pg)
  56. {
  57. return reinterpret_cast<$<class> *> (DUserCastClass(const_cast<DUser::Gadget *> (pg), s_hclMe));
  58. }
  59. static inline $<class> * Cast(HGADGET hgad)
  60. {
  61. return Cast(DUserCastDirect(hgad));
  62. }
  63. static HCLASS GetClass()
  64. {
  65. ASSERT(s_hclMe != NULL); // Ensure class is properly initialized
  66. return s_hclMe;
  67. }
  68. $<helper>
  69. //
  70. // Convenience wrappers
  71. //
  72. <repeat:iFunc,$<funcs.count>>
  73. <if:$<func.isInherited>=="false">
  74. <if:"$<func.isEvent>"=="true">
  75. __forceinline HRESULT $<func.short>($<params.proto>)
  76. {
  77. ASSERT(IsInsideContext(GetHandle()));
  78. return CallStubEvent($<params.call>, s_rgmi$<class>[$<iFunc>].cbSlotOffset);
  79. }
  80. </if>
  81. <if:"$<func.isMethod>"=="true">
  82. __forceinline $<func.return> $<func.short>($<params.proto>)
  83. {
  84. ASSERT(IsInsideContext(GetHandle()));
  85. $<func.short>Msg msg;
  86. msg.cbSize = sizeof(msg);
  87. msg.nMsg = s_rgmi$<class>[$<iFunc>].cbSlotOffset;
  88. <repeat:iParam,$<params.count>>
  89. <if:"$<param.flow>"=="IN">
  90. msg.$<param> = $<param>;
  91. </if>
  92. </repeat> ; iParam
  93. <if:"$<func.return>"!="HRESULT">
  94. <if:$<params.count.out>!=0>
  95. <repeat:iParam,$<params.count>>
  96. <if:"$<param.flow>"=="OUT">
  97. UNREFERENCED_PARAMETER($<param>);
  98. </if>
  99. </repeat> ; iParam
  100. </if> ; has params
  101. </if> ; return != HRESULT
  102. <if:"$<func.return>"=="void">
  103. CallStubMethod(&msg);
  104. </if>
  105. <if:"$<func.return>"!="void">
  106. $<func.return> r = CallStubMethod(&msg);
  107. <if:"$<func.return>"=="HRESULT">
  108. <if:$<params.count.out>!=0>
  109. if (SUCCEEDED(r)) {
  110. <repeat:iParam,$<params.count>>
  111. <if:"$<param.flow>"=="OUT">
  112. if ($<param> != NULL) {
  113. *$<param> = msg.$<param>;
  114. }
  115. </if>
  116. </repeat> ; iParam
  117. }
  118. </if> ; has out params
  119. </if> ; return == HRESULT
  120. return r;
  121. </if> ; return != void
  122. }
  123. </if> ; isMethod
  124. </if> ; !isInherited
  125. </repeat> ; iFunc
  126. //
  127. // Message structures
  128. //
  129. <repeat:iFunc,$<funcs.count>>
  130. <if:$<func.isInherited>=="false">
  131. <if:$<func.isMethod>=="true">
  132. struct $<func.short>Msg : public MethodMsg
  133. {
  134. <repeat:iParam,$<params.count>>
  135. $<param.flow> $<param.type> $<param>;
  136. </repeat>
  137. };
  138. </if> ; isMethod
  139. </if> : !isInherited
  140. </repeat> ; iFunc
  141. // Send API's- wrappers around DUserSendMethod()
  142. <repeat:iFunc,$<funcs.count>>
  143. <if:$<func.isInherited>=="false">
  144. $<func.return> Send$<func.short>($<params.proto>);
  145. </if> ; !isInherited
  146. </repeat> ; iFunc
  147. // Post API's- wrappers around DUserPostMethod()
  148. <repeat:iFunc,$<funcs.count>>
  149. <if:$<func.isInherited>=="false">
  150. HRESULT Post$<func.short>($<params.proto>);
  151. </if> ; !isInherited
  152. </repeat> ; iFunc
  153. protected:
  154. static HCLASS s_hclMe;
  155. static DUser::MessageClassStub s_mc;
  156. <if:$<funcs.count>!=0>
  157. public:
  158. static DUser::MessageInfoStub s_rgmi$<class>[];
  159. </if>
  160. }; // stub class $<class.full>
  161. $<namespace.close>
  162. </repeat> ; iClass
  163. //
  164. // Setup a class to automatically initialize the stubs.
  165. //
  166. class InitStub
  167. {
  168. public:
  169. InitStub();
  170. };
  171. </outfile>
  172. <outfile:stub.cpp>
  173. /***************************************************************************\\
  174. *
  175. * Generated by GIDL on $<date> at $<time>
  176. *
  177. * Stub class portion
  178. * Target = $<target>
  179. *
  180. \***************************************************************************/
  181. #include "stdafx.h"
  182. <if:"$<project>"!="">
  183. #include "$<project>"
  184. </if>
  185. #include "stub.h"
  186. #pragma warning(disable:4100) // unreferenced formal parameter
  187. using namespace DUser;
  188. #if defined(_M_IX86)
  189. //
  190. // NOTE: Because these function is __declspec(naked), the compiler isn't
  191. // smart enough to use ESP for parameters. Therefore, we need to directly
  192. // reference them and not use the inline assembly notation.
  193. //
  194. //---------------------------------------------------------------------------
  195. __declspec(naked)
  196. HRESULT
  197. Gadget::CallStubMethod(MethodMsg * pmsg)
  198. {
  199. UNREFERENCED_PARAMETER(pmsg);
  200. {
  201. __asm
  202. {
  203. mov edx, dword ptr [ecx]; // edx = start of message table
  204. mov eax, dword ptr [esp + 4]; // eax = GMSG* (param 1)
  205. add edx, dword ptr ((GMSG)[eax]).nMsg;
  206. // edx = MsgSlot for msg
  207. mov eax, dword ptr [edx + 4]; // ecx = cbThisOffset
  208. mov ecx, dword ptr [ecx + 4]; // eax = start of 'this' array
  209. mov edx, dword ptr [edx + 0]; // edx = get function ptr
  210. mov ecx, dword ptr [eax + ecx]; // ecx = 'this' ptr
  211. jmp edx; // jump (call will mess stack up)
  212. };
  213. }
  214. }
  215. #else // _M_IX86
  216. //---------------------------------------------------------------------------
  217. HRESULT
  218. Gadget::CallStubMethod(MethodMsg * pmsg)
  219. {
  220. int cbSlotOffset= pmsg->nMsg;
  221. BYTE * pdwData = reinterpret_cast<BYTE *> (this);
  222. BYTE * pbMT = * (reinterpret_cast<BYTE **> (pdwData));
  223. BYTE * pbrgThis = * (reinterpret_cast<BYTE **> (pdwData + sizeof(void *)));
  224. BYTE * pbSlot = (reinterpret_cast<BYTE *> (pbMT + cbSlotOffset));
  225. int cbThisOffset= * (reinterpret_cast<int *> (pbSlot + sizeof(void *)));
  226. union
  227. {
  228. DUser::MethodProc pfnTemp;
  229. void * pfn;
  230. };
  231. pfn = * (reinterpret_cast<void **> (pbSlot));
  232. void * pvThis = * (reinterpret_cast<void **> (pbrgThis + cbThisOffset));
  233. SGadget * pDummy = reinterpret_cast<SGadget *> (pvThis);
  234. return (pDummy->*pfnTemp)(pmsg);
  235. }
  236. #endif // _M_IX86
  237. //---------------------------------------------------------------------------
  238. HRESULT
  239. Gadget::CallSuperMethod(MethodMsg * pmsg, void * pMT)
  240. {
  241. int cbSlotOffset= pmsg->nMsg;
  242. BYTE * pdwData = reinterpret_cast<BYTE *> (this);
  243. BYTE * pbMT = (reinterpret_cast<BYTE *> (pMT));
  244. BYTE * pbrgThis = * (reinterpret_cast<BYTE **> (pdwData + sizeof(void *)));
  245. BYTE * pbSlot = (reinterpret_cast<BYTE *> (pbMT + cbSlotOffset));
  246. int cbThisOffset= * (reinterpret_cast<int *> (pbSlot + sizeof(void *)));
  247. union
  248. {
  249. DUser::MethodProc pfnTemp;
  250. void * pfn;
  251. };
  252. pfn = * (reinterpret_cast<void **> (pbSlot));
  253. void * pvThis = * (reinterpret_cast<void **> (pbrgThis + cbThisOffset));
  254. SGadget * pDummy = reinterpret_cast<SGadget *> (pvThis);
  255. return (pDummy->*pfnTemp)(pmsg);
  256. }
  257. //---------------------------------------------------------------------------
  258. UINT
  259. Gadget::CallStubEvent(EventMsg * pmsg, int nEventMsg)
  260. {
  261. int cbSlotOffset= nEventMsg;
  262. BYTE * pdwData = reinterpret_cast<BYTE *> (this);
  263. BYTE * pbMT = * (reinterpret_cast<BYTE **> (pdwData));
  264. BYTE * pbrgThis = * (reinterpret_cast<BYTE **> (pdwData + sizeof(void *)));
  265. BYTE * pbSlot = (reinterpret_cast<BYTE *> (pbMT + cbSlotOffset));
  266. int cbThisOffset= * (reinterpret_cast<int *> (pbSlot + sizeof(void *)));
  267. union
  268. {
  269. DUser::EventProc pfnTemp;
  270. void * pfn;
  271. };
  272. pfn = * (reinterpret_cast<void **> (pbSlot));
  273. void * pvThis = * (reinterpret_cast<void **> (pbrgThis + cbThisOffset));
  274. SGadget * pDummy = reinterpret_cast<SGadget *> (pvThis);
  275. return (pDummy->*pfnTemp)(pmsg);
  276. }
  277. //---------------------------------------------------------------------------
  278. UINT
  279. Gadget::CallSuperEvent(EventMsg * pmsg, void * pMT, int nEventMsg)
  280. {
  281. int cbSlotOffset= nEventMsg;
  282. BYTE * pdwData = reinterpret_cast<BYTE *> (this);
  283. BYTE * pbMT = (reinterpret_cast<BYTE *> (pMT));
  284. BYTE * pbrgThis = * (reinterpret_cast<BYTE **> (pdwData + sizeof(void *)));
  285. BYTE * pbSlot = (reinterpret_cast<BYTE *> (pbMT + cbSlotOffset));
  286. int cbThisOffset= * (reinterpret_cast<int *> (pbSlot + sizeof(void *)));
  287. union
  288. {
  289. DUser::MethodProc pfnTemp;
  290. void * pfn;
  291. };
  292. pfn = * (reinterpret_cast<void **> (pbSlot));
  293. void * pvThis = * (reinterpret_cast<void **> (pbrgThis + cbThisOffset));
  294. SGadget * pDummy = reinterpret_cast<SGadget *> (pvThis);
  295. return (pDummy->*pfnTemp)(pmsg);
  296. }
  297. <repeat:iClass,$<classes.count>>
  298. /***************************************************************************\\
  299. *
  300. * class $<class.full>
  301. *
  302. \***************************************************************************/
  303. $<namespace.open>
  304. HCLASS $<class>::s_hclMe = NULL;
  305. MessageClassStub $<class>::s_mc;
  306. <if:$<funcs.count>!=0>
  307. MessageInfoStub $<class>::s_rgmi$<class>[] = {
  308. <repeat:iFunc,$<funcs.count>>
  309. { -1, L"$<func.short>" },
  310. </repeat>
  311. };
  312. </if>
  313. //---------------------------------------------------------------------------
  314. BOOL $<class>::Init()
  315. {
  316. ZeroMemory(&s_mc, sizeof(s_mc));
  317. s_mc.cbSize = sizeof(s_mc);
  318. s_mc.nClassVersion = $<class.version>;
  319. s_mc.pszClassName = L"$<class.full>";
  320. <if:$<funcs.count>==0>
  321. s_mc.rgMsgInfo = NULL;
  322. </if>
  323. <if:$<funcs.count>!=0>
  324. s_mc.rgMsgInfo = s_rgmi$<class>;
  325. </if>
  326. s_mc.cMsgs = $<funcs.count>;
  327. s_hclMe = DUserRegisterStub(&s_mc, 0);
  328. return s_hclMe != NULL;
  329. }
  330. <repeat:iFunc,$<funcs.count>>
  331. <if:$<func.isInherited>=="false">
  332. <if:"$<func.isEvent>"=="true">
  333. HRESULT
  334. $<class>::Send$<func.short>($<params.proto>)
  335. {
  336. ASSERT(0); // Not Implemented
  337. return E_NOTIMPL;
  338. }
  339. </if>
  340. <if:"$<func.isMethod>"=="true">
  341. //---------------------------------------------------------------------------
  342. $<func.return>
  343. $<class>::Send$<func.short>($<params.proto>)
  344. {
  345. $<func.short>Msg msg;
  346. msg.cbSize = sizeof(msg);
  347. msg.nMsg = s_rgmi$<class>[$<iFunc>].cbSlotOffset;
  348. <repeat:iParam,$<params.count>>
  349. <if:"$<param.flow>"=="IN">
  350. msg.$<param> = $<param>;
  351. </if>
  352. </repeat> ; iParam
  353. <if:"$<func.return>"!="HRESULT">
  354. <if:$<params.count.out>!=0>
  355. <repeat:iParam,$<params.count>>
  356. <if:"$<param.flow>"=="OUT">
  357. UNREFERENCED_PARAMETER($<param>);
  358. </if>
  359. </repeat> ; iParam
  360. </if> ; has params
  361. </if> ; return != HRESULT
  362. <if:"$<func.return>"=="void">
  363. DUserSendMethod(this, &msg);
  364. </if>
  365. <if:"$<func.return>"!="void">
  366. $<func.return> r = DUserSendMethod(this, &msg);
  367. <if:"$<func.return>"=="HRESULT">
  368. <if:$<params.count.out>!=0>
  369. if (SUCCEEDED(r)) {
  370. <repeat:iParam,$<params.count>>
  371. <if:"$<param.flow>"=="OUT">
  372. if ($<param> != NULL) {
  373. *$<param> = msg.$<param>;
  374. }
  375. </if>
  376. </repeat> ; iParam
  377. }
  378. </if> ; has out params
  379. </if> ; return == HRESULT
  380. return r;
  381. </if> ; return != void
  382. } // end $<class>::Send$<func.short>
  383. </if> ; isMethod
  384. <if:"$<func.isEvent>"=="true">
  385. //---------------------------------------------------------------------------
  386. HRESULT
  387. $<class>::Post$<func.short>($<params.proto>)
  388. {
  389. ASSERT(0); // Not Implemented
  390. return E_NOTIMPL;
  391. }
  392. </if>
  393. <if:"$<func.isMethod>"=="true">
  394. //---------------------------------------------------------------------------
  395. HRESULT
  396. $<class>::Post$<func.short>($<params.proto>)
  397. {
  398. $<func.short>Msg msg;
  399. msg.cbSize = sizeof(msg);
  400. msg.nMsg = s_rgmi$<class>[$<iFunc>].cbSlotOffset;
  401. <repeat:iParam,$<params.count>>
  402. <if:"$<param.flow>"=="IN">
  403. msg.$<param> = $<param>;
  404. </if>
  405. </repeat> ; iParam
  406. return DUserPostMethod(this, &msg);
  407. } // end $<class>::Post$<func.short>
  408. </if> ; isMethod
  409. </if> ; $<func.isInherited>=="false">
  410. </repeat> ; iFunc
  411. $<namespace.close>
  412. </repeat> ; iClass
  413. //
  414. // Setup a class to automatically initialize the stubs.
  415. //
  416. InitStub::InitStub()
  417. {
  418. <repeat:iClass,$<classes.count>>
  419. $<class.full>::Init();
  420. </repeat>
  421. }
  422. #ifndef DUSER_EXPORTS
  423. InitStub g_InitStub;
  424. #endif
  425. </outfile>
  426. <outfile:super.h>
  427. /***************************************************************************\\
  428. *
  429. * Generated by GIDL on $<date> at $<time>
  430. *
  431. * Super class portion
  432. * Target = $<target>
  433. *
  434. \***************************************************************************/
  435. #pragma once
  436. #include "stub.h"
  437. #include "Gadget.h"
  438. // Forward Declarations
  439. <repeat:iClass,$<classes.count>>
  440. $<namespace.open>
  441. class S$<class>;
  442. $<namespace.close>
  443. </repeat>
  444. void CALLBACK GenericDecode(DUser::Gadget * pg, MethodMsg * pmsg);
  445. /***************************************************************************\\
  446. *
  447. * Implementation class helpers
  448. *
  449. \***************************************************************************/
  450. <repeat:iClass,$<classes.count>>
  451. //---------------------------------------------------------------------------
  452. //
  453. // Implementation class $<class.full>
  454. //
  455. $<namespace.open>
  456. template <class T, class base>
  457. class $<class>Impl : public base
  458. {
  459. public:
  460. static BOOL Init$<class.string>()
  461. {
  462. if (FAILED(T::InitClass())) {
  463. return FALSE;
  464. }
  465. <if:"$<super>"!="">
  466. if (!$<super.namespace>::S$<super.short>::Init$<super.string>()) {
  467. return FALSE;
  468. }
  469. </if>
  470. ZeroMemory(&s_mc, sizeof(s_mc));
  471. s_mc.cbSize = sizeof(s_mc);
  472. s_mc.nClassVersion = $<class.version>;
  473. s_mc.pszClassName = L"$<class.full>";
  474. s_mc.pszSuperName = L"$<super.full>";
  475. s_mc.rgMsgInfo = s_rgmi;
  476. s_mc.cMsgs = $<funcs.count>;
  477. s_mc.pfnPromote = T::Promote$<class>;
  478. s_mc.pfnDemote = T::Demote$<class>;
  479. return DUserRegisterGuts(&s_mc) != NULL;
  480. }
  481. static inline HRESULT
  482. InitClass()
  483. {
  484. return S_OK;
  485. }
  486. static inline HRESULT
  487. PreBuild(DUser::Gadget::ConstructInfo * pciData)
  488. {
  489. UNREFERENCED_PARAMETER(pciData);
  490. return S_OK;
  491. }
  492. inline HRESULT
  493. PostBuild(DUser::Gadget::ConstructInfo * pciData)
  494. {
  495. UNREFERENCED_PARAMETER(pciData);
  496. return S_OK;
  497. }
  498. static HRESULT CALLBACK
  499. Promote$<class>(DUser::ConstructProc pfnCS, HCLASS hclCur, DUser::Gadget * pgad, DUser::Gadget::ConstructInfo * pciData)
  500. {
  501. HRESULT hr;
  502. hr = T::PreBuild(pciData);
  503. if (FAILED(hr)) {
  504. return hr;
  505. }
  506. hr = (pfnCS)(DUser::Gadget::ccSuper, T::s_hclSuper, pgad, pciData);
  507. if (FAILED(hr)) {
  508. return hr;
  509. }
  510. T * pc = new T;
  511. if (pc == NULL) {
  512. return E_OUTOFMEMORY;
  513. }
  514. pc->m_pgad = pgad;
  515. hr = (pfnCS)(DUser::Gadget::ccSetThis, hclCur, pgad, pc);
  516. if (FAILED(hr)) {
  517. return hr;
  518. }
  519. hr = pc->PostBuild(pciData);
  520. if (FAILED(hr)) {
  521. delete pc;
  522. return E_OUTOFMEMORY;
  523. }
  524. return S_OK;
  525. }
  526. static HCLASS CALLBACK
  527. Demote$<class>(HCLASS hclCur, DUser::Gadget * pgad, void * pvData)
  528. {
  529. UNREFERENCED_PARAMETER(hclCur);
  530. UNREFERENCED_PARAMETER(pgad);
  531. T * pc = reinterpret_cast<T *> (pvData);
  532. delete pc;
  533. <if:"$<super>"!="">
  534. return T::s_hclSuper;
  535. </if>
  536. <if:"$<super>"=="">
  537. return NULL;
  538. </if>
  539. }
  540. $<class> * GetStub() const
  541. {
  542. return reinterpret_cast<$<class> *> (m_pgad);
  543. }
  544. /*
  545. $<helper>
  546. */
  547. protected:
  548. static DUser::MessageClassGuts s_mc;
  549. public:
  550. static DUser::MessageInfoGuts s_rgmi[];
  551. }; // implementation class $<class.full>Impl
  552. #define IMPLEMENT_GUTS_$<class.string>(me, super) \\
  553. DUser::MessageClassGuts $<class.full>Impl<me, super>::s_mc; \\
  554. DUser::MessageInfoGuts $<class.full>Impl<me, super>::s_rgmi[] = { \\
  555. <repeat:iFunc,$<funcs.count>>
  556. <if:$<func.isInherited>=="false">
  557. <if:$<func.isMethod>=="true">
  558. { (DUser::Method<me, $<class>::$<func.short>Msg>(me::Api$<func.short>)), L"$<func.short>" }, \\
  559. </if>
  560. <if:$<func.isEvent>=="true">
  561. { (DUser::Event<me, EventMsg>(me::Api$<func.short>)), L"$<func.short>" }, \\
  562. </if>
  563. </if> ; !isInherited
  564. <if:$<func.isInherited>=="true">
  565. <if:$<func.isMethod>=="true">
  566. { (DUser::Method<me, $<class>::$<func.short>Msg>(me::Api$<func.short>) != DUser::Method<super, $<super>::$<func.short>Msg>(super::Api$<func.short>) ? DUser::Method<me, $<class>::$<func.short>Msg>(me::Api$<func.short>) : NULL), L"$<func.short>" }, \\
  567. </if>
  568. <if:$<func.isEvent>=="true">
  569. { (DUser::Event<me, EventMsg>(me::Api$<func.short>) != DUser::Event<super, EventMsg>(super::Api$<func.short>) ? DUser::Event<me, EventMsg>(me::Api$<func.short>) : NULL), L"$<func.short>" }, \\
  570. </if>
  571. </if> ; isInherited
  572. </repeat> ; iFunc
  573. }; \\
  574. $<namespace.close>
  575. </repeat> ; iClass
  576. /***************************************************************************\\
  577. *
  578. * Super class helpers
  579. *
  580. * NOTE: Unlike the stub class, the super class does NOT inherit from any
  581. * base class. This is because it is illegal to jump multiple levels of
  582. * inheritence and scope a function for the super's super.
  583. *
  584. \***************************************************************************/
  585. <repeat:iClass,$<classes.count>>
  586. //---------------------------------------------------------------------------
  587. //
  588. // Super class $<class.full>
  589. //
  590. $<namespace.open>
  591. <if:"$<super>"=="">
  592. class S$<class> : public DUser::SGadget
  593. </if>
  594. <if:"$<super>"!="">
  595. class S$<class> : public $<super.namespace>::S$<super.short>
  596. </if>
  597. {
  598. public:
  599. static BOOL Init$<class.string>();
  600. <repeat:iFunc,$<funcs.count>>
  601. <if:$<func.isInherited>=="false">
  602. <if:"$<func.isEvent>"=="true">
  603. dapi HRESULT Api$<func.short>($<params.proto>)
  604. {
  605. return m_pgad->CallSuperEvent($<params.call>, s_mcsS$<class>.pmt, $<class>::s_rgmi$<class>[$<iFunc>].cbSlotOffset);
  606. }
  607. </if>
  608. <if:"$<func.isMethod>"=="true">
  609. dapi $<func.return> Api$<func.short>($<class>::$<func.short>Msg * pmsg)
  610. {
  611. pmsg->nMsg = $<class>::s_rgmi$<class>[$<iFunc>].cbSlotOffset;
  612. return ($<func.return>) m_pgad->CallSuperMethod(pmsg, s_mcsS$<class>.pmt);
  613. }
  614. </if> ; isMethod
  615. </if>
  616. </repeat> ; iFunc
  617. public:
  618. static HCLASS s_hclSuper; // HCLASS for THIS super-class
  619. static DUser::MessageClassSuper
  620. s_mcsS$<class>; // Super information
  621. }; // super class $<class.full>
  622. $<namespace.close>
  623. </repeat> ; iClass
  624. </outfile> ; super.h
  625. <outfile:super.cpp>
  626. /***************************************************************************\\
  627. *
  628. * Generated by GIDL on $<date> at $<time>
  629. *
  630. * Super class portion
  631. * Target = $<target>
  632. *
  633. \***************************************************************************/
  634. #include "stdafx.h"
  635. <if:"$<project>"!="">
  636. #include "$<project>"
  637. </if>
  638. #include "super.h"
  639. #include "stub.h"
  640. #include <stddef.h>
  641. #pragma warning(disable:4100) // unreferenced formal parameter
  642. using namespace DUser;
  643. HCLASS SGadget::s_hclSuper = NULL;
  644. <repeat:iClass,$<classes.count>>
  645. <if:"$<class.namespace>"=="">
  646. MessageClassSuper S$<class>::s_mcsS$<class>;
  647. </if>
  648. <if:"$<class.namespace>"!="">
  649. MessageClassSuper $<class.namespace>::S$<class>::s_mcsS$<class>;
  650. </if>
  651. </repeat>
  652. void CALLBACK GenericDecode(DUser::Gadget * pg, MethodMsg * pmsg)
  653. {
  654. ASSERT(0); // Not Implemented
  655. UNREFERENCED_PARAMETER(pg);
  656. UNREFERENCED_PARAMETER(pmsg);
  657. }
  658. <repeat:iClass,$<classes.count>>
  659. /***************************************************************************\\
  660. *
  661. * class $<class.full>
  662. *
  663. \***************************************************************************/
  664. $<namespace.open>
  665. <if:$<target>=="x86">
  666. const int off$<class>Direct = offsetof(S$<class>, m_pgad);
  667. </if>
  668. HCLASS S$<class>::s_hclSuper = NULL;
  669. //---------------------------------------------------------------------------
  670. BOOL
  671. S$<class>::Init$<class.string>()
  672. {
  673. if (s_hclSuper != NULL) {
  674. return TRUE;
  675. }
  676. <if:"$<super>"!="">
  677. if (!$<super.namespace>::S$<super.short>::Init$<super.string>()) {
  678. return FALSE;
  679. }
  680. </if>
  681. ZeroMemory(&s_mcsS$<class>, sizeof(s_mcsS$<class>));
  682. s_mcsS$<class>.cbSize = sizeof(s_mcsS$<class>);
  683. s_mcsS$<class>.nClassVersion = 1;
  684. s_mcsS$<class>.pszClassName = L"$<class.full>";
  685. s_hclSuper = DUserRegisterSuper(&s_mcsS$<class>);
  686. return s_hclSuper != NULL;
  687. }
  688. $<namespace.close>
  689. </repeat> ; iClass
  690. </outfile> ; super.cpp