A kind of method printing backup under Windows environment
Technical field
The invention belongs to computer system security management technique field, standby particularly to printing under a kind of Windows environment
The method of part.
Background technology
At present, printing device is widely used in working environment, also improves secrecy for people while bringing convenience
The degree of risk of information leakage.Reveal security information by printing, generally involve user's higher level even core stage
Secret, destructive power is big, and case-solving rate is low, greatly compromises the interests of individual, collective.Print redundancy technique to meet the tendency in this context
And give birth to, for constituent parts by printing the information leakage problem that approach exists, it is proposed that effective solution.At present, it is achieved
Print backup and mainly have two kinds of methods: one is installation agent program on terminal computer, utilize printing pool to monitor api interface
Obtaining print data, the file analyzing concrete printing from the print data obtained backs up;Another kind is to dispose to print
Server.When mimeograph documents, can only be by printing on files passe to be printed to printing server, at printing server
Upper backup mimeograph documents.
The shortcoming of first method is to back up all mimeograph documents.Because printing pool monitoring api interface can only obtain printing
The file name of file, obtains file full path footpath by file name and relies on concrete application program realization, it is impossible to ensure to obtain
To correct file full path footpath, thus all mimeograph documents cannot be backed up.
Second method can back up all of mimeograph documents, but shortcoming is also apparent from.Mainly there is a following problem, first: this
The method of kind needs to change the use habit of user, and user must will print on files passe to printing server, it is impossible to
This locality completes printing.Second: all users print to queue up on printing server and carry out, and reduce work efficiency,
Too increase the management cost to printing server simultaneously.
In sum, in the prior art, in the case of not changing user's use habit, it is impossible to realize backup all printings literary composition
Part.
Summary of the invention
Present invention mainly solves technical problem is that: provide a kind of method printing backup under Windows environment, the method
In the case of not changing user's use habit, back up all mimeograph documents.
For solving above-mentioned technical problem, the present invention adopts the following technical scheme that
A kind of method printing backup under Windows environment, comprises the steps of
A., virtual printer is installed: XPS virtual printer is installed on the terminal device, is used for printing content is stored disk
In file;
B., API HOOK is installed: API HOOK is installed on the terminal device, is used for capturing the printing that application program is initiated;
C. Printer Information is obtained: obtain the Printer Information that terminal unit connects, including: printer name;
Only obtain the actual printer being directly connected to the machine and the actual printer being connected by network;
D. Printer Information is stored: be stored in internal memory by the printer name obtained in step c;
E. printing is captured: capture application program is initiated the api function of printing and called, and obtains printer name;
F. printing is analyzed: entered by the printer name of storage in the printer name obtained in step e and described step d
Row compares.If the match is successful, perform step g;If mating unsuccessful, end operation;
G. printing deception: the printer name obtained in described step e is replaced with the virtual printer installed in step a
Printer name.Preserve the printer name obtained in described step e in internal memory;
H. backup file is generated: wait that virtual printer has printed, the file that standby virtual printer generates;
I. mimeograph documents are generated: use the printer name preserved in described step g, print the backup file in described step h,
Complete to print.
The beneficial effects of the present invention is: the method printing backup under a kind of windows environment of the present invention, can be for different
Network size, in the case of not changing user's use habit, it is achieved backs up all mimeograph documents, is effectively prevented confidential information
Leaked by printing type and spread.
Accompanying drawing explanation
Fig. 1 is the flow chart of the method printing backup of the present invention;
Fig. 2 is the structural representation printing standby system of embodiments of the invention.
Detailed description of the invention:
Below in conjunction with accompanying drawing and example, the present invention is described in further detail.
The invention provides a kind of method printing backup under Windows environment, its application scenarios is LAN environment, such as Fig. 2
Shown in, this LAN includes control station computer 201, client computer 202, public printing device and printing server 204,
This public printing device is the printer 203 that a Daepori is logical, and the operating system of client computer is Windows operating system,
In the case of not changing user's use habit, it is achieved back up all mimeograph documents.
Such as, the computer name of client computer referred to as APC, IP address is 192.168.0.85, and printer name is referred to as HP
P2055D, IP address is 192.168.0.88, and user passes through client computer, uses Word application program to open a file
Path be C: user Administrator desktop, file name be " logical soft company introduction ", file type be .doc, size
For the file that 200k, number of pages are page 3.It it is the file execution whole document of printing of " logical soft company introduction .doc " to file name
Operation, arranging printing number is 1 part.
As it is shown in figure 1, the specific works step of the method printing backup of the present invention is as follows:
A., virtual printer 101 is installed: virtual printer is installed on client computers, entitled: XPS Document
Writer.Purpose be used for by file name be " logical soft company introduction ", file type be .doc, size be 200k, number of pages be page 3
File store in client computer disk file;
B. installing API HOOK102: install API HOOK on client computers, purpose is used for capturing WORD application program and sends out
The printing risen
C. Printer Information 103 is obtained: obtaining the Printer Information that client computer is connected, Printer Information comprises printing
Machine title HP P2055D;
D. storage Printer Information 104: printer name HP P2055D is stored to client computer internal memory;
E. the api function of capture printing 105:API HOOK capture WORD application program initiation printing calls, function
Entitled StartDoc, obtains the parameter in function call, and parameter comprises printer name HP P2055D;
F. printing 106 is analyzed: the printer name HP P2055D of acquisition and the printer name of storage are mated;
Perform step 107 to be mated by the printer name obtaining printer name HP P2055D and storage, as consistent the most then
It is made into merit, then continues executing with step 108, as inconsistent, then end operation;
G. printing deception 109: the printer name HP P2055D of acquisition is replaced with virtual printer name XPS
Document Writer.And the printer name HP P2055D of acquisition is saved in client computer internal memory;
H. backup file 110 is generated: waiting that virtual XPS Document Writer printer prints and terminate, virtual printer is raw
Becoming file, title: APC_2015-02-20-13-15-40-leads to soft company introduction .xps;Back up this file;
I. mimeograph documents 111 are generated: use printer name HP P2055D to print APC_2015-02-20-13-15-40-and lead to soft
Company introduction .xps, printing completes.
The method of the present invention also can back up the mimeograph documents of extended formatting, the text such as such as EXCEL, PPT, PDF, TXT, JNT literary composition
Part and JPG, TIF, PNG picture format file, and CAD, CAXA graphical format file.