Revert "[host] simplify dll loading"

This reverts commit b89a8fee04.
This commit is contained in:
Geoffrey McRae
2017-12-17 04:03:16 +11:00
parent b77a34b8b6
commit bf85358715
2 changed files with 39 additions and 3 deletions

View File

@@ -23,10 +23,45 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include <inttypes.h>
#include <tmmintrin.h>
#include "common\debug.h"
class Util
{
public:
static std::string GetSystemRoot()
{
std::string defaultPath;
size_t pathSize;
char *libPath;
if (_dupenv_s(&libPath, &pathSize, "SystemRoot") != 0)
{
DEBUG_ERROR("Unable to get the SystemRoot environment variable");
return defaultPath;
}
if (!pathSize)
{
DEBUG_ERROR("The SystemRoot environment variable is not set");
return defaultPath;
}
#ifdef _WIN64
defaultPath = std::string(libPath) + "\\System32";
#else
if (IsWow64())
{
defaultPath = std::string(libPath) + "\\Syswow64";
}
else
{
defaultPath = std::string(libPath) + "\\System32";
}
#endif
return defaultPath;
}
static inline void BGRAtoRGB(uint8_t * orig, size_t imagesize, uint8_t * dest)
{
assert((uintptr_t)orig % 16 == 0);