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

Function cmdClasses

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

Source from the content-addressed store, hash-verified

110}
111
112int cmdClasses(_In_ LPCTSTR BaseName, _In_opt_ LPCTSTR Machine, _In_ DWORD Flags, _In_ int argc, _In_reads_(argc) PTSTR argv[])
113/*++
114
115Routine Description:
116
117 CLASSES command
118 lists classes on (optionally) specified machine
119 format as <name>: <destination>
120
121Arguments:
122
123 BaseName - name of executable
124 Machine - if non-NULL, remote machine
125 argc/argv - remaining parameters - ignored
126
127Return Value:
128
129 EXIT_xxxx
130
131--*/
132{
133 DWORD reqGuids = 128;
134 DWORD numGuids;
135 LPGUID guids = NULL;
136 DWORD index;
137 int failcode = EXIT_FAIL;
138
139 UNREFERENCED_PARAMETER(BaseName);
140 UNREFERENCED_PARAMETER(Flags);
141 UNREFERENCED_PARAMETER(argc);
142 UNREFERENCED_PARAMETER(argv);
143
144 guids = new GUID[reqGuids];
145 if(!guids) {
146 goto final;
147 }
148 if(!SetupDiBuildClassInfoListEx(0,guids,reqGuids,&numGuids,Machine,NULL)) {
149 do {
150 if(GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
151 goto final;
152 }
153 delete [] guids;
154 reqGuids = numGuids;
155 guids = new GUID[reqGuids];
156 if(!guids) {
157 goto final;
158 }
159 } while(!SetupDiBuildClassInfoListEx(0,guids,reqGuids,&numGuids,Machine,NULL));
160 }
161 FormatToStream(stdout,Machine?MSG_CLASSES_HEADER:MSG_CLASSES_HEADER_LOCAL,numGuids,Machine);
162 for(index=0;index<numGuids;index++) {
163 TCHAR className[MAX_CLASS_NAME_LEN];
164 TCHAR classDesc[LINE_LEN];
165 if(!SetupDiClassNameFromGuidEx(&guids[index],className,MAX_CLASS_NAME_LEN,NULL,Machine,NULL)) {
166 if (FAILED(StringCchCopy(className,MAX_CLASS_NAME_LEN,TEXT("?")))) {
167 goto final;
168 }
169 }

Callers

nothing calls this directly

Calls 1

FormatToStreamFunction · 0.85

Tested by

no test coverage detected