' Winver.ab

#ifdef UNICODE
Const _FuncName_VerFindFile = "VerFindFileW"
Const _FuncName_VerInstallFile = "VerInstallFileW"
Const _FuncName_GetFileVersionInfoSize = "GetFileVersionInfoSizeW"
Const _FuncName_GetFileVersionInfo = "GetFileVersionInfoW"
Const _FuncName_GetFileVersionInfoSizeEx = "GetFileVersionInfoSizeExW"
Const _FuncName_GetFileVersionInfoEx = "GetFileVersionInfoExW"
Const _FuncName_VerLanguageName = "VerLanguageNameW"
Const _FuncName_VerQueryValue = "VerQueryValueW"
#else
Const _FuncName_VerFindFile = "VerFindFileA"
Const _FuncName_VerInstallFile = "VerInstallFileA"
Const _FuncName_GetFileVersionInfoSize = "GetFileVersionInfoSizeA"
Const _FuncName_GetFileVersionInfo = "GetFileVersionInfoA"
Const _FuncName_GetFileVersionInfoSizeEx = "GetFileVersionInfoSizeExA"
Const _FuncName_GetFileVersionInfoEx = "GetFileVersionInfoExA"
Const _FuncName_VerLanguageName = "VerLanguageNameA"
Const _FuncName_VerQueryValue = "VerQueryValueA"
#endif

' Symbols
Const VS_FILE_INFO = RT_VERSION
Const VS_VERSION_INFO = 1
Const VS_USER_DEFINED = 100

' VS_VERSION.dwFileFlags
Const VS_FFI_SIGNATURE = &hFEEF04BD
Const VS_FFI_STRUCVERSION = &h00010000
Const VS_FFI_FILEFLAGSMASK = &h0000003F

' VS_VERSION.dwFileFlags
Const VS_FF_DEBUG = &h00000001
Const VS_FF_PRERELEASE = &h00000002
Const VS_FF_PATCHED = &h00000004
Const VS_FF_PRIVATEBUILD = &h00000008
Const VS_FF_INFOINFERRED = &h00000010
Const VS_FF_SPECIALBUILD = &h00000020

' VS_VERSION.dwFileOS
Const VOS_UNKNOWN = &h00000000
Const VOS_DOS = &h00010000
Const VOS_OS216 = &h00020000
Const VOS_OS232 = &h00030000
Const VOS_NT = &h00040000
Const VOS_WINCE = &h00050000

Const VOS__BASE = &h00000000
Const VOS__WINDOWS16 = &h00000001
Const VOS__PM16 = &h00000002
Const VOS__PM32 = &h00000003
Const VOS__WINDOWS32 = &h00000004

Const VOS_DOS_WINDOWS16 = &h00010001
Const VOS_DOS_WINDOWS32 = &h00010004
Const VOS_OS216_PM16 = &h00020002
Const VOS_OS232_PM32 = &h00030003
Const VOS_NT_WINDOWS32 = &h00040004

' VS_VERSION.dwFileType
Const VFT_UNKNOWN = &h00000000
Const VFT_APP = &h00000001
Const VFT_DLL = &h00000002
Const VFT_DRV = &h00000003
Const VFT_FONT = &h00000004
Const VFT_VXD = &h00000005
Const VFT_STATIC_LIB = &h00000007

' VS_VERSION.dwFileSubtype for VFT_WINDOWS_DRV
Const VFT2_UNKNOWN = &h00000000
Const VFT2_DRV_PRINTER = &h00000001
Const VFT2_DRV_KEYBOARD = &h00000002
Const VFT2_DRV_LANGUAGE = &h00000003
Const VFT2_DRV_DISPLAY = &h00000004
Const VFT2_DRV_MOUSE = &h00000005
Const VFT2_DRV_NETWORK = &h00000006
Const VFT2_DRV_SYSTEM = &h00000007
Const VFT2_DRV_INSTALLABLE = &h00000008
Const VFT2_DRV_SOUND = &h00000009
Const VFT2_DRV_COMM = &h0000000A
Const VFT2_DRV_INPUTMETHOD = &h0000000B
Const VFT2_DRV_VERSIONED_PRINTER = &h0000000C

' VS_VERSION.dwFileSubtype for VFT_WINDOWS_FONT
Const VFT2_FONT_RASTER = &h00000001
Const VFT2_FONT_VECTOR = &h00000002
Const VFT2_FONT_TRUETYPE = &h00000003

' VerFindFile() flags
Const VFFF_ISSHAREDFILE = &h0001

