Jose's Read Only Forum 2023

IT-Consultant: José Roca (PBWIN 10+/PBCC 6+) (Archive only) => Windows API Headers => Topic started by: Pierre Bellisle on February 13, 2021, 06:12:19 AM

Title: CM_Locate_DevNode(Ex)
Post by: Pierre Bellisle 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.
Title: Re: CM_Locate_DevNode(Ex)
Post by: José Roca 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.

Title: Re: CM_Locate_DevNode(Ex)
Post by: Pierre Bellisle 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.


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
Title: Re: CM_Locate_DevNode(Ex)
Post by: José Roca on February 13, 2021, 08:10:55 PM
Ok. File updated.
Title: Re: CM_Locate_DevNode(Ex)
Post by: Pierre Bellisle on February 13, 2021, 09:24:21 PM
:-)