| 49 | } |
| 50 | |
| 51 | void DBWinReader::Notify() |
| 52 | { |
| 53 | static_assert(systemProcessNamesCount == Win32::fixedNumberOfSystemPids, "The size of the systemProcessNames array must be 'fixedNumberOfSystemPids' (5)"); |
| 54 | if (m_dbWinBuffer->processId < Win32::fixedNumberOfSystemPids) |
| 55 | { |
| 56 | Add(m_dbWinBuffer->processId, systemProcessNames[m_dbWinBuffer->processId], m_dbWinBuffer->data); |
| 57 | } |
| 58 | else |
| 59 | { |
| 60 | HANDLE handle = ::OpenProcess(PROCESS_QUERY_INFORMATION | SYNCHRONIZE, FALSE, m_dbWinBuffer->processId); |
| 61 | #ifdef OPENPROCESS_DEBUG |
| 62 | if (!handle) |
| 63 | { |
| 64 | Win32::Win32Error error(GetLastError(), "OpenProcess"); |
| 65 | LogSource::Add(stringbuilder() << error.what() << ", data: " << m_dbWinBuffer->data << " (pid: " << m_dbWinBuffer->processId << ")"); |
| 66 | } |
| 67 | #else |
| 68 | // performance does not improve significantly (almost immeasurable) without the Add() call, nor without the OpenProcess call. |
| 69 | // there might be performance to be gained by: |
| 70 | // - making a non-virtual Notice() method |
| 71 | // - copying the information from m_dbWinBuffer->data and calling SetEvent(m_dbWinBufferReady.get()); before _any_ other operation. |
| 72 | if (handle) |
| 73 | Add(handle, m_dbWinBuffer->data); |
| 74 | else |
| 75 | Add(m_dbWinBuffer->processId, "<system>", m_dbWinBuffer->data); |
| 76 | #endif |
| 77 | } |
| 78 | ::SetEvent(m_dbWinBufferReady.get()); |
| 79 | } |
| 80 | |
| 81 | } // namespace debugviewpp |
| 82 | } // namespace fusion |
nothing calls this directly
no test coverage detected