Method and device for scanning file

The invention provides a method and a device for scanning a file. The method comprises the following steps of: when monitoring the operation of the file, obtaining a file object of the file; switching into a progress space of a scanning engine and establishing a memory map for the file object; transmitting a handle of the memory map of the file object into the progress space of the scanning engine; and utilizing the handle of the memory map of the file object by utilizing the scanning engine to scan the file. According to the invention, the scanning engine can be prevented from opening the file for a second time, so that the efficiency is improved and mutual interception of a plurality of antivirus programs is avoided.