libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
LoadLibraryWrapper.hpp
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright © 2002 by J.M.McGuiness, coder@hussar.me.uk
3 **
4 ** This library is free software; you can redistribute it and/or
5 ** modify it under the terms of the GNU Lesser General Public
6 ** License as published by the Free Software Foundation; either
7 ** version 2.1 of the License, or (at your option) any later version.
8 **
9 ** This library is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 ** Lesser General Public License for more details.
13 **
14 ** You should have received a copy of the GNU Lesser General Public
15 ** License along with this library; if not, write to the Free Software
16 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 
19 #pragma once
20 
21 #include "../../../core/non_copyable.hpp"
22 
23 
24 namespace jmmcg { namespace NTUtils {
25 
26  const TCHAR scm_lib_name[]=_T("advapi32.dll");
27 
28  class LoadLibraryWrapper : protected non_copyable {
29  public:
30  LoadLibraryWrapper(const TCHAR * const lib_name)
32  assert(library_handle);
33  }
34  virtual ~LoadLibraryWrapper(void) {
35  ::FreeLibrary(library_handle);
36  }
37 
38  const HMODULE &Handle(void) const noexcept(true) {
39  return library_handle;
40  }
41 
42  private:
43  const HMODULE library_handle;
44 
45  void operator=(const LoadLibraryWrapper &)=delete;
46  };
47 
48 } }