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.

116 lines
2.7 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: didevobjinstobj.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. #include "stdafx.h"
  11. #include "Direct.h"
  12. #include "dms.h"
  13. #include "diDevObjInstObj.h"
  14. extern BSTR GUIDtoBSTR(LPGUID g);
  15. extern BSTR DINPUTGUIDtoBSTR(LPGUID g);
  16. STDMETHODIMP C_dxj_DIDeviceObjectInstanceObject::getGuidType( BSTR __RPC_FAR *ret){
  17. *ret=DINPUTGUIDtoBSTR(&m_inst.guidType);
  18. return S_OK;
  19. }
  20. STDMETHODIMP C_dxj_DIDeviceObjectInstanceObject::getOfs( long __RPC_FAR *ret){
  21. *ret=(long)m_inst.dwOfs;
  22. return S_OK;
  23. }
  24. STDMETHODIMP C_dxj_DIDeviceObjectInstanceObject::getType( long __RPC_FAR *ret)
  25. {
  26. *ret=(long)m_inst.dwType;
  27. return S_OK;
  28. }
  29. STDMETHODIMP C_dxj_DIDeviceObjectInstanceObject::getFlags( long __RPC_FAR *ret)
  30. {
  31. *ret=(long)m_inst.dwFlags;
  32. return S_OK;
  33. }
  34. //USES_CONVERSION;
  35. STDMETHODIMP C_dxj_DIDeviceObjectInstanceObject::getName( BSTR __RPC_FAR *ret){
  36. *ret=SysAllocString(m_inst.tszName); //T2BSTR(m_inst.tszName);
  37. return S_OK;
  38. }
  39. STDMETHODIMP C_dxj_DIDeviceObjectInstanceObject::getCollectionNumber( short __RPC_FAR *ret)
  40. {
  41. *ret=(short)m_inst.wCollectionNumber;
  42. return S_OK;
  43. }
  44. STDMETHODIMP C_dxj_DIDeviceObjectInstanceObject::getDesignatorIndex( short __RPC_FAR *ret)
  45. {
  46. *ret=(short)m_inst.wDesignatorIndex;
  47. return S_OK;
  48. }
  49. STDMETHODIMP C_dxj_DIDeviceObjectInstanceObject::getUsagePage( short __RPC_FAR *ret)
  50. {
  51. *ret=(short)m_inst.wUsagePage;
  52. return S_OK;
  53. }
  54. STDMETHODIMP C_dxj_DIDeviceObjectInstanceObject::getUsage( short __RPC_FAR *ret)
  55. {
  56. *ret=(short)m_inst.wUsage;
  57. return S_OK;
  58. }
  59. STDMETHODIMP C_dxj_DIDeviceObjectInstanceObject::getExponent( short __RPC_FAR *ret)
  60. {
  61. *ret=(short)m_inst.wExponent;
  62. return S_OK;
  63. }
  64. STDMETHODIMP C_dxj_DIDeviceObjectInstanceObject::getDimension( long __RPC_FAR *ret)
  65. {
  66. *ret=(long)m_inst.dwDimension;
  67. return S_OK;
  68. }
  69. C_dxj_DIDeviceObjectInstanceObject::C_dxj_DIDeviceObjectInstanceObject()
  70. {
  71. ZeroMemory(&m_inst,sizeof(DIDEVICEOBJECTINSTANCEW));
  72. }
  73. void C_dxj_DIDeviceObjectInstanceObject::init(DIDEVICEOBJECTINSTANCEW *inst)
  74. {
  75. memcpy(&m_inst,inst,sizeof(DIDEVICEOBJECTINSTANCEW));
  76. }
  77. HRESULT C_dxj_DIDeviceObjectInstanceObject::create(DIDEVICEOBJECTINSTANCEW *inst,I_dxj_DirectInputDeviceObjectInstance **ret)
  78. {
  79. HRESULT hr;
  80. if (!ret) return E_INVALIDARG;
  81. C_dxj_DIDeviceObjectInstanceObject *c=NULL;
  82. c=new CComObject<C_dxj_DIDeviceObjectInstanceObject>;
  83. if( c == NULL ) return E_FAIL;
  84. c->init(inst);
  85. hr=c->QueryInterface(IID_I_dxj_DirectInputDeviceObjectInstance, (void**)ret);
  86. return hr;
  87. }