MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / GetControlAPIDLLPath

Function GetControlAPIDLLPath

IntelPresentMon/ControlLib/cApiWrapper.cpp:52–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50#define CTL_DLL_PATH_LEN 512
51
52ctl_result_t GetControlAPIDLLPath(ctl_init_args_t* pInitArgs, wchar_t* pwcDLLPath)
53{
54 if ((NULL == pRuntimeArgs) || (NULL == pRuntimeArgs->pRuntimePath))
55 {
56 // Load the requested DLL based on major version in init args
57 uint16_t majorVersion = CTL_MAJOR_VERSION(pInitArgs->AppVersion);
58
59 // If caller's major version is higher than the DLL's, then simply not support the caller!
60 // This is not supposed to happen as wrapper is part of the app itself which includes igcl_api.h with right major version
61 if (majorVersion > CTL_IMPL_MAJOR_VERSION)
62 return CTL_RESULT_ERROR_UNSUPPORTED_VERSION;
63
64#if (CTL_IMPL_MAJOR_VERSION > 1)
65 if (majorVersion > 1)
66 StringCbPrintfW(pwcDLLPath,CTL_DLL_PATH_LEN,L"%s%d.dll", CTL_DLL_NAME, majorVersion);
67 else // just control_api.dll
68 StringCbPrintfW(pwcDLLPath,CTL_DLL_PATH_LEN,L"%s.dll", CTL_DLL_NAME);
69#else
70 StringCbPrintfW(pwcDLLPath,CTL_DLL_PATH_LEN,L"%s.dll", CTL_DLL_NAME);
71#endif
72
73 }
74 else if (pRuntimeArgs->pRuntimePath)
75 {
76 // caller specified a specific RT, use it instead
77 wcsncpy_s(pwcDLLPath, CTL_DLL_PATH_LEN, pRuntimeArgs->pRuntimePath, CTL_DLL_PATH_LEN - 1);
78 }
79 return CTL_RESULT_SUCCESS;
80}
81
82
83

Callers 1

CTL_APICALL ctlInitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected