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,478 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

932 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

10 Experts available now in Live!

Get 1:1 Help Now