Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
Medium Priority
?
1,559 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 2000 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 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

650 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