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,465 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
  • 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now