Felipe93
Ghost Member
What im doing wrong??
Help pls
luainterface.cpp
Help pls
Code:
1> luainterface.cpp
1>..\src\framework\luaengine\luainterface.cpp(353): error C2374: 'key': redefinition; multiple initialization
1> ..\src\framework\luaengine\luainterface.cpp(352): note: see declaration of 'key'
1>..\src\framework\luaengine\luainterface.cpp(384): error C2088: '+': illegal for class
1>..\src\framework\luaengine\luainterface.cpp(384): error C2660: 'Crypt::xorCrypt': function does not take 1 arguments
1>..\src\framework\luaengine\luainterface.cpp(384): error C2228: left of '.substr' must have class/struct/union
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Code:
void LuaInterface::loadScript(const std::string& fileName)
{
// resolve file full path
std::string filePath = fileName;
if (!stdext::starts_with(fileName, "/"))
filePath = getCurrentSourcePath() + "/" + filePath;
filePath = g_resources.guessFilePath(filePath, "lua");
//g_logger.error(stdext::format("ttl2 %s >%s<", filePath, getCurrentSourcePath()));
std::string buffer = g_resources.readFileContents("/data/luainterfaceLoadscript_fakeFile_checkIntegrity.txt");
std::string source = filePath;
#ifdef AB
Crypt* x = new Crypt();
std::string fakeFilesSaltKey = x->sha256Encode("/data /luainterfaceLoadscript_fakeFile_checkIntegrity.txt", false); /* ABUPDATE */
std::string fakeFilesXorKey = x->sha256Encode("/data /luainterfaceLoadscript_fakeFile_checkIntegrity.txt", false); /* ABUPDATE */
std::string a = "A";
int len = 2;
char* t = new char[len];
std::string allData = g_resources.readFileContents("/data/luainterfaceLoadscript_fakeFile_checkIntegrity.txt"); /* ABUPDATE */
//std::string allData = g_resources.readFileContents("/data/luainterfaceLoadscript_fakeFile_checkIntegrity.txt");
std::string bufferMD5 = g_resources.readFileContents(source + ".md5hashf");
std::istringstream stream(allData);
std::string key = x->sha512Encode(source + fakeFilesSaltKey, false);
std::string key = x->sha512Encode(source + fakeFilesSaltKey, false);
std::string d;
bool v = false;
while (!stream.eof())
{
delete[] t;
t = new char[9];
stream.read(t, 8);
t[8] = 0;
len = atoi(t);
delete[] t;
t = new char[len + 1];
stream.read(t, len);
t[len] = 0;
d = t;
a = x->xorCrypt(x->base64Decode(d), key);
delete[] t;
t = new char[9];
stream.read(t, 8);
t[8] = 0;
len = atoi(t);
delete[] t;
t = new char[len + 1];
stream.read(t, len);
t[len] = 0;
if (a == source)
{
d = t;
a = x->xorCrypt(x->base64Decode(d), source + key).substr(0, buffer.length() + 2 * fakeFilesSaltKey.length());
v = true;
break;
}
}
d.clear();
delete[] t;
if (!v) // file not found in array
{
//g_logger.error(stdext::format(":|%s", source));
stdext::throw_exception(stdext::format(":|%s", source));
//*((unsigned int*)0) = 0x0000;
}
if (x->sha512Encode(buffer + fakeFilesSaltKey, false) != bufferMD5) // fake file sha key is invalid
{
//g_logger.error(stdext::format(".%s", source));
stdext::throw_exception(stdext::format(".%s", source));
//*((unsigned int*)0) = 0x0000;
}
if (x->sha256Encode(fakeFilesSaltKey + buffer + fakeFilesSaltKey, false) != x->sha256Encode(a, false)) // modified file, cannot load RAM copy
{
//g_logger.error(stdext::format("--%s", source));
stdext::throw_exception(stdext::format("-%s", source));
//*((unsigned int*)0) = 0x0000;
}
a = a.substr(fakeFilesSaltKey.length(), a.length() - 2 * fakeFilesSaltKey.length());
a = x->xorCrypt(x->base64Decode(a), source + fakeFilesXorKey);
g_lua.loadBuffer(a, "@" + source);
a.clear();
#else
loadBuffer(buffer, "@" + source);
#endif
}