update for HEAD-2003091401
[reactos.git] / subsys / system / explorer / Seashell / SeaShellExt / Include / UIModulVer.h
1 ////////////////////////////////////////////////////////////////
2 // 1998 Microsoft Systems Journal
3 //
4 // If this code works, it was written by Paul DiLascia.
5 // If not, I don't know who wrote it.
6 //
7 #ifndef __MODULEVER_H
8 #define __MODULEVER_H
9
10 //#undef _INC_SHLWAPI
11 //#undef NOSHLWAPI
12 #include <shlwapi.h>
13
14 // tell linker to link with version.lib for VerQueryValue, etc.
15 #pragma comment(linker, "/defaultlib:version.lib")
16
17 #ifndef DLLVER_PLATFORM_WINDOWS
18 #error ModuleVer.h requires a newer version of the SDK than you have!
19 #error Please update your SDK files.
20 #endif
21
22 //////////////////
23 // This class loads a library. Destructor frees for automatic cleanup.
24 //
25 class CTRL_EXT_CLASS CLoadLibrary {
26 private:
27         HINSTANCE m_hinst;
28 public:
29         CLoadLibrary(LPCTSTR lpszName) : m_hinst(LoadLibrary(lpszName)) { }
30         ~CLoadLibrary()          { FreeLibrary(m_hinst); }
31         operator HINSTANCE () { return m_hinst; }       // cast operator
32 };
33
34 //////////////////
35 // CModuleVersion version info about a module.
36 // To use:
37 //
38 // CModuleVersion ver
39 // if (ver.GetFileVersionInfo("_T("mymodule))) {
40 //              // info is in ver, you can call GetValue to get variable info like
41 //              CString s = ver.GetValue(_T("CompanyName"));
42 // }
43 //
44 // You can also call the static fn DllGetVersion to get DLLVERSIONINFO.
45 //
46 class CTRL_EXT_CLASS CModuleVersion : public VS_FIXEDFILEINFO {
47 protected:
48         BYTE* m_pVersionInfo;   // all version info
49
50         struct TRANSLATION {
51                 WORD langID;                    // language ID
52                 WORD charset;                   // character set (code page)
53         } m_translation;
54
55 public:
56         CModuleVersion();
57         virtual ~CModuleVersion();
58
59         BOOL            GetFileVersionInfo(LPCTSTR modulename);
60         CString GetValue(LPCTSTR lpKeyName);
61         static BOOL DllGetVersion(LPCTSTR modulename, DLLVERSIONINFO& dvi);
62 };
63
64 #endif