Hcnetsdk.dll 9 Hikvision Error !!hot!! Guide
After any failed SDK call, call NET_DVR_GetLastError() to get the raw error code. Error 9 is the generic illegal parameter – but sometimes the real error is different, and the SDK mis-reports it.
I can give a more precise fix.
return userId;