EvilZone

Programming and Scripting => C - C++ => : ca0s May 21, 2011, 12:24:12 PM

: FindAddress
: ca0s May 21, 2011, 12:24:12 PM
I think this was made by Rojodos.

:
#include <stdio.h>
#include <windows.h>
typedef VOID (*MYPROC)(LPTSTR);

int main (int argc, char **argv) {
    char dll[100];
    char funcion[100];
   
    HINSTANCE libreria;   
    MYPROC procadd;

    printf ("Finds offsets. First argument is DLL's name,\n");
    printf ("second one is the function's name inside that DLL.\n");
    printf ("Example: %s msvcrt.dll system\n\n", argv[0]);
   
    if (argc != 3){
        printf ("Not enough arguments.\n");
        return 1;
        }
       
    memset(dll,0,sizeof(dll));
    memset(funcion,0,sizeof(funcion));
   
    memcpy (dll, argv[1], strlen(argv[1]));
    memcpy (funcion, argv[2], strlen(argv[2]));
   
    libreria = LoadLibrary(dll);
    procadd = (MYPROC)GetProcAddress (libreria,funcion);
   
    printf ("Offset of %s in DLL %s es %x", funcion, dll, procadd);
   
    return 0;
   
    }