| 28 | } |
| 29 | |
| 30 | void sfh::EventLog::LogDllQuerySuccess(uint32_t processId, uint32_t threadId, const wchar_t* requestName, |
| 31 | const std::vector<const wchar_t*> responsePaths) |
| 32 | { |
| 33 | if (!MCGEN_EVENT_ENABLED(DllQuerySuccess)) |
| 34 | return; |
| 35 | |
| 36 | ULONG dataCount = 4 + static_cast<ULONG>(responsePaths.size()); |
| 37 | auto data = std::make_unique<EVENT_DATA_DESCRIPTOR[]>(dataCount); |
| 38 | uint32_t pathLength = static_cast<uint32_t>(responsePaths.size()); |
| 39 | |
| 40 | EventDataDescCreate(&data[0], &processId, sizeof(uint32_t)); |
| 41 | EventDataDescCreate(&data[1], &threadId, sizeof(uint32_t)); |
| 42 | EventDataDescCreate(&data[2], requestName ? requestName : L"NULL", |
| 43 | static_cast<ULONG>(requestName |
| 44 | ? (wcslen(requestName) + 1) * sizeof(wchar_t) |
| 45 | : sizeof(L"NULL"))); |
| 46 | EventDataDescCreate(&data[3], &pathLength, sizeof(uint32_t)); |
| 47 | for (size_t i = 0; i < responsePaths.size(); ++i) |
| 48 | { |
| 49 | auto path = responsePaths[i]; |
| 50 | EventDataDescCreate(&data[4 + i], path ? path : L"NULL", |
| 51 | static_cast<ULONG>(path ? (wcslen(path) + 1) * sizeof(wchar_t) : sizeof(L"NULL"))); |
| 52 | } |
| 53 | EventWrite(SubtitleFontHelper_Context.RegistrationHandle, &DllQuerySuccess, dataCount, data.get()); |
| 54 | } |
| 55 | |
| 56 | void sfh::EventLog::LogDllQueryFailure(uint32_t processId, uint32_t threadId, const wchar_t* requestName, |
| 57 | const wchar_t* reason) |