[python-win32] win32evtlogutil.SafeFormatMessage shortcomings

Eric Davis endavis at gmail.com
Thu Oct 11 18:49:39 CEST 2007


Running pywin32 version 210.
Python 2.5

I have some events that don't get formatted correctly, basically ones
that contain messages from winerror and some events in the security logs.


System Log Error
[273] ID:7000 Service Control Manager
   Type: ERROR
   Time: 10/11/2007 05:13:18
The Network Load Balancing service failed to start due to the following
error:
%%1058

The 1058 is an error message from the winerror.h header, which I can get
with win32api.FormatMessage, but why doesn't SafeFormatMessage do this
automatically?


Security Log Audit Failure Message
Object Open:
	Object Server:	Security
	Object Type:	File
	Object Name:	C:\WINDOWS\DtcInstall.log
	Handle ID:	-
	Operation ID:	{0,72457}
	Process ID:	1208
	Image File Name:	
	Primary User Name:	NETWORK SERVICE
	Primary Domain:	NT AUTHORITY
	Primary Logon ID:	(0x0,0x3E4)
	Client User Name:	-
	Client Domain:	-
	Client Logon ID:	-
	Accesses:	%%1538
			%%1541
			%%4416
			%%4417
			%%4418
			%%4419
			%%4420
			%%4423
			%%4424
			
	Privileges:	-
	Restricted Sid Count:	0
	Access Mask:	0x12019F

The %% messages are not from winerror.h.  I believe the security log has
a messages dll of its own, but I have no idea how to get those messages.
Again, why doesn't SafeFormatMessage do this automatically?

Is there a way that I can do this with the win32api?  The messages are
formatted correctly with wmi, but wmi is painfully slow because the
event logs are so large.

Thanks,
Eric



More information about the python-win32 mailing list