-
Notifications
You must be signed in to change notification settings - Fork 1
/
FileVersionInfo.h
78 lines (63 loc) · 2.37 KB
/
FileVersionInfo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the LICENSE file distributed with
* this work for additional information regarding copyright ownership.
*
* Also, if exists, check the Licenses directory for information about
* third-party modules.
*
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _MXLIBHLP_FILE_VERSION_INFO_H
#define _MXLIBHLP_FILE_VERSION_INFO_H
#include <Defines.h>
#include <AutoPtr.h>
#include <Strings\Strings.h>
//-----------------------------------------------------------
namespace MX {
class CFileVersionInfo : public CBaseMemObj, public CNonCopyableObj
{
public:
CFileVersionInfo();
HRESULT InitializeFromFileName(_In_z_ LPCWSTR szFileNameW);
HRESULT InitializeFromFileHandle(_In_ HANDLE hFile);
HRESULT InitializeFromProcessHandle(_In_opt_ HANDLE hProc);
HRESULT InitializeFromMemory(_In_ LPCVOID lpBaseAddress, _In_ SIZE_T nImageSize, _In_ BOOL bImageIsMapped);
SIZE_T GetLanguagesCount() const
{
return nTranslationBlocksCount;
};
WORD GetLanguage(_In_opt_ SIZE_T nIndex) const;
WORD GetCharset(_In_opt_ SIZE_T nIndex) const;
HRESULT GetString(_In_z_ LPCWSTR szFieldW, _Inout_ CStringW &cStrW, _In_opt_ SIZE_T nLangIndex=0);
MX_UNICODE_STRING GetString(_In_z_ LPCWSTR szFieldW, _In_opt_ SIZE_T nLangIndex=0);
VS_FIXEDFILEINFO* operator->() const
{
return lpFfi;
};
private:
HRESULT AnalyzeVersionInfo(_In_ LPVOID lpPeParser);
private:
#pragma pack(1)
typedef struct {
WORD wLang;
WORD wCharSet;
} TRANSLATION_BLOCK, *LPTRANSLATION_BLOCK;
#pragma pack()
TAutoFreePtr<BYTE> cVersionInfo;
VS_FIXEDFILEINFO *lpFfi;
LPTRANSLATION_BLOCK lpTranslationBlock;
SIZE_T nTranslationBlocksCount;
};
}; //namespace MX
//-----------------------------------------------------------
#endif //_MXLIBHLP_FILE_VERSION_INFO_H