[clamav-users] 回复: 回复: Cannot get 'fd' when using API 'cl_scanfile'
Micah Snyder (micasnyd)
micasnyd at cisco.com
Wed Sep 9 18:29:51 UTC 2020
Hi Jack Gao,
On Windows I believe you need to pass files to ‘cl_scanfile’ and not directories. I think directories _do_ work on non-Windows platforms but the safe_open API I think can’t handle them on Windows. It would be nice to fix that though!
-Micah
From: clamav-users <clamav-users-bounces at lists.clamav.net> On Behalf Of Gao Hui via clamav-users
Sent: Wednesday, September 9, 2020 12:37 AM
To: ClamAV users ML <clamav-users at lists.clamav.net>
Cc: Gao Hui <JackGao96 at outlook.com>
Subject: [clamav-users] 回复: 回复: Cannot get 'fd' when using API 'cl_scanfile'
Hi Ged,
I do some little tests and I think I find the problem for now.
For example, if I want to scan 'D:\test' and pass the char into it. The code will translate it to wchar and it becames '\\?\D:\test'. It will open the same folder if you put them in folder's address bar. But _wopen will return -1 if you use '\\?\D:\test'.
________________________________
发件人: clamav-users <clamav-users-bounces at lists.clamav.net<mailto:clamav-users-bounces at lists.clamav.net>> 代表 G.W. Haywood via clamav-users <clamav-users at lists.clamav.net<mailto:clamav-users at lists.clamav.net>>
发送时间: 2020年9月9日 7:26
收件人: Gao Hui via clamav-users <clamav-users at lists.clamav.net<mailto:clamav-users at lists.clamav.net>>
抄送: G.W. Haywood <clamav at jubileegroup.co.uk<mailto:clamav at jubileegroup.co.uk>>
主题: Re: [clamav-users] 回复: Cannot get 'fd' when using API 'cl_scanfile'
Hi there,
On Wed, 9 Sep 2020, Gao Hui via clamav-users wrote:
> I am trying to use API to scan a file with the file's absolute file
> path under Windows system.
> ...
> 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?
I don't really do Windows, so even if you'd told us which versions of
everything you are using it wouldn't have helped me. But I do have
some experience of fixing things.
In a case like this I'd probably look for something which uses the API
calls to the library successfully, and run that through the same debug
processes which you are using for the code which fails. Comparing the
code which succeeds with the code which fails should shed some light.
You probably have something which succeeds in the ClamAV distribution.
--
73,
Ged.
_______________________________________________
clamav-users mailing list
clamav-users at lists.clamav.net<mailto:clamav-users at lists.clamav.net>
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clamav.net/pipermail/clamav-users/attachments/20200909/56a0c4fa/attachment.htm>
More information about the clamav-users
mailing list