Please enable JavaScript to view this site.

Bug Validator Help

Navigation: Native API

Calling the API via GetProcAddress

Scroll Prev Top Next More


Calling API functions using GetProcAddress


If you don't want to use the svlBVAPI.c/h files you can use GetProcAddress() to find the interface functions in the Bug 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 bv with api. For example bvSetThreadNameW() becomes apiSetThreadNameW();



Example usage


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


HMODULE getValidatorModule()
   HMODULE   hModule;
   hModule = GetModuleHandle(_T("svlBugValidatorStub6432.dll"));        // 32 bit DLL with 64 bit Bug Validator GUI
   if (hModule == NULL)
      hModule = GetModuleHandle(_T("svlBugValidatorStub_x64.dll"));        // 64 bit DLL with 64 bit Bug Validator GUI
   if (hModule == NULL)
      hModule = GetModuleHandle(_T("svlBugValidatorStub.dll"));                // 32 bit DLL with 32 bit Bug Validator GUI
   return hModule;

// get module, will only succeed if Bug Validator launched this app or is injected into this app
hMod = getValidatorModule();
if (hMod != NULL)
    // Bug Validator is present, lookup the function and call it to set the thread name
    bvSetThreadNameW_FUNC   pFunc;
    // "apiSetThreadNameW" is equivalent to linking against "bvSetThreadNameW"
    pFunc = (bvSetThreadNameW_FUNC)GetProcAddress(hMod, "apiSetThreadNameW");
    if (pFunc != NULL)



API functions and their GetProcAddress names


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




Other exported functions


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


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