Re: WMI/COM and ExecNotificationQueryAsync for Win32_NTLogEvent




I have run some more testing, and it turns out the error I am getting is in
fact a access denied error. So it seems that I need to set up security and
permissions to correctly access the windows NT event log. I see in the VB
examples these lines of code:

Set objWMI = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colLoggedEvents = objWMI.ExecQuery _
("Select * from Win32_NTLogEvent Where Logfile = 'System'" )

What is the corresponding C++/COM version of this? I can't seem to find the
correct incantation in COM land to get the system log notifications through
an asynchronous query handler?

Thanks so much,

"roger_man" wrote:


Thanks, yes, I have looked at those, but none of them have any examples
specifically for Win32_NTLogEvent. I think it might either be a security
thing or a WQL query issue, since when I call ExecNotificationQueryAsync, I
get an error message which does not map to any of the standard error messages
one can get from this call. I am using an unsecured apartment for security,
could that be an issue?

Thanks,

"Scherbina Vladimir" wrote:

Hello, roger_man.

"roger_man" <rogerman@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C0BB7E48-1E78-453D-947C-7E9112926B98@xxxxxxxxxxxxxxxx
Hi,

I am trying to create an application that uses WMI to listen for
Win32_NTLogEvent messages from the local machine through a asynchronous
listener via ExecNotificationQueryAsync in a C++/COM environment, and I'm
not
having a whole lot of luck. I am finding examples to do this with Visual
Basic, but somehow they do not translate into C++/COM very well.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_c___application_examples.asp -
this list of c++ examples will be usefull for you.

Particularly, I am having trouble creating the WQL query in the function:

hresult = pSvc->ExecNotificationQueryAsync(
_bstr_t("WQL"),
_bstr_t("SELECT * "
"FROM __InstanceCreationEvent WITHIN 1 "
"WHERE TargetInstance ISA 'Win32_NTLogEvent'"),
WBEM_FLAG_SEND_STATUS,
NULL,
pStubSink);

Something along these lines, but for some reason I am not able to connect
to
this event. I know I have to have security permissions in order to
receive
these events (which I beleive I do), but is there something wrong with my
WQL
query that is keeping me from connecting to and listening to NT log
events?
What else could I be doing wrong with this approach?

Thank you so much for any and all assistance,

--
Vladimir



.



Relevant Pages

  • Re: WMI/COM and ExecNotificationQueryAsync for Win32_NTLogEvent
    ... fact a access denied error. ... So it seems that I need to set up security ... thing or a WQL query issue, since when I call ExecNotificationQueryAsync, ... listener via ExecNotificationQueryAsync in a C++/COM environment, ...
    (microsoft.public.win32.programmer.networks)
  • Re: Form Security
    ... After all this, if no error message has been generated, the form contents are emailed to me. ... I'm no Linux guru, so I don't know what someone could do to cause problems with this script, other than spam me. ... What he's proposing is false security - which is worse than no security ...
    (comp.lang.php)
  • Re: Form Security
    ... I am running it through trimand strip_tags, but haven't decided yet on a regular expression to use, or even if I really need to. ... After all this, if no error message has been generated, the form contents are emailed to me. ... I'm no Linux guru, so I don't know what someone could do to cause problems with this script, other than spam me. ... What he's proposing is false security - which is worse than no security ...
    (comp.lang.php)
  • Re: Unable to open Project 2003 Project Plan
    ... A quick google search on the error message in the project newsgroups ... rolling out SP-3 any time soon. ... I see this as a serious BUG created by Microsoft in a security ... I'm using Microsoft Project 2003 Service Pack 2 and I'm running ...
    (microsoft.public.project)
  • Re: Main Dialogue error
    ... Windows help - www.rickrogers.org ... "Susan Flors" wrote in message ... > under msconfig I couldn't locate anything that said "security center" only ... >> this one Christmas - I get one error message that occurs while I boot up ...
    (microsoft.public.windowsxp.general)