Const VFF_CURNEDEST = &h0001
Const VFF_FILEINUSE = &h0002
Const VFF_BUFFTOOSMALL = &h0004

' VerInstallFile() flags
Const VIFF_FORCEINSTALL = &h0001
Const VIFF_DONTDELETEOLD = &h0002

Const VIF_TEMPFILE = &h00000001
Const VIF_MISMATCH = &h00000002
Const VIF_SRCOLD = &h00000004

Const VIF_DIFFLANG = &h00000008
Const VIF_DIFFCODEPG = &h00000010
Const VIF_DIFFTYPE = &h00000020

Const VIF_WRITEPROT = &h00000040
Const VIF_FILEINUSE = &h00000080
Const VIF_OUTOFSPACE = &h00000100
Const VIF_ACCESSVIOLATION = &h00000200
Const VIF_SHARINGVIOLATION = &h00000400
Const VIF_CANNOTCREATE = &h00000800
Const VIF_CANNOTDELETE = &h00001000
Const VIF_CANNOTRENAME = &h00002000
Const VIF_CANNOTDELETECUR = &h00004000
Const VIF_OUTOFMEMORY = &h00008000

Const VIF_CANNOTREADSRC = &h00010000
Const VIF_CANNOTREADDST = &h00020000

Const VIF_BUFFTOOSMALL = &h00040000
Const VIF_CANNOTLOADLZ32 = &h00080000
Const VIF_CANNOTLOADCABINET = &h00100000

Const FILE_VER_GET_LOCALISED = &h01
Const FILE_VER_GET_NEUTRAL = &h02

' Types and structures

Type VS_FIXEDFILEINFO
	dwSignature As DWord
	dwStrucVersion As DWord
	dwFileVersionMS As DWord
	dwFileVersionLS As DWord
	dwProductVersionMS As DWord
	dwProductVersionLS As DWord
	dwFileFlagsMask As DWord
	dwFileFlags As DWord
	dwFileOS As DWord
	dwFileType As DWord
	dwFileSubtype As DWord
	dwFileDateMS As DWord
	dwFileDateLS As DWord
End Type

' Function prototypes

Declare Function VerFindFile Lib "version" Alias _FuncName_VerFindFile (
	uFlags As DWord,
	szFileName As LPCTSTR,
	szWinDir As LPCTSTR,
	szAppDir As LPCTSTR,
	szCurDir As LPTSTR,
	ByRef uCurDirLen As DWord,
	szDestDir As LPTSTR,
	ByRef uDestDirLen As DWord _
) As DWord

Declare Function VerInstallFile Lib "version" Alias _FuncName_VerInstallFile (
	uFlags As DWord,
	szSrcFileName As LPCTSTR,
	szDestFileName As LPCTSTR,
	szSrcDir As LPCTSTR,
	szDestDir As LPCTSTR,
	szTmpFile As LPTSTR,
	ByRef uTmpFileLen As DWord _
) As DWord

Declare Function GetFileVersionInfoSize Lib "version" Alias _FuncName_GetFileVersionInfoSize (
	lptstrFilename As LPCTSTR,
	ByRef dwHandle As DWord _
) As DWord

Declare Function GetFileVersionInfo Lib "version" Alias _FuncName_GetFileVersionInfo (
	lptstrFilename As LPCTSTR,
	dwHandle As DWord,
	dwLen As DWord,
	lpData As VoidPtr _
) As BOOL

Declare Function GetFileVersionInfoSizeEx Lib "version" Alias _FuncName_GetFileVersionInfoSizeEx (
	dwFlags As DWord,
	lptstrFilename As LPCTSTR,
	ByRef dwHandle As DWord _
) As DWord

Declare Function GetFileVersionInfoEx Lib "version" Alias _FuncName_GetFileVersionInfoEx (
	dwFlags As DWord,
	lptstrFilename As LPCTSTR,
	dwHandle As DWord,
	dwLen As DWord,
	lpData As VoidPtr _
) As BOOL

Declare Function VerLanguageName Lib "version" Alias _FuncName_VerLanguageName (
	wLang As DWord,
	szLang As LPTSTR,
	cchLang As DWord _
) As DWord

Declare Function VerQueryValue Lib "version" Alias _FuncName_VerQueryValue (
	pBlock As VoidPtr,
	lpSubBlock As LPCTSTR,
	ByRef lpBuffer As VoidPtr,
	ByRef uLen As DWord _
) As BOOL
