For some reason, whether I used the NV_BOARD_INFO or NV_BOARD_INFO_V1 structure for the NvAPI_GPU_GetBoardInfo method, I keep getting the NVAPI_INCOMPATIBLE_STRUCT_VERSION API error. Any ideas on what I am doing wrong. Is it because I did not fully instantiate the NV_BOARD_INFO struct? Below is a quick code snippet of what I am doing. Code is written in C++/CLI:
NV_BOARD_INFO boardInfo; // variable to store the graphics card info
// get the graphics card information for the selected GPU
m_apiStatus = NvAPI_GPU_GetBoardInfo(m_ptrPhysicalHandlers[physHandlerNum], &boardInfo);
// check if the API successfully obtained information for the graphics card
if (m_apiStatus == NVAPI_OK)
{
// the API was successful
// store the board serial number
return gcnew String((const char*)boardInfo.BoardNum);
}
else
{
// let the user know an error occurred with the API
throw gcnew Exception(GetApiErrMsg(m_apiStatus));
}
So I made a few updates and found out that I had to set the version information before trying to get the serial number. However, now the serial number being returned contains all zeros for the graphics card I am using for testing. Graphics card is a GTX 1050 TI. Updated source code is below:
NV_BOARD_INFO_V1 boardInfo = { 0 }; // variable to store the graphics card info
boardInfo.version = NV_BOARD_INFO_VER1;
// get the graphics card information for the selected GPU
m_apiStatus = NvAPI_GPU_GetBoardInfo(m_ptrPhysicalHandlers[physHandlerNum], &boardInfo);
// check if the API successfully obtained information for the graphics card
if (m_apiStatus == NVAPI_OK)
{
String^ serialNumber = “”; // the graphics card serial number
// the API was successful
// get total number of characters the serial number has
size_t numElements = (sizeof(boardInfo.BoardNum) / sizeof(boardInfo.BoardNum[0]));
// iterate through each character and add them to the variable to return
for (size_t i = 0; i < numElements; i++)
{
serialNumber += boardInfo.BoardNum[i];
}
// return the board serial number
return serialNumber;
}
else
{
// let the user know an error occurred with the API
throw gcnew Exception(GetApiErrMsg(m_apiStatus));
}