OpenBarnyard
 
Loading...
Searching...
No Matches
TSystemDLL_Win.cpp
Go to the documentation of this file.
1#include "ToshiPCH.h"
2#include "TSystemDLL_Win.h"
3
4#include <windows.h>
5
6//-----------------------------------------------------------------------------
7// Enables memory debugging.
8// Note: Should be the last include!
9//-----------------------------------------------------------------------------
10#include "Core/TMemoryDebugOn.h"
11
13
14// $Barnyard: FUNCTION 006da9e0
16{
17 m_pDLL = TNULL;
18}
19
21{
22 m_sFileName = other.m_sFileName;
23 m_pDLL = other.m_pDLL;
24}
25
26// $Barnyard: FUNCTION 006daa00
27// $Barnyard: FUNCTION 006daa10
32
33TBOOL TSystemDLLWin::Load( const TString8& a_sFileName )
34{
35#ifdef TOSHI_DYNAMIC_LINKING
36 Unload();
37 m_sFileName = a_sFileName;
38 m_pDLL = LoadLibraryA( m_sFileName );
39 TASSERT( m_pDLL != TNULL );
40
41 return m_pDLL != TNULL;
42#else
43 return TFALSE;
44#endif
45}
46
48{
49#ifdef TOSHI_DYNAMIC_LINKING
50 if ( m_pDLL != NULL )
51 {
52 FreeLibrary( m_pDLL );
53 m_sFileName = "";
54 m_pDLL = NULL;
55 }
56#endif
57}
58
59void* TSystemDLLWin::GetAddress( const TString8& a_sSymbolName )
60{
61 void* pAddress = GetProcAddress( (HMODULE)GetDLL(), a_sSymbolName );
62 TASSERT( pAddress != TNULL );
63
64 return pAddress;
65}
66
68{
69 m_sFileName = other.m_sFileName;
70 m_pDLL = other.m_pDLL;
71 return *this;
72}
73
#define TASSERT(X,...)
Definition Defines.h:138
#define TOSHI_NAMESPACE_START
Definition Defines.h:47
#define TOSHI_NAMESPACE_END
Definition Defines.h:50
#define TNULL
Definition Typedefs.h:23
#define TFALSE
Definition Typedefs.h:24
bool TBOOL
Definition Typedefs.h:6
TBOOL Load(const TString8 &a_sFileName)
TSystemDLLWin & operator=(const TSystemDLLWin &other)
void * GetDLL() const
virtual ~TSystemDLLWin()
void * GetAddress(const TString8 &a_sSymbolName)