MCPcopy Create free account
hub / github.com/Apache553/SubtitleFontHelper / QueryAndLoad

Function QueryAndLoad

FontLoadInterceptor/RpcClient.cpp:377–423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

375 }
376
377 void QueryAndLoad(const wchar_t* query)
378 {
379 try
380 {
381 if (query == nullptr)
382 return;
383 // strip GDI added prefix '@'
384 if (*query == L'@')
385 ++query;
386 // skip empty string
387 if (*query == L'\0')
388 return;
389 if (!QueryCache::GetInstance().IsQueryNeeded(query))
390 return;
391 auto response = QueryFont(query);
392
393 std::vector<std::wstring> paths;
394 for (int i = 0; i < response.fonts_size(); ++i)
395 {
396 auto& font = response.fonts()[i];
397 auto path = Utf8ToWideString(font.path());
398 paths.emplace_back(std::move(path));
399 }
400 QueryCache::GetInstance().AddToCache(query);
401 std::vector<const wchar_t*> logData;
402 for (auto& s : paths)
403 {
404 logData.push_back(s.c_str());
405 }
406 if (logData.empty())
407 {
408 EventLog::GetInstance().LogDllQueryNoResult(GetCurrentProcessId(), GetCurrentThreadId(), query);
409 }
410 else
411 {
412 EventLog::GetInstance().LogDllQuerySuccess(GetCurrentProcessId(), GetCurrentThreadId(), query, logData);
413 }
414
415 TryLoad(query, response);
416 }
417 catch (std::exception& e)
418 {
419 EventLog::GetInstance().LogDllQueryFailure(GetCurrentProcessId(), GetCurrentThreadId(), query,
420 AnsiStringToWideString(e.what()).c_str());
421 // ignore exceptions
422 }
423 }
424
425 void QueryAndLoad(const char* query)
426 {

Callers 10

CreateFontAMethod · 0.85
CreateFontWMethod · 0.85
CreateFontIndirectAMethod · 0.85
CreateFontIndirectWMethod · 0.85
CreateFontIndirectExAMethod · 0.85
CreateFontIndirectExWMethod · 0.85
EnumFontFamiliesAMethod · 0.85
EnumFontFamiliesWMethod · 0.85
EnumFontFamiliesExAMethod · 0.85
EnumFontFamiliesExWMethod · 0.85

Calls 9

QueryFontFunction · 0.85
TryLoadFunction · 0.85
AnsiStringToWideStringFunction · 0.85
IsQueryNeededMethod · 0.80
AddToCacheMethod · 0.80
LogDllQueryNoResultMethod · 0.80
Utf8ToWideStringFunction · 0.70
LogDllQuerySuccessMethod · 0.45
LogDllQueryFailureMethod · 0.45

Tested by

no test coverage detected