Skip to content

Instantly share code, notes, and snippets.

@hounsell
Created September 26, 2014 14:01
Show Gist options
  • Save hounsell/87aadc440a7fc3faadc2 to your computer and use it in GitHub Desktop.
Save hounsell/87aadc440a7fc3faadc2 to your computer and use it in GitHub Desktop.
Get Language Id for File (Part 2)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Threading.Tasks;
namespace VersionInfo
{
internal static class NativeMethods
{
[DllImport("version.dll", CharSet = CharSet.Auto, SetLastError = true, BestFitMapping = false)]
public static extern int GetFileVersionInfoSize(string lptstrFilename, out int handle);
[DllImport("version.dll", CharSet = CharSet.Auto, BestFitMapping = false)]
public static extern bool GetFileVersionInfo(string lptstrFilename, int dwHandle, int dwLen, HandleRef lpData);
[DllImport("version.dll", CharSet = CharSet.Auto, BestFitMapping = false)]
public static extern bool VerQueryValue(HandleRef pBlock, string lpSubBlock, [In, Out] ref IntPtr lplpBuffer, out int len);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment