Thank's for update.
small example to list versions of some dll's in system folders#define WIN32_LEAN_AND_MEAN
#include <stdio.h>
#include <windows.h>
#include <winver.h>
#pragma comment(lib, "version.lib")
#pragma comment(lib, "user32.lib")
#pragma comment(lib, "msvcrt.lib")
void __cdecl mainCRTStartup(void)
{
int __cdecl main(int argc, char **argv);
void __cdecl exit(int status);
exit(main(0,0));
}
LPSTR GetVersionInfo(TCHAR *szFileName, TCHAR *szValue, TCHAR *szBuffer, ULONG nLength)
{
LPSTR csRet;
DWORD len;
csRet = NULL;
len = GetFileVersionInfoSize(szFileName, 0);
if (len) {
csRet = NULL;
LPVOID ver = LocalAlloc(LPTR, len);
if (ver != NULL)
{
DWORD *codepage;
char fmt[256];
PVOID ptr = 0;
if (GetFileVersionInfo(szFileName, 0, len, ver))
{
if (VerQueryValue(ver, "\\VarFileInfo\\Translation", (LPVOID) & codepage, &len))
{
wsprintf(fmt, "\\StringFileInfo\\%08x\\%s", (*codepage) << 16 | (*codepage) >> 16, szValue);
if (VerQueryValue(ver, fmt, &ptr, &len))
{
lstrcpyn(szBuffer, (TCHAR *)ptr, min(nLength, len));
csRet = szBuffer;
}
}
}
LocalFree(ver);
}
}
return csRet;
}
int main(int argc, char **argv)
{
WIN32_FIND_DATA fdFile;
HANDLE hFile;
TCHAR *szMask[] = {TEXT("c:\\Windows\\system32\\d3*.*"),TEXT("c:\\Windows\\sysWOW64\\d3*.*")};
TCHAR szTmp[MAX_PATH];
for (int i = 0; i < 2; i++) {
lstrcpy(szTmp, szMask[i]);
hFile = FindFirstFile(szTmp, &fdFile);
szTmp[20] = 0;
if (hFile != INVALID_HANDLE_VALUE)
do {
if ((fdFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
!= FILE_ATTRIBUTE_DIRECTORY) {
TCHAR szVer[100];
lstrcpy(&szTmp[20], fdFile.cFileName);
printf("%s %s\n", szTmp, GetVersionInfo(szTmp, "ProductVersion", szVer, sizeof(szVer)));
}
} while (FindNextFile(hFile, &fdFile));
FindClose(hFile);
printf("\n");
#ifndef _WIN64
break;
#endif
}
return 0;
}