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.

99 lines
2.3 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: didevinstobj.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. #include "stdafx.h"
  11. #include "Direct.h"
  12. #include "dms.h"
  13. #include "diDevInstObj.h"
  14. #include "dinputDeviceObj.h"
  15. extern BSTR GUIDtoBSTR(LPGUID g);
  16. extern BSTR DINPUTGUIDtoBSTR(LPGUID g);
  17. STDMETHODIMP C_dxj_DIDeviceInstance8Object::getGuidInstance( BSTR __RPC_FAR *ret){
  18. *ret=DINPUTGUIDtoBSTR(&m_inst.guidInstance);
  19. return S_OK;
  20. }
  21. STDMETHODIMP C_dxj_DIDeviceInstance8Object::getGuidProduct( BSTR __RPC_FAR *ret){
  22. *ret=GUIDtoBSTR( &(m_inst.guidProduct));
  23. return S_OK;
  24. }
  25. STDMETHODIMP C_dxj_DIDeviceInstance8Object::getGuidFFDriver( BSTR __RPC_FAR *ret){
  26. *ret=DINPUTGUIDtoBSTR(&(m_inst.guidFFDriver));
  27. return S_OK;
  28. }
  29. //USES_CONVERSION;
  30. STDMETHODIMP C_dxj_DIDeviceInstance8Object::getProductName( BSTR __RPC_FAR *ret){
  31. *ret=SysAllocString(m_inst.tszProductName); //T2BSTR(m_inst.tszProductName);
  32. return S_OK;
  33. }
  34. STDMETHODIMP C_dxj_DIDeviceInstance8Object::getInstanceName( BSTR __RPC_FAR *ret){
  35. *ret=SysAllocString(m_inst.tszInstanceName); //(m_inst.tszInstanceName);
  36. return S_OK;
  37. }
  38. STDMETHODIMP C_dxj_DIDeviceInstance8Object::getUsagePage( short __RPC_FAR *ret)
  39. {
  40. *ret=(short)m_inst.wUsagePage;
  41. return S_OK;
  42. }
  43. STDMETHODIMP C_dxj_DIDeviceInstance8Object::getUsage( short __RPC_FAR *ret)
  44. {
  45. *ret=(short)m_inst.wUsage;
  46. return S_OK;
  47. }
  48. STDMETHODIMP C_dxj_DIDeviceInstance8Object::getDevType( long __RPC_FAR *ret)
  49. {
  50. *ret=(long)m_inst.dwDevType;
  51. return S_OK;
  52. }
  53. C_dxj_DIDeviceInstance8Object::C_dxj_DIDeviceInstance8Object()
  54. {
  55. ZeroMemory(&m_inst,sizeof(DIDEVICEINSTANCEW));
  56. }
  57. void C_dxj_DIDeviceInstance8Object::init(DIDEVICEINSTANCEW *inst)
  58. {
  59. memcpy(&m_inst,inst,sizeof(DIDEVICEINSTANCEW));
  60. }
  61. HRESULT C_dxj_DIDeviceInstance8Object::create(DIDEVICEINSTANCEW *inst,I_dxj_DirectInputDeviceInstance8 **ret)
  62. {
  63. HRESULT hr;
  64. if (!ret) return E_INVALIDARG;
  65. C_dxj_DIDeviceInstance8Object *c=NULL;
  66. c=new CComObject<C_dxj_DIDeviceInstance8Object>;
  67. c->init(inst);
  68. if( c == NULL ) return E_FAIL;
  69. hr=c->QueryInterface(IID_I_dxj_DirectInputDeviceInstance8, (void**)ret);
  70. return hr;
  71. }