CM_Locate_DevNode(Ex)

Started by Pierre Bellisle, February 13, 2021, 06:12:19 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Pierre Bellisle

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.

José Roca

#1
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.


Pierre Bellisle

#2
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.


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

José Roca

Ok. File updated.

Pierre Bellisle