Paul Vriens : advapi32: Add a stubbed GetEventLogInformation with input param checking.

Alexandre Julliard julliard at winehq.org
Wed Oct 28 10:12:24 CDT 2009


Module: wine
Branch: master
Commit: 7cc43213d70d70a945666ae50c6c525160835493
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7cc43213d70d70a945666ae50c6c525160835493

Author: Paul Vriens <Paul.Vriens.Wine at gmail.com>
Date:   Wed Oct 28 10:07:18 2009 +0100

advapi32: Add a stubbed GetEventLogInformation with input param checking.

---

 dlls/advapi32/advapi32.spec    |    2 +-
 dlls/advapi32/eventlog.c       |   58 ++++++++++++++++++++++++++++++++++++++++
 dlls/advapi32/tests/eventlog.c |    2 +-
 3 files changed, 60 insertions(+), 2 deletions(-)

diff --git a/dlls/advapi32/advapi32.spec b/dlls/advapi32/advapi32.spec
index 058760d..806cecf 100644
--- a/dlls/advapi32/advapi32.spec
+++ b/dlls/advapi32/advapi32.spec
@@ -236,7 +236,7 @@
 @ stdcall GetCurrentHwProfileW(ptr)
 @ stdcall GetEffectiveRightsFromAclA(ptr ptr ptr)
 @ stdcall GetEffectiveRightsFromAclW(ptr ptr ptr)
-# @ stub GetEventLogInformation
+@ stdcall GetEventLogInformation(long long ptr long ptr)
 @ stdcall GetExplicitEntriesFromAclA(ptr ptr ptr)
 @ stdcall GetExplicitEntriesFromAclW(ptr ptr ptr)
 @ stdcall GetFileSecurityA(str long ptr long ptr)
diff --git a/dlls/advapi32/eventlog.c b/dlls/advapi32/eventlog.c
index 1074ccc..e5c7bd7 100644
--- a/dlls/advapi32/eventlog.c
+++ b/dlls/advapi32/eventlog.c
@@ -190,6 +190,64 @@ ULONG WINAPI EnableTrace( ULONG enable, ULONG flag, ULONG level, LPCGUID guid, T
 }
 
 /******************************************************************************
+ * GetEventLogInformation [ADVAPI32.@]
+ *
+ * Retrieve some information about an event log.
+ *
+ * PARAMS
+ *  hEventLog      [I]   Handle to an open event log.
+ *  dwInfoLevel    [I]   Level of information (only EVENTLOG_FULL_INFO)
+ *  lpBuffer       [I/O] The buffer for the returned information
+ *  cbBufSize      [I]   The size of the buffer
+ *  pcbBytesNeeded [O]   The needed bytes to hold the information
+ *
+ * RETURNS
+ *  Success: TRUE. lpBuffer will hold the information and pcbBytesNeeded shows
+ *           the needed buffer size.
+ *  Failure: FALSE.
+ */
+BOOL WINAPI GetEventLogInformation( HANDLE hEventLog, DWORD dwInfoLevel, LPVOID lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
+{
+    EVENTLOG_FULL_INFORMATION *efi;
+
+    FIXME("(%p, %d, %p, %d, %p) stub\n", hEventLog, dwInfoLevel, lpBuffer, cbBufSize, pcbBytesNeeded);
+
+    if (dwInfoLevel != EVENTLOG_FULL_INFO)
+    {
+        SetLastError(ERROR_INVALID_LEVEL);
+        return FALSE;
+    }
+
+    if (!hEventLog)
+    {
+        SetLastError(ERROR_INVALID_HANDLE);
+        return FALSE;
+    }
+
+    if (!lpBuffer || !pcbBytesNeeded)
+    {
+        /* FIXME: This will be handled properly when eventlog is moved
+         * to a higher level
+         */
+        SetLastError(RPC_X_NULL_REF_POINTER);
+        return FALSE;
+    }
+
+    *pcbBytesNeeded = sizeof(EVENTLOG_FULL_INFORMATION);
+    if (cbBufSize < sizeof(EVENTLOG_FULL_INFORMATION))
+    {
+        SetLastError(ERROR_INSUFFICIENT_BUFFER);
+        return FALSE;
+    }
+
+    /* Pretend the log is not full */
+    efi = (EVENTLOG_FULL_INFORMATION *)lpBuffer;
+    efi->dwFull = 0;
+
+    return TRUE;
+}
+
+/******************************************************************************
  * GetNumberOfEventLogRecords [ADVAPI32.@]
  *
  * Retrieves the number of records in an event log.
diff --git a/dlls/advapi32/tests/eventlog.c b/dlls/advapi32/tests/eventlog.c
index 51d798b..628b08c 100644
--- a/dlls/advapi32/tests/eventlog.c
+++ b/dlls/advapi32/tests/eventlog.c
@@ -99,7 +99,7 @@ static void test_info(void)
     if (!pGetEventLogInformation)
     {
         /* NT4 */
-        skip("GetEventLogInformation is not available\n");
+        win_skip("GetEventLogInformation is not available\n");
         return;
     }
     SetLastError(0xdeadbeef);




More information about the wine-cvs mailing list