Author Topic: CM_Locate_DevNode(Ex)  (Read 1079 times)

0 Members and 1 Guest are viewing this topic.

Offline Pierre Bellisle

  • JK-Mitglieder
  • Full Member
  • *
  • Posts: 108
  • User-Rate: +12/-7
CM_Locate_DevNode(Ex)
« on: February 13, 2021, 06:12:19 AM »
Salut Jose,

I was playing with CM_Locate_DevNode(Ex).
For some, life could be easier if the pdnDevInst DWORD parameter was declared as BYREF.

This applies for the four implementations of the function.
CM_Locate_DevNodeA()
CM_Locate_DevNodeW()
CM_Locate_DevNode_ExA()
CM_Locate_DevNode_ExW()

Hasta luego.
« Last Edit: February 13, 2021, 06:31:16 PM by Pierre Bellisle »

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2512
  • User-Rate: +209/-0
Re: CM_Locate_DevNode(Ex)
« Reply #1 on: February 13, 2021, 11:55:10 AM »
The "A" versions are correctly declared as BYREF ASCIIZ. The "W" versions should be BYREF WSTRINGZ. I declared them as BYVAL DWORD because I wrote it for PB9, that had no implemented this data type and then forgot to change it for PB10.

Attached is the modified file. I have changed CM_Create_DevNodeW, CM_Create_DevNode_ExW, CM_Get_HW_Prof_FlagsW, CM_Get_HW_Prof_Flags_ExW, CM_Get_Device_Interface_ListW, CM_Get_Device_Interface_List_ExW, CM_Get_Device_Interface_List_SizeW, CM_Get_Device_Interface_List_Size_ExW, CM_Locate_DevNodeW, CM_Locate_DevNode_ExW, CM_Set_HW_Prof_FlagsW and CM_Set_HW_Prof_Flags_ExW.

« Last Edit: February 13, 2021, 08:10:27 PM by José Roca »

Offline Pierre Bellisle

  • JK-Mitglieder
  • Full Member
  • *
  • Posts: 108
  • User-Rate: +12/-7
Re: CM_Locate_DevNode(Ex)
« Reply #2 on: February 13, 2021, 06:23:44 PM »
Hola Jose,

Thank for the update.
I guess I could have elaborate my thought a little bit more.
I was referring only to the pdnDevInst variable part.
pdnDevInst will be written to by the CM_Locate_DevNode(Ex)(AW) functions.

Code: [Select]
LOCAL crError    AS DWORD
LOCAL pdnDevInst AS DWORD

crError = CM_Locate_DevNode(BYVAL pdnDevInst, BYVAL %NULL, %CM_Locate_Devnode_Normal) 'crError = %CR_INVALID_POINTER 0x3

crError = CM_Locate_DevNode(BYREF pdnDevInst, BYVAL %NULL, %CM_Locate_Devnode_Normal) 'crError = %CR_SUCCESS 0x0
« Last Edit: February 13, 2021, 06:29:12 PM by Pierre Bellisle »

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2512
  • User-Rate: +209/-0
Re: CM_Locate_DevNode(Ex)
« Reply #3 on: February 13, 2021, 08:10:55 PM »
Ok. File updated.

Offline Pierre Bellisle

  • JK-Mitglieder
  • Full Member
  • *
  • Posts: 108
  • User-Rate: +12/-7
Re: CM_Locate_DevNode(Ex)
« Reply #4 on: February 13, 2021, 09:24:21 PM »
:-)