MCPcopy Create free account
hub / github.com/deskflow/deskflow / nextProcessEntry

Method nextProcessEntry

src/lib/platform/MSWindowsSession.cpp:133–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133BOOL MSWindowsSession::nextProcessEntry(HANDLE snapshot, LPPROCESSENTRY32 entry)
134{
135 // TODO: issue S3-2021
136 // resetting the error state here is acceptable, but having to do so indicates
137 // that a different win32 function call has failed beforehand. we should
138 // always check for errors after each win32 function call.
139 SetLastError(0);
140
141 BOOL gotEntry = Process32Next(snapshot, entry);
142 if (!gotEntry) {
143
144 DWORD err = GetLastError();
145
146 // only throw if it's not the end of the snapshot, if not the 'no more
147 // files' error then it's probably something serious.
148 if (err != ERROR_NO_MORE_FILES) {
149 LOG_ERR("could not get next process entry");
150 throw std::runtime_error(windowsErrorToString(GetLastError()));
151 }
152 }
153
154 return gotEntry;
155}

Callers

nothing calls this directly

Calls 1

windowsErrorToStringFunction · 0.85

Tested by

no test coverage detected