A kind of multi-process operates the security method menu of same file simultaneously
Technical field
The present invention relates to windows kernels and windows application-development technologies field, specifically a kind of practical
Property strong, multi-process operate the security method menu of same file simultaneously.
Background technology
With developing rapidly for computer technology, electronic data has been directed to almost all of field, and the safety of data is got over
Come more important, intentionally or accidentally between loss with destruction be likely to result in great loss.Many editing machines do not provide peace at present
The notepad of total inspection, such as Microsoft, board, what the write to file was taken is mandatory covering, other editing machine
Although such as Microsoft Visual Studio, Uedit etc. provide source file content and constantly check contrast mechanism, which is right
The write of data equally uses pressure and covers, this to multi-process simultaneously operation file when easily cause the data for first writing to lose
Lose, all that has been achieved is spoiled for the work before being allowed to.Based on this, a kind of multi-process is now provided while operating same file, the write to file
The method for carrying out security inspection, the method can add associated program, and the file operation to associated program equally carries out safety
Property check, it is practical.
The content of the invention
The technical assignment of the present invention is to solve the deficiencies in the prior art, there is provided a kind of practical, multi-process is operated simultaneously
The security method menu of same file.
The technical scheme is that what is realized in the following manner, a kind of multi-process operates the safety of same file simultaneously
Property method, which implements process and is:
Between file kernel and application program, add a file security module, this document security module to cut by hook
Each operation of user is obtained, further according to file operation main body and the corresponding operation of operation read-write mark, its specific operation process is:
1), user addition associated program, check read-write operation of the associated program to program;
2), associated program read file, file security module log file check information, source file is backed up and is given birth to
Into mission bit stream, mission bit stream here includes reading process ID, source file path, temporary file path and the source file of file most
Modification time afterwards;
3), associated program reading and writing of files, associated program carries out validation of information to source file when to file write data,
Check that whether which was changed by other processes this operation is outer, i.e., the last modification time of file security module contrast source file with
The last modification time for being recorded, and provide a user with warning;
4), task list safeguard that file security module starts safeguards that thread carries out real-time inspection to task list, creates dimension
Shield thread, is constantly checked to entering list, the task to failing is cleared up, and task list described here is process ID correspondence
The list of mission bit stream, i.e., each mission bit stream are all unique, and process ID, the source file road of operation file are recorded in the list
The last modification time of footpath, temporary file path and source file.
The step 1)Detailed operation process be:
First, to application program itself, security inspection is carried out to the read-write of file kernel, and other programs are arranged to close
Connection program, monitors associated program to the read-write of file and provides a user with safety warning;
2nd, after user submits the program for needing association to, the document that associated program write is specified is carried out physical store by system,
Computer is again started up, system loads associated program automatically;
3rd, associated program is passed to file security module by system, and file security module safeguards an associated program chained list.
The step 2)Detailed process be:
A, file security module copy source file generate temporary file, and, before written document, user's is all for associated program
Operation is carried out on temporary file;
B, record source file path, make user read to source file at any time and write data;
The file path of C, record temporary file;
D, record source file last modification time, is made with associated program written document when as file security verify
Foundation, if the last modification time of source file and record Time Inconsistency, report to the police to user;
E, record read the process ID of file, and add the information recorded in step B, C, D, E by file security module
To inside task list.
The step 3)Detailed process be
A, traversal associated program chained list, judge whether the corresponding program of write process is associated program;
B, the last modification time of reading source file and record time are contrasted;
C, the preserving type that file is carried out according to judged result prompting user, preserving type here refer to covering or another
Deposit.
The step 4)Detailed process be:
A, startup task manager module;
B, contrast task list and system process;
Continue step b after c, deletion failure task, until failing in system for task is deleted completely.
The produced compared with prior art beneficial effect of the present invention is:
A kind of multi-process of the present invention operates the security method menu of same file to realize that user is carried out when writing automatically simultaneously
Integrity checking alerts user;User is provided addition associated program function, makes associated program same when file write is carried out
Automatically carry out File Integrity Checking and report to the police to user;It is practical, it is applied widely, it is easy to promote.
Description of the drawings
Associated program list schematic diagram of the accompanying drawing 1 for the present invention.
Addition associated program schematic diagram of the accompanying drawing 2 for the present invention.
Task list schematic diagram of the accompanying drawing 3 for the present invention.
Accompanying drawing 4 reads file schematic diagram for the associated program of the present invention.
Associated program reading and writing of files schematic diagram of the accompanying drawing 5 for the present invention.
Accompanying drawing 6 safeguards schematic diagram for the task list of the present invention.
Specific embodiment
Operate the security method menu work of same file following in detail simultaneously a kind of multi-process of the present invention below in conjunction with the accompanying drawings
Describe in detail bright.
The present invention mentality of designing be:The characteristics of considering windows message mechanisms, using the message intercept mode of system,
I.e. hook is intercepted, and judges whether file operation main body is associated program and action type, that is, read or written document, to file operation
Main body is associated program and carries out the action of read operation and carry out mission bit stream record, and the mission bit stream addition of record is taken office
In business information list.For the write operation of associated program, file security module can carry out file security verification before writing, right
The operation that verification does not pass through is reported to the police to user;The basis of the present invention is that other programs are added in associated program list
Face, carries out security inspection such that it is able to the operating writing-file to these associated programs, and certain method can also provide application layer
File read-write function.Based on this mentality of designing, as shown in Figure 1, a kind of multi-process is now provided while operating the peace of same file
Full property method, the method is in application layer user operation part and drives layer file security writing module to be partially completed.
Wherein apply layer segment, there is provided two functions of user, A, readable written document, B, associated program can be added.
Next to that kernel file security module, file security module controls the read-write operation of associated program, in associated program
Read document stage record source file information and generate mission bit stream, and be added in task list, while an assignment file is safeguarded,
Prevent task list accidental destruction;The associated program written document stage, when file security module can read the last modification of source file
Between compare with the last modification time recorded by mission bit stream, if result is consistent, then associated program can be directly to source file
Middle write data, if inconsistent, then file security module is notified that application program is reported to the police to the write operation of user.
Which implements process:
Between file kernel and application program, add a file security module, this document security module to cut by hook
Each operation of user is obtained, further according to file operation main body and the corresponding operation of operation read-write mark, its specific operation process is:
1), user addition associated program, check read-write operation of the associated program to program, this step not only can to from
Body, the read-write to file carry out security inspection, moreover it is possible to other programs are arranged to associated program, and can monitor associated program pair
The read-write of file and provide a user with safety warning.
2), associated program read file, file security module log file check information, source file is backed up and is given birth to
Into mission bit stream, mission bit stream here includes reading process ID, source file path, temporary file path and the source file of file most
Modification time afterwards.
3), associated program reading and writing of files, associated program carries out validation of information to source file when to file write data,
Check that whether which was changed by other processes this operation is outer, i.e., the last modification time of file security module contrast source file with
The last modification time for being recorded, and provide a user with warning.
4), task list safeguard that file security module starts safeguards that thread carries out real-time inspection to task list, creates dimension
Shield thread, is constantly checked to entering list, the task to failing is cleared up, and task list described here is process ID correspondence
The list of mission bit stream, i.e., each mission bit stream are all unique, and process ID, the source file road of operation file are recorded in the list
The last modification time of footpath, temporary file path and source file.
As shown in Figure 2, the step 1)Detailed operation process be:
First, to application program itself, security inspection is carried out to the read-write of file kernel, and other programs are arranged to close
Connection program, monitors associated program to the read-write of file and provides a user with safety warning;
2nd, after user submits the program for needing association to, the document that associated program write is specified is carried out physical store by system,
Computer is again started up, system loads associated program automatically;
3rd, associated program is passed to file security module by system, and file security module safeguards an associated program chained list.
As shown in accompanying drawing 3, Fig. 4, the step 2)Detailed process be:
A, file security module copy source file generate temporary file, and, before written document, user's is all for associated program
Operation is carried out on temporary file;
B, record source file path, make user read to source file at any time and write data;
The file path of C, record temporary file;
D, record source file last modification time, is made with associated program written document when as file security verify
Foundation, if the last modification time of source file and record Time Inconsistency, report to the police to user;
E, record read the process ID of file, and add the information recorded in step B, C, D, E by file security module
To inside task list.
As shown in Figure 5, the step 3)Detailed process be
A, traversal associated program chained list, judge whether the corresponding program of write process is associated program;
B, the last modification time of reading source file and record time are contrasted;
C, the preserving type that file is carried out according to judged result prompting user, preserving type here refer to covering or another
Deposit.
As shown in Figure 6, the step 4)Detailed process be:
A, startup task manager module;
B, contrast task list and system process;
Continue step b after c, deletion failure task, until failing in system for task is deleted completely.
Embodiment of above is merely to illustrate the present invention, and not limitation of the present invention, about the common of technical field
Technical staff, without departing from the spirit and scope of the present invention, can also make a variety of changes and modification, therefore all
The technical scheme of equivalent falls within scope of the invention, and the scope of patent protection of the present invention should be defined by the claims.