04-07-2009 05:21 AM
Is there a way to obtain version information of DLL's in CVI-RT? The supported WIN32 API functions does not appear to include the following functions:
- GetFileVersionInfoSize()
- GetFileVersionInfo()
04-08-2009 11:52 AM
Hello tedoyle,
If you are just interested in getting the file version information, you could try the following (error checking omitted for brevity):
void CVIFUNC_C RTmain (void)
{
char * fileInfo;
char * lock;
int size = 0;
HMODULE module = 0;
HRSRC resource;
HRSRC loaded;
VS_FIXEDFILEINFO * pFFI;
if (InitCVIRTE (0, 0, 0) == 0)
return; /* out of memory */
Cls();
printf("\n\n\n\n\n");
module = LoadLibraryEx("c:\\ni-rt\\system\\cvi_lvrt.dll", NULL, DONT_RESOLVE_DLL_REFERENCES);
resource = FindResource (module, MAKEINTRESOURCE(1), RT_VERSION);
loaded = LoadResource (module, resource);
lock = LockResource (loaded);
size = SizeofResource(module, resource);
fileInfo = malloc(size);
memcpy(fileInfo, lock, size);
pFFI = (VS_FIXEDFILEINFO *)((DWORD *) fileInfo + 10);
printf("\nThe version of cvi_lvrt is %d.%d.%d.%d\n\n",
HIWORD(pFFI->dwFileVersionMS),
LOWORD(pFFI->dwFileVersionMS),
HIWORD(pFFI->dwFileVersionLS),
LOWORD(pFFI->dwFileVersionLS));
if (fileInfo)
free(fileInfo);
if (module)
FreeLibrary(module);
CloseCVIRTE ();
}
Let me know if you have any questions
NickB
National Instruments
04-08-2009 04:54 PM
04-09-2009 10:20 AM
under Visual Studio, the generated executable does not have a Version resource by default. you have to add it yourself.
this is very easy to accomplish: on the solution explorer tab, right click on your project and select "Add/Resource...". in the dialog box which appears, select "Version". now go to the Resource View and edit the version resource. don't forget to frequently set a new version number for your executable. (i don't know any way to automatically increment the version number).