PDA

View Full Version : Can't find the mistake...



fabio
14th October 2015, 18:48
Hey I got some problem with my scripts..
For example this code line worked few months ago and now it doesn't.


template <typename ... Ts> void Com_Printf(const char* fmt, Ts ... ts);

Give me this error:


Ferror C2061: Syntaxfehler: Bezeichner 'Ts'

I'm using Visual Studio 2012 for Windows Desktop. And I get more errors that never happened before. Example:


error C2143: Syntaxfehler: Es fehlt ',' vor '...'
Same Line

Anyone knows the reason?

Thanks in advance

php
14th October 2015, 20:26
Yeah

a) try reading upon the code that you copy from other sources (https://github.com/riicchhaarrd/CoDExtended/blob/master/old/xtnded/windows/include.hpp) e.g google templates?
b) does your current compiler support those templates? c++11/14

fabio
14th October 2015, 20:33
a) I do, at least I tried to. And it worked some time ago, now it doesn't.. For those who doesn't know, I got the source from PHP's Github. Credits given to him
b) Yes the compiler supported them before too..

IzNoGoD
14th October 2015, 22:20
Did you set your compiler to c++11/14 mode?

kung foo man
14th October 2015, 23:44
Just post the whole file, it could be some missing { or ; or whatever some lines above it

fabio
15th October 2015, 07:29
It's working now with Visual Basic 2015.. Thanks anyway!
Now I can't inject the file anymore.. Everything was working before and now it doesn't. Any Idea?



#include "include.h"


mySQL mySqlCon("127.0.0.1", "", "", "db", 3306);

int closer()
{

int a = Scr_GetInt(0);
int b = Scr_GetInt(1);
char* c = Scr_GetString(2);

switch (a)
{
case 1: //getGuidNew
Scr_AddInt(1);
break;

case 2: //login User
Scr_AddInt(6666);
break;

case 3: //MySQL Query SELECT
{
MYSQL_RES *res = mySqlCon.gsc_mysql_query(c);
MYSQL_ROW row = mySqlCon.gsc_mysql_fetch_row(res);
Scr_AddString(row[0]);
break;
}
case 4: //MySQL Query
{
if (!mySqlCon.gsc_mysql_query(c))
Scr_AddInt(1);
else
Scr_AddInt(0);
break;
}

default:
Com_Printf("Unkown closer() command: %d\n", a);
}

return 1;
}
void mainMethod()
{
Cmd_AddCommand("help", version);
cracking_hook_call(0x4686FA, (int)Sys_LoadDll);
if (GetModuleHandle("uo_game_mp_x86.dll") != NULL) {
ScriptInitiating();
}
cracking_hook_function(0x2003AA50, (int)closer);
}

DWORD g_threadID;
HMODULE g_hModule;
extern "C" BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
g_hModule = hinstDLL;
DisableThreadLibraryCalls(hinstDLL);
Com_Printf("\n[CoD Xtreme] Injected successfully. Visit www.modszombies.com\n");
mainMethod();
break;

case DLL_PROCESS_DETACH:
case DLL_THREAD_DETACH:
FreeLibraryAndExitThread(g_hModule, 0);
break;
}
return TRUE;
}


DllMain isn't called. I also added MessageBoxes etc.. Doesn't work. Tried to inject with my own injector which worked before and with cheatengine.

You can view the whole source here: https://github.com/modsfabio/codextreme_v1

serthy
15th October 2015, 14:01
Maybe post your whole project?

fabio
15th October 2015, 15:34
https://github.com/modsfabio/codextreme_v1

serthy
15th October 2015, 18:41
https://github.com/modsfabio/codextreme_v1

No, I meant your complete visual studio project (solution, external libs etc).

Your repo does not build on its own..

fabio
18th October 2015, 06:52
Here we go: http://www53.zippyshare.com/v/nudVFAFd/file.html

serthy
18th October 2015, 13:03
So, to get your project to compile in visual studio 2015 I had to:
- disable precompiled headers
- add libmysql.lib to to the linker options of all Build-targets in x86/x64
- cast GetModuleHandle((LPCSTR)"uo_game_mp_x86.dll");
It compiles without errors then. If I maybe have time ill lokk into your dllmain issue

fabio
18th October 2015, 16:16
I got the project compiled. I have the DLL, but if I inject it, nothing happens. Even Dllmain isn't called.
(I added a msgbox but it didn't pop up)

Mitch
20th October 2015, 16:21
Did you compile the dll as a 32-bit release? I guess that a 32-bit process and a 64-bit dll doesn't work.
Also did you add the mysql dll to the same directory as your compiled dll?

Maybe there is some useful information in this thread:
http://killtube.org/showthread.php?1730-Libcod-for-windows&p=10967&viewfull=1#post10967

kung foo man
21st October 2015, 01:45
depends.exe is a nice tool to check if a exe/dll is missing dependencies

http://www.dependencywalker.com/