CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 13 of 13
  1. #1
    Join Date
    May 2011
    Posts
    7

    Exclamation calling non exported functions from dll

    dear all

    this id the first time to me with dll

    the problem is that i have a dll file and i don't have it's source code.
    now i want to call non exported functions from this dll they are COM METHOD functions but after a lot of search and questions in many sites nothing till now.
    i know every thing about these functions name,parameters and return type

    thanks in advance

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: calling non exported functions from dll

    i want to call non exported functions from this dll they are COM METHOD functions
    All COM methods are non exported. So you have to go regular COM way: register server, create coclass instance, query interface, etc.
    Best regards,
    Igor

  3. #3
    Join Date
    May 2011
    Posts
    7

    Re: calling non exported functions from dll

    Quote Originally Posted by Igor Vartanov View Post
    All COM methods are non exported. So you have to go regular COM way: register server, create coclass instance, query interface, etc.
    thank you for your fast reply
    i know how to register the dll but the next steps can you please explain it in more details
    because i am a beginner in this part
    thanks in advance

  4. #4
    Join Date
    Apr 1999
    Posts
    27,449

    Re: calling non exported functions from dll

    Quote Originally Posted by eng.comm View Post
    thank you for your fast reply
    i know how to register the dll but the next steps can you please explain it in more details
    All of those things are explained in any tutorial or book on COM programming.

    Regards,

    Paul McKenzie

  5. #5
    Join Date
    May 2011
    Posts
    7

    Re: calling non exported functions from dll

    Quote Originally Posted by Igor Vartanov View Post
    All COM methods are non exported. So you have to go regular COM way: register server, create coclass instance, query interface, etc.
    thank you for your fast reply
    i know how to register the dll but the next steps can you please explain it in more details
    because i am a beginner in this part
    thanks in advance

  6. #6
    Join Date
    Apr 1999
    Posts
    27,449

    Re: calling non exported functions from dll

    Quote Originally Posted by eng.comm View Post
    thank you for your fast reply
    i know how to register the dll but the next steps can you please explain it in more details
    because i am a beginner in this part
    thanks in advance
    I guess you didn't read my post.

    All of that information is explained in great detail in many tutorials and books. Having one of us to retype that same information here is not fair. Just do your research -- you have the Internet.

    Regards.

    Paul McKenzie

  7. #7
    Join Date
    May 2011
    Posts
    7

    Re: calling non exported functions from dll

    Quote Originally Posted by Paul McKenzie View Post
    I guess you didn't read my post.

    All of that information is explained in great detail in many tutorials and books. Having one of us to retype that same information here is not fair. Just do your research -- you have the Internet.

    Regards.

    Paul McKenzie
    you are right
    i said this because i have a very limited time any way thank you
    i will do my research

  8. #8
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: calling non exported functions from dll

    i said this because i have a very limited time any way thank you
    I have to disappoint you. There's no way to learn something non-trivial (like COM) been having "a very limited time". Sorry.
    Best regards,
    Igor

  9. #9
    Join Date
    May 2011
    Posts
    7

    Re: calling non exported functions from dll

    you are really disappointed me, my project core is not how to call dll functions but the project supervisor gave me this dll to use some functions from it in my project and i don't know any thing about this dll except the functions prototype and the whole project depend on this dll so i asked you to explain in details because it is a side task in my project so i don't want to waste time in learning some thing i not interested in now and no time for it

    any way thank you

  10. #10
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: calling non exported functions from dll

    Yes, I understand your situation. But dealing with COM has too many implications, too many details to be taken into consideration. COM object could be incorporated into C++ code few ways:
    • straight old-fashioned COM API direct calls and dealing with raw interfaces,
    • MFC wrapper ("add class from type library" wizard),
    • #import directive generated wrapper (.tlh headers)
    Each way has its own quirks and pitfalls, but generally all looks quite similar: you create an object, query for some interface and finally call its method. Besides, threading model and everything that relates to it has to be understood in details to avoid improper use and unexplained behavior.

    As long as the whole project depends on this dll, there should be few cases when the dll is used. You could learn something from that, if you have no time to learn COM regular way.

    Of course, all the above has sense only if the dll is really COM dll which I doubt considering your project supervisor instructions (function prototype is the most suspicious part, as COM has its own ways to expose prototypes to developers ).
    Best regards,
    Igor

  11. #11
    Join Date
    May 2011
    Posts
    7

    Re: calling non exported functions from dll

    first thank you very much because you are really want to help me

    but excuse me in the questions that appears to you very easy but this is the first time to me in dealing with this type of programming

    i didn't said that the dll type is COM because i don't know it's type but if dll that containing functions of type COM METHOD is called COM dll so yes it is a COM dll
    i used a small program to know the functions in the dll and their types it is called dll export view
    and here is it's output when i used it on my dll

    ==================================================
    Function Name : DllCanUnloadNow
    Address : 0x10001890
    Relative Address : 0x00001890
    Ordinal : 1 (0x1)
    Filename : Trans_ATL.dll
    Full Path : G:\Trans_ATL.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : DllGetClassObject
    Address : 0x100018f0
    Relative Address : 0x000018f0
    Ordinal : 2 (0x2)
    Filename : Trans_ATL.dll
    Full Path : G:\Trans_ATL.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : DllInstall
    Address : 0x10001af0
    Relative Address : 0x00001af0
    Ordinal : 3 (0x3)
    Filename : Trans_ATL.dll
    Full Path : G:\Trans_ATL.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : DllRegisterServer
    Address : 0x10001ad0
    Relative Address : 0x00001ad0
    Ordinal : 4 (0x4)
    Filename : Trans_ATL.dll
    Full Path : G:\Trans_ATL.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : DllUnregisterServer
    Address : 0x10001ae0
    Relative Address : 0x00001ae0
    Ordinal : 5 (0x5)
    Filename : Trans_ATL.dll
    Full Path : G:\Trans_ATL.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : ITransCript::EnableEmphaticFATHA
    Address :
    Relative Address :
    Ordinal : 5 (0x5)
    Filename : Trans_ATL.dll
    Full Path : G:\Trans_ATL.dll
    Type : COM Method
    ==================================================

    ==================================================
    Function Name : ITransCript::EnableEmphaticLAM_RAA
    Address :
    Relative Address :
    Ordinal : 4 (0x4)
    Filename : Trans_ATL.dll
    Full Path : G:\Trans_ATL.dll
    Type : COM Method
    ==================================================

    ==================================================
    Function Name : ITransCript::EnableLastCharTashkeel
    Address :
    Relative Address :
    Ordinal : 3 (0x3)
    Filename : Trans_ATL.dll
    Full Path : G:\Trans_ATL.dll
    Type : COM Method
    ==================================================

    ==================================================
    Function Name : ITransCript::GetResult
    Address :
    Relative Address :
    Ordinal : 2 (0x2)
    Filename : Trans_ATL.dll
    Full Path : G:\Trans_ATL.dll
    Type : COM Method
    ==================================================

    ==================================================
    Function Name : ITransCript::SetText
    Address :
    Relative Address :
    Ordinal : 1 (0x1)
    Filename : Trans_ATL.dll
    Full Path : G:\Trans_ATL.dll
    Type : COM Method
    ==================================================
    the functions i want to use are those of type COM
    i can load and use the functions of type exported but those of type COM i can't use them

    thank you again for your interest and your time

  12. #12
    Join Date
    Apr 1999
    Posts
    27,449

    Re: calling non exported functions from dll

    Quote Originally Posted by eng.comm View Post
    the functions i want to use are those of type COM
    i can load and use the functions of type exported but those of type COM i can't use them
    Again, there is a huge amount of source code available that shows how to load a COM DLL and call the functions using CoCreateInstance, QueryInterface, etc. Have you made any effort yourself to find and read this information?

    Again, it really isn't fair to ask anyone here to go through a full tutorial on how to call COM methods. It's no different than asking us to explain the C++ language and the rules. A forum isn't designed to be a teacher -- it's there just to answer questions in a quick and efficient manner.

    Just go to the Internet, search, and you will find ample amount of documentation that's out there. If it's so important for you to get this done, then you wouldn't waste time waiting for Igor, myself, or someone else to be your teacher. You have to be proactive and search for the vast number of tutorials that shows you not only how to use an ActiveX or COM control, but how to build one.

    An example:

    http://www.google.com/#sclient=psy&h...b94ef403c105f7

    If after you have your code set up, and you have a specific issue with the Active-X program, then you can ask questions.

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; May 18th, 2011 at 06:50 PM.

  13. #13
    Join Date
    May 2011
    Posts
    7

    Re: calling non exported functions from dll

    Quote Originally Posted by Paul McKenzie View Post
    Again, there is a huge amount of source code available that shows how to load a COM DLL and call the functions using CoCreateInstance, QueryInterface, etc. Have you made any effort yourself to find and read this information?

    Again, it really isn't fair to ask anyone here to go through a full tutorial on how to call COM methods. It's no different than asking us to explain the C++ language and the rules. A forum isn't designed to be a teacher -- it's there just to answer questions in a quick and efficient manner.

    Just go to the Internet, search, and you will find ample amount of documentation that's out there. If it's so important for you to get this done, then you wouldn't waste time waiting for Igor, myself, or someone else to be your teacher. You have to be proactive and search for the vast number of tutorials that shows you not only how to use an ActiveX or COM control, but how to build one.

    An example:

    http://www.google.com/#sclient=psy&h...b94ef403c105f7

    If after you have your code set up, and you have a specific issue with the Active-X program, then you can ask questions.

    Regards,

    Paul McKenzie
    it seems that there is a big miss understand i didn't ask you to teach me any thing i was just show you the case to put me in the correct way when i posted last reply i tried to let you know the type of the dll as you said "if it is a com" and as i don't know its type so i posted the last reply

    i totaly agree with you that i must do my research but at first i must know for what i will do my research is it about calling com dll if it is a com dll

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured