| 1 | // Copyright (c) .NET Foundation. All rights reserved. |
| 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. |
| 3 | |
| 4 | using System.Runtime.InteropServices; |
| 5 | using System.Text; |
| 6 | |
| 7 | namespace Microsoft.NuGet.Build.Tasks |
| 8 | { |
| 9 | internal static class NativeMethods |
| 10 | { |
| 11 | internal const uint ERROR_INSUFFICIENT_BUFFER = 0x8007007A; |
| 12 | internal const uint S_OK = 0x0; |
| 13 | |
| 14 | /// <summary> |
| 15 | /// Get the runtime version for a given file |
| 16 | /// </summary> |
| 17 | /// <param name="szFullPath">The path of the file to be examined</param> |
| 18 | /// <param name="szBuffer">The buffer allocated for the version information that is returned.</param> |
| 19 | /// <param name="cchBuffer">The size, in wide characters, of szBuffer</param> |
| 20 | /// <param name="dwLength">The size, in bytes, of the returned szBuffer.</param> |
| 21 | /// <returns>HResult</returns> |
| 22 | [DllImport("mscoree.dll", SetLastError = true, CharSet = CharSet.Unicode)] |
| 23 | internal static extern uint GetFileVersion(string szFullPath, StringBuilder szBuffer, int cchBuffer, out uint dwLength); |
| 24 | } |
| 25 | } |