home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 7.ddi / WINCLUDE.ZIP / VER.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  9.9 KB  |  258 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. *******************************************************************************
  12. *
  13. * #define LIB   - To be used with VER.LIB (default is for VER.DLL)
  14. *
  15. \*****************************************************************************/
  16.  
  17. #ifndef __VER_H         /* prevent multiple includes */
  18. #define __VER_H
  19.  
  20. #if !defined(__WINDOWS_H) && !defined(LIB)
  21. #include <windows.h>    /* <windows.h> must be included */
  22. #endif  /* __WINDOWS_H */
  23.  
  24. #ifndef RC_INVOKED
  25. #pragma option -a-      /* Assume byte packing throughout */
  26. #endif  /* RC_INVOKED */
  27.  
  28. #ifdef __cplusplus
  29. extern "C" {            /* Assume C declarations for C++ */
  30. #endif  /* __cplusplus */
  31.  
  32. /*
  33.  * If .lib version is being used, declare types used in this file.
  34.  */
  35. #ifdef LIB
  36.  
  37. #ifndef WINAPI          /* don't declare if they're already declared */
  38. #define WINAPI          _far _pascal
  39. #define NEAR            _near
  40. #define FAR             _far
  41. #define PASCAL          _pascal
  42. typedef int             BOOL;
  43. #define TRUE            1
  44. #define FALSE           0
  45. typedef unsigned char   BYTE;
  46. typedef unsigned short  WORD;
  47. typedef unsigned int    UINT;
  48. typedef signed long     LONG;
  49. typedef unsigned long   DWORD;
  50. typedef char far*       LPSTR;
  51. typedef const char far* LPCSTR;
  52. typedef int             HFILE;
  53. #define OFSTRUCT        void    /* Not used by the .lib version */
  54. #define LOWORD(l)               ((WORD)(l))
  55. #define HIWORD(l)               ((WORD)((DWORD)(l) >> 16))
  56. #define MAKEINTRESOURCE(i)      (LPSTR)((DWORD)((WORD)(i)))
  57. #endif  /* WINAPI */
  58.  
  59. #else   /* LIB */
  60.  
  61. /* If .dll version is being used then windows.h is including     */
  62. /* If included with the 3.0 windows.h, define compatible aliases */
  63. #if !defined(WINVER) || (WINVER < 0x030a)
  64. #define UINT        WORD
  65. #define LPCSTR      LPSTR
  66. #define HFILE       int
  67. #define WINAPI      FAR PASCAL
  68. #endif  /* WIN3.0 */
  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. }                       /* End of extern "C" { */
  251. #endif  /* __cplusplus */
  252.  
  253. #pragma option -a.      /* Revert to default packing */
  254.  
  255. #endif  /* RC_INVOKED */
  256.  
  257. #endif  /* __VER_H */
  258.