|
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 |
| -} |
| 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 | + public final static int CR_BUFFER_SMALL = 0x0000001A; |
| 42 | + |
| 43 | + public final static int CM_LOCATE_DEVNODE_NORMAL = 0; |
| 44 | + public final static int CM_LOCATE_DEVNODE_PHANTOM = 1; |
| 45 | + public final static int CM_LOCATE_DEVNODE_CANCELREMOVE = 2; |
| 46 | + public final static int CM_LOCATE_DEVNODE_NOVALIDATION = 4; |
| 47 | + public final static int CM_LOCATE_DEVNODE_BITS = 7; |
| 48 | + |
| 49 | + /** |
| 50 | + * The CM_Locate_DevNode function obtains a device instance handle to the |
| 51 | + * device node that is associated with a specified device instance ID on the |
| 52 | + * local machine. |
| 53 | + * |
| 54 | + * @param pdnDevInst |
| 55 | + * A pointer to a device instance handle that CM_Locate_DevNode |
| 56 | + * retrieves. The retrieved handle is bound to the local machine. |
| 57 | + * @param pDeviceID |
| 58 | + * A pointer to a NULL-terminated string representing a device |
| 59 | + * instance ID. If this value is NULL, or if it points to a |
| 60 | + * zero-length string, the function retrieves a device instance |
| 61 | + * handle to the device at the root of the device tree. * |
| 62 | + * @param ulFlags |
| 63 | + * A variable of ULONG type that supplies one of the following |
| 64 | + * flag values that apply if the caller supplies a device |
| 65 | + * instance identifier: CM_LOCATE_DEVNODE_NORMAL, |
| 66 | + * CM_LOCATE_DEVNODE_PHANTOM, CM_LOCATE_DEVNODE_CANCELREMOVE, or |
| 67 | + * CM_LOCATE_DEVNODE_NOVALIDATION |
| 68 | + * @return If the operation succeeds, CM_Locate_DevNode returns CR_SUCCESS. |
| 69 | + * Otherwise, the function returns one of the CR_Xxx error codes |
| 70 | + * that are defined in Cfgmgr32.h. |
| 71 | + * @see <A HREF= |
| 72 | + * "https://docs.microsoft.com/en-us/windows/desktop/api/cfgmgr32/nf-cfgmgr32-cm_locate_devnodea"> |
| 73 | + * CM_Locate_DevNode</A> |
| 74 | + */ |
| 75 | + int CM_Locate_DevNode(IntByReference pdnDevInst, String pDeviceID, int ulFlags); |
| 76 | + |
| 77 | + /** |
| 78 | + * The CM_Get_Parent function obtains a device instance handle to the parent |
| 79 | + * node of a specified device node (devnode) in the local machine's device |
| 80 | + * tree. |
| 81 | + * |
| 82 | + * @param pdnDevInst |
| 83 | + * Caller-supplied pointer to the device instance handle to the |
| 84 | + * parent node that this function retrieves. The retrieved handle |
| 85 | + * is bound to the local machine. |
| 86 | + * @param dnDevInst |
| 87 | + * Caller-supplied device instance handle that is bound to the |
| 88 | + * local machine. |
| 89 | + * @param ulFlags |
| 90 | + * Not used, must be zero. |
| 91 | + * @return If the operation succeeds, the function returns CR_SUCCESS. |
| 92 | + * Otherwise, it returns one of the CR_-prefixed error codes defined |
| 93 | + * in Cfgmgr32.h. |
| 94 | + * @see <A HREF= |
| 95 | + * "https://docs.microsoft.com/en-us/windows/desktop/api/cfgmgr32/nf-cfgmgr32-cm_get_parent"> |
| 96 | + * CM_Get_Parent</A> |
| 97 | + */ |
| 98 | + int CM_Get_Parent(IntByReference pdnDevInst, int dnDevInst, int ulFlags); |
| 99 | + |
| 100 | + /** |
| 101 | + * The CM_Get_Child function is used to retrieve a device instance handle to |
| 102 | + * the first child node of a specified device node (devnode) in the local |
| 103 | + * machine's device tree. |
| 104 | + * |
| 105 | + * @param pdnDevInst |
| 106 | + * Caller-supplied pointer to the device instance handle to the |
| 107 | + * child node that this function retrieves. The retrieved handle |
| 108 | + * is bound to the local machine. |
| 109 | + * @param dnDevInst |
| 110 | + * Caller-supplied device instance handle that is bound to the |
| 111 | + * local machine. |
| 112 | + * @param ulFlags |
| 113 | + * Not used, must be zero. |
| 114 | + * @return If the operation succeeds, the function returns CR_SUCCESS. |
| 115 | + * Otherwise, it returns one of the CR_-prefixed error codes defined |
| 116 | + * in Cfgmgr32.h. |
| 117 | + * @see <A HREF= |
| 118 | + * "https://docs.microsoft.com/en-us/windows/desktop/api/cfgmgr32/nf-cfgmgr32-cm_get_child"> |
| 119 | + * CM_Get_Child</A> |
| 120 | + */ |
| 121 | + int CM_Get_Child(IntByReference pdnDevInst, int dnDevInst, int ulFlags); |
| 122 | + |
| 123 | + /** |
| 124 | + * The CM_Get_Sibling function obtains a device instance handle to the next |
| 125 | + * sibling node of a specified device node (devnode) in the local machine's |
| 126 | + * device tree. |
| 127 | + * |
| 128 | + * @param pdnDevInst |
| 129 | + * Caller-supplied pointer to the device instance handle to the |
| 130 | + * sibling node that this function retrieves. The retrieved |
| 131 | + * handle is bound to the local machine. |
| 132 | + * @param dnDevInst |
| 133 | + * Caller-supplied device instance handle that is bound to the |
| 134 | + * local machine. |
| 135 | + * @param ulFlags |
| 136 | + * Not used, must be zero. |
| 137 | + * @return If the operation succeeds, the function returns CR_SUCCESS. |
| 138 | + * Otherwise, it returns one of the CR_-prefixed error codes defined |
| 139 | + * in Cfgmgr32.h. |
| 140 | + * @see <A HREF= |
| 141 | + * "https://docs.microsoft.com/en-us/windows/desktop/api/cfgmgr32/nf-cfgmgr32-cm_get_sibling"> |
| 142 | + * CM_Get_Sibling</A> |
| 143 | + */ |
| 144 | + int CM_Get_Sibling(IntByReference pdnDevInst, int dnDevInst, int ulFlags); |
| 145 | + |
| 146 | + /** |
| 147 | + * The CM_Get_Device_ID function retrieves the device instance ID for a |
| 148 | + * specified device instance on the local machine. |
| 149 | + * |
| 150 | + * @param devInst |
| 151 | + * Caller-supplied device instance handle that is bound to the |
| 152 | + * local machine. |
| 153 | + * @param Buffer |
| 154 | + * Address of a buffer to receive a device instance ID string. |
| 155 | + * The required buffer size can be obtained by calling |
| 156 | + * CM_Get_Device_ID_Size, then incrementing the received value to |
| 157 | + * allow room for the string's terminating NULL. |
| 158 | + * @param BufferLen |
| 159 | + * Caller-supplied length, in characters, of the buffer specified |
| 160 | + * by Buffer. |
| 161 | + * @param ulFlags |
| 162 | + * Not used, must be zero. |
| 163 | + * @return If the operation succeeds, the function returns CR_SUCCESS. |
| 164 | + * Otherwise, it returns one of the CR_-prefixed error codes defined |
| 165 | + * in Cfgmgr32.h. |
| 166 | + * @see <A HREF= |
| 167 | + * "https://docs.microsoft.com/en-us/windows/desktop/api/cfgmgr32/nf-cfgmgr32-cm_get_device_idw"> |
| 168 | + * CM_Get_Device_ID</A> |
| 169 | + */ |
| 170 | + int CM_Get_Device_ID(int devInst, Pointer Buffer, int BufferLen, int ulFlags); |
| 171 | + |
| 172 | + /** |
| 173 | + * The CM_Get_Device_ID_Size function retrieves the buffer size required to |
| 174 | + * hold a device instance ID for a device instance on the local machine. |
| 175 | + * |
| 176 | + * @param pulLen |
| 177 | + * Receives a value representing the required buffer size, in |
| 178 | + * characters. |
| 179 | + * @param dnDevInst |
| 180 | + * Caller-supplied device instance handle that is bound to the |
| 181 | + * local machine. |
| 182 | + * @param ulFlags |
| 183 | + * Not used, must be zero. |
| 184 | + * @return If the operation succeeds, the function returns CR_SUCCESS. |
| 185 | + * Otherwise, it returns one of the CR_-prefixed error codes defined |
| 186 | + * in Cfgmgr32.h. |
| 187 | + * @see <A HREF= |
| 188 | + * "https://docs.microsoft.com/en-us/windows/desktop/api/cfgmgr32/nf-cfgmgr32-cm_get_device_id_size"> |
| 189 | + * CM_Get_Device_ID_Size</A> |
| 190 | + */ |
| 191 | + int CM_Get_Device_ID_Size(IntByReference pulLen, int dnDevInst, int ulFlags); |
| 192 | +} |
0 commit comments