Results 1 to 5 of 5

Thread: loading a library

  1. #1
    vmagic
    Guest

    loading a library

    hello,

    i am wondering how you would load a library into an exe. example, if i wanted to add some code to popup a message box into a simple hello world application, and i need to import the user32.dll, how would i do that.
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  2. #2

    loading a library

    with the api LoadLibraryA load the dll and with GetProcAddress you have the adress of any api of this library in your machine.

    look WINAPIS32 is the help of the apis.

    Ricardo Narvaja

  3. #3
    vmagic
    Guest

    loading a library

    when i use GetProcAddress, where does the address get stored so that i can use it?

    thanks
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  4. #4
    Super Moderator
    Join Date
    Dec 2004
    Posts
    1,486
    Blog Entries
    15

    loading a library

    please grab a copy of win32.hlp
    or downlaod platform sdk from microsoft
    and go through them it will clearly state what will be returned

    now where it returns is dependent on how you see it i believe

    for example a line of hll program may look like this

    if (ret = GetProcAddress( *dll ,*proc) !=0)
    {
    call ret (args);
    do blah;
    return success;
    }
    else {
    get lost;
    }
    return iamlost;

    now the same would be looking like this is asm
    invoke GetProcAddres, ADDR name_of_dll, ADDR name_of_proc
    mov return,eax

    push args
    call [return]

    now if you are looking and coding under debugger
    you can do like below

    push addr
    push addr
    call GetprocAddress
    push args
    call eax

    please look into winhlp
    code some simple programs
    run them under debugger get your self familiarized with
    what return where and how

    and btw i am not discouraging you but in this forum you cant expect
    answers to questions like your because this forum is meant for questions
    regarding ollydbg its usage its problems its plugins etc

    try to visit win32asmboard if you are interested in coding in assembly
    or may be read through forgers winprog tuts if you prefer
    high level syntax

    ps edit
    i re read your original question
    by a simple hello world program you mean you are coding with c or c++
    and building it as console version ?? (a console version means it displays
    the string in the black box called dos)
    then you will have some more compatibility problems like
    putting together gui code along side of cui
    gui == graphical user interface
    cui == console user interface

  5. #5
    vmagic
    Guest

    loading a library

    ok thanks.

    why would it matter if its being in dos or not, because if im loading that library and calling code from there then would it really matter?

    i know all about windows api and stuff, i was wondering where does the value returned from GetProcAddress go in asm? cause its not like one can use variables at the debugging level..
    I promise that I have read the FAQ and tried to use the Search to answer my question.

Similar Threads

  1. IDA Signature: Rockey4ND v1.x C++ library
    By prt in forum Tools of Our Trade (TOT) Messageboard
    Replies: 7
    Last Post: November 3rd, 2007, 18:40
  2. IDA Signature: Key-lok II C++ library
    By prt in forum Tools of Our Trade (TOT) Messageboard
    Replies: 2
    Last Post: July 5th, 2007, 12:34
  3. Softice 4.2.7 loading
    By Snatch in forum Tools of Our Trade (TOT) Messageboard
    Replies: 4
    Last Post: October 1st, 2002, 20:54
  4. how to see the DD library name under linux
    By tapo2001 in forum Advanced Reversing and Programming
    Replies: 0
    Last Post: October 11th, 2001, 09:16
  5. IDA / symbol loading Q..
    By Znah in forum Tools of Our Trade (TOT) Messageboard
    Replies: 1
    Last Post: June 10th, 2001, 23:03

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •