1999-01-03 13:48:29 +01:00
|
|
|
/*
|
|
|
|
* Win32 advapi functions
|
|
|
|
*
|
2003-11-11 22:59:15 +01:00
|
|
|
* Copyright 1995 Sven Verdoolaege
|
|
|
|
* Copyright 1998 Juergen Schmied
|
|
|
|
* Copyright 2003 Mike Hearn
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
1999-03-14 17:35:05 +01:00
|
|
|
#include "windef.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winbase.h"
|
1999-01-03 13:48:29 +01:00
|
|
|
#include "winerror.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winreg.h"
|
2003-01-21 00:23:12 +01:00
|
|
|
#include "winternl.h"
|
1999-01-03 13:48:29 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
1999-02-17 14:51:06 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(advapi);
|
2003-11-11 22:59:15 +01:00
|
|
|
WINE_DECLARE_DEBUG_CHANNEL(eventlog);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
1999-01-03 13:48:29 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* BackupEventLogA [ADVAPI32.@]
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI BackupEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
1999-05-14 10:17:14 +02:00
|
|
|
FIXME("stub\n");
|
1999-01-03 13:48:29 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
1999-01-28 14:46:25 +01:00
|
|
|
|
1999-01-03 13:48:29 +01:00
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* BackupEventLogW [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hEventLog []
|
|
|
|
* lpBackupFileName []
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
|
|
|
BackupEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
1999-05-14 10:17:14 +02:00
|
|
|
FIXME("stub\n");
|
1999-01-03 13:48:29 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* ClearEventLogA [ADVAPI32.@]
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI ClearEventLogA ( HANDLE hEventLog, LPCSTR lpBackupFileName )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
1999-05-14 10:17:14 +02:00
|
|
|
FIXME("stub\n");
|
1999-01-03 13:48:29 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* ClearEventLogW [ADVAPI32.@]
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI ClearEventLogW ( HANDLE hEventLog, LPCWSTR lpBackupFileName )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
1999-05-14 10:17:14 +02:00
|
|
|
FIXME("stub\n");
|
1999-01-03 13:48:29 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* CloseEventLog [ADVAPI32.@]
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI CloseEventLog ( HANDLE hEventLog )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
1999-05-14 10:17:14 +02:00
|
|
|
FIXME("stub\n");
|
1999-01-03 13:48:29 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* DeregisterEventSource [ADVAPI32.@]
|
1999-01-03 13:48:29 +01:00
|
|
|
* Closes a handle to the specified event log
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hEventLog [I] Handle to event log
|
|
|
|
*
|
|
|
|
* RETURNS STD
|
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI DeregisterEventSource( HANDLE hEventLog )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
2002-10-25 21:17:33 +02:00
|
|
|
FIXME("(%p): stub\n",hEventLog);
|
1999-01-03 13:48:29 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* GetNumberOfEventLogRecords [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hEventLog []
|
|
|
|
* NumberOfRecords []
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
|
|
|
GetNumberOfEventLogRecords( HANDLE hEventLog, PDWORD NumberOfRecords )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
1999-05-14 10:17:14 +02:00
|
|
|
FIXME("stub\n");
|
1999-01-03 13:48:29 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* GetOldestEventLogRecord [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hEventLog []
|
|
|
|
* OldestRecord []
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
|
|
|
GetOldestEventLogRecord( HANDLE hEventLog, PDWORD OldestRecord )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
1999-05-14 10:17:14 +02:00
|
|
|
FIXME(":stub\n");
|
1999-01-03 13:48:29 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* NotifyChangeEventLog [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hEventLog []
|
|
|
|
* hEvent []
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI NotifyChangeEventLog( HANDLE hEventLog, HANDLE hEvent )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
1999-05-14 10:17:14 +02:00
|
|
|
FIXME("stub\n");
|
1999-01-03 13:48:29 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* OpenBackupEventLogA [ADVAPI32.@]
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
HANDLE WINAPI
|
|
|
|
OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
1999-05-14 10:17:14 +02:00
|
|
|
FIXME("stub\n");
|
2002-07-31 21:26:03 +02:00
|
|
|
return (HANDLE)1;
|
1999-01-03 13:48:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* OpenBackupEventLogW [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpUNCServerName []
|
|
|
|
* lpFileName []
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
HANDLE WINAPI
|
|
|
|
OpenBackupEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpFileName )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
1999-05-14 10:17:14 +02:00
|
|
|
FIXME("stub\n");
|
2002-07-31 21:26:03 +02:00
|
|
|
return (HANDLE)1;
|
1999-01-03 13:48:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* OpenEventLogA [ADVAPI32.@]
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
HANDLE WINAPI OpenEventLogA(LPCSTR uncname,LPCSTR source)
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
1999-05-14 10:17:14 +02:00
|
|
|
FIXME("(%s,%s),stub!\n",uncname,source);
|
2002-07-31 21:26:03 +02:00
|
|
|
return (HANDLE)0xcafe4242;
|
1999-01-03 13:48:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* OpenEventLogW [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* uncname []
|
|
|
|
* source []
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
HANDLE WINAPI
|
|
|
|
OpenEventLogW( LPCWSTR uncname, LPCWSTR source )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
1999-05-14 10:17:14 +02:00
|
|
|
FIXME("stub\n");
|
2002-07-31 21:26:03 +02:00
|
|
|
return (HANDLE)1;
|
1999-01-03 13:48:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* ReadEventLogA [ADVAPI32.@]
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI ReadEventLogA( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset,
|
1999-01-03 13:48:29 +01:00
|
|
|
LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded )
|
|
|
|
{
|
1999-05-14 10:17:14 +02:00
|
|
|
FIXME("stub\n");
|
1999-01-03 13:48:29 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* ReadEventLogW [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hEventLog []
|
|
|
|
* dwReadFlags []
|
|
|
|
* dwRecordOffset []
|
|
|
|
* lpBuffer []
|
|
|
|
* nNumberOfBytesToRead []
|
|
|
|
* pnBytesRead []
|
|
|
|
* pnMinNumberOfBytesNeeded []
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
|
|
|
ReadEventLogW( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset,
|
2002-06-01 01:06:46 +02:00
|
|
|
LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
|
1999-01-28 14:46:25 +01:00
|
|
|
DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
1999-05-14 10:17:14 +02:00
|
|
|
FIXME("stub\n");
|
1999-01-03 13:48:29 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* RegisterEventSourceA [ADVAPI32.@]
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
HANDLE WINAPI RegisterEventSourceA( LPCSTR lpUNCServerName, LPCSTR lpSourceName )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
2003-01-21 00:23:12 +01:00
|
|
|
|
|
|
|
UNICODE_STRING lpUNCServerNameW;
|
|
|
|
UNICODE_STRING lpSourceNameW;
|
|
|
|
HANDLE ret;
|
|
|
|
RtlCreateUnicodeStringFromAsciiz(&lpUNCServerNameW, lpUNCServerName);
|
|
|
|
RtlCreateUnicodeStringFromAsciiz(&lpSourceNameW, lpSourceName);
|
|
|
|
ret = RegisterEventSourceW(lpUNCServerNameW.Buffer,lpSourceNameW.Buffer);
|
|
|
|
RtlFreeUnicodeString (&lpUNCServerNameW);
|
|
|
|
RtlFreeUnicodeString (&lpSourceNameW);
|
1999-01-03 13:48:29 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* RegisterEventSourceW [ADVAPI32.@]
|
1999-01-03 13:48:29 +01:00
|
|
|
* Returns a registered handle to an event log
|
|
|
|
*
|
|
|
|
* PARAMS
|
1999-01-28 14:46:25 +01:00
|
|
|
* lpUNCServerName [I] Server name for source
|
|
|
|
* lpSourceName [I] Source name for registered handle
|
1999-01-03 13:48:29 +01:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: Handle
|
|
|
|
* Failure: NULL
|
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
HANDLE WINAPI
|
|
|
|
RegisterEventSourceW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
1999-05-14 10:17:14 +02:00
|
|
|
FIXME("(%s,%s): stub\n", debugstr_w(lpUNCServerName),
|
1999-01-03 13:48:29 +01:00
|
|
|
debugstr_w(lpSourceName));
|
2002-07-31 21:26:03 +02:00
|
|
|
return (HANDLE)1;
|
1999-01-03 13:48:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* ReportEventA [ADVAPI32.@]
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI ReportEventA ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID,
|
1999-01-03 13:48:29 +01:00
|
|
|
PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCSTR *lpStrings, LPVOID lpRawData)
|
|
|
|
{
|
2003-11-11 22:59:15 +01:00
|
|
|
LPCWSTR *wideStrArray;
|
|
|
|
UNICODE_STRING str;
|
|
|
|
int i;
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
if (wNumStrings == 0) return TRUE;
|
|
|
|
if (!lpStrings) return TRUE;
|
|
|
|
|
|
|
|
wideStrArray = HeapAlloc(GetProcessHeap(), 0, sizeof(LPCWSTR) * wNumStrings);
|
|
|
|
for (i = 0; i < wNumStrings; i++)
|
|
|
|
{
|
|
|
|
RtlCreateUnicodeStringFromAsciiz(&str, lpStrings[i]);
|
|
|
|
wideStrArray[i] = str.Buffer;
|
|
|
|
}
|
|
|
|
ret = ReportEventW(hEventLog, wType, wCategory, dwEventID, lpUserSid,
|
|
|
|
wNumStrings, dwDataSize, wideStrArray, lpRawData);
|
|
|
|
for (i = 0; i < wNumStrings; i++)
|
|
|
|
{
|
|
|
|
if (wideStrArray[i]) HeapFree( GetProcessHeap(), 0, (LPSTR)wideStrArray[i] );
|
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(), 0, wideStrArray);
|
|
|
|
return ret;
|
1999-01-03 13:48:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-15 00:11:17 +01:00
|
|
|
* ReportEventW [ADVAPI32.@]
|
1999-01-28 14:46:25 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hEventLog []
|
|
|
|
* wType []
|
|
|
|
* wCategory []
|
|
|
|
* dwEventID []
|
|
|
|
* lpUserSid []
|
|
|
|
* wNumStrings []
|
|
|
|
* dwDataSize []
|
|
|
|
* lpStrings []
|
|
|
|
* lpRawData []
|
1999-01-03 13:48:29 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI
|
2002-06-01 01:06:46 +02:00
|
|
|
ReportEventW( HANDLE hEventLog, WORD wType, WORD wCategory,
|
|
|
|
DWORD dwEventID, PSID lpUserSid, WORD wNumStrings,
|
1999-01-28 14:46:25 +01:00
|
|
|
DWORD dwDataSize, LPCWSTR *lpStrings, LPVOID lpRawData )
|
1999-01-03 13:48:29 +01:00
|
|
|
{
|
2003-11-11 22:59:15 +01:00
|
|
|
int i;
|
|
|
|
|
|
|
|
/* partial stub */
|
|
|
|
|
|
|
|
if (wNumStrings == 0) return TRUE;
|
|
|
|
if (!lpStrings) return TRUE;
|
|
|
|
|
|
|
|
for (i = 0; i < wNumStrings; i++)
|
|
|
|
{
|
|
|
|
switch (wType)
|
|
|
|
{
|
|
|
|
case EVENTLOG_SUCCESS:
|
|
|
|
TRACE_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
|
|
|
|
break;
|
|
|
|
case EVENTLOG_ERROR_TYPE:
|
|
|
|
ERR_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
|
|
|
|
break;
|
|
|
|
case EVENTLOG_WARNING_TYPE:
|
|
|
|
WARN_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
TRACE_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
|
1999-01-03 13:48:29 +01:00
|
|
|
}
|