Skip to content

Commit

Permalink
Moved things around to reduce anti-virus false positive.
Browse files Browse the repository at this point in the history
Test fix for some guy having problems with CEF dll loading. 
Updated some error messages for VC2013.
  • Loading branch information
ccw808 committed Jul 24, 2015
1 parent 21e8aeb commit 9d5e46a
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 47 deletions.
9 changes: 9 additions & 0 deletions MTA10/core/CCore.cpp
Expand Up @@ -1140,6 +1140,15 @@ void CCore::InitialiseWeb ()
if ( m_pWebCore )
return;

// Ensure DllDirectory has not been changed
SString strDllDirectory = GetSystemDllDirectory();
SString strRequiredDllDirectory = CalcMTASAPath( "mta" );
if ( strRequiredDllDirectory.EqualsI( strDllDirectory ) == false )
{
AddReportLog( 3118, SString ( "DllDirectory wrong: DllDirectory:'%s' Path:'%s'", *strDllDirectory, *strRequiredDllDirectory ) );
SetDllDirectory( strRequiredDllDirectory );
}

m_pWebCore = new CWebCore;
m_pWebCore->Initialise ();
}
Expand Down
1 change: 0 additions & 1 deletion MTA10/launch/StdInc.h
Expand Up @@ -3,7 +3,6 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define MTA_CLIENT
#define SHARED_UTIL_WITH_SYS_INFO
#include "SharedUtil.h"

#include "resource.h"
Expand Down
4 changes: 2 additions & 2 deletions MTA10/loader/MainFunctions.cpp
Expand Up @@ -89,7 +89,7 @@ void InitLocalization( bool bNoFail )
if ( !bNoFail )
return;
DisplayErrorMessageBox ( ("Loading core failed. Please ensure that \n"
"Microsoft Visual C++ 2008 SP1 Redistributable Package (x86) \n"
"Microsoft Visual C++ 2013 Redistributable Package (x86) \n"
"and the latest DirectX is correctly installed."), _E("CL24"), "vc-redist-missing" ); // Core.dll load failed. Ensure VC++ Redists and DX are installed
return ExitProcess( EXIT_ERROR );
}
Expand All @@ -112,7 +112,7 @@ void InitLocalization( bool bNoFail )
return;

DisplayErrorMessageBox ( ("Loading core failed. Please ensure that \n"
"Microsoft Visual C++ 2008 SP1 Redistributable Package (x86) \n"
"Microsoft Visual C++ 2013 Redistributable Package (x86) \n"
"and the latest DirectX is correctly installed."), _E("CL26"), "vc-redist-missing" ); // Core.dll load failed. Ensure VC++ Redists and DX are installed
FreeLibrary ( hCoreModule );
return ExitProcess( EXIT_ERROR );
Expand Down
3 changes: 1 addition & 2 deletions MTA10_Server/launcher/Main.cpp
Expand Up @@ -24,7 +24,6 @@
#include "CDynamicLibrary.h"
#include <iostream>
#include "MTAPlatform.h"
#define SHARED_UTIL_WITH_SYS_INFO
#include "SharedUtil.h"
#include "SharedUtil.hpp"

Expand Down Expand Up @@ -140,7 +139,7 @@ int main ( int argc, char* argv [] )
printf ( "ERROR: Could not load %s\n", LIB_CORE );
printf ( "* Check installed data files.\n" );
#ifdef WIN32
printf ( "* Check installed Microsoft Visual C++ 2008 SP1 Redistributable Package (x86).\n" );
printf ( "* Check installed Microsoft Visual C++ 2013 Redistributable Package (x86).\n" );
#endif
}

Expand Down
1 change: 1 addition & 0 deletions Shared/sdk/SString.h
Expand Up @@ -113,6 +113,7 @@ class SString : public std::string
bool Contains ( const SString& strOther ) const;
bool ContainsI ( const SString& strOther ) const;
bool CompareI ( const SString& strOther ) const;
bool EqualsI ( const SString& strOther ) const { return CompareI( strOther ); }
SString SubStr ( int iPos, int iCount = 0x3fffffff ) const;
SString Left ( int iCount ) const;
SString Right ( int iCount ) const;
Expand Down
4 changes: 4 additions & 0 deletions Shared/sdk/SharedUtil.Misc.h
Expand Up @@ -139,6 +139,10 @@ namespace SharedUtil
SString GetSystemErrorMessage ( uint uiErrorCode, bool bRemoveNewlines = true, bool bPrependCode = true );
void SetClipboardText ( const SString& strText );

