Using CreateEventEx causes problems with CAN_SetClientParam
Posted: Thu 9. Jun 2022, 17:17
I have changed my event creation method from CreateEvent to CreateEventEx (see https://docs.microsoft.com/en-us/window ... teeventexw).
After doing so, CAN_SetClientParam (with CAN_PARAM_ONRCV_EVENT_HANDLE) returned CAN_ERR_ILLPARAMVAL.
I experimented a bit and found the following:
1) when using the following access rights in the last parameter: SYNCHRONIZE | DELETE | EVENT_MODIFY_STATE, the event handle was not accepted by the PEAK software.
2) when using STANDARD_RIGHTS_ALL, the event handle was not accepted by the PEAK software either
3) only when using EVENT_ALL_ACCESS, the event handle was accepted
::CreateEventExW(nullptr, nullptr, 0, EVENT_ALL_ACCESS);
The MS documentation does advise not use EVENT_ALL_ACCESS unless absolutely necessary and I never needed it so far.
My question now: why is it necessary for this handle to have these access rights?
After doing so, CAN_SetClientParam (with CAN_PARAM_ONRCV_EVENT_HANDLE) returned CAN_ERR_ILLPARAMVAL.
I experimented a bit and found the following:
1) when using the following access rights in the last parameter: SYNCHRONIZE | DELETE | EVENT_MODIFY_STATE, the event handle was not accepted by the PEAK software.
2) when using STANDARD_RIGHTS_ALL, the event handle was not accepted by the PEAK software either
3) only when using EVENT_ALL_ACCESS, the event handle was accepted
::CreateEventExW(nullptr, nullptr, 0, EVENT_ALL_ACCESS);
The MS documentation does advise not use EVENT_ALL_ACCESS unless absolutely necessary and I never needed it so far.
My question now: why is it necessary for this handle to have these access rights?