1 /* 2 * The contents of this file is dual-licensed under 2 3 * alternative Open Source/Free licenses: LGPL 2.1 or later and 4 * Apache License 2.0. (starting with JNA version 4.0.0). 5 * 6 * You can freely decide which license you want to apply to 7 * the project. 8 * 9 * You may obtain a copy of the LGPL License at: 10 * 11 * http://www.gnu.org/licenses/licenses.html 12 * 13 * A copy is also included in the downloadable source code package 14 * containing JNA, in file "LGPL2.1". 15 * 16 * You may obtain a copy of the Apache License at: 17 * 18 * http://www.apache.org/licenses/ 19 * 20 * A copy is also included in the downloadable source code package 21 * containing JNA, in file "AL2.0". 22 */ 23 package com.sun.jna.platform.win32; 24 25 26 import com.sun.jna.Pointer; 27 import com.sun.jna.Structure; 28 import com.sun.jna.Structure.FieldOrder; 29 30 /** 31 * Interface for the VerRsrc.h header file. 32 */ 33 public interface VerRsrc { 34 35 /** 36 * Contains version information for a file. This information is language and code page independent. 37 */ 38 @FieldOrder({"dwSignature", "dwStrucVersion", 39 "dwFileVersionMS", "dwFileVersionLS", 40 "dwProductVersionMS", "dwProductVersionLS", 41 "dwFileFlagsMask", "dwFileFlags", "dwFileOS", 42 "dwFileType", "dwFileSubtype", 43 "dwFileDateMS", "dwFileDateLS"}) 44 public static class VS_FIXEDFILEINFO extends Structure { 45 46 public static class ByReference extends VS_FIXEDFILEINFO implements Structure.ByReference { ByReference()47 public ByReference() { 48 } 49 ByReference(Pointer memory)50 public ByReference(Pointer memory) { 51 super(memory); 52 } 53 } 54 55 /** 56 * Contains the value 0xFEEF04BD. This is used with the szKey member of the VS_VERSIONINFO structure when 57 * searching a file for the VS_FIXEDFILEINFO structure. 58 */ 59 public WinDef.DWORD dwSignature; 60 61 /** 62 * The binary version number of this structure. The high-order word of this member contains the major version 63 * number, and the low-order word contains the minor version number. 64 */ 65 public WinDef.DWORD dwStrucVersion; 66 67 /** 68 * The most significant 32 bits of the file's binary version number. This member is used with dwFileVersionLS to 69 * form a 64-bit value used for numeric comparisons. 70 */ 71 public WinDef.DWORD dwFileVersionMS; 72 73 /** 74 * The least significant 32 bits of the file's binary version number. This member is used with dwFileVersionMS 75 * to form a 64-bit value used for numeric comparisons. 76 */ 77 public WinDef.DWORD dwFileVersionLS; 78 79 /** 80 * The most significant 32 bits of the binary version number of the product with which this file was 81 * distributed. This member is used with dwProductVersionLS to form a 64-bit value used for numeric comparisons. 82 */ 83 public WinDef.DWORD dwProductVersionMS; 84 85 /** 86 * The least significant 32 bits of the binary version number of the product with which this file was 87 * distributed. This member is used with dwProductVersionMS to form a 64-bit value used for numeric comparisons. 88 */ 89 public WinDef.DWORD dwProductVersionLS; 90 91 /** 92 * Contains a bitmask that specifies the valid bits in dwFileFlags. A bit is valid only if it was defined when 93 * the file was created. 94 */ 95 public WinDef.DWORD dwFileFlagsMask; 96 97 /** 98 * Contains a bitmask that specifies the Boolean attributes of the file. This member can include one or more of 99 * the following values. 100 */ 101 public WinDef.DWORD dwFileFlags; 102 103 /** 104 * The operating system for which this file was designed. 105 */ 106 public WinDef.DWORD dwFileOS; 107 108 /** 109 * The general type of file. 110 */ 111 public WinDef.DWORD dwFileType; 112 113 /** 114 * The function of the file. The possible values depend on the value of dwFileType. 115 */ 116 public WinDef.DWORD dwFileSubtype; 117 118 /** 119 * The most significant 32 bits of the file's 64-bit binary creation date and time stamp. 120 */ 121 public WinDef.DWORD dwFileDateMS; 122 123 /** 124 * The least significant 32 bits of the file's 64-bit binary creation date and time stamp. 125 */ 126 public WinDef.DWORD dwFileDateLS; 127 VS_FIXEDFILEINFO()128 public VS_FIXEDFILEINFO() { 129 super(); 130 } 131 VS_FIXEDFILEINFO(Pointer memory)132 public VS_FIXEDFILEINFO(Pointer memory) { 133 super(memory); 134 read(); 135 } 136 getFileVersionMajor()137 public int getFileVersionMajor() { 138 return dwFileVersionMS.intValue() >>> 16; 139 } 140 getFileVersionMinor()141 public int getFileVersionMinor() { 142 return dwFileVersionMS.intValue() & 0xffff; 143 } 144 getFileVersionRevision()145 public int getFileVersionRevision() { 146 return dwFileVersionLS.intValue() >>> 16; 147 } 148 getFileVersionBuild()149 public int getFileVersionBuild() { 150 return dwFileVersionLS.intValue() & 0xffff; 151 } 152 getProductVersionMajor()153 public int getProductVersionMajor() { 154 return dwProductVersionMS.intValue() >>> 16; 155 } 156 getProductVersionMinor()157 public int getProductVersionMinor() { 158 return dwProductVersionMS.intValue() & 0xffff; 159 } 160 getProductVersionRevision()161 public int getProductVersionRevision() { 162 return dwProductVersionLS.intValue() >>> 16; 163 } 164 getProductVersionBuild()165 public int getProductVersionBuild() { 166 return dwProductVersionLS.intValue() & 0xffff; 167 } 168 } 169 } 170