[summary of the invention]
The technical matters that the present invention will solve is to provide a kind of adapter windows desktop method, and the user can use the windows desktop extender under not by the interference of desktop security software.
The present invention is achieved in that a kind of adapter windows desktop method, and the present invention specifically comprises the steps:
After step 10, windows desktop extender start, this program creation one message sink processing module, and through the explorer of this program with dynamic link library loading injection Windows;
Step 20, when the success of long-range injection dynamic link library, get into step 30; , withdraws from long-range injection dynamic link library this program and end when failing;
Comprise a DLL module by this program injection in step 30, the said explorer; Said DLL module definition one extended operation Message Processing flow process, and the extended message treatment scheme is set to the Message Processing flow process of explorer, and preserve the original inter-process flow process of explorer;
, the user produces desktop operated message when using the windows desktop program; , the user produces extended operation message when using the feature operation of windows desktop extender; Explorer is handled desktop operated message and the extended operation message of Windows in extended operation Message Processing flow process;
Said extended operation Message Processing flow process is:
After said DLL module receives desktop operated message, this desktop operated message handled letting corresponding desktop programs carry out action through the original built-in function treatment scheme of explorer;
After said DLL module is received this extended operation message, the part message that need pass to said message acceptance processing module in this extended operation message is encrypted formation one encrypting messages, and this encrypting messages is distributed to said message sink processing module;
Said DLL module judges that whether this extended operation message comprises the inside story that need call said inter-process flow process, then is distributed to explorer with this inside story if desired;
After step 40, said message sink processing module are received encrypting messages, this encrypting messages is decrypted into execution message; This program is carried out action according to said execution message; After said explorer received inside story, this explorer was handled said inside information according to original inter-process flow process and is let corresponding desktop programs carry out action.
Further, said step 10 further is specially:
It is fast that step 11, this program are passed through RegisterClass function and the said message sink processing of the CreateWindow function creation mould of Windows.
Further, said step 20 further is specially:
Step 21, said program obtain the process ID of said explorer;
Step 22, this program are opened the explorer process through said process ID, obtain process handle;
Step 23, this program are distributed a memory headroom in explorer after, the path of said dynamic link library is write this memory headroom;
Step 24, this program creation remote thread are loaded on explorer with said dynamic link library;
Step 25, after said dynamic link library is loaded on explorer and accomplishes, said program discharges this memory headroom.
Further, said step 30 further is specially:
Step 31, said DLL module obtain the forms handle of the SysListView32 of windows desktop;
Step 32, DLL module are utilized said forms handle, through this extended operation Message Processing flow process of SetWindowLongPtr function definition of Windows;
Step 33, said program are registered the class name of this message sink module through the RegisterClass function of Windows; Said program is through the forms name of CreateWindow function creation one this message sink module of Windows; After said message sink processing module was created, Windows gave this message sink processing module one first handle;
Said DLL module utilizes said class name and forms name to find out said first handle through the FindWindowEx function of Windows;
Step 34, said DLL module form an encrypting messages with the extended operation message conversion process that squints; Said DLL module finds the PostMessage function of encrypting messages through Windows said message sink processing module according to said first handle, and this encrypting messages is distributed said message sink processing module.
The present invention has following advantage: method is simple; Method through the long-range injection dynamic link library of said program is taken over windows desktop; Technology through long-range injection solves in traditional Hook Technique message can be by interception of desktop security software and the problem of filtering, and lets the windows desktop extender can right smoothly on windows desktop, moving.
[embodiment]
It is said to see also Fig. 1-2, and a kind of adapter windows desktop method of the present invention comprises the steps:
After step 10, windows desktop extender start, this program creation one message sink processing module, and through the explorer of this program with dynamic link library loading injection Windows;
Step 20, when the success of long-range injection dynamic link library, get into step 30; , withdraws from long-range injection dynamic link library this program and end when failing;
Comprise a DLL module by this program injection in step 30, the said explorer; Said DLL module definition one extended operation Message Processing flow process, and the extended message treatment scheme is set to the Message Processing flow process of explorer, and preserve the original inter-process flow process of explorer;
, the user produces desktop operated message when using the windows desktop program; , the user produces extended operation message when using the feature operation of windows desktop extender; Explorer is handled desktop operated message and the extended operation message of Windows in extended operation Message Processing flow process;
Said extended operation Message Processing flow process is a (see figure 2):
After said DLL module receives desktop operated message, this desktop operated message handled letting corresponding desktop programs carry out action through the original built-in function treatment scheme of explorer;
After said DLL module is received this extended operation message, the part message that need pass to said message acceptance processing module in this extended operation message is encrypted formation one encrypting messages, and this encrypting messages is distributed to said message sink processing module;
Said DLL module judges that whether this extended operation message comprises the inside story that need call said inter-process flow process, then is distributed to explorer with this inside story if desired;
After step 40, said message sink processing module are received encrypting messages, this encrypting messages is decrypted into execution message; This program is carried out action according to said execution message; After said explorer received inside story, this explorer was handled said inside information according to original inter-process flow process and is let corresponding desktop programs carry out action.
Method through long-range injection dynamic link library; Avoid the problem that traditional hook is filtered by the interception of desktop security software when message is transmitted; The desktop of realization Windows is taken over, and the extender (as showing the 3D scene at desktop, carrying out scene switching etc. with mouse roller) of desktop can under do not filtered by desktop security software and interception etc. disturbed, be moved.
Said step 10 further is specially:
It is fast that step 11, this program are passed through RegisterClass function and the said message sink processing of the CreateWindow function creation mould of Windows.
Said step 20 further is specially:
Step 21, said program obtain the process ID of said explorer;
Step 22, this program are opened the explorer process through said process ID, obtain process handle;
Step 23, this program are distributed a memory headroom in explorer after, the path of said dynamic link library is write this memory headroom;
Step 24, this program creation remote thread are loaded on explorer with said dynamic link library;
Step 25, after said dynamic link library is loaded on explorer and accomplishes, said program discharges this memory headroom.
Said step 30 further is specially:
Step 31, said DLL module obtain the forms handle of the SysListView32 of windows desktop;
Step 32, DLL module are utilized said forms handle, through this extended operation Message Processing flow process of SetWindowLongPtr function definition of Windows;
Step 33, said program are registered the class name of this message sink module through the RegisterClass function of Windows; Said program is through the forms name of CreateWindow function creation one this message sink module of Windows; After said message sink processing module was created, Windows gave this message sink processing module one first handle;
Said DLL module utilizes said class name and forms name to find out said first handle through the FindWindowEx function of Windows;
Step 34, said DLL module form an encrypting messages with the extended operation message conversion process that squints; Said DLL module finds the PostMessage function of encrypting messages through Windows said message sink processing module according to said first handle, and this encrypting messages is distributed said message sink processing module.
Concrete operations flow process of the present invention is following:
1.Windows the desktop extender is created the message sink processing module:
1-1. behind the program start, at first define a forms process (being extended operation Message Processing flow process) that is used for receiving message, promptly the WNDPROC call back function type with Windows defines a forms process (like MyWndProc).
1-2. one of the RegisterClass function registration self-defining type (like MyClassColor5201) through Windows is provided with the forms title (like MyWndProc) of its forms process for previous definition simultaneously.
1-3. be used for receiving the window of message then with these forms of CreateWindow function creation of Windows, this window name is called self-defining title (like MyClassColor5201), the handle of parent window is hShellDefView; So just can receive encrypting messages that the DLL module is distributed.
1-4. when the message sink processing module received the encrypting messages that the DLL module distributes, this message sink processing module was deciphered said encrypting messages according to the method for 4-2; Said encrypting messages deciphering back forms carries out message; Said message sink processing module is handled this execution message; Accomplish the operational motion (as showing the 3D scene on the table, can carrying out the switching of scene, convergent-divergent etc.) of said windows desktop extender through mouse roller.
2.Windows the desktop extender loads dynamic link library the explorer that injects Windows:
2-1. obtain the process ID of explorer:
2-1-1. obtain the handle (being hProgram) of shell Program Manager through the FindWindowEx function of Windows.
2-1-2. obtain the handle (being hShellDefView) of the SHELLDLL_DefView subwindow of shell Program Manager.
2-1-3. obtain desktop handle (being hDesktopFolderView) through the FindWindowEx function of Windows.
2-1-4. obtain the process ID (being nDesktopProcessId) of explorer through the GetWindowThreadProcessId function of Windows.
Obtain process handle 2-2. open the explorer process through the process ID of explorer:
Obtain the process handle of explorer 2-2-1. use the OpenProcess function of Windows.
2-3. behind remote dispensing internal memory on the explorer, write the dynamic link library file path that will inject:
2-3-1. the VirtualAllocEx function through Windows is applied for memory headroom on explorer, the space size is the required space size of the dynamic link library file complete trails that will inject.
2-3-2. the WriteProcessMemory function through Windows is written in the dynamic link library file complete trails in the space described in the 2-3-1.
2-4. create the dynamic link library that remote thread loads top appointment:
2-4-1. carry out the establishment of remote thread through the CreateRemoteThread function of Windows; And call the said dynamic link library of LoadLibrary function loading; If the successful i.e. said DLL module of operation in explorer, if failure then withdraw from this program and finish.
2-5. wait for that dynamic link library loads completion and returns, the releasing memory space, accomplish dynamic link library and inject:
2-5-1. using the WaitForSingleObject function of Windows to wait for after remote thread is created loaded returns.
The process handle that 2-5-2. the CloseHandle function of use Windows is closed among the 2-2-1 to be opened.
2-5-3. use the VirtualFreeEx function of Windows to be released in the memory headroom described in the 2-3-1.
3.DLL the Window message process of module is taken over and message encryption is transmitted:
3-1. when the DLL module initialization, use the technology of 2-1, obtain the handle of SHELLDLL_DefView window.
3-2.DLL self-defining forms process of module definition (being extended operation Message Processing flow process), promptly the WNDPROC call back function type with Windows defines a forms process title (like NewProgramProc).
3-3. utilize the handle of getting among the 3-1; SetWindowLongPtr function through Windows; The forms process that explorer is set is self-defining forms process (being NewProgramProc); Preserve its original forms process of returning (being the desktop operated of explorer, the operational processes flow process of non-extender) pointer simultaneously to former Windows.
3-4. obtain the forms handle (being hNewDesktopHandle) that the desktop extender of creating among the 1-3 receives message with the FindWindowEx function of Windows.
3-5. in self-defining forms process (being NewProgramProc) lining; Use the extended operation message that feature operation produced (being the parameter m sg in the self-defined forms process NewProgramProc) of windows desktop extender to handle to the user; Contents processing depends on what function is program want to provide; Simultaneously encrypt the formation encrypting messages to extended operation message with the method for 4-1, encrypting messages is distributed in the message sink processing module of windows desktop extender through the PostMessage function of Windows then and gone.Other non-encrypted message (being the message that is produced under the operation of user's non-extender in using windows desktop) are accomplished the adapter of message flow with the inter-process flow process of the original explorer of CallWindowProc function call of Windows.
4. the encryption and decryption of extended operation message:
4-1. extended operation message encryption: the extended message conversion process that squints (is added all that like the ID predefine constant value with extended message WM USER adds X; Wherein WM USER is the initial value of the user self-defined message of Windows definition, and X is the round values of a nonnegative number) the formation encrypting messages.
4-2. extended operation decrypt messages: encrypting messages is advanced anti-line displacement conversion process (all deduct WM_USER like the ID predefine constant value with encrypting messages and deduct X again, wherein X is the round values of a nonnegative number) form execution message.
To sum up can know; A kind of windows desktop method of taking over of the present invention is injected explorer through the mode of long-range injection dynamic link library with the DLL module; Avoid desktop security software is tackled filtration to the message of traditional Hook Technique problem through the technology of long-range injection; Realize effectively taking over windows desktop, the Windows extender can on the desktop of Windows, be carried out smoothly use.
Though more than described embodiment of the present invention; But the technician who is familiar with the present technique field is to be understood that; We described concrete embodiment is illustrative; Rather than being used for qualification to scope of the present invention, those of ordinary skill in the art are in the modification and the variation of the equivalence of doing according to spirit of the present invention, all should be encompassed in the scope that claim of the present invention protects.