Solved

I keep getting the error "The procedure entry point RegDeleteKeyExW could not be located in the dynamic link library ADVAPI32.dll"

Posted on 2006-06-23
5
4,302 Views
Last Modified: 2012-05-05
Hi
I have a program written in C++ using Visual Studio 2005.
At some point in my code I would like to call the function RegDeleteKey to delete a specific registry key.

My code is as simple as this:

LONG MyClass::deleteAKey(CString path)
{
    LONG lRet;

    // open the key
    if ( ERROR_SUCCESS !=  RegOpenKeyEx ( HKEY_LOCAL_MACHINE, path, 0, _sam, &_hKey))
    {
          //Could not open the registry key
          return -1;
    }
    else
         lRet = RegDeleteKeyEx(_hKey, path, KEY_WOW64_64KEY, 0);

    return lRet;
}

All compiles and links fine.  But when I try to run my program, I immediately get the error message, "The procedure entry point RegDeleteKeyExW could not be located in the dynamic link library ADVAPI32.dll".  Now I wonder what could be wrong.

At the top of my .cpp file, I have also added the line:
#pragma comment(lib, "Advapi32.lib")

but nothing helps.

I'm guessing it has to do with name mangling but I'm not sure how to go about fixing this.  I'm not sure...just a guess.
Can anyone help?

Thanks so much
0
Comment
Question by:zarrona
[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
5 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 16973821
'RegDeleteKeyEx()' is mapped to 'RegDeleteKeyExW()' when UNICODE is #defined, yet that entry point should be there. What OS are you rinning that under? The minimum requirement is

Client
  Requires Windows Vista or Windows XP Professional x64 Edition.
Server
  Requires Windows Server "Longhorn" or Windows Server 2003 SP1.


see http://msdn.microsoft.com/library/en-us/sysinfo/base/regdeletekeyex.asp

BTW, have you tried

         lRet = RegDeleteKeyExA(_hKey, path, KEY_WOW64_64KEY, 0);

to explicitly call the ANSI counterpart?
0
 

Author Comment

by:zarrona
ID: 16974386
hi jkr,

Yes, Unicode is defined in my project and I understand that is why the "W" if found in "RegDeleteKeyExW()".
And I had already tried explicitly using the ANSI form RegDeleteKeyExA(hKey, "somepath" KEY_WOW64_64KEY, 0)...but that still made no difference.  I even tried using KEY_WOW64_32KEY as the 3rd paramater. :-(...no hope.

I'm developing and running my program on a Windows XP Professioal x64 Edition too.  So I'm guessing my machine is concidered a "client" right?...since I"m not trying to develope on a server.

I'm wondering do I have to load the library  "Advapi32.lib" in a different way rather than just adding the line

#pragma comment(lib, "Advapi32.lib")

at the top of my cpp file.  Or maybe make some changes to the Project Properties to add a dll or .lib or change something in the Linker section.

Another thought....I just noticed under the MSDN site the function RegDeleteKey().  Appears a bit different. I wonder what could be the big difference other than the parameters.

thanks

0
 

Author Comment

by:zarrona
ID: 16986718
Problem solved....

I just used the RegDeleteKey() function and that gave me no problems while running my program.
0
 

Accepted Solution

by:
CetusMOD earned 0 total points
ID: 17258159
PAQed with points refunded (500)

CetusMOD
Community Support Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

691 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