|
| 1 | +/* Copyright (c) 2018 Daniel Widdis, All Rights Reserved |
| 2 | + * |
| 3 | + * The contents of this file is dual-licensed under 2 |
| 4 | + * alternative Open Source/Free licenses: LGPL 2.1 or later and |
| 5 | + * Apache License 2.0. (starting with JNA version 4.0.0). |
| 6 | + * |
| 7 | + * You can freely decide which license you want to apply to |
| 8 | + * the project. |
| 9 | + * |
| 10 | + * You may obtain a copy of the LGPL License at: |
| 11 | + * |
| 12 | + * http://www.gnu.org/licenses/licenses.html |
| 13 | + * |
| 14 | + * A copy is also included in the downloadable source code package |
| 15 | + * containing JNA, in file "LGPL2.1". |
| 16 | + * |
| 17 | + * You may obtain a copy of the Apache License at: |
| 18 | + * |
| 19 | + * http://www.apache.org/licenses/ |
| 20 | + * |
| 21 | + * A copy is also included in the downloadable source code package |
| 22 | + * containing JNA, in file "AL2.0". |
| 23 | + */ |
| 24 | +package com.sun.jna.platform.win32; |
| 25 | + |
| 26 | +import com.sun.jna.Library; |
| 27 | +import com.sun.jna.Native; |
| 28 | +import com.sun.jna.Pointer; |
| 29 | +import com.sun.jna.ptr.IntByReference; |
| 30 | +import com.sun.jna.win32.W32APIOptions; |
| 31 | + |
| 32 | +/** |
| 33 | + * Windows Cfgmgr32. |
| 34 | + * |
| 35 | + * @author widdis[at]gmail[dot]com |
| 36 | + */ |
| 37 | +public interface Cfgmgr32 extends Library { |
| 38 | + Cfgmgr32 INSTANCE = Native.load("Cfgmgr32", Cfgmgr32.class, W32APIOptions.DEFAULT_OPTIONS); |
| 39 | + |
| 40 | + public final static int CR_SUCCESS = 0; |
| 41 | + |
| 42 | + public final static int CM_LOCATE_DEVNODE_NORMAL = 0; |
| 43 | + public final static int CM_LOCATE_DEVNODE_PHANTOM = 1; |
| 44 | + public final static int CM_LOCATE_DEVNODE_CANCELREMOVE = 2; |
| 45 | + public final static int CM_LOCATE_DEVNODE_NOVALIDATION = 4; |
| 46 | + public final static int CM_LOCATE_DEVNODE_BITS = 7; |
| 47 | + |
| 48 | + /** |
| 49 | + * The CM_Locate_DevNode function obtains a device instance handle to the |
| 50 | + * device node that is associated with a specified device instance ID on the |
| 51 | + * local machine. |
| 52 | + * |
| 53 | + * @param pdnDevInst |
| 54 | + * A pointer to a device instance handle that CM_Locate_DevNode |
| 55 | + * retrieves. The retrieved handle is bound to the local machine. |
| 56 | + * @param pDeviceID |
| 57 | + * A pointer to a NULL-terminated string representing a device |
| 58 | + * instance ID. If this value is NULL, or if it points to a |
| 59 | + * zero-length string, the function retrieves a device instance |
| 60 | + * handle to the device at the root of the device tree. * |
| 61 | + * @param ulFlags |
| 62 | + * A variable of ULONG type that supplies one of the following |
| 63 | + * flag values that apply if the caller supplies a device |
| 64 | + * instance identifier: CM_LOCATE_DEVNODE_NORMAL, |
| 65 | + * CM_LOCATE_DEVNODE_PHANTOM, CM_LOCATE_DEVNODE_CANCELREMOVE, or |
| 66 | + * CM_LOCATE_DEVNODE_NOVALIDATION |
| 67 | + * @return If the operation succeeds, CM_Locate_DevNode returns CR_SUCCESS. |
| 68 | + * Otherwise, the function returns one of the CR_Xxx error codes |
| 69 | + * that are defined in Cfgmgr32.h. |
| 70 | + * @see <A HREF= |
| 71 | + * "https://docs.microsoft.com/en-us/windows/desktop/api/cfgmgr32/nf-cfgmgr32-cm_locate_devnodea"> |
| 72 | + * CM_Locate_DevNode</A> |
| 73 | + */ |
| 74 | + int CM_Locate_DevNode(IntByReference pdnDevInst, String pDeviceID, int ulFlags); |
| 75 | + |
| 76 | + /** |
| 77 | + * The CM_Get_Parent function obtains a device instance handle to the parent |
| 78 | + * node of a specified device node (devnode) in the local machine's device |
| 79 | + * tree. |
| 80 | + * |
| 81 | + * @param pdnDevInst |
| 82 | + * Caller-supplied pointer to the device instance handle to the |
| 83 | + * parent node that this function retrieves. The retrieved handle |
| 84 | + * is bound to the local machine. |
| 85 | + * @param dnDevInst |
| 86 | + * Caller-supplied device instance handle that is bound to the |
| 87 | + * local machine. |
| 88 | + * @param ulFlags |
| 89 | + * Not used, must be zero. |
| 90 | + * @return If the operation succeeds, the function returns CR_SUCCESS. |
| 91 | + * Otherwise, it returns one of the CR_-prefixed error codes defined |
| 92 | + * in Cfgmgr32.h. |
| 93 | + * @see <A HREF= |
| 94 | + * "https://docs.microsoft.com/en-us/windows/desktop/api/cfgmgr32/nf-cfgmgr32-cm_get_parent"> |
| 95 | + * CM_Get_Parent</A> |
| 96 | + */ |
| 97 | + int CM_Get_Parent(IntByReference pdnDevInst, int dnDevInst, int ulFlags); |
| 98 | + |
| 99 | + /** |
| 100 | + * The CM_Get_Child function is used to retrieve a device instance handle to |
| 101 | + * the first child node of a specified device node (devnode) in the local |
| 102 | + * machine's device tree. |
| 103 | + * |
| 104 | + * @param pdnDevInst |
| 105 | + * Caller-supplied pointer to the device instance handle to the |
| 106 | + * child node that this function retrieves. The retrieved handle |
| 107 | + * is bound to the local machine. |
| 108 | + * @param dnDevInst |
| 109 | + * Caller-supplied device instance handle that is bound to the |
| 110 | + * local machine. |
| 111 | + * @param ulFlags |
| 112 | + * Not used, must be zero. |
| 113 | + * @return If the operation succeeds, the function returns CR_SUCCESS. |
| 114 | + * Otherwise, it returns one of the CR_-prefixed error codes defined |
| 115 | + * in Cfgmgr32.h. |
| 116 | + * @see <A HREF= |
| 117 | + * "https://docs.microsoft.com/en-us/windows/desktop/api/cfgmgr32/nf-cfgmgr32-cm_get_child"> |
| 118 | + * CM_Get_Child</A> |
| 119 | + */ |
| 120 | + int CM_Get_Child(IntByReference pdnDevInst, int dnDevInst, int ulFlags); |
| 121 | + |
| 122 | + /** |
| 123 | + * The CM_Get_Sibling function obtains a device instance handle to the next |
| 124 | + * sibling node of a specified device node (devnode) in the local machine's |
| 125 | + * device tree. |
| 126 | + * |
| 127 | + * @param pdnDevInst |
| 128 | + * Caller-supplied pointer to the device instance handle to the |
| 129 | + * sibling node that this function retrieves. The retrieved |
| 130 | + * handle is bound to the local machine. |
| 131 | + * @param dnDevInst |
| 132 | + * Caller-supplied device instance handle that is bound to the |
| 133 | + * local machine. |
| 134 | + * @param ulFlags |
| 135 | + * Not used, must be zero. |
| 136 | + * @return If the operation succeeds, the function returns CR_SUCCESS. |
| 137 | + * Otherwise, it returns one of the CR_-prefixed error codes defined |
| 138 | + * in Cfgmgr32.h. |
| 139 | + * @see <A HREF= |
| 140 | + * "https://docs.microsoft.com/en-us/windows/desktop/api/cfgmgr32/nf-cfgmgr32-cm_get_sibling"> |
| 141 | + * CM_Get_Sibling</A> |
| 142 | + */ |
| 143 | + int CM_Get_Sibling(IntByReference pdnDevInst, int dnDevInst, int ulFlags); |
| 144 | + |
| 145 | + /** |
| 146 | + * The CM_Get_Device_ID function retrieves the device instance ID for a |
| 147 | + * specified device instance on the local machine. |
| 148 | + * |
| 149 | + * @param devInst |
| 150 | + * Caller-supplied device instance handle that is bound to the |
| 151 | + * local machine. |
| 152 | + * @param Buffer |
| 153 | + * Address of a buffer to receive a device instance ID string. |
| 154 | + * The required buffer size can be obtained by calling |
| 155 | + * CM_Get_Device_ID_Size, then incrementing the received value to |
| 156 | + * allow room for the string's terminating NULL. |
| 157 | + * @param BufferLen |
| 158 | + * Caller-supplied length, in characters, of the buffer specified |
| 159 | + * by Buffer. |
| 160 | + * @param ulFlags |
| 161 | + * Not used, must be zero. |
| 162 | + * @return If the operation succeeds, the function returns CR_SUCCESS. |
| 163 | + * Otherwise, it returns one of the CR_-prefixed error codes defined |
| 164 | + * in Cfgmgr32.h. |
| 165 | + * @see <A HREF= |
| 166 | + * "https://docs.microsoft.com/en-us/windows/desktop/api/cfgmgr32/nf-cfgmgr32-cm_get_device_idw"> |
| 167 | + * CM_Get_Device_ID</A> |
| 168 | + */ |
| 169 | + int CM_Get_Device_ID(int devInst, Pointer Buffer, int BufferLen, int ulFlags); |
| 170 | + |
| 171 | + /** |
| 172 | + * The CM_Get_Device_ID_Size function retrieves the buffer size required to |
| 173 | + * hold a device instance ID for a device instance on the local machine. |
| 174 | + * |
| 175 | + * @param pulLen |
| 176 | + * Receives a value representing the required buffer size, in |
| 177 | + * characters. |
| 178 | + * @param dnDevInst |
| 179 | + * Caller-supplied device instance handle that is bound to the |
| 180 | + * local machine. |
| 181 | + * @param ulFlags |
| 182 | + * Not used, must be zero. |
| 183 | + * @return If the operation succeeds, the function returns CR_SUCCESS. |
| 184 | + * Otherwise, it returns one of the CR_-prefixed error codes defined |
| 185 | + * in Cfgmgr32.h. |
| 186 | + * @see <A HREF= |
| 187 | + * "https://docs.microsoft.com/en-us/windows/desktop/api/cfgmgr32/nf-cfgmgr32-cm_get_device_id_size"> |
| 188 | + * CM_Get_Device_ID_Size</A> |
| 189 | + */ |
| 190 | + int CM_Get_Device_ID_Size(IntByReference pulLen, int dnDevInst, int ulFlags); |
| 191 | +} |
0 commit comments