58
58
59
59
#include "php_win32_globals.h"
60
60
#include "wsyslog.h"
61
+ #include "codepage.h"
61
62
62
63
void closelog (void )
63
64
{
@@ -92,6 +93,7 @@ void vsyslog(int priority, const char *message, va_list args)
92
93
unsigned short etype ;
93
94
char * tmp = NULL ;
94
95
DWORD evid ;
96
+ wchar_t * strsw [2 ];
95
97
96
98
/* default event source */
97
99
if (INVALID_HANDLE_VALUE == PW32G (log_source ))
@@ -110,11 +112,28 @@ void vsyslog(int priority, const char *message, va_list args)
110
112
etype = EVENTLOG_WARNING_TYPE ;
111
113
evid = PHP_SYSLOG_WARNING_TYPE ;
112
114
}
115
+
113
116
vspprintf (& tmp , 0 , message , args ); /* build message */
117
+
118
+ strsw [0 ] = php_win32_cp_any_to_w (PW32G (log_header ));
119
+ strsw [1 ] = php_win32_cp_any_to_w (tmp );
120
+
121
+ /* report the event */
122
+ if (strsw [0 ] && strsw [1 ]) {
123
+ ReportEventW (PW32G (log_source ), etype , (unsigned short ) priority , evid , NULL , 2 , 0 , strsw , NULL );
124
+ free (strsw [0 ]);
125
+ free (strsw [1 ]);
126
+ efree (tmp );
127
+ return ;
128
+ }
129
+
130
+ free (strsw [0 ]);
131
+ free (strsw [1 ]);
132
+
114
133
strs [0 ] = PW32G (log_header ); /* write header */
115
134
strs [1 ] = tmp ; /* then the message */
116
- /* report the event */
117
- ReportEvent (PW32G (log_source ), etype , (unsigned short ) priority , evid , NULL , 2 , 0 , strs , NULL );
135
+
136
+ ReportEventA (PW32G (log_source ), etype , (unsigned short ) priority , evid , NULL , 2 , 0 , strs , NULL );
118
137
efree (tmp );
119
138
}
120
139
0 commit comments