Author Topic: FindAddress  (Read 2077 times)

0 Members and 1 Guest are viewing this topic.

Offline ca0s

  • VIP
  • Sir
  • *
  • Posts: 432
  • Cookies: 53
    • View Profile
    • ka0labs #
FindAddress
« on: May 21, 2011, 12:24:12 pm »
I think this was made by Rojodos.

Code: [Select]
#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;
   
    }