MCPcopy Create free account
hub / github.com/NullArray/WinKernel-Resources / cmdListClass

Function cmdListClass

Drivers/Driver-SRC/setup/devcon/cmds.cpp:188–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188int cmdListClass(_In_ LPCTSTR BaseName, _In_opt_ LPCTSTR Machine, _In_ DWORD Flags, _In_ int argc, _In_reads_(argc) PTSTR argv[])
189/*++
190
191Routine Description:
192
193 LISTCLASS <name>....
194 lists all devices for each specified class
195 there can be more than one physical class for a class name (shouldn't be
196 though) in such cases, list each class
197 if machine given, list devices for that machine
198
199Arguments:
200
201 BaseName - name of executable
202 Machine - if non-NULL, remote machine
203 argc/argv - remaining parameters - list of class names
204
205Return Value:
206
207 EXIT_xxxx
208
209--*/
210{
211 DWORD reqGuids = 16;
212 int argIndex;
213 int failcode = EXIT_FAIL;
214 LPGUID guids = NULL;
215 HDEVINFO devs = INVALID_HANDLE_VALUE;
216
217 UNREFERENCED_PARAMETER(BaseName);
218 UNREFERENCED_PARAMETER(Flags);
219
220 if(!argc) {
221 return EXIT_USAGE;
222 }
223
224 guids = new GUID[reqGuids];
225 if(!guids) {
226 goto final;
227 }
228
229 for(argIndex = 0;argIndex<argc;argIndex++) {
230 DWORD numGuids;
231 DWORD index;
232
233 if(!(argv[argIndex] && argv[argIndex][0])) {
234 continue;
235 }
236
237 //
238 // there could be one to many name to GUID mapping
239 //
240 while(!SetupDiClassGuidsFromNameEx(argv[argIndex],guids,reqGuids,&numGuids,Machine,NULL)) {
241 if(GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
242 goto final;
243 }
244 delete [] guids;
245 reqGuids = numGuids;

Callers

nothing calls this directly

Calls 2

FormatToStreamFunction · 0.85
DumpDeviceFunction · 0.85

Tested by

no test coverage detected