Answered by:
CoCreateInstance() fails for INetFWPolicy2 in service application

Question
-
We have created a service, wherein we are using CoCreateInstance() for INetFWPolicy2. This call fails with error code E_INVALIDARG (0x80070057L).
If we use INetFWMgr in place of INetFWPloicy2 then CoCreateInstance() returns success.
Secondly we tried calling CoCreateInstance() for INetFWPolicy2 in other non service application. And observed CoCreateInstance() for INetFWPolicy2 returns success.Please let us know what is the reason behind this behavior.
Thanks in advance.
Thursday, April 5, 2012 12:12 PM
Answers
-
Can you supply more details? please post a code snippet of your failing call. It is quite possible there is an invalid argument being passed.
I'd expect the call to look something like this
InetFwPolicy2* pNetFwPolicy2 = 0; /// Create an instance of the NetFwPolicy2 class status = CoCreateInstance(__uuidof(NetFwPolicy2), 0, CLSCTX_INPROC_SERVER, __uuidof(INetFwPolicy2), (LPVOID*)&pNetFwPolicy2);
Hope this helps,
Dusty Harper [MSFT]
Microsoft Corporation
------------------------------------------------------------
This posting is provided "AS IS", with NO warranties and confers NO rights
------------------------------------------------------------- Proposed as answer by Dusty Harper [MSFT]Moderator Thursday, April 5, 2012 4:49 PM
- Marked as answer by Dusty Harper [MSFT]Moderator Friday, April 6, 2012 11:45 PM
Thursday, April 5, 2012 4:49 PMModerator
All replies
-
We have created a service, wherein we are using CoCreateInstance() for INetFWPolicy2. This call fails with error code E_INVALIDARG (0x80070057L).
If we use INetFWMgr in place of INetFWPloicy2 then CoCreateInstance() returns success.
Secondly we tried calling CoCreateInstance() for INetFWPolicy2 in other non service application. And observed CoCreateInstance() for INetFWPolicy2 returns success.Please let us know what is the reason behind this behavior.
Thanks in advance.
- Merged by Helen Zhao Monday, April 9, 2012 6:12 AM merge them to keep the same topic
Thursday, April 5, 2012 12:10 PM -
Can you supply more details? please post a code snippet of your failing call. It is quite possible there is an invalid argument being passed.
I'd expect the call to look something like this
InetFwPolicy2* pNetFwPolicy2 = 0; /// Create an instance of the NetFwPolicy2 class status = CoCreateInstance(__uuidof(NetFwPolicy2), 0, CLSCTX_INPROC_SERVER, __uuidof(INetFwPolicy2), (LPVOID*)&pNetFwPolicy2);
Hope this helps,
Dusty Harper [MSFT]
Microsoft Corporation
------------------------------------------------------------
This posting is provided "AS IS", with NO warranties and confers NO rights
------------------------------------------------------------- Proposed as answer by Dusty Harper [MSFT]Moderator Thursday, April 5, 2012 4:49 PM
- Marked as answer by Dusty Harper [MSFT]Moderator Friday, April 6, 2012 11:45 PM
Thursday, April 5, 2012 4:49 PMModerator -
Thanks a lot Dusty...Friday, April 6, 2012 12:17 PM
-
Hi Gauravkrs,
I found there is another thread you posted in Windows Filtering Platform (WFP) forum. I'd like to merge them to keep in the same topic.
Thanks for your understanding.
Best regards,Helen Zhao [MSFT]
MSDN Community Support | Feedback to us
Monday, April 9, 2012 6:10 AM