Merge pull request #9446 from seanshpark/stkalign_helpers
[platform/upstream/coreclr.git] / src / utilcode / dlwrap.cpp
1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4
5
6 #include "stdafx.h"                     // Precompiled header key.
7 #include "utilcode.h"
8 #include "metadata.h"
9 #include "ex.h"
10 #include "pedecoder.h"
11
12 #include <wininet.h>
13 #include <urlmon.h>
14 #include <version.h>
15
16 DWORD 
17 GetFileVersionInfoSizeW_NoThrow(
18         LPCWSTR lptstrFilename, /* Filename of version stamped file */
19         LPDWORD lpdwHandle
20         )
21 {
22     WRAPPER_NO_CONTRACT;
23     HRESULT hr=S_OK;
24     DWORD dwRet=0;
25     EX_TRY
26     {
27         dwRet=GetFileVersionInfoSize( (LPWSTR)lptstrFilename,  lpdwHandle );  
28     }
29     EX_CATCH_HRESULT(hr);
30     if (hr!=S_OK)
31         SetLastError(hr);
32     return dwRet;
33     
34 }
35
36 BOOL
37 GetFileVersionInfoW_NoThrow(
38         LPCWSTR lptstrFilename, /* Filename of version stamped file */
39         DWORD dwHandle,         /* Information from GetFileVersionSize */
40         DWORD dwLen,            /* Length of buffer for info */
41         LPVOID lpData
42         )         
43 {
44     WRAPPER_NO_CONTRACT;
45     HRESULT hr=S_OK;
46     BOOL bRet=FALSE;
47     EX_TRY
48     {
49         bRet=GetFileVersionInfo( (LPWSTR)lptstrFilename, dwHandle,dwLen,lpData );  
50     }
51     EX_CATCH_HRESULT(hr);
52     if (hr!=S_OK)
53         SetLastError(hr);
54     return bRet;
55     
56 }
57
58 BOOL
59 VerQueryValueW_NoThrow(
60         const LPVOID pBlock,
61         LPCWSTR lpSubBlock,
62         LPVOID * lplpBuffer,
63         PUINT puLen
64         )     
65 {
66     WRAPPER_NO_CONTRACT;
67     HRESULT hr=S_OK;
68     BOOL bRet=FALSE;
69     EX_TRY
70     {
71         bRet=VerQueryValueW( pBlock, (LPWSTR)lpSubBlock,lplpBuffer,puLen );
72     }
73     EX_CATCH_HRESULT(hr);
74     if (hr!=S_OK)
75         SetLastError(hr);
76     return bRet;
77     
78 }
79