Where im failing on native dll?

Spectre

Интересующийся
Пользователь
Сообщения
7
Розыгрыши
0
Репутация
0
Реакции
1
Баллы
335
So im trying to make a native dll since im so bored to keep using a limited library for interface, at the moment this is the code:

C++:
#include "SpectrePrivate.h"


IMPLEMENT_PACKAGE(Spectre);


//extern "C" DLL_EXPORT TCHAR GPackage[];
//DLL_EXPORT TCHAR GPackage[] = TEXT("Spectre");


IMPLEMENT_CLASS(AUIEvents);


IMPLEMENT_FUNCTION(AUIEvents, -1, execgetNewLog);


void AUIEvents::execgetNewLog(FFrame& Stack, RESULT_DECL)
{
    guard(AUIEvents::execgetNewLog)
    P_FINISH;


    //G->Logf(TEXT("in new print log() "));
    GLog->Logf(TEXT("in new log() "));


    *(TCHAR**)Result = TEXT("Just a test");


    unguardexec;
}

At my mind it was normal but when i open L2 i get Critical Error:




Could anyone give me a light on it?
 
how are u trying to execute that dll with l2?
u added on l2.exe import ?
maybe doing via interface to open via a new super class?
 
Im trying to make new native functions with a new dll, so its nothing related to import on l2.exe
 
so the game will magically hook on a new dll? xd
 
Since its native, i guess its supposed he find the dll of the same name from .u file
 
You can use:

Don't forget post source code after release to help people who have same problems.
 
i checked the post so what i got, is that you need to hook the Core with the Address of the function and pass the function itself, but how should i use this hookcore? make a dll entry? i made some kind of entry, but i couldnt get how it gonna work?

C++:
#include "stdafx.h"
#include "Core\Inc\Core.h"
#include "Engine\Inc\Engine.h"


#define RESULT_DECL void* const Result
typedef void(*NativeFunc)(FFrame& stack, RESULT_DECL);
typedef BYTE(__cdecl* GRegisterNative_fnType)(INT iNative, NativeFunc Func);
GRegisterNative_fnType volatile GRegisterNative_fn = NULL;

extern "C" DLL_EXPORT TCHAR GPackage[];
DLL_EXPORT TCHAR GPackage[] = TEXT("Spectre");

void hookCore();

BOOL APIENTRY UIEvents( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
        hookCore();
        break;
    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
    case DLL_PROCESS_DETACH:
        break;
    }
    return TRUE;
}

//extern "C" DLL_EXPORT TCHAR GPackage[];
//DLL_EXPORT TCHAR GPackage[] = TEXT("Spectre");

void execgetNewLog(FFrame& Stack, RESULT_DECL)
{
    //guard(AUIEvents::getNewLog)
        //P_FINISH;

    *(const TCHAR**)Result = TEXT("Just a test");
    
    //unguardexec;
}

void hookCore()
{
    auto hCore = GetModuleHandleA("Core.dll");

    if (hCore) {
        GRegisterNative_fn = (GRegisterNative_fnType)GetProcAddress(hCore, "?GRegisterNative@@YAEHABQ8UObject@@AEXAAUFFrame@@QAX@Z@Z");

        if (GRegisterNative_fn)
        {
            GRegisterNative_fn(-1, &execgetNewLog);
        }
    }
}

atm this is the code and im getting the same error.
 
What is UIEvents? maybe DllMain?
 
Последнее редактирование:
Well on my knowledge i guess it was supposed to connect to Spectre.UIEvents, where Spectre is the File and UIEvents is the class like on .u file, inside Spectre.u theres a class called UIEvents.uc, so i was thinking its the same for dll or was it my mistake?
 
This code uses an entry point with an incorrect function name. I have provided a link to more detailed information above. This is if you are trying to connect your DLL and during its initialization get a reference to a certain function from the Core.dll
 
Works? Write post there with examples and sources + includes in zip.