The following C code extracts the resource strings FileVersion and ProductVersion from SMSAPI.DLL to obtain SDK version information. This code should also be run against BASE.DLL to extract SMS version information.
DWORD dwVerInfoSize; // Size of version information block
LPSTR lpVersion; // String pointer to 'version' text
DWORD dwVerHnd=0; // An 'ignored' parameter, always '0'
UINT* puVersionLen = new UINT;
BOOL bRetCode;
char szFileName[20];
strcpy(szFileName, "smsapi.dll");
dwVerInfoSize = GetFileVersionInfoSize(szFileName, &dwVerHnd);
if (dwVerInfoSize) {
LPSTR lpstrVffInfo;
HANDLE hMem;
hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
lpstrVffInfo = (char *)GlobalLock(hMem);
GetFileVersionInfo(argv[1], dwVerHnd, dwVerInfoSize, lpstrVffInfo);
// Product Version
bRetCode = VerQueryValue((LPVOID)lpstrVffInfo,
TEXT("\\StringFileInfo\\040904E4\\ProductVersion"),
(LPVOID *)&lpVersion,
puVersionLen);
if(bRetCode)
{
printf("ProductVersion %s\n",lpVersion);
}
else
{
printf("ProductVersion query failed\n");
}
// File version
bRetCode = VerQueryValue((LPVOID)lpstrVffInfo,
TEXT("\\StringFileInfo\\040904E4\\FileVersion"),
(LPVOID *)&lpVersion,
puVersionLen);
if(bRetCode)
{
printf("FileVersion %s\n",lpVersion);
}
else
{
printf("FileVersion query failed\n");
}
}