Updated.
[wine/multimedia.git] / dlls / advapi32 / eventlog.c
blob6260687644bf0a11df954e04cf82cda736dfe198
1 /*
2 * Win32 advapi functions
4 * Copyright 1995 Sven Verdoolaege
5 * Copyright 1998 Juergen Schmied
6 * Copyright 2003 Mike Hearn
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winerror.h"
28 #include "winreg.h"
29 #include "winternl.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(advapi);
34 WINE_DECLARE_DEBUG_CHANNEL(eventlog);
36 /******************************************************************************
37 * BackupEventLogA [ADVAPI32.@]
39 BOOL WINAPI BackupEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
41 FIXME("stub\n");
42 return TRUE;
45 /******************************************************************************
46 * BackupEventLogW [ADVAPI32.@]
48 * PARAMS
49 * hEventLog []
50 * lpBackupFileName []
52 BOOL WINAPI
53 BackupEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName )
55 FIXME("stub\n");
56 return TRUE;
59 /******************************************************************************
60 * ClearEventLogA [ADVAPI32.@]
62 BOOL WINAPI ClearEventLogA ( HANDLE hEventLog, LPCSTR lpBackupFileName )
64 FIXME("stub\n");
65 return TRUE;
68 /******************************************************************************
69 * ClearEventLogW [ADVAPI32.@]
71 BOOL WINAPI ClearEventLogW ( HANDLE hEventLog, LPCWSTR lpBackupFileName )
73 FIXME("stub\n");
74 return TRUE;
77 /******************************************************************************
78 * CloseEventLog [ADVAPI32.@]
80 BOOL WINAPI CloseEventLog ( HANDLE hEventLog )
82 FIXME("stub\n");
83 return TRUE;
86 /******************************************************************************
87 * DeregisterEventSource [ADVAPI32.@]
88 * Closes a handle to the specified event log
90 * PARAMS
91 * hEventLog [I] Handle to event log
93 * RETURNS STD
95 BOOL WINAPI DeregisterEventSource( HANDLE hEventLog )
97 FIXME("(%p): stub\n",hEventLog);
98 return TRUE;
101 /******************************************************************************
102 * GetNumberOfEventLogRecords [ADVAPI32.@]
104 * PARAMS
105 * hEventLog []
106 * NumberOfRecords []
108 BOOL WINAPI
109 GetNumberOfEventLogRecords( HANDLE hEventLog, PDWORD NumberOfRecords )
111 FIXME("stub\n");
112 return TRUE;
115 /******************************************************************************
116 * GetOldestEventLogRecord [ADVAPI32.@]
118 * PARAMS
119 * hEventLog []
120 * OldestRecord []
122 BOOL WINAPI
123 GetOldestEventLogRecord( HANDLE hEventLog, PDWORD OldestRecord )
125 FIXME(":stub\n");
126 return TRUE;
129 /******************************************************************************
130 * NotifyChangeEventLog [ADVAPI32.@]
132 * PARAMS
133 * hEventLog []
134 * hEvent []
136 BOOL WINAPI NotifyChangeEventLog( HANDLE hEventLog, HANDLE hEvent )
138 FIXME("stub\n");
139 return TRUE;
142 /******************************************************************************
143 * OpenBackupEventLogA [ADVAPI32.@]
145 HANDLE WINAPI
146 OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName )
148 FIXME("stub\n");
149 return (HANDLE)1;
152 /******************************************************************************
153 * OpenBackupEventLogW [ADVAPI32.@]
155 * PARAMS
156 * lpUNCServerName []
157 * lpFileName []
159 HANDLE WINAPI
160 OpenBackupEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpFileName )
162 FIXME("stub\n");
163 return (HANDLE)1;
166 /******************************************************************************
167 * OpenEventLogA [ADVAPI32.@]
169 HANDLE WINAPI OpenEventLogA(LPCSTR uncname,LPCSTR source)
171 FIXME("(%s,%s),stub!\n",uncname,source);
172 return (HANDLE)0xcafe4242;
175 /******************************************************************************
176 * OpenEventLogW [ADVAPI32.@]
178 * PARAMS
179 * uncname []
180 * source []
182 HANDLE WINAPI
183 OpenEventLogW( LPCWSTR uncname, LPCWSTR source )
185 FIXME("stub\n");
186 return (HANDLE)1;
189 /******************************************************************************
190 * ReadEventLogA [ADVAPI32.@]
192 BOOL WINAPI ReadEventLogA( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset,
193 LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded )
195 FIXME("stub\n");
196 return TRUE;
199 /******************************************************************************
200 * ReadEventLogW [ADVAPI32.@]
202 * PARAMS
203 * hEventLog []
204 * dwReadFlags []
205 * dwRecordOffset []
206 * lpBuffer []
207 * nNumberOfBytesToRead []
208 * pnBytesRead []
209 * pnMinNumberOfBytesNeeded []
211 BOOL WINAPI
212 ReadEventLogW( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset,
213 LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
214 DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded )
216 FIXME("stub\n");
217 return TRUE;
220 /******************************************************************************
221 * RegisterEventSourceA [ADVAPI32.@]
223 HANDLE WINAPI RegisterEventSourceA( LPCSTR lpUNCServerName, LPCSTR lpSourceName )
226 UNICODE_STRING lpUNCServerNameW;
227 UNICODE_STRING lpSourceNameW;
228 HANDLE ret;
229 RtlCreateUnicodeStringFromAsciiz(&lpUNCServerNameW, lpUNCServerName);
230 RtlCreateUnicodeStringFromAsciiz(&lpSourceNameW, lpSourceName);
231 ret = RegisterEventSourceW(lpUNCServerNameW.Buffer,lpSourceNameW.Buffer);
232 RtlFreeUnicodeString (&lpUNCServerNameW);
233 RtlFreeUnicodeString (&lpSourceNameW);
234 return ret;
237 /******************************************************************************
238 * RegisterEventSourceW [ADVAPI32.@]
239 * Returns a registered handle to an event log
241 * PARAMS
242 * lpUNCServerName [I] Server name for source
243 * lpSourceName [I] Source name for registered handle
245 * RETURNS
246 * Success: Handle
247 * Failure: NULL
249 HANDLE WINAPI
250 RegisterEventSourceW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName )
252 FIXME("(%s,%s): stub\n", debugstr_w(lpUNCServerName),
253 debugstr_w(lpSourceName));
254 return (HANDLE)1;
257 /******************************************************************************
258 * ReportEventA [ADVAPI32.@]
260 BOOL WINAPI ReportEventA ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID,
261 PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCSTR *lpStrings, LPVOID lpRawData)
263 LPCWSTR *wideStrArray;
264 UNICODE_STRING str;
265 int i;
266 BOOL ret;
268 if (wNumStrings == 0) return TRUE;
269 if (!lpStrings) return TRUE;
271 wideStrArray = HeapAlloc(GetProcessHeap(), 0, sizeof(LPCWSTR) * wNumStrings);
272 for (i = 0; i < wNumStrings; i++)
274 RtlCreateUnicodeStringFromAsciiz(&str, lpStrings[i]);
275 wideStrArray[i] = str.Buffer;
277 ret = ReportEventW(hEventLog, wType, wCategory, dwEventID, lpUserSid,
278 wNumStrings, dwDataSize, wideStrArray, lpRawData);
279 for (i = 0; i < wNumStrings; i++)
281 if (wideStrArray[i]) HeapFree( GetProcessHeap(), 0, (LPSTR)wideStrArray[i] );
283 HeapFree(GetProcessHeap(), 0, wideStrArray);
284 return ret;
287 /******************************************************************************
288 * ReportEventW [ADVAPI32.@]
290 * PARAMS
291 * hEventLog []
292 * wType []
293 * wCategory []
294 * dwEventID []
295 * lpUserSid []
296 * wNumStrings []
297 * dwDataSize []
298 * lpStrings []
299 * lpRawData []
301 BOOL WINAPI
302 ReportEventW( HANDLE hEventLog, WORD wType, WORD wCategory,
303 DWORD dwEventID, PSID lpUserSid, WORD wNumStrings,
304 DWORD dwDataSize, LPCWSTR *lpStrings, LPVOID lpRawData )
306 int i;
308 /* partial stub */
310 if (wNumStrings == 0) return TRUE;
311 if (!lpStrings) return TRUE;
313 for (i = 0; i < wNumStrings; i++)
315 switch (wType)
317 case EVENTLOG_SUCCESS:
318 TRACE_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
319 break;
320 case EVENTLOG_ERROR_TYPE:
321 ERR_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
322 break;
323 case EVENTLOG_WARNING_TYPE:
324 WARN_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
325 break;
326 default:
327 TRACE_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
328 break;
331 return TRUE;