title: How to get Version Info entries using C++ Builder
body: <p>The thread at <a href="https://stackoverflow.com/questions/940707/how-do-i-programmatically-get-the-version-of-a-dll-or-exe-file">How to get version info</a> shows the code to get FileVersion, I need to get other values, includuing some I myself have added to VersionInfo table.</p>
  
  <p>How can I get them using C++Builder 10.2 (Tokyo) ? </p>
  
  <p>I used to get them in C++Builder 6.0 using the VerQueryValue method but it is raising too many exception on types. </p>
  
  <p>I do not know how to change the code to C++Builder 10.2.</p>
  
  <p>Bellow is the actual code I am using:</p>
  
  <p>class.h</p>
  
  <pre><code>struct TransArray
  {
      WORD LanguageID, CharacterSet;
  };
  DWORD VerInfo, VerSize;
  HANDLE MemHandle;
  LPVOID MemPtr, BufferPtr;
  UINT BufferLength;
  TransArray *Array;
  char QueryBlock[255];
  String FFileVersion ;
  </code></pre>
  
  <p>class.cpp</p>
  
  <pre><code>// this one of the methods which have errors
  String __fastcall TAppVersion::GetFileVersion(void)
  {
      String Result ;
      BufferPtr = NULL ;
  
      // Get the product version.
      wsprintf(QueryBlock, "\\StringFileInfo\\%04x%04x\\FileVersion",
                      Array[0].LanguageID, Array[0].CharacterSet);
      VerQueryValue(MemPtr, QueryBlock, &amp;BufferPtr, &amp;BufferLength);
  
      if(BufferPtr) Result = (char *)BufferPtr;
  
      return(Result);
  }
  //---------------------------------------------------
  __fastcall TAppVersion::TAppVersion()
  {
      FFileName = Application-&gt;ExeName ;
      VerSize = GetFileVersionInfoSize(FFileName.c_str(), &amp;VerInfo);
      if (VerSize &gt; 0) {
          MemHandle = GlobalAlloc(GMEM_MOVEABLE, VerSize);
          MemPtr = GlobalLock(MemHandle);
          GetFileVersionInfo(FFileName.c_str(), VerInfo, VerSize, MemPtr);
          VerQueryValue(MemPtr, "\\VarFileInfo\\Translation", &amp;BufferPtr,
                                  &amp;BufferLength);
          Array = (TransArray *)BufferPtr;
  
          FFileVersion = GetFileVersion();
      }
  }
  //-----------------------------------------------
  </code></pre>