Create a DLL

Results 1 to 8 of 8
  1. #1
    Member Alex-G is offline
    MemberRank
    Apr 2007 Join Date
    GermanyLocation
    56Posts

    Create a DLL

    hey RageZone
    i follow chris05's tutorial "Create a DLL"
    GameServer 1.00.90
    I. Setting the offsets <-OK
    PHP Code:
    0058810B    6A 0F           PUSH 0F
    0058810D    6A 0C           PUSH 0C 
    III. File offsets.h<-OK
    offsets.h:
    PHP Code:
    #ifndef _DLL_H_
    #define _DLL_H_
    #include <stdio.h>
    //extern "C" __declspec(dllexport) void Config();
    #endif
    #define GS_BC_DROP_ID (0x0058810B+1)
    #define GS_BC_DROP_GROUP (0x0058810D+1)

    #define LogAdd ((void(*) (BYTE,char*,...))0x00403C01)
    char aini[] = ".\\data\\DSTeam.ini" ;
    int ProcuraArquivo(charArquivo)
    {
        
    FILE *fp;
        
    fp=fopen(Arquivo,"rb");
        if (
    fp==0)
            {
                return 
    0;
            }
        else
            {
                
    fclose(fp);
                return 
    1;
            }

    IV. File .cpp<-OK
    DllMain.cpp:
    PHP Code:
    #include "offsets.h"
    #include <string.h>
    #include <windows.h>
    extern "C" __declspec(dllexportvoid Config();

    bool BcDropIni char ini)
    {
        
    BYTE Bc;
        
    Bc GetPrivateProfileInt("Configs","BCItemDropID",15,ini);
        *(
    unsigned char *) GS_BC_DROP_ID Bc ;
        
    Bc GetPrivateProfileInt("Configs","BCItemDropGroup",12,ini);
        *(
    unsigned char *) GS_BC_DROP_GROUP Bc ;
        return 
    1;
    }

    bool IniciaIni()
    {
        
    //char a[255];
        
    char aini[] = ".\\data\\DSTeam.ini" ;
        
    bool rResultado;
        
    rResultado BcDropIni aini );
        return 
    1;
    }
    void Config()
    {
        
    DWORD OldProtect;
        
    LPVOID lpAddress = (LPVOID)0x00401000;
        if ( 
    VirtualProtect
        
    (lpAddress,0x246000,PAGE_EXECUTE_READWRITE,&OldProtect))
        {
        
    //sprintf( a , "Dll carregada com sucesso");
        //LogAdd(3 , a);//
        
    MessageBox(NULL"DSTeam.dll foicarregada.","Sucesso",MB_OK);
        if(!
    ProcuraArquivo(aini))
            {
                
    MessageBox(NULL,"Arquivo de inicialização nãoencontrado.\nPor favor verifique!","DSTeam.ini",NULL);
                ::
    ExitProcess(0);
            }
        
    bool inicio ;
        
    inicioIniciaIni() ;
        }

    V. Compiling the DLL<-problem
    Debug--> Compile with Warnings
    Relase--> don't Compile --> Warning
    PHP Code:
    1>c:\users\alex\documents\visual studio 2008\projects\gameserver\gameserver\offsets.h(14) : warning C4996'fopen'This function or variable may be unsafeConsider using fopen_s insteadTo disable deprecation, use _CRT_SECURE_NO_WARNINGSSee online help for details
    can you can someone help me pleas?
    msn: alex-g91@hotmail.de
    icq:204994380
    if you don't have PM me.

    Source code as download:
    http://88.152.106.232/GameServer.rar


  2. #2
    Account Upgraded | Title Enabled! Alin1337 is offline
    MemberRank
    Dec 2007 Join Date
    1,096Posts

    Re: Create a DLL

    in StdAfx.h add
    Code:
    #pragma warning( disable : 4996 )

  3. #3
    Member Alex-G is offline
    MemberRank
    Apr 2007 Join Date
    GermanyLocation
    56Posts

    Re: Create a DLL

    Quote Originally Posted by hackalin View Post
    in StdAfx.h add
    Code:
    #pragma warning( disable : 4996 )
    Thanks for the fast answer!
    Debug--> Compile with warning but compile..
    Relase-->
    with #pragma warning( disable : 4996 )
    fatal error LNK1561

    without #pragma warning( disable : 4996 )
    warning C4996: 'fopen'
    fatal error LNK1561
    Last edited by Alex-G; 23-12-09 at 08:40 PM.

  4. #4
    Kingdom of Shadows [RCZ]ShadowKing is offline
    MemberRank
    Jul 2007 Join Date
    1,644Posts

    Re: Create a DLL

    warnings won't stop the compile process.
    Post the full error!

  5. #5
    Member Alex-G is offline
    MemberRank
    Apr 2007 Join Date
    GermanyLocation
    56Posts

    Re: Create a DLL

    Quote Originally Posted by [RCZ]ShadowKing View Post
    warnings won't stop the compile process.
    Post the full error!
    i have german Visual C++ 2008
    PHP Code:
    1>------ Erstellen gestartetProjektGameServerKonfigurationRelease Win32 ------
    1>Kompilieren...
    1>DllMain.cpp
    1
    >c:\users\alex\documents\visual studio 2008\projects\gameserver\gameserver\offsets.h(14) : warning C4996'fopen'This function or variable may be unsafeConsider using fopen_s insteadTo disable deprecation, use _CRT_SECURE_NO_WARNINGSSee online help for details.
    1>        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h(237): Siehe Deklaration von 'fopen'
    1>Verknüpfen...
    1>   Bibliothek "C:\Users\Alex\Documents\Visual Studio 2008\Projects\GameServer\Release\GameServer.lib" und Objekt "C:\Users\Alex\Documents\Visual Studio 2008\Projects\GameServer\Release\GameServer.exp" werden erstellt.
    1>LINK fatal error LNK1561Einstiegspunkt muss definiert werden.
    1>Das Buildprotokoll wurde unter "file://c:\Users\Alex\Documents\Visual Studio 2008\Projects\GameServer\GameServer\Release\BuildLog.htm" gespeichert.
    1>GameServer 1 Fehler1 Warnung(en)
    ========== 
    Erstellen0 erfolgreichFehler bei 10 aktuell0 übersprungen ========== 

  6. #6
    Retired Old Man Shatter is offline
    MemberRank
    Jun 2008 Join Date
    NowhereLocation
    1,884Posts

    Re: Create a DLL

    its just a warning, and as u can read ->

    Code:
    This function or variable may be unsafe. Consider using fopen_s instead.
    it still works, even tho theres a warning , if u want to get rid of it do as the vs said and change fopen -> fopen_s

  7. #7
    Kingdom of Shadows [RCZ]ShadowKing is offline
    MemberRank
    Jul 2007 Join Date
    1,644Posts

    Re: Create a DLL

    Project -> Proprieties -> from Application(.exe) to Dynamic Library(.dll) -> Ok -> Compile

  8. #8
    Member Alex-G is offline
    MemberRank
    Apr 2007 Join Date
    GermanyLocation
    56Posts

    Re: Create a DLL

    Quote Originally Posted by Shatter View Post
    its just a warning, and as u can read ->

    Code:
    This function or variable may be unsafe. Consider using fopen_s instead.
    it still works, even tho theres a warning , if u want to get rid of it do as the vs said and change fopen -> fopen_s
    i try it already = error C2660: 'fopen_s': Funktion akzeptiert keine 2 Argumente
    eng:Function does not accept 2 arguments

    ---------- Post added at 06:36 PM ---------- Previous post was at 06:05 PM ----------

    I solved it
    PHP Code:
    fopen_s(&fp,Arquivo,"rb"); 
    Thanks for your support!!
    Last edited by Alex-G; 28-12-09 at 06:21 AM.



Advertisement