Thread: From ini to LoadLibrary

  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    38

    From ini to LoadLibrary

    Hey guys. I have created a ini file, inside I have nothing. I want the user to write there which DLL he would like to load. By default I have a DLL called Medit.dll that loads when the application opens, but I also want to open the dll that the user specified in the ini to load as well. =\ Can you guys help me out of point me somewhere? Thanks

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    You can use LoadLibrary with REadPrivateProfileString

    but what you want to do with the library AFTER you load it?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Registered User
    Join Date
    Mar 2007
    Posts
    38
    Thanks, I will try that. I'm trying to do a loader, that will inject the Medit.dll. But I want the user to be able to add another dll to be injected. I got all the code ready, all I need is how to take the dll name that user set in the ini file.

  4. #4
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    GetPrivateProfileString - this is the correct function name for reading strings from ini-file
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    How are you going to GetProcAddress() the functions in an unknown dll?

    How will you know what paramaters the functions take?
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  6. #6
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    I suppose the replacing dll should export exactly the same interface as the dll it is going to replace...
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  7. #7
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    So the new DLL has the same functions (I assume different functionality), with the same paramaters?

    Why does it have a different name/path then?

    Is it a bogus copy of the original DLL for some neferious / malicious reason?

    If so why are we helping?
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Parsing a INI file
    By Wraithan in forum C++ Programming
    Replies: 6
    Last Post: 10-17-2005, 05:17 AM
  2. Ini File Reading using fscanf()
    By Mr.Modem in forum C Programming
    Replies: 5
    Last Post: 08-13-2005, 12:58 PM
  3. ini files
    By ProjectsProject in forum C Programming
    Replies: 1
    Last Post: 10-18-2004, 03:01 PM
  4. INI Functions
    By Bordonel in forum C Programming
    Replies: 2
    Last Post: 06-19-2002, 04:49 AM
  5. ini file reader/writer
    By cozman in forum Game Programming
    Replies: 7
    Last Post: 06-11-2002, 10:09 AM