While trying to read and get number of events in an Event Log I am getting an error 87.

```cpp
#include <windows.h>
#include <stdio.h>
#include <strsafe.h>
#define PROVIDER_NAME "System"

void wmain(void)
{
    HANDLE hEventLog = NULL;
    DWORD status = ERROR_SUCCESS;
    PDWORD numEvents = 0;

    hEventLog = OpenEventLog(NULL, PROVIDER_NAME);
    printf("Last error: %lu\n", GetLastError());
    if (!GetNumberOfEventLogRecords(hEventLog, numEvents))
    {
        printf("Failed GetNumberOfEventLogRecords: %lu\n", GetLastError());

    }

```

Output:

```
Last error: 0
Failed GetNumberOfEventLogRecords: 87

```

I've tried with a few variants on the PROVIDER\_NAME and I've based my example off this doc but once I do any kind of tweaking like my example I run into the ERROR\_INVALID\_PARAMETER

<https://learn.microsoft.com/en-us/windows/win32/eventlog/querying-for-event-source-messages>

I am not sure what the incorrect parameter is in reference to.