[Application]

- Added some codes to avoid loading a dll from current directory.

[Library]
- Added new functions to avoid loading a dll from current directory. (CSystem::RmSetDllDirectory(), CSystem::RmLoadLibrary())
This commit is contained in:
spx
2010-09-11 19:39:45 +00:00
parent 3aa4673019
commit 3da0aa3f4c
11 changed files with 252 additions and 82 deletions

View File

@ -19,6 +19,7 @@
#include "StdAfx.h"
#include "MeasureNet.h"
#include "Rainmeter.h"
#include "System.h"
BYTE* CMeasureNet::c_Table = NULL;
UINT CMeasureNet::c_NumOfTables = 0;
@ -662,7 +663,7 @@ void CMeasureNet::InitializeNewApi()
{
if (c_IpHlpApiLibrary == NULL)
{
c_IpHlpApiLibrary = LoadLibrary(L"IpHlpApi.dll");
c_IpHlpApiLibrary = GetModuleHandle(L"IpHlpApi.dll");
if (c_IpHlpApiLibrary)
{
c_GetIfTable2Ex = (FPGETIFTABLE2EX)GetProcAddress(c_IpHlpApiLibrary, "GetIfTable2Ex");
@ -675,7 +676,6 @@ void CMeasureNet::InitializeNewApi()
{
if (c_IpHlpApiLibrary)
{
FreeLibrary(c_IpHlpApiLibrary);
c_IpHlpApiLibrary = NULL;
}
c_GetIfTable2Ex = NULL;
@ -701,7 +701,6 @@ void CMeasureNet::FinalizeNewApi()
{
c_FreeMibTable(c_Table);
FreeLibrary(c_IpHlpApiLibrary);
c_IpHlpApiLibrary = NULL;
c_GetIfTable2Ex = NULL;
c_FreeMibTable = NULL;