Please enable JavaScript to view this site.

Performance Validator Help

Navigation: API

Calling the API via GetProcAddress

Scroll Prev Top Next More

 

Calling API functions using GetProcAddress

 

If you don't want to use the svlPVAPI.c/h files you can use GetProcAddress() to find the interface functions in the Performance Validator DLL.

 

The interface functions have different names and do not use C++ name mangling, but have identical parameters to the API functions.

 

To determine the function name take any native API name, replace the leading pv with api. For example pvSetThreadNameW() becomes apiSetThreadNameW();

 

 

Example usage

 

typedef void (*pvSetThreadNameW_FUNC)(const TCHAR   *name);

 

HMODULE getValidatorModule()
{
   HMODULE   hModule;
 
   hModule = GetModuleHandle(_T("svlPerformanceThreadValidatorStub6432.dll"));        // 32 bit DLL with 64 bit Performance Validator GUI
   if (hModule == NULL)
      hModule = GetModuleHandle(_T("svlPerformanceValidatorStub_x64.dll"));                // 64 bit DLL with 64 bit Performance Validator GUI
   if (hModule == NULL)
      hModule = GetModuleHandle(_T("svlPerformanceValidatorStub.dll"));                // 32 bit DLL with 32 bit Performance Validator GUI
 
   return hModule;
}
 

HMODULE   hMod;
 
// get module, will only succeed if Performance Validator launched this app or is injected into this app
 
hMod = getValidatorModule();
if (hMod != NULL)
{
    // PV is present, lookup the function and call it to set the current thread's name
 
    pvSetThreadNameW_FUNC   pFunc;
 
    // "apiSetThreadNameW" is equivalent to linking against "pvSetThreadNameW"
 
    pFunc = (pvSetThreadNameW_FUNC)GetProcAddress(hMod, "apiSetThreadNameW");
    if (pFunc != NULL)
    {
        (*pFunc)(threadName);
    }
}

 

 

API functions and their GetProcAddress names

 

For any API functions not listed, try looking up the name in svlPerformanceValidatorStub.dll using depends.exe or PE File Browser.

 

 

 

Other exported functions

 

You may see some other functions exported from svlPerformanceValidatorStub.dll(_x64).dll.

 

warningnote These other functions are for Performance Validator's use. Using them may damage memory locations and/or crash your code. Best not to use them!