// Version checks
bool IsWindowsVersionOrGreater ( WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor );
bool IsWindowsXPSP3OrGreater ( void );

#endif

// Ensure rand() seed gets set to a new unique value
Expand Down
35 changes: 32 additions & 3 deletions Shared/sdk/SharedUtil.Misc.hpp
Expand Up @@ -35,7 +35,6 @@ CCriticalSection CRefCountable::ms_CS;
std::map < uint, uint > ms_ReportAmountMap;

#ifdef MTA_CLIENT
#ifdef WIN32

#define TROUBLE_URL1 "http://updatesa.multitheftauto.com/sa/trouble/?v=_VERSION_&id=_ID_&tr=_TROUBLE_"

Expand Down Expand Up @@ -781,7 +780,6 @@ SString SharedUtil::GetSystemErrorMessage ( uint uiError, bool bRemoveNewlines,
}


#endif


#ifdef ExpandEnvironmentStringsForUser
Expand Down Expand Up @@ -877,9 +875,40 @@ bool SharedUtil::ShellExecuteNonBlocking ( const SString& strAction, const SStri
return MyShellExecute ( false, strAction, strFile, strParameters, strDirectory );
}


#endif // MTA_CLIENT

#ifdef WIN32
///////////////////////////////////////////////////////////////////////////
//
// SharedUtil::IsWindowsVersionOrGreater
//
// From Windows Kits\8.1 VersionHelpers.h
// (Ignores compatibility mode)
//
///////////////////////////////////////////////////////////////////////////
bool SharedUtil::IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor)
{
OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0 };
DWORDLONG const dwlConditionMask = VerSetConditionMask(
VerSetConditionMask(
VerSetConditionMask(
0, VER_MAJORVERSION, VER_GREATER_EQUAL),
VER_MINORVERSION, VER_GREATER_EQUAL),
VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);

osvi.dwMajorVersion = wMajorVersion;
osvi.dwMinorVersion = wMinorVersion;
osvi.wServicePackMajor = wServicePackMajor;

return VerifyVersionInfoW(&osvi, VER_MAJORVERSION |
VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE;
}

bool SharedUtil::IsWindowsXPSP3OrGreater()
{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 3);
}
#endif // WIN32

static uchar ToHexChar ( uchar c )
{
Expand Down
2 changes: 0 additions & 2 deletions Shared/sdk/SharedUtil.SysInfo.h
Expand Up @@ -33,8 +33,6 @@ namespace SharedUtil
void GetWMIAntiVirusStatus ( std::vector < SString >& outEnabledList, std::vector < SString >& outDisabledList );
bool GetLibVersionInfo ( const SString& strLibName, SLibVersionInfo* pOutLibVersionInfo );
bool Is64BitOS ( void );
bool IsWindowsVersionOrGreater ( WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor );
bool IsWindowsXPSP3OrGreater ( void );
}

#endif
37 changes: 0 additions & 37 deletions Shared/sdk/SharedUtil.SysInfo.hpp
Expand Up @@ -557,40 +557,3 @@ bool SharedUtil::Is64BitOS( void )
}

#endif // MTA_CLIENT

#ifdef WIN32

///////////////////////////////////////////////////////////////
//
// SharedUtil::IsWindowsVersionOrGreater
//
// From Windows Kits\8.1 VersionHelpers.h
// (Ignores compatibility mode)
//
///////////////////////////////////////////////////////////////
bool SharedUtil::IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor)
{
OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0 };
DWORDLONG const dwlConditionMask = VerSetConditionMask(
VerSetConditionMask(
VerSetConditionMask(
0, VER_MAJORVERSION, VER_GREATER_EQUAL),
VER_MINORVERSION, VER_GREATER_EQUAL),
VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);

osvi.dwMajorVersion = wMajorVersion;
osvi.dwMinorVersion = wMinorVersion;
osvi.wServicePackMajor = wServicePackMajor;

return VerifyVersionInfoW(&osvi, VER_MAJORVERSION |
VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE;
}

bool SharedUtil::IsWindowsXPSP3OrGreater()
{
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 3);
}

#endif // WIN32


0 comments on commit 9d5e46a

Please sign in to comment.