Add CPU/GPU gate and support new ANSALPR using OCR

This commit is contained in:
2026-04-12 17:16:16 +10:00
parent 27083a6530
commit 0a8aaed215
30 changed files with 1870 additions and 2166 deletions

View File

@@ -1,5 +1,7 @@
// dllmain.cpp : Defines the entry point for the DLL application.
#include "pch.h"
#include "ANSCVVendorGate.h" // anscv_vendor_gate::IsNvidiaGpuAvailable()
#include "ANSLicense.h" // ANSCENTER::EngineType, CheckHardwareInformation
#include <mutex>
#include <unordered_map>
#include <iostream>
@@ -61,6 +63,15 @@ BOOL APIENTRY DllMain( HMODULE hModule,
// Pinning keeps the code pages mapped; the OS kills all threads when
// the process exits, so this is safe and is Microsoft's recommended
// pattern for DLLs that own threads.
//
// CRITICAL: do NOT call CheckHardwareInformation() or
// anscv_vendor_gate::IsNvidiaGpuAvailable() here. DllMain holds the
// OS loader lock (LdrpLoaderLock). CheckHardwareInformation touches
// hwinfo → DXGI / WMI / COM which internally call LoadLibrary; doing
// that while holding the loader lock causes a classic loader-lock
// deadlock (confirmed by stress-test hang). The vendor gate will
// lazy-initialise on the first real call from worker code, which
// runs with the loader lock released.
{
HMODULE hSelf = nullptr;
GetModuleHandleExW(