Is there a way to Get around "Entry Point Not Found" error??

R

Rymfax

I have an application that will be used on both XP and Vista. One of
the things this application needs to do is determine the exact
operating system it is on. To get the correct "flavor" of Vista that
might be running, there is a new function in Kernel32.dll called
GetProductInfo(). The problem I'm running into is that if I include
this function in my application, the app errors on XP at start up with
the following message:

The procedure entry point GetProductInfo could not be located in the
dynamic link library KERNERL32.dll

Now I understand that this is happening because the kernel32.dll on XP
does not have that function, but I put an if statement in my code so
that if the MajorVersion of the OS is < 6 (VISTA) then it doesn't call
this function anyway. However that doesn't seem to be sufficient to
keep it from trying to find the entry point anyway. Is there a way
for me go get around this?

TIA,

Rym
 
C

Carl Daniel [VC++ MVP]

Rymfax said:
I have an application that will be used on both XP and Vista. One of
the things this application needs to do is determine the exact
operating system it is on. To get the correct "flavor" of Vista that
might be running, there is a new function in Kernel32.dll called
GetProductInfo(). The problem I'm running into is that if I include
this function in my application, the app errors on XP at start up with
the following message:

The procedure entry point GetProductInfo could not be located in the
dynamic link library KERNERL32.dll

Now I understand that this is happening because the kernel32.dll on XP
does not have that function, but I put an if statement in my code so
that if the MajorVersion of the OS is < 6 (VISTA) then it doesn't call
this function anyway. However that doesn't seem to be sufficient to
keep it from trying to find the entry point anyway. Is there a way
for me go get around this?

You need to use LoadLibrary/GetProcAddress to get a pointer to the
function - don't call the prototype that's provided by the Windows SDK.
This will remove the hard depedency on GetProductInfo from your image and
you can determine at runtime if the function is supported.

-cd
 
A

Andre Kostur

I have an application that will be used on both XP and Vista. One of
the things this application needs to do is determine the exact
operating system it is on. To get the correct "flavor" of Vista that
might be running, there is a new function in Kernel32.dll called
GetProductInfo(). The problem I'm running into is that if I include
this function in my application, the app errors on XP at start up with
the following message:

The procedure entry point GetProductInfo could not be located in the
dynamic link library KERNERL32.dll

Now I understand that this is happening because the kernel32.dll on XP
does not have that function, but I put an if statement in my code so
that if the MajorVersion of the OS is < 6 (VISTA) then it doesn't call
this function anyway. However that doesn't seem to be sufficient to
keep it from trying to find the entry point anyway. Is there a way
for me go get around this?

You're offtopic. This is a Microsoft specific question, so you should be
asking in a Microsoft-specifc newsgroup.
 
R

r_z_aret

I removed comp.comp.lang.c++ from the list of newsgroups (to comply
with earlier post). More below (in line).


I have an application that will be used on both XP and Vista. One of
the things this application needs to do is determine the exact
operating system it is on. To get the correct "flavor" of Vista that
might be running, there is a new function in Kernel32.dll called
GetProductInfo(). The problem I'm running into is that if I include
this function in my application, the app errors on XP at start up with
the following message:

The procedure entry point GetProductInfo could not be located in the
dynamic link library KERNERL32.dll

Yep. The loader tries to resolve all links before a program even
starts. So the "if" statement you added is irrelevant. Try using
LoadLibrary and GetProcAddress. Using them is a bit of a pain, but
they work for me, and I think are the only way to provide dynamic
support.

Now I understand that this is happening because the kernel32.dll on XP
does not have that function, but I put an if statement in my code so
that if the MajorVersion of the OS is < 6 (VISTA) then it doesn't call
this function anyway. However that doesn't seem to be sufficient to
keep it from trying to find the entry point anyway. Is there a way
for me go get around this?

TIA,

Rym

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 400
Boston, MA 02116
www.penfact.com
 
J

JussiJ

@q66g2000hsg.googlegroups.com:

You're offtopic. This is a Microsoft specific question, so
you should be asking in a Microsoft-specifc newsgroup.

Looks very much on topic to me.

The error is caused by the missing entry point added to the
executable at link time.

So as Robert suggests, the answer is take the entry out of the
executable and use the LoadLibrary and GetProcAddress Win32 API's
to late bind the troublesome Win32 API.

Jussi Jumppanen
Author: Zeus for Windows IDE
http://www.zeusedit.com
 
R

Rick C

JussiJ said:
Looks very much on topic to me.


Andre was probably posting from comp.lang.c++, where they (in my limited
experience) don't like to discuss Microsoft-specific stuff. One could argue
it was a group the OP shouldn't have added. (I've taken it off the list of
groups to spare their tender feelings.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top