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.

855 lines
21 KiB

  1. /*****************************************************************************
  2. *
  3. * DIEffV.c
  4. *
  5. * Copyright (c) 1996-1997 Microsoft Corporation. All Rights Reserved.
  6. *
  7. * Abstract:
  8. *
  9. * Effect driver for VJOYD devices.
  10. *
  11. * Contents:
  12. *
  13. * CEffVxd_CreateInstance
  14. *
  15. *****************************************************************************/
  16. #include "dinputpr.h"
  17. #ifndef WINNT
  18. #if defined(IDirectInputDevice2Vtbl)
  19. /*****************************************************************************
  20. *
  21. * The sqiffle for this file.
  22. *
  23. *****************************************************************************/
  24. #define sqfl sqflVxdEff
  25. /*****************************************************************************
  26. *
  27. * Declare the interfaces we will be providing.
  28. *
  29. * WARNING! If you add a secondary interface, you must also change
  30. * CEffVxd_New!
  31. *
  32. *****************************************************************************/
  33. Primary_Interface(CEffVxd, IDirectInputEffectDriver);
  34. Interface_Template_Begin(CEffVxd)
  35. Primary_Interface_Template(CEffVxd, IDirectInputEffectDriver)
  36. Interface_Template_End(CEffVxd)
  37. /*****************************************************************************
  38. *
  39. * @doc INTERNAL
  40. *
  41. * @struct CEffVxd |
  42. *
  43. * An <i IDirectInputEffectDriver> wrapper for VJOYD
  44. * joysticks.
  45. *
  46. * @field IDirectInputEffectDriver | didc |
  47. *
  48. * The object (containing vtbl).
  49. *
  50. *****************************************************************************/
  51. typedef struct CEffVxd {
  52. /* Supported interfaces */
  53. IDirectInputEffectDriver ded;
  54. } CEffVxd, DVE, *PDVE;
  55. typedef IDirectInputEffectDriver DED, *PDED;
  56. #define ThisClass CEffVxd
  57. #define ThisInterface IDirectInputEffectDriver
  58. #define riidExpected &IID_IDirectInputEffectDriver
  59. /*****************************************************************************
  60. *
  61. * CEffVxd::QueryInterface (from IUnknown)
  62. * CEffVxd::AddRef (from IUnknown)
  63. * CEffVxd::Release (from IUnknown)
  64. *
  65. *****************************************************************************/
  66. /*****************************************************************************
  67. *
  68. * @doc DDK
  69. *
  70. * @method HRESULT | IDirectInputEffectDriver | QueryInterface |
  71. *
  72. * Gives a client access to other interfaces on an object.
  73. *
  74. * @cwrap LPDIRECTINPUTEFFECTDRIVER | lpEffectDriver
  75. *
  76. * @parm IN REFIID | riid |
  77. *
  78. * The requested interface's IID.
  79. *
  80. * @parm OUT LPVOID * | ppvObj |
  81. *
  82. * Receives a pointer to the obtained interface.
  83. *
  84. * @returns
  85. *
  86. * Returns a COM error code.
  87. *
  88. * @xref OLE documentation for <mf IUnknown::QueryInterface>.
  89. *
  90. *****************************************************************************
  91. *
  92. * @doc DDK
  93. *
  94. * @method HRESULT | IDirectInputEffectDriver | AddRef |
  95. *
  96. * Increments the reference count for the interface.
  97. *
  98. * @cwrap LPDIRECTINPUTEFFECTDRIVER | lpEffectDriver
  99. *
  100. * @returns
  101. *
  102. * Returns the object reference count.
  103. *
  104. * @xref OLE documentation for <mf IUnknown::AddRef>.
  105. *
  106. *****************************************************************************
  107. *
  108. * @doc DDK
  109. *
  110. * @method HRESULT | IDirectInputEffectDriver | Release |
  111. *
  112. * Decrements the reference count for the interface.
  113. * If the reference count on the object falls to zero,
  114. * the object is freed from memory.
  115. *
  116. * @cwrap LPDIRECTINPUTEFFECTDRIVER | lpEffectDriver
  117. *
  118. * @returns
  119. *
  120. * Returns the object reference count.
  121. *
  122. * @xref OLE documentation for <mf IUnknown::Release>.
  123. *
  124. *****************************************************************************
  125. *
  126. * @doc INTERNAL
  127. *
  128. * @method HRESULT | CEffVxd | QIHelper |
  129. *
  130. * We don't have any dynamic interfaces and simply forward
  131. * to <f Common_QIHelper>.
  132. *
  133. * @parm IN REFIID | riid |
  134. *
  135. * The requested interface's IID.
  136. *
  137. * @parm OUT LPVOID * | ppvObj |
  138. *
  139. * Receives a pointer to the obtained interface.
  140. *
  141. *****************************************************************************
  142. *
  143. * @doc INTERNAL
  144. *
  145. * @method HRESULT | CEffVxd | AppFinalize |
  146. *
  147. * We don't have any weak pointers, so we can just
  148. * forward to <f Common_Finalize>.
  149. *
  150. * @parm PV | pvObj |
  151. *
  152. * Object being released from the application's perspective.
  153. *
  154. *****************************************************************************/
  155. /*
  156. * @doc INTERNAL
  157. *
  158. * @method HRESULT | CEffVxd | Finalize |
  159. *
  160. * We don't have any instance data, so we can just
  161. * forward to <f Common_Finalize>.
  162. *
  163. *****************************************************************************/
  164. #ifdef DEBUG
  165. Default_QueryInterface(CEffVxd)
  166. Default_AddRef(CEffVxd)
  167. Default_Release(CEffVxd)
  168. #else
  169. #define CEffVxd_QueryInterface Common_QueryInterface
  170. #define CEffVxd_AddRef Common_AddRef
  171. #define CEffVxd_Release Common_Release
  172. #endif
  173. #define CEffVxd_QIHelper Common_QIHelper
  174. #define CEffVxd_AppFinalize Common_AppFinalize
  175. #define CEffVxd_Finalize Common_Finalize
  176. /*****************************************************************************
  177. *
  178. * @doc INTERNAL
  179. *
  180. * @method HRESULT | CEffVxd | DeviceID |
  181. *
  182. * Inform the driver of the identity of the device.
  183. * See <mf IDirectInputEffectDriver::DeviceID>
  184. * for more information.
  185. *
  186. * Doesn't do anything because VJOYD will already
  187. * have told the driver its identity.
  188. *
  189. * @cwrap LPDIRECTINPUTEFFECTDRIVER | lpEffectDriver
  190. *
  191. * @parm DWORD | dwDirectInputVersion |
  192. *
  193. * The version of DirectInput that loaded the
  194. * effect driver.
  195. *
  196. * @parm DWORD | dwExternalID |
  197. *
  198. * The joystick ID number being used.
  199. * The Windows joystick subsystem allocates external IDs.
  200. *
  201. * @parm DWORD | fBegin |
  202. *
  203. * Nonzero if access to the device is beginning.
  204. * Zero if the access to the device is ending.
  205. *
  206. * @parm DWORD | dwInternalID |
  207. *
  208. * Internal joystick id. The device driver manages
  209. * internal IDs.
  210. *
  211. * @parm LPVOID | lpReserved |
  212. *
  213. * Reserved for future use (HID).
  214. *
  215. * @returns
  216. *
  217. * <c S_OK> if the operation completed successfully.
  218. *
  219. * An error code if something is wrong.
  220. *
  221. *****************************************************************************/
  222. STDMETHODIMP
  223. CEffVxd_DeviceID(PDED pded, DWORD dwDIVer, DWORD dwExternalID, DWORD fBegin,
  224. DWORD dwInternalID, LPVOID pvReserved)
  225. {
  226. PDVE this;
  227. HRESULT hres;
  228. EnterProcI(IDirectInputEffectDriver::VxD::DeviceID,
  229. (_ "pxuuu", pded, dwDIVer, dwExternalID, fBegin, dwInternalID));
  230. this = _thisPvNm(pded, ded);
  231. dwDIVer;
  232. dwExternalID;
  233. fBegin;
  234. dwInternalID;
  235. pvReserved;
  236. hres = S_OK;
  237. ExitOleProcR();
  238. return hres;
  239. }
  240. /*****************************************************************************
  241. *
  242. * @doc INTERNAL
  243. *
  244. * @func HRESULT | CEffVxd_Ioctl |
  245. *
  246. * Perform an IOCTL to VJOYD.
  247. *
  248. * @parm DWORD | dwIOCode |
  249. *
  250. * The function to perform.
  251. *
  252. * @parm PV | pvIn |
  253. *
  254. * Input arguments, the number of which depends on the
  255. * function code.
  256. *
  257. * @returns
  258. *
  259. * <c S_OK> if the operation completed successfully.
  260. *
  261. * An error code if something is wrong.
  262. *
  263. *****************************************************************************/
  264. STDMETHODIMP
  265. CEffVxd_Ioctl(DWORD dwIOCode, PV pvIn)
  266. {
  267. HRESULT hres;
  268. HRESULT hresFF;
  269. EnterProc(CEffVxD_Ioctl, (_ "u", dwIOCode));
  270. /*
  271. * Once again, we rely on the fact that STDCALL passes
  272. * parameters right to left, so our arguments are exactly
  273. * in the form of a VXDFFIO structure.
  274. */
  275. CAssertF(cbX(VXDFFIO) == cbX(dwIOCode) + cbX(pvIn));
  276. CAssertF(FIELD_OFFSET(VXDFFIO, dwIOCode) == 0);
  277. CAssertF(FIELD_OFFSET(VXDFFIO, pvArgs) == cbX(dwIOCode));
  278. AssertF(cbSubPvPv(&pvIn, &dwIOCode) == cbX(dwIOCode));
  279. hres = IoctlHw(IOCTL_JOY_FFIO, &dwIOCode, cbX(VXDFFIO),
  280. &hresFF, cbX(hresFF));
  281. if (SUCCEEDED(hres)) {
  282. hres = hresFF;
  283. }
  284. ExitOleProc();
  285. return hres;
  286. }
  287. /*****************************************************************************
  288. *
  289. * @doc INTERNAL
  290. *
  291. * @method HRESULT | CEffVxd | Escape |
  292. *
  293. * Escape to the driver.
  294. * See <mf IDirectInputEffectDriver::Escape>
  295. * for more information.
  296. *
  297. * @cwrap LPDIRECTINPUTEFFECTDRIVER | lpEffectDriver
  298. *
  299. * @parm DWORD | dwId |
  300. *
  301. * The joystick ID number being used.
  302. *
  303. * @parm DWORD | dwEffect |
  304. *
  305. * The effect at which the command is directed.
  306. *
  307. * @parm LPDIEFFESCAPE | pesc |
  308. *
  309. * Command block.
  310. *
  311. * @returns
  312. *
  313. * <c S_OK> if the operation completed successfully.
  314. *
  315. * An error code if something is wrong.
  316. *
  317. *****************************************************************************/
  318. STDMETHODIMP
  319. CEffVxd_Escape(PDED pded, DWORD dwId, DWORD dwEffect, LPDIEFFESCAPE pesc)
  320. {
  321. PDVE this;
  322. HRESULT hres;
  323. EnterProcI(IDirectInputEffectDriver::VxD::Escape,
  324. (_ "puxx", pded, dwId, dwEffect, pesc->dwCommand));
  325. this = _thisPvNm(pded, ded);
  326. dwId;
  327. dwEffect;
  328. pesc;
  329. hres = CEffVxd_Ioctl(FFIO_ESCAPE, &dwId);
  330. ExitOleProcR();
  331. return hres;
  332. }
  333. /*****************************************************************************
  334. *
  335. * @doc INTERNAL
  336. *
  337. * @method HRESULT | CEffVxd | SetGain |
  338. *
  339. * Set the overall device gain.
  340. * See <mf IDirectInputEffectDriver::SetGain>
  341. * for more information.
  342. *
  343. * @cwrap LPDIRECTINPUTEFFECTDRIVER | lpEffectDriver
  344. *
  345. * @parm DWORD | dwId |
  346. *
  347. * The joystick ID number being used.
  348. *
  349. * @parm DWORD | dwGain |
  350. *
  351. * The new gain value.
  352. *
  353. * @returns
  354. *
  355. * <c S_OK> if the operation completed successfully.
  356. *
  357. * An error code if something is wrong.
  358. *
  359. *****************************************************************************/
  360. STDMETHODIMP
  361. CEffVxd_SetGain(PDED pded, DWORD dwId, DWORD dwGain)
  362. {
  363. PDVE this;
  364. HRESULT hres;
  365. EnterProcI(IDirectInputEffectDriver::VxD::SetGain,
  366. (_ "puu", pded, dwId, dwGain));
  367. this = _thisPvNm(pded, ded);
  368. dwId;
  369. hres = CEffVxd_Ioctl(FFIO_SETGAIN, &dwId);
  370. ExitOleProcR();
  371. return hres;
  372. }
  373. /*****************************************************************************
  374. *
  375. * @doc INTERNAL
  376. *
  377. * @method HRESULT | CEffVxd | SetForceFeedbackState |
  378. *
  379. * Change the force feedback state for the device.
  380. * See <mf IDirectInputEffectDriver::SetForceFeedbackState>
  381. * for more information.
  382. *
  383. * @cwrap LPDIRECTINPUTEFFECTDRIVER | lpEffectDriver
  384. *
  385. * @parm DWORD | dwId |
  386. *
  387. * The external joystick number being addressed.
  388. *
  389. * @parm DWORD | dwState |
  390. *
  391. * New state, one of the <c DEV_*> values.
  392. *
  393. * @returns
  394. * <c S_OK> on success.
  395. *
  396. * @devnote
  397. *
  398. * Semantics unclear.
  399. *
  400. *****************************************************************************/
  401. STDMETHODIMP
  402. CEffVxd_SetForceFeedbackState(PDED pded, DWORD dwId, DWORD dwState)
  403. {
  404. PDVE this;
  405. HRESULT hres;
  406. EnterProcI(IDirectInputEffectDriver::VxD::SetForceFeedbackState,
  407. (_ "pux", pded, dwId, dwState));
  408. this = _thisPvNm(pded, ded);
  409. dwId;
  410. dwState;
  411. hres = CEffVxd_Ioctl(FFIO_SETFFSTATE, &dwId);
  412. ExitOleProcR();
  413. return hres;
  414. }
  415. /*****************************************************************************
  416. *
  417. * @doc INTERNAL
  418. *
  419. * @method HRESULT | CEffVxd | GetForceFeedbackState |
  420. *
  421. * Retrieve the force feedback state for the device.
  422. * See <mf IDirectInputEffectDriver::GetForceFeedbackState>
  423. * for more information.
  424. *
  425. * @cwrap LPDIRECTINPUTEFFECTDRIVER | lpEffectDriver
  426. *
  427. * @parm DWORD | dwId |
  428. *
  429. * The external joystick number being addressed.
  430. *
  431. * @parm LPDIDEVICESTATE | pds |
  432. *
  433. * Receives device state.
  434. *
  435. * @returns
  436. * <c S_OK> on success.
  437. *
  438. * @devnote
  439. *
  440. * Semantics unclear.
  441. *
  442. *****************************************************************************/
  443. STDMETHODIMP
  444. CEffVxd_GetForceFeedbackState(PDED pded, DWORD dwId, LPDIDEVICESTATE pds)
  445. {
  446. PDVE this;
  447. HRESULT hres;
  448. EnterProcI(IDirectInputEffectDriver::VxD::GetForceFeedbackState,
  449. (_ "pup", pded, dwId, pds));
  450. this = _thisPvNm(pded, ded);
  451. dwId;
  452. pds;
  453. hres = CEffVxd_Ioctl(FFIO_GETFFSTATE, &dwId);
  454. ExitOleProcR();
  455. return hres;
  456. }
  457. /*****************************************************************************
  458. *
  459. * @doc INTERNAL
  460. *
  461. * @method HRESULT | CEffVxd | DownloadEffect |
  462. *
  463. * Send an effect to the device.
  464. * See <mf IDirectInputEffectDriver::SetGain>
  465. * for more information.
  466. *
  467. * @cwrap LPDIRECTINPUTEFFECTDRIVER | lpEffectDriver
  468. *
  469. * @parm DWORD | dwId |
  470. *
  471. * The external joystick number being addressed.
  472. *
  473. * @parm DWORD | dwEffectId |
  474. *
  475. * Magic cookie dword that identifies the effect.
  476. *
  477. * @parm IN OUT LPDWORD | pdwEffect |
  478. *
  479. * The effect being modified.
  480. *
  481. * @parm LPCDIEFFECT | peff |
  482. *
  483. * The new parameters for the effect.
  484. *
  485. * @parm DWORD | dwFlags |
  486. *
  487. * Zero or more <c DIEP_*> flags.
  488. *
  489. * @returns
  490. * <c S_OK> on success.
  491. *
  492. *****************************************************************************/
  493. STDMETHODIMP
  494. CEffVxd_DownloadEffect(PDED pded, DWORD dwId, DWORD dwEffectId,
  495. LPDWORD pdwEffect, LPCDIEFFECT peff, DWORD fl)
  496. {
  497. PDVE this;
  498. HRESULT hres;
  499. EnterProcI(IDirectInputEffectDriver::VxD::DownloadEffect,
  500. (_ "puxxpx", pded, dwId, dwEffectId, *pdwEffect, peff, fl));
  501. this = _thisPvNm(pded, ded);
  502. dwEffectId;
  503. pdwEffect;
  504. peff;
  505. fl;
  506. hres = CEffVxd_Ioctl(FFIO_DOWNLOADEFFECT, &dwId);
  507. ExitOleProcPpv(pdwEffect);
  508. return hres;
  509. }
  510. /*****************************************************************************
  511. *
  512. * @doc INTERNAL
  513. *
  514. * @method HRESULT | CEffVxd | DestroyEffect |
  515. *
  516. * Remove an effect from the device.
  517. * See <mf IDirectInputEffectDriver::DestroyEffect>
  518. * for more information.
  519. *
  520. * @cwrap LPDIRECTINPUTEFFECTDRIVER | lpEffectDriver
  521. *
  522. * @parm DWORD | dwId |
  523. *
  524. * The external joystick number being addressed.
  525. *
  526. * @parm DWORD | dwEffect |
  527. *
  528. * The effect to be destroyed.
  529. *
  530. * @returns
  531. * <c S_OK> on success.
  532. *
  533. *****************************************************************************/
  534. STDMETHODIMP
  535. CEffVxd_DestroyEffect(PDED pded, DWORD dwId, DWORD dwEffect)
  536. {
  537. PDVE this;
  538. HRESULT hres;
  539. EnterProcI(IDirectInputEffectDriver::VxD::DestroyEffect,
  540. (_ "pux", pded, dwId, dwEffect));
  541. this = _thisPvNm(pded, ded);
  542. dwEffect;
  543. hres = CEffVxd_Ioctl(FFIO_DESTROYEFFECT, &dwId);
  544. ExitOleProcR();
  545. return hres;
  546. }
  547. /*****************************************************************************
  548. *
  549. * @doc INTERNAL
  550. *
  551. * @method HRESULT | CEffVxd | StartEffect |
  552. *
  553. * Begin playback of an effect.
  554. * See <mf IDirectInputEffectDriver::StartEffect>
  555. * for more information.
  556. *
  557. * @cwrap LPDIRECTINPUTEFFECTDRIVER | lpEffectDriver
  558. *
  559. * @parm DWORD | dwId |
  560. *
  561. * The external joystick number being addressed.
  562. *
  563. * @parm DWORD | dwEffect |
  564. *
  565. * The effect to be played.
  566. *
  567. * @parm DWORD | dwMode |
  568. *
  569. * How the effect is to affect other effects.
  570. *
  571. * @parm DWORD | dwCount |
  572. *
  573. * Number of times the effect is to be played.
  574. *
  575. * @returns
  576. * <c S_OK> on success.
  577. *
  578. *****************************************************************************/
  579. STDMETHODIMP
  580. CEffVxd_StartEffect(PDED pded, DWORD dwId, DWORD dwEffect,
  581. DWORD dwMode, DWORD dwCount)
  582. {
  583. PDVE this;
  584. HRESULT hres;
  585. EnterProcI(IDirectInputEffectDriver::VxD::StartEffect,
  586. (_ "puxxu", pded, dwId, dwEffect, dwMode, dwCount));
  587. this = _thisPvNm(pded, ded);
  588. dwEffect;
  589. dwMode;
  590. dwCount;
  591. hres = CEffVxd_Ioctl(FFIO_STARTEFFECT, &dwId);
  592. ExitOleProcR();
  593. return hres;
  594. }
  595. /*****************************************************************************
  596. *
  597. * @doc INTERNAL
  598. *
  599. * @method HRESULT | CEffVxd | StopEffect |
  600. *
  601. * Halt playback of an effect.
  602. * See <mf IDirectInputEffectDriver::StartEffect>
  603. * for more information.
  604. *
  605. * @cwrap LPDIRECTINPUTEFFECTDRIVER | lpEffectDriver
  606. *
  607. * @parm DWORD | dwId |
  608. *
  609. * The external joystick number being addressed.
  610. *
  611. * @parm DWORD | dwEffect |
  612. *
  613. * The effect to be stopped.
  614. *
  615. * @returns
  616. * <c S_OK> on success.
  617. *
  618. *****************************************************************************/
  619. STDMETHODIMP
  620. CEffVxd_StopEffect(PDED pded, DWORD dwId, DWORD dwEffect)
  621. {
  622. PDVE this;
  623. HRESULT hres;
  624. EnterProcI(IDirectInputEffectDriver::VxD::StopEffect,
  625. (_ "pux", pded, dwId, dwEffect));
  626. this = _thisPvNm(pded, ded);
  627. dwEffect;
  628. hres = CEffVxd_Ioctl(FFIO_STOPEFFECT, &dwId);
  629. ExitOleProcR();
  630. return hres;
  631. }
  632. /*****************************************************************************
  633. *
  634. * @doc INTERNAL
  635. *
  636. * @method HRESULT | CEffVxd | GetEffectStatus |
  637. *
  638. * Obtain information about an effect.
  639. * See <mf IDirectInputEffectDriver::StartEffect>
  640. * for more information.
  641. *
  642. * @cwrap LPDIRECTINPUTEFFECTDRIVER | lpEffectDriver
  643. *
  644. * @parm DWORD | dwId |
  645. *
  646. * The external joystick number being addressed.
  647. *
  648. * @parm DWORD | dwEffect |
  649. *
  650. * The effect to be queried.
  651. *
  652. * @parm LPDWORD | pdwStatus |
  653. *
  654. * Receives the effect status.
  655. *
  656. * @returns
  657. * <c S_OK> on success.
  658. *
  659. *****************************************************************************/
  660. STDMETHODIMP
  661. CEffVxd_GetEffectStatus(PDED pded, DWORD dwId, DWORD dwEffect,
  662. LPDWORD pdwStatus)
  663. {
  664. PDVE this;
  665. HRESULT hres;
  666. EnterProcI(IDirectInputEffectDriver::VxD::StopEffect,
  667. (_ "pux", pded, dwId, dwEffect));
  668. this = _thisPvNm(pded, ded);
  669. dwEffect;
  670. pdwStatus;
  671. hres = CEffVxd_Ioctl(FFIO_GETEFFECTSTATUS, &dwId);
  672. ExitOleProcR();
  673. return hres;
  674. }
  675. /*****************************************************************************
  676. *
  677. * @doc DDK
  678. *
  679. * @method HRESULT | CEffVxd | GetVersions |
  680. *
  681. * Obtain version information about the force feedback
  682. * hardware and driver.
  683. *
  684. * @cwrap LPDIRECTINPUTEFFECTDRIVER | lpEffectDriver
  685. *
  686. * @parm LPDIDRIVERVERSIONS | pvers |
  687. *
  688. * A structure which should be filled in with version information
  689. * describing the hardware, firmware, and driver.
  690. *
  691. * DirectInput will set the <e DIDRIVERVERSIONS.dwSize> field
  692. * to sizeof(DIDRIVERVERSIONS) before calling this method.
  693. *
  694. * @returns
  695. * <c S_OK> on success.
  696. *
  697. *****************************************************************************/
  698. STDMETHODIMP
  699. CEffVxd_GetVersions(PDED pded, LPDIDRIVERVERSIONS pvers)
  700. {
  701. PDVE this;
  702. HRESULT hres;
  703. EnterProcI(IDirectInputEffectDriver::VxD::GetVersions, (_ "pux", pded));
  704. this = _thisPvNm(pded, ded);
  705. /*
  706. * Returning E_NOTIMPL causes DirectInput to ask the VxD for the same
  707. * information.
  708. */
  709. hres = E_NOTIMPL;
  710. ExitOleProcR();
  711. return hres;
  712. }
  713. /*****************************************************************************
  714. *
  715. * CEffVxd_New (constructor)
  716. *
  717. *****************************************************************************/
  718. STDMETHODIMP
  719. CEffVxd_New(PUNK punkOuter, RIID riid, PPV ppvObj)
  720. {
  721. HRESULT hres;
  722. EnterProcI(IDirectInputEffectDriver::VxD::<constructor>,
  723. (_ "Gp", riid, ppvObj));
  724. hres = Common_NewRiid(CEffVxd, punkOuter, riid, ppvObj);
  725. if (SUCCEEDED(hres)) {
  726. PDVE this;
  727. if (Num_Interfaces(CEffVxd) == 1) {
  728. this = _thisPvNm(*ppvObj, ded);
  729. } else {
  730. this = _thisPv(*ppvObj);
  731. }
  732. /* No initialization needed */
  733. }
  734. ExitOleProcPpvR(ppvObj);
  735. return hres;
  736. }
  737. /*****************************************************************************
  738. *
  739. * The long-awaited vtbls and templates
  740. *
  741. *****************************************************************************/
  742. #pragma BEGIN_CONST_DATA
  743. #define CEffVxd_Signature 0x46454556 /* "VEFF" */
  744. Primary_Interface_Begin(CEffVxd, IDirectInputEffectDriver)
  745. CEffVxd_DeviceID,
  746. CEffVxd_GetVersions,
  747. CEffVxd_Escape,
  748. CEffVxd_SetGain,
  749. CEffVxd_SetForceFeedbackState,
  750. CEffVxd_GetForceFeedbackState,
  751. CEffVxd_DownloadEffect,
  752. CEffVxd_DestroyEffect,
  753. CEffVxd_StartEffect,
  754. CEffVxd_StopEffect,
  755. CEffVxd_GetEffectStatus,
  756. Primary_Interface_End(CEffVxd, IDirectInputEffectDriver)
  757. #endif // defined(IDirectInputDevice2Vtbl)
  758. #endif