Leaked source code of windows server 2003
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.8 KiB

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