~ubuntu-branches/debian/lenny/italc/lenny

« back to all changes in this revision

Viewing changes to ica/win32/src/DynamicFn.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Patrick Winnertz
  • Date: 2008-06-17 13:46:54 UTC
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20080617134654-2y5m7ki93r5c1ysf
Tags: upstream-1.0.9~rc3
ImportĀ upstreamĀ versionĀ 1.0.9~rc3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
 
2
 * Copyright (C) 2007 Constantin Kaplinsky.  All Rights Reserved.
 
3
 * 
 
4
 * This is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 * 
 
9
 * This software 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
 
12
 * GNU General Public License for more details.
 
13
 * 
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this software; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
 
17
 * USA.
 
18
 */
 
19
 
 
20
#include "DynamicFn.h"
 
21
 
 
22
DynamicFnBase::DynamicFnBase(const TCHAR* dllName, const char* fnName) : fnPtr(0), dllHandle(0) {
 
23
  dllHandle = LoadLibrary(dllName);
 
24
  if (!dllHandle) {
 
25
    vnclog.Print(LL_INTERR, VNCLOG("DLL %s not found (error %d)"),
 
26
                 (const char*)dllName, GetLastError());
 
27
    return;
 
28
  }
 
29
  fnPtr = (void *) GetProcAddress(dllHandle, fnName);
 
30
  if (!fnPtr)
 
31
    vnclog.Print(LL_INTERR, VNCLOG("proc %s not found in %s (error %d)"),
 
32
                 fnName, (const char*)dllName, GetLastError());
 
33
}
 
34
 
 
35
DynamicFnBase::~DynamicFnBase() {
 
36
  if (dllHandle)
 
37
    FreeLibrary(dllHandle);
 
38
}
 
39
 
 
40