uLib
User mode C/C++ extended API library for Win32 programmers.
|
Easy enumeration of version info string blocks.
#include <uLib/VerInfo.h>
Classes | |
struct | PVXLT |
Typedefs | |
typedef void(__stdcall * | PFnEnumVerStr) (CSTR Name, CSTR Val, PVOID UserData) |
Functions | |
UINT | EnumVersionStrings (PVOID vInfo, PFnEnumVerStr Action, PVOID UserData) |
int | AboutVerBox (HWND hOwner, LPCWSTR Caption, CSTR FName=NULL) |
PVOID | GetVersionResource (HMODULE hMod, CSTR ResId, PUINT pSize) |
PVOID | LoadVersionInfo (CSTR FName, PDWORD pSize) |
PVOID | FreeVersionInfo (PVOID vInfo) |
CSTR | GetFixedVersionStr (IN PVOID vInfo) |
UINT | GetVersionString (IN PVOID VerBuf, IN CSTR BlockId, IN CSTR Name, OUT TSTR Buffer, IN UINT BufLen) |
Get a specific version string. More... | |
bool | GetVerTranslations (IN PVOID vInfo, OUT PVXLT *ppXlt, OUT PUINT pCount) |
CSTR | GetVerTranslationStr (IN PVOID vInfo) |
Variables | |
CCSTR | V_ProdName = _T("ProductName") |
CCSTR | V_ProdVer = _T("ProductVersion") |
CCSTR | V_Copyright = _T("LegalCopyright") |
CCSTR | V_Company = _T("CompanyName") |
CCSTR | V_Descript = _T("FileDescription") |
CCSTR | V_Comments = _T("Comments") |
CCSTR | V_EnUniBlock = _T("040904B0") |
US English / Unicode. More... | |
CCSTR | V_EnMultiBlock = _T("040904E4") |
US English / Codepage 1252. More... | |
struct VXLT |
Resource language specification. Usage example:
See also V_EnMultiBlock, V_EnUniBlock for some predefined ones.
Class Members | ||
---|---|---|
WORD | Lang | Microsoft langage Id. |
WORD | Cp | IBM codepage. |
Action callback for EnumVersionStrings().
Name | Version string identifier, f.ex. ProductName. |
Val | Version string value. f.ex. Microsoft Windows. |
UserData | Arbitrary data passed in to EnumVersionStrings. |
UINT EnumVersionStrings | ( | PVOID | vInfo, |
PFnEnumVerStr | Action, | ||
PVOID | UserData | ||
) |
Enumerate the strings in a version info block.
vInfo | Version info block to enumerate. |
Action | Your enumeration callback function. |
UserData | Whatever your Action callback might need. |
Note: Enumerates the first string info block it finds (if more than one).
Definition at line 249 of file VerInfo.cpp.
int AboutVerBox | ( | HWND | hOwner, |
LPCWSTR | Caption, | ||
CSTR | FName = NULL |
||
) |
AboutVerBox shows version strings and module bitness in a dialog box.
It uses a memory template, so it doesn't need a dialog resource. Hence it can live comfortably in a library.
hOwner | Owner of the dialog box. |
Caption | Dialog title. Note that this has to be a wide string, since it's inserted verbatim in the template. |
FName | Filename containing the version resource. Use NULL to indicate the current process. |
Definition at line 326 of file VerInfo.cpp.
PVOID GetVersionResource | ( | HMODULE | hMod, |
CSTR | ResId, | ||
PUINT | pSize | ||
) |
Get a R/O pointer directly to the version resource.
[in] | hMod | Handle of the resource module. Use NULL for the current process. |
[in] | ResId | Id of the version resource. |
[out] | pSize | [optional] Recieves the size of the version resource. |
Note: Some Win32 APIs, e.g VerQueryValueA, may flip the lid on this pointer,
since they expect the memory block to be writable (which it isn't).
(The VerQueryValueA issue is the resource string translation from Unicode to ANSI,
so remember to only use GetVersionStr() or VerQueryValueW for the strings.)
Definition at line 23 of file VerInfo.cpp.
Load version info from a file into dynamic memory.
[in] | FName | Filename of the resource module. Use NULL for the current process. |
[out] | pSize | [optional] Recieves the size of the version info. |
Dispose with FreeVersionInfo() when you're done.
Definition at line 29 of file VerInfo.cpp.
PVOID FreeVersionInfo | ( | PVOID | vInfo | ) |
Free memory from LoadVersionInfo().
Definition at line 59 of file VerInfo.cpp.
CSTR GetFixedVersionStr | ( | IN PVOID | vInfo | ) |
Get the VS_FIXEDFILEINFO as a dotted version string.
vInfo | A pointer to the version info block. |
UINT GetVersionString | ( | IN PVOID | VerBuf, |
IN CSTR | BlockId, | ||
IN CSTR | Name, | ||
OUT TSTR | Buffer, | ||
IN UINT | BufLen | ||
) |
Get a specific version string.
Get a specific version string.
vInfo | Pointer to the version info block. |
BlockId | Language id of the StringFileInfo, f.ex. "040904E4". |
Name | Version string identifier, f.ex. ProductName. |
Buffer | Recieves the version string. |
BufLen | Length, in TCHARs, of the recieving Buffer. |
See also VXLT, GetVerTranslationStr().
Definition at line 133 of file VerInfo.cpp.
bool GetVerTranslations | ( | IN PVOID | vInfo, |
OUT PVXLT * | ppXlt, | ||
OUT PUINT | pCount | ||
) |
Get the available resource language versions.
ppXlt | Recieves a pointer to the translations. |
pCount | Recieves the count of translations in the array. |
CSTR GetVerTranslationStr | ( | IN PVOID | vInfo | ) |
Get the first \VarFileInfo\Translation of the resource.
Uses an internal static buffer. On failure, it returns an empty string.
See also VXLT