Results 1 to 8 of 8
  1. #1
    PsychicSounds's Avatar
    Join Date
    Apr 2011
    Gender
    male
    Posts
    35
    Reputation
    8
    Thanks
    0
    My Mood
    Doh

    Post -.- I hate you msvc++. Dll issues

    I have a c++ dll that I made to inject to Diablo 2 I use CreateRemoteThread to call methods in the dll but the dll doesnt work.
    So I opened up Dependency Walker and found 2 errors. 1 I dont care about
    and 1 that seems like the problem.
    The 1 says that a function in the dll is not being exported. I think this is caused by microsoft visual c++ and some compiler options but I dont know how to fix. Anyone know how to fix?
    My Youtube
    Check it out for Dubstep, commentarys, hacks, hack tutorials and other stuffs


    List of achievments
    = finished
    = not done

    make a solitaire trainer(shutup) =
    diablo 2 trainer =

  2. #2
    proman98's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    Achel
    Posts
    1,024
    Reputation
    47
    Thanks
    81
    My Mood
    Fine
    give us more details?

  3. #3
    PsychicSounds's Avatar
    Join Date
    Apr 2011
    Gender
    male
    Posts
    35
    Reputation
    8
    Thanks
    0
    My Mood
    Doh
    Heres the 2 errors from dependency walker
    Code:
    Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
    Error: Modules with different CPU types were found.
    Heres my dll code
    Code:
    #include <windows.h>
    
    
    BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReason, LPVOID lpReserved) {
    
        UNREFERENCED_PARAMETER(lpReserved);
    
        if(ulReason == DLL_PROCESS_ATTACH) {
            DisableThreadLibraryCalls(hModule);
        }
    
    
        return (TRUE);
    }
    
    extern "C" __declspec(dllexport) void Initialize() {
        MessageBox(0, "Locked and Loaded.", "DLL Injection Successful!", 0);
    }
    My Youtube
    Check it out for Dubstep, commentarys, hacks, hack tutorials and other stuffs


    List of achievments
    = finished
    = not done

    make a solitaire trainer(shutup) =
    diablo 2 trainer =

  4. #4
    .::SCHiM::.'s Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    733
    Reputation
    180
    Thanks
    880
    My Mood
    Twisted
    Quote Originally Posted by PsychicSounds View Post
    Heres the 2 errors from dependency walker
    Code:
    Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
    Error: Modules with different CPU types were found.
    Heres my dll code
    Code:
    #include <windows.h>
    
    
    BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReason, LPVOID lpReserved) {
    
        UNREFERENCED_PARAMETER(lpReserved);
    
        if(ulReason == DLL_PROCESS_ATTACH) {
            DisableThreadLibraryCalls(hModule);
        }
    
    
        return (TRUE);
    }
    
    extern "C" __declspec(dllexport) void Initialize() {
        MessageBox(0, "Locked and Loaded.", "DLL Injection Successful!", 0);
    }
    Why don't you just use the CreateThread() call inside the DLLMAIN()?
    If you want to see the return value of functions you can just setup a named pipe to another application.

    I'm SCHiM

    Morals derive from the instinct to survive. Moral behavior is survival behavior above the individual level.

    Polymorphic engine
    Interprocess callback class
    SIN
    Infinite-precision arithmetic
    Hooking dynamic linkage
    (sloppy)Kernel mode Disassembler!!!

    Semi debugger




  5. #5
    Fovea's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Posts
    325
    Reputation
    101
    Thanks
    411
    My Mood
    Amused
    The answer to Why not CreateThread? is found at Best Practices for Creating DLLs

  6. #6
    PsychicSounds's Avatar
    Join Date
    Apr 2011
    Gender
    male
    Posts
    35
    Reputation
    8
    Thanks
    0
    My Mood
    Doh
    Quote Originally Posted by Fovea View Post
    The answer to Why not CreateThread? is found at Best Practices for Creating DLLs
    xD thats the article the article that made me want to make it. Im now using CreateRemoteThread() to call the methods instead of __asm but I still need the exporting of the dll to properly work :/
    My Youtube
    Check it out for Dubstep, commentarys, hacks, hack tutorials and other stuffs


    List of achievments
    = finished
    = not done

    make a solitaire trainer(shutup) =
    diablo 2 trainer =

  7. #7
    Fovea's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Posts
    325
    Reputation
    101
    Thanks
    411
    My Mood
    Amused
    The answer is simple, you are injecting into a suspended process. A suspended process's environment is not ready for normal execution, only when the program reaches entry point will it be ready.

    There are two solutions. Solution one is the simplest, let the application run and remove the CREATE_SUSPENDED flag. Solution two entails the suspension of the process, the patching of the entry point to be an infinite loop, dll injection via CreateRemoteThread on an export, check eip against entry point, resumption of the process (main thread), and finally the removal of the infinite loop by restoring the instructions overwritten (do this safely by suspending main thread).
    Last edited by Fovea; 05-22-2011 at 06:04 AM.

  8. #8
    PsychicSounds's Avatar
    Join Date
    Apr 2011
    Gender
    male
    Posts
    35
    Reputation
    8
    Thanks
    0
    My Mood
    Doh
    Im sorry but I have no idea how to do that
    My Youtube
    Check it out for Dubstep, commentarys, hacks, hack tutorials and other stuffs


    List of achievments
    = finished
    = not done

    make a solitaire trainer(shutup) =
    diablo 2 trainer =