Solved

GetProcAddress fails to load a function from a dll with  ERROR_PROC_NOT_FOUND when try to load from a diffrent path

Posted on 2006-12-01
4
1,498 Views
Last Modified: 2008-02-26
I am try to load a function from a dll in run time.
I want to avoid the old version dll that is located first in the path and to load the newer version of the dll.
I am trying
      fnGetProcImFile = (LPFN_GETPROCIMAGEFILENAME)GetProcAddress(
                  GetModuleHandle("<PATH_4_Newer_LIB>\\psapi.dll"), "GetProcessImageFileNameA");

It is keep failing.
What should I do ?

10x
Assaf
0
Comment
Question by:Assaf_Gantz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 48

Assisted Solution

by:AlexFM
AlexFM earned 500 total points
ID: 18058884
Try first to load psapi.dll using LoadLibrary function, then use library handle in GetProcAddress. Your current code contains actually two operations and it is difficult to understand what is wrong.
GetModuleHandle returns handle to library which is already mapped to current process memory. Possibly this is not version that you need.
0
 

Author Comment

by:Assaf_Gantz
ID: 18069473
I verified and the GetModuleHandle is failing
I think it is due to the fact that this dll is already in use in the binary.
My main issue is that the dll that is being use is older and I need one of the newer function.

Is there any way to get this function from the newer dll that is located in a different location?

Please advise
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
ID: 18069544
Did you try LoadLibrary with full Dll path?
0
 

Author Comment

by:Assaf_Gantz
ID: 18069592
Thank you it seems to do the trick
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question