error PRJ0019: A tool returned an error code: "Performing registration"
Hi,
I am writing a COM Server DLL. The DLL compiles fines, but when i built the project it thorws the above error.
The code which is creating the problem is below
Code:
// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void)
{//
// registers object, typelib and all interfaces in typelib
HRESULT hr = _AtlModule.DllRegisterServer();
return hr;
}
If i change return hr to return FALSE, it builds fine, but when i try to use the dll from a client
Code:
HRESULT hr = spEventProvider.CoCreateInstance(_uuidof(APIHelloWorld));
I get the following error in debug mode
Code:
hr 0x80040154 Class not registered HRESULT
The main problem i guess with registration.
I have already gone through the thread in code guru about error PRJ0019.
I have used the dependecy tool to see the errors while loading the dll and got the following
Code:
DllRegistrationServer:"C:\DSICommon\IDAS-Impls\VCHelloWorld\Release\VCHelloWorld.dll" failed
Return code was 0x80070716
I tried searching MSDN for error code 0x80070716, but was not able to find any thing.
I have struggling with this since yesterday and tried many things but nothing works.
Does it have to do with OS? Following is my environment
Windows XP Professional version 2002, SP 2
Microsoft Development Enviroment 2002 Version 7.0.9466
Microsoft .NET Framework 1.0 Version 1.0.3705
If someone has encountered this problem before and can throw some light i would really appreciate it.
Thanks in advacne for all the help.
Re: error PRJ0019: A tool returned an error code: "Performing registration"
Quote:
Originally Posted by novice123
I tried searching MSDN for error code 0x80070716, but was not able to find any thing.
The easiest way to find the reason for the error is to go to the
Code:
Tools Menu --> Error Look Up --> Look it up!
In your case 0x80070716 corresponds to error -
Quote:
The specified resource name cannot be found in the image file.
Which means that the resource (in this case .RGS File) that is expected to be compiled into the COM Server's resources was missing, and not built into it.
You need to ensure that it's present and it's being compiled.
You will find it's ID in the respective COM Class's Declaration (Header) as a macro -
Code:
DECLARE_REGISTRY_RESOURCEID(IDR_YourComClass)
Look up the ID in the RC File to find the name of the registry resource file (typically YourComClass.rgs).
Ensure that this file is a part of the project, and contains valid content.
If any of the steps listed above is missing, the RGS file is not being compiled into your COM Server's resources, and hence the ATL Library is not able to execute it (which results in registry entries for the COM Class being added).
Re: error PRJ0019: A tool returned an error code: "Performing registration"
Quote:
Originally Posted by novice123
If i change return hr to return FALSE, it builds fine,
You mean it registers fine... ;)
(Registration of a COM Server is a Post Build Step... )
Changing it to FALSE is a wrong thing to do as FALSE ironically carries value "0", which S_OK also does. In other words, replacing an HRESULT Error Code (E_*) with FALSE ends up in returning a SUCCESS code.
Naturally, the registration tool (RegSvr32.exe) interpreted FALSE as S_OK (as both are valued at 0) and threw no error.
Bottom line: That is ATL code... Don't change it.
1 Attachment(s)
Re: error PRJ0019: A tool returned an error code: "Performing registration"
Hi,
Thanks for the response. I guess the .rgs file is part of the build and .rc file gets updated each time you build.
Regarding the registration, what is the difference between DECLARE_REGISTRY_RESOURCEID and DECLARE_REGISTRY_RESOURCE.
?
In my case the project is called VCHelloWorld and COM class is called APIHelloWorld
Code:
library VCHelloWorldLib
{
importlib("stdole2.tlb");
[
uuid(59AB760B-3813-450a-894D-6CCD77D13237),
helpstring("APIHelloWorld Class")
]
coclass APIHelloWorld
{
[default] interface IAPIHelloWorld;
};
};
In my project APIHelloWorld.h has the definition and APIHelloWorld.cpp has the implementation
VCHelloWorld is the project name and VCHelloWorld.idl is has the definition of the interface.
In my case when i say
Code:
DECLARE_REGISTRY_RESOURCEID(IDR_APIHELLOWORLD)
in APIHelloWorld.h , it throws undeclared identifier error.
I think, i get this eror, since VCHelloWorld.rc there is no definition of IDR_APIHelloWorld .
In the begining when i create the project from the wizard VCHelloWorld.rc
has following definitions
Code:
#define IDS_PROJNAME 100
#define IDR_VCHELLOWORLD 101
In order to eliminate the error, i modified the VCHelloWorld.rc file by adding the following
Code:
#define IDR_APIHELLOWORLD 102
After making the above change, i don't get IDR_APIHELLOWORLD undecarled identifier error.
But now i keep getting ": error PRJ0019: A tool returned an error code"
Attached are the sourcefiles of the project in zip format. I just took all the files of instead of the complete project, since it is becoming too big.
Can you please take a look if you can and tell me what can be wrong ?
Thanks very much for all the help and appreciate it
Re: error PRJ0019: A tool returned an error code: "Performing registration"
At first look, it seems that you have edited your project and in doing so (unintentionally) damaged resources.
Inside VCHellowWorld.rc -
Code:
IDR_APIHELLOWORLD "APIHELLOWORLDA"
It should typically be a RGS file. This is missing in your project, and hence the class that uses this ID does not have a corresponding registration file. So, your class cannot be registered - period.
Now, to fix this problem - I would recommend you to abandon this project (as it seems disturbed) which is anyways pretty empty.
Create a new project. Use the ATL Class Wizard to Add a new class. Like this -
Code:
Right Click Project in Class View --> Add --> Add Class --> ATL in left pane --> ATL Simple Object --> Fill first field --> Finish
You will see that the wizard has created a .CPP, a .H, and a new .RGS for you.
Add a method (Right Click Interface --> Add Method), compile and see your component get registered.
To learn how stuff works, go backward - see the interface's entry in the IDL, the registry resource id's in the RC, and .H, etc...
Re: error PRJ0019: A tool returned an error code: "Performing registration"
Hi,
Thank you very much for the response. I guess with your steps, i was able to solve the problem i was facing.
Thank you very much again.
I would really appreciate if you can provide some links which explain developing application with ATL and COM
thanks
Re: error PRJ0019: A tool returned an error code: "Performing registration"
Quote:
Originally Posted by novice123
Thank you very much for the response. I guess with your steps, i was able to solve the problem i was facing.
Thank you very much again.
You are welcome... :)
Quote:
Originally Posted by novice123
I would really appreciate if you can provide some links which explain developing application with ATL and COM
As far as ATL / COM goes, I strongly advise writing test applications the way you have been... It's the way to go.
Use the ATL wizards, and in doing so don't forget to verify how a wizard action changes your project / source code - i.e work backwards to learn how stuff worked.
Additionally, books like Beginning ATL / COM Programming by Wrox Press make learning the basics simple...