home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / INC.PAK / VER.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  10KB  |  265 lines

  1. /*****************************************************************************\
  2. *                                                                             *
  3. * ver.h -       Version management functions, types, and definitions          *
  4. *                                                                             *
  5. *               Include file for VER.DLL and VER.LIB.  These libraries are    *
  6. *               designed to allow version stamping of Windows executable files*
  7. *               and of special .VER files for DOS executable files.           *
  8. *                                                                             *
  9. *               The API is unchanged for LIB and DLL versions.                *
  10. *                                                                             *
  11. *               Copyright (c) 1992, Microsoft Corp.  All rights reserved      *
  12. *                                                                             *
  13. *******************************************************************************
  14. *
  15. * #define LIB   - To be used with VER.LIB (default is for VER.DLL)
  16. *
  17. \*****************************************************************************/
  18.  
  19. #if !defined (__FLAT__)
  20. #ifndef _INC_VER
  21. #define _INC_VER
  22.  
  23. #ifndef RC_INVOKED
  24. #pragma pack(1)         /* Assume byte packing throughout */
  25. #endif /* RC_INVOKED */
  26.  
  27. #ifdef __cplusplus
  28. extern "C" {            /* Assume C declarations for C++ */
  29. #endif    /* __cplusplus */
  30.  
  31. /*
  32.  * If .lib version is being used, declare types used in this file.
  33.  */
  34. #ifdef LIB
  35.  
  36. #ifndef WINAPI                      /* don't declare if they're already declared */
  37. #define WINAPI      _far _pascal
  38. #define NEAR        _near
  39. #define FAR         _far
  40. #define PASCAL      _pascal
  41. typedef int             BOOL;
  42. #define TRUE        1
  43. #define FALSE       0
  44. typedef unsigned char   BYTE;
  45. typedef unsigned short  WORD;
  46. typedef unsigned int    UINT;
  47. typedef signed long     LONG;
  48. typedef unsigned long   DWORD;
  49. typedef char far*       LPSTR;
  50. typedef const char far* LPCSTR;
  51. typedef int             HFILE;
  52. #define OFSTRUCT    void            /* Not used by the .lib version */
  53. #define LOWORD(l)        ((WORD)(l))
  54. #define HIWORD(l)        ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
  55. #define MAKEINTRESOURCE(i)    (LPSTR)((DWORD)((WORD)(i)))
  56. #endif  /* WINAPI */
  57.  
  58. #else   /* LIB */
  59.  
  60. /* If .dll version is being used and we're being included with
  61.  * the 3.0 windows.h, #define compatible type aliases.
  62.  * If included with the 3.0 windows.h, #define compatible aliases
  63.  */
  64. #ifndef _INC_WINDOWS
  65. #define UINT        WORD
  66. #define LPCSTR      LPSTR
  67. #define HFILE       int
  68. #endif  /* !_INC_WINDOWS */
  69.  
  70. #endif  /* !LIB */
  71.  
  72. /* ----- RC defines ----- */
  73. #ifdef RC_INVOKED
  74. #define ID(id)            id
  75. #else
  76. #define ID(id)            MAKEINTRESOURCE(id)
  77. #endif
  78.  
  79. /* ----- Symbols ----- */
  80. #define VS_FILE_INFO        ID(16)        /* Version stamp res type */
  81. #define VS_VERSION_INFO        ID(1)          /* Version stamp res ID */
  82. #define VS_USER_DEFINED        ID(100)        /* User-defined res IDs */
  83.  
  84. /* ----- VS_VERSION.dwFileFlags ----- */
  85. #define    VS_FFI_SIGNATURE    0xFEEF04BDL
  86. #define    VS_FFI_STRUCVERSION    0x00010000L
  87. #define    VS_FFI_FILEFLAGSMASK    0x0000003FL
  88.  
  89. /* ----- VS_VERSION.dwFileFlags ----- */
  90. #define    VS_FF_DEBUG        0x00000001L
  91. #define    VS_FF_PRERELEASE    0x00000002L
  92. #define    VS_FF_PATCHED        0x00000004L
  93. #define    VS_FF_PRIVATEBUILD    0x00000008L
  94. #define    VS_FF_INFOINFERRED    0x00000010L
  95. #define    VS_FF_SPECIALBUILD    0x00000020L
  96.  
  97. /* ----- VS_VERSION.dwFileOS ----- */
  98. #define    VOS_UNKNOWN        0x00000000L
  99. #define    VOS_DOS            0x00010000L
  100. #define    VOS_OS216        0x00020000L
  101. #define    VOS_OS232        0x00030000L
  102. #define    VOS_NT            0x00040000L
  103.  
  104. #define    VOS__BASE        0x00000000L
  105. #define    VOS__WINDOWS16        0x00000001L
  106. #define    VOS__PM16        0x00000002L
  107. #define    VOS__PM32        0x00000003L
  108. #define    VOS__WINDOWS32        0x00000004L
  109.  
  110. #define    VOS_DOS_WINDOWS16    0x00010001L
  111. #define    VOS_DOS_WINDOWS32    0x00010004L
  112. #define    VOS_OS216_PM16        0x00020002L
  113. #define    VOS_OS232_PM32        0x00030003L
  114. #define    VOS_NT_WINDOWS32    0x00040004L
  115.  
  116. /* ----- VS_VERSION.dwFileType ----- */
  117. #define    VFT_UNKNOWN        0x00000000L
  118. #define    VFT_APP            0x00000001L
  119. #define    VFT_DLL            0x00000002L
  120. #define    VFT_DRV            0x00000003L
  121. #define    VFT_FONT        0x00000004L
  122. #define    VFT_VXD            0x00000005L
  123. #define    VFT_STATIC_LIB        0x00000007L
  124.  
  125. /* ----- VS_VERSION.dwFileSubtype for VFT_WINDOWS_DRV ----- */
  126. #define    VFT2_UNKNOWN        0x00000000L
  127. #define VFT2_DRV_PRINTER    0x00000001L
  128. #define    VFT2_DRV_KEYBOARD    0x00000002L
  129. #define    VFT2_DRV_LANGUAGE    0x00000003L
  130. #define    VFT2_DRV_DISPLAY    0x00000004L
  131. #define    VFT2_DRV_MOUSE        0x00000005L
  132. #define    VFT2_DRV_NETWORK    0x00000006L
  133. #define    VFT2_DRV_SYSTEM        0x00000007L
  134. #define    VFT2_DRV_INSTALLABLE    0x00000008L
  135. #define    VFT2_DRV_SOUND        0x00000009L
  136. #define    VFT2_DRV_COMM        0x0000000AL
  137.  
  138. /* ----- VS_VERSION.dwFileSubtype for VFT_WINDOWS_FONT ----- */
  139. #define VFT2_FONT_RASTER    0x00000001L
  140. #define    VFT2_FONT_VECTOR    0x00000002L
  141. #define    VFT2_FONT_TRUETYPE    0x00000003L
  142.  
  143. /* ----- VerFindFile() flags ----- */
  144. #define VFFF_ISSHAREDFILE    0x0001
  145.  
  146. #define VFF_CURNEDEST        0x0001
  147. #define VFF_FILEINUSE        0x0002
  148. #define VFF_BUFFTOOSMALL    0x0004
  149.  
  150. /* ----- VerInstallFile() flags ----- */
  151. #define VIFF_FORCEINSTALL    0x0001
  152. #define VIFF_DONTDELETEOLD    0x0002
  153.  
  154. #define VIF_TEMPFILE        0x00000001L
  155. #define VIF_MISMATCH        0x00000002L
  156. #define VIF_SRCOLD        0x00000004L
  157.  
  158. #define VIF_DIFFLANG        0x00000008L
  159. #define VIF_DIFFCODEPG        0x00000010L
  160. #define VIF_DIFFTYPE        0x00000020L
  161.  
  162. #define VIF_WRITEPROT        0x00000040L
  163. #define VIF_FILEINUSE        0x00000080L
  164. #define VIF_OUTOFSPACE        0x00000100L
  165. #define VIF_ACCESSVIOLATION    0x00000200L
  166. #define VIF_SHARINGVIOLATION    0x00000400L
  167. #define VIF_CANNOTCREATE    0x00000800L
  168. #define VIF_CANNOTDELETE    0x00001000L
  169. #define VIF_CANNOTRENAME    0x00002000L
  170. #define VIF_CANNOTDELETECUR    0x00004000L
  171. #define VIF_OUTOFMEMORY        0x00008000L
  172.  
  173. #define VIF_CANNOTREADSRC    0x00010000L
  174. #define VIF_CANNOTREADDST    0x00020000L
  175.  
  176. #define VIF_BUFFTOOSMALL    0x00040000L
  177.  
  178. #ifndef RC_INVOKED              /* RC doesn't need to see the rest of this */
  179.  
  180. /* ----- Types and structures ----- */
  181.  
  182. typedef signed short int SHORT;
  183.  
  184. typedef struct tagVS_FIXEDFILEINFO
  185. {
  186.     DWORD   dwSignature;            /* e.g. 0xfeef04bd */
  187.     DWORD   dwStrucVersion;         /* e.g. 0x00000042 = "0.42" */
  188.     DWORD   dwFileVersionMS;        /* e.g. 0x00030075 = "3.75" */
  189.     DWORD   dwFileVersionLS;        /* e.g. 0x00000031 = "0.31" */
  190.     DWORD   dwProductVersionMS;     /* e.g. 0x00030010 = "3.10" */
  191.     DWORD   dwProductVersionLS;     /* e.g. 0x00000031 = "0.31" */
  192.     DWORD   dwFileFlagsMask;        /* = 0x3F for version "0.42" */
  193.     DWORD   dwFileFlags;            /* e.g. VFF_DEBUG | VFF_PRERELEASE */
  194.     DWORD   dwFileOS;               /* e.g. VOS_DOS_WINDOWS16 */
  195.     DWORD   dwFileType;             /* e.g. VFT_DRIVER */
  196.     DWORD   dwFileSubtype;          /* e.g. VFT2_DRV_KEYBOARD */
  197.     DWORD   dwFileDateMS;           /* e.g. 0 */
  198.     DWORD   dwFileDateLS;           /* e.g. 0 */
  199. } VS_FIXEDFILEINFO;
  200.  
  201. /* ----- Function prototypes ----- */
  202.  
  203. UINT WINAPI VerFindFile(UINT uFlags, LPCSTR szFileName,
  204.       LPCSTR szWinDir, LPCSTR szAppDir,
  205.       LPSTR szCurDir, UINT FAR* lpuCurDirLen,
  206.       LPSTR szDestDir, UINT FAR* lpuDestDirLen);
  207.  
  208. DWORD WINAPI VerInstallFile(UINT uFlags,
  209.       LPCSTR szSrcFileName, LPCSTR szDestFileName, LPCSTR szSrcDir,
  210.       LPCSTR szDestDir, LPCSTR szCurDir, LPSTR szTmpFile, UINT FAR* lpuTmpFileLen);
  211.  
  212. /* Returns size of version info in bytes */
  213. DWORD WINAPI GetFileVersionInfoSize(
  214.       LPCSTR lpstrFilename,     /* Filename of version stamped file */
  215.       DWORD FAR *lpdwHandle);   /* Information for use by GetFileVersionInfo */
  216.  
  217. /* Read version info into buffer */
  218. BOOL WINAPI GetFileVersionInfo(
  219.       LPCSTR lpstrFilename,     /* Filename of version stamped file */
  220.       DWORD dwHandle,           /* Information from GetFileVersionSize */
  221.       DWORD dwLen,              /* Length of buffer for info */
  222.       void FAR* lpData);        /* Buffer to place the data structure */
  223.  
  224. /* Returns size of resource in bytes */
  225. DWORD WINAPI GetFileResourceSize(
  226.       LPCSTR lpstrFilename,     /* Filename of version stamped file */
  227.       LPCSTR lpstrResType,      /* Type:  normally VS_FILE_INFO */
  228.       LPCSTR lpstrResID,        /* ID:  normally VS_VERSION_INFO */
  229.       DWORD FAR *lpdwFileOffset); /* Returns file offset of resource */
  230.  
  231. /* Reads file resource into buffer */
  232. BOOL WINAPI GetFileResource(
  233.       LPCSTR lpstrFilename,     /* Filename of version stamped file */
  234.       LPCSTR lpstrResType,      /* Type:  normally VS_FILE_INFO */
  235.       LPCSTR lpstrResID,        /* ID:  normally VS_VERSION_INFO */
  236.       DWORD dwFileOffset,       /* File offset or NULL */
  237.       DWORD dwResLen,           /* Length of resource to read or NULL */
  238.       void FAR* lpData);        /* Pointer to data buffer */
  239.  
  240. UINT WINAPI VerLanguageName(UINT wLang, LPSTR szLang, UINT nSize);
  241.  
  242. UINT WINAPI GetWindowsDir(LPCSTR szAppDir, LPSTR lpBuffer, int nSize);
  243.  
  244. UINT WINAPI GetSystemDir(LPCSTR szAppDir, LPSTR lpBuffer, int nSize);
  245.  
  246. BOOL WINAPI VerQueryValue(const void FAR* pBlock, LPCSTR lpSubBlock,
  247.       void FAR* FAR* lplpBuffer, UINT FAR* lpuLen);
  248.  
  249. #ifdef __cplusplus
  250. }
  251. #endif    /* __cplusplus */
  252.  
  253. #pragma pack()
  254.  
  255. #endif  /* !RC_INVOKED */
  256. #endif  /* !_INC_VER */
  257.  
  258.  
  259. #else  /* !__FLAT__ */
  260. #ifndef RC_INVOKED
  261.   #pragma message ("VER.H obsolete, including WINVER.H instead")
  262. #endif
  263. #include <winver.h>
  264. #endif /* !__FLAT__ */
  265.