I use the GetLastError and get error code 5. But I still don't understand it
why I don't have the authotity. Even I can't open a file in D:\\ disk.
Btw, I write golang and call libclamav to scan the file. Is there any thing I
need to pay attention?
Thanks again! Any suggestion could help!
________________________________
发件人: clamav-users <[email protected]> 代表 Gao Hui via
clamav-users <[email protected]>
发送时间: 2020年9月9日 2:25
收件人: [email protected] <[email protected]>
抄送: Gao Hui <[email protected]>
主题: [clamav-users] Cannot get 'fd' when using API 'cl_scanfile'
Hi there,
I am trying to use API to scan a file with the file's absolute file path under
Windows system. But it returns CL_EOPEN, Can't open file or directory. So, I
debug step by step. The 'cl_scanfile' calls 'cl_scanfile_callback' and
'cl_scanfile_callback' calls 'safe_open (fname, O_RDONLY | O_BINARY)' , in the
'safe_open', there is a function called '_wopen' and it returns -1. So, the
code can't find file descriptor.
I don't know why '_wopen' returns -1 and how to debug it. So, any suggestion
could be helpful.
Also, I try to use GetLastError but find nothing.
int safe_open(const char *path, int flags, ...)
{
wchar_t *wpath = uncpath(path);
int ret;
if (!wpath)
return -1;
if (flags & O_CREAT) {
int mode;
va_list ap;
va_start(ap, flags);
mode = va_arg(ap, int);
va_end(ap);
ret = _wopen(wpath, flags, mode);
}
else {
ret = _wopen(wpath, flags);
}
free(wpath);
return ret;
}
Thanks!
Jack Gao
_______________________________________________
clamav-users mailing list
[email protected]
https://lists.clamav.net/mailman/listinfo/clamav-users
Help us build a comprehensive ClamAV guide:
https://github.com/vrtadmin/clamav-faq
http://www.clamav.net/contact.html#ml