Embodiment
For making the object, technical solutions and advantages of the present invention clearer, below in conjunction with specific embodiment, and with reference to accompanying drawing, the present invention is described in more detail.
Fig. 2 shows the method flow diagram of a kind of Registry provided by the invention.As shown in Figure 2, the method comprises:
Step 201: start REGEDIT;
Step 202: the window handle that obtains described REGEDIT;
Step 203: by calling interface function, described REGEDIT is operated according to described window handle.
Step 201: start REGEDIT.
In Windows system, the mode of startup REGEDIT can have multiple, and as REGEDIT is opened in the api interface analog subscriber manual operation providing by system, or the api interface that calling system provides directly starts REGEDIT etc.
Alternatively, if REGEDIT is opened in analog subscriber manual operation, can adjust " RUN " window by the Hotkey of simulation Win+R, and in opening path, input Register.exe, then analog subscriber mouse is clicked " the determining " on this " RUN " window, starts REGEDIT.
Those skilled in the art will appreciate that the function that the graphic user interface to computer system that alleged interface function herein refers to that system or development platform provide operates.
Fig. 3 shows wherein a kind of method flow diagram of opening REGEDIT in Windows system Imitating user manual operation.As shown in Figure 3, the method comprises:
Step 301: recall " RUN " window by calling system api interface " keybd_event " input keyboard pseudo code " VK_LWIN+R ";
Step 302: calling system api interface " FindWindow & EnumChildWindows " is searched the handle " hedit " of the input frame of window " ClassName=Eidt ", obtain the input frame handle on " RUN " window, then calling system api interface " SendMessage " sends message number " WM_SETTEXT " to this handle " hedit ", its parameter is " Register.exe ", i.e. simulating hand operation is to described input frame input " Register.exe ";
Step 303: calling system api interface " FindWindow & EnumChildWindows " is searched the button handle " hbtn " of window " WindowsName=' determines ' ", obtain the confirming button handle on " RUN " window, and calling system api interface " PostMessage " sends BN_CLICKED message to handle " hbtn ", be that simulating hand is clicked confirming button, open REGEDIT.
Certainly in aforesaid way, also can operate by keyboard analog forms such as shortcuts.In addition, in every kind of operating system, the path of opening of REGEDIT is not quite similar, and can operate to start REGEDIT according to actual conditions analog subscriber.
Step 202: the window handle that obtains described REGEDIT.In Windows system, each window of opening has specific handle, by obtaining this handle, can operate on it.
According to the above-mentioned example, by analog subscriber manual operation, open after REGEDIT, can be in a time-out time 5s, poll calling system api interface " FindWindow ", search the handle of window " ClassName=RegisterWindowClass ", search the window handle that obtains Register.exe REGEDIT.
Step 203: by calling interface function, described REGEDIT is operated according to described window handle.Particularly, the operation of registration table is comprised and imports or derive register-file, newly-built, deletion or rename key or key assignments item, revise key assignments item etc.For above-mentioned these operations to registration table, can realize by calling interface function.
Alternatively, describedly by calling interface function, registration table is operated and comprised: obtain the menu item of REGEDIT, analog mouse and/or keyboard operate described menu item.
Fig. 4 shows the method flow diagram that obtains the menu item of REGEDIT in the present invention.As shown in Figure 4, the method for obtaining REGEDIT menu item comprises the steps:
Step 401: all top-level window handles of the system of obtaining, form first window handle list;
Step 402: in precalculated position analog mouse clicking operation;
Step 403: in predetermined time interval, all top-level window handles of the system of again obtaining, form Second Window handle list;
Step 404: the difference set of obtaining first window handle list and Second Window handle list;
Step 405: the window handle that obtains menu from described difference set;
Step 406: obtain menu item according to the window handle of described menu.
Alternatively, described precalculated position comprises the coordinate of key assignments item and/or the menu bar of REGEDIT.For different operations, can select directly on corresponding key assignments item, to simulate right mouse button and select corresponding menu to operate, also can be directly at the enterprising line operate of menu bar of REGEDIT.For example, for importing, derivation, newly-built and rename operation, can select to utilize the menu bar of REGEDIT to operate, and other operations can be chosen in and simulate right mouse button on corresponding key assignments item and select corresponding menu to operate, certainly as derive, two kinds of modes of operation such as newly-built and rename all can.
Take newly-built key and/or key assignments item below obtains the idiographic flow of menu item in REGEDIT as example describes in detail.Fig. 5 shows the method flow diagram of newly-built expansion key in the present invention.As shown in Figure 5, this idiographic flow comprises:
Step 501: all top-level window handle list of obtaining system by system api interface EnumChildWindows, are designated as first window handle list hwndlistl;
Step 502: at preposition place, the api interface mouse_event Transfer Parameters MOUSEEVENTF_RIGHTDOWN & MOUSEEVENTF_RIGHTUP providing by operating system, operates with analog mouse right button.
Step 503: in a time-out time (acquiescence 5s), recursive call system api interface EnumChildWindows obtains current all top-level window handles in a system, is designated as Second Window handle list hwndlist2;
Step 504: the difference set of calculating Second Window handle list hwndlist2 and first window handle list hwndlist1;
Step 505: search the handle of ClassName=#32768 in described difference set, i.e. the window handle hwnd of popup menu item;
Step 506: the window handle hwnd of described popup menu item is converted to menu handle hmenu by system api interface GetMenu;
Step 507: obtain all menu item numbers in this menu according to described menu handle hmenu calling system api interface GetMenuItemCount, and calling system api interface GetMenuItemInfo travels through each menu item, obtain the menu item that its Word message is " newly-built ", and return to the position coordinates (x at this menu item place, y), analog subscriber is placed on this position coordinates (x by cursor of mouse, y), and search popup menu according to the step of introducing above, so recurrence continues to find Word message for the corresponding position coordinates of menu item of " item ";
Step 508: at position coordinates place corresponding to found " item " menu item, analog subscriber mouse clicking operation, and the keyboard operation of analog subscriber, input the title of newly-built key, and simulate carriage return operation, complete the newly-built operation of key.
Seemingly, difference is that what finally to be searched is that Word message is " string value ", " binary value ", " DWORD value ", " many string values " or " extendible string value " etc. for the newly-built operation of key assignments item and the newly-built class of operation of above-mentioned key.
In described step 502, preposition can be father's key coordinate of the key of wanting newly-built in REGEDIT window on interface, the left side, can be also interface, the right that described father's key the is corresponding coordinate of position of anticipating of taking up an official post.
In addition, described newly-built operation can also complete by the System menu obtaining on REGEDIT, be specially: the window handle that obtains REGEDIT, and obtain its menu handle according to described window handle, according to described menu handle, find after the position coordinates of Edit menu item, simulation is placed in this position coordinates place by cursor of mouse, and search popup menu, so recurrence continues to find Word message for the corresponding position coordinates of menu item of " item ", and carries out corresponding newly-built operation.
Alternatively, describedly by calling interface function, registration table is also operated and comprised: obtain and launch key coordinate and/or key assignments item coordinate, and analog mouse operates.
Fig. 6 shows the method flow diagram that obtains expansion key coordinate in the present invention.As shown in Figure 5, obtaining expansion key seat calibration method comprises:
Step 601: the interface handle that obtains root key in REGEDIT;
Step 602: according to the interface handle of root key, call interface function and successively search from tree root, obtain the coordinate that launches key.
Fig. 7 shows the method flow diagram that obtains key assignments item coordinate in the present invention.As shown in Figure 7, obtaining key assignments item seat calibration method comprises:
Step 701: analog mouse operation, at the coordinate position of the expansion key getting, carry out clicking operation;
Step 702: the interface handle at an interface, place that finds key value;
Step 703: according to the interface handle at described key assignments item place, travel through and search from this interface list, and obtain the coordinate of described key assignments item.
Take below and revise key assignments item as the example brief description operating process of REGEDIT once.
Fig. 8 shows the detailed embodiment process flow diagram that utilizes the present invention to revise key assignments item under Windows system in REGEDIT.As shown in Figure 8, the method comprises:
Step 801: move REGEDIT Regedit by calling system interface, and obtain the interface handle of Regedit;
Step 802: split target key assignments item path to be modified; Such as revising the key assignments content of the key assignments item LogPixels of key HKEY_CURRENT_CONFIG \ Software \ Fonts, be split into for the first time key HKEY_CURRENT_CONFIG \ Software \ Fonts and key assignments item LogPixels; Key HKEY_CURRENT_CONFIG \ Software \ Fonts is arranged in the tree structure of Regedit interface left-hand component, and key assignments item LogPixels is arranged in the list structure of Regedit interface right-hand component;
Step 803: according to the window handle of Regedit, search the window handle of the root key key of Regedit interface left-hand component;
Step 804: according to the window handle of root key key, call GUI function and search layer by layer from tree root, the coordinate position of locator key, such as the HKEY_CURRENT_CONFIG \ Software \ coordinate position of the sub-key Fonts in Fonts is found in final location;
Step 805: find after the coordinate position of sub-key, analog mouse operation, clicks the coordinate position navigating to, and the key assignments item information that this sub-key is corresponding is presented in the list structure of Regedit interface right part;
Step 806: obtain the interface handle of the root key assignments item of Regedit interface right part, and according to the interface handle of described key assignments item, travel through described list structure, finally locate the coordinate position of key assignments item to be found;
Step 807: on the coordinate position of found key assignments item, analog mouse right button operation, popup menu item, and from described menu item, select the operation of modifying of " modification " menu item.
Be described in detail in below in REGEDIT and obtain and launch key coordinate and the method step that obtains key assignments item coordinate.
Fig. 9 shows and utilizes the present invention to launch the detailed embodiment process flow diagram of key coordinate obtain REGEDIT under Windows system in.As shown in Figure 9, the method comprises:
Step 901: search the window of type SysTreeView32 by system api interface FindWindow, obtain the window handle hwnd at key in REGEDIT (interface, the REGEDIT left side);
Step 902: calling system api interface SendMessage sends message number TVM_GETNEXTITEM to described key window handle hwnd, and its parameter is " TVGN_ROOT ", to obtain the information hitem of root key HKEY_CLASSES_ROOT in REGEDIT;
Step 903: calling system api interface WriteProcessMemory applies for an internal memory rectAddr, and its structure form is TVITEM;
Step 904: calling system api interface SendMessage sends message number TVM_GETNEXTITEM to described key window handle hwnd, parameter is " 1 ", obtain first key information item under described key HKEY_CLASSES_ROOT, and be saved in memory block rectAddr, the information hitem that is simultaneously root key HKEY_CLASSES_ROOT its father node is also saved in memory block rectAddr;
Step 905: calling system api interface ReadProcessMemory reads described first key information item from memory block rectAddr, and this key information comprises text and rect, represents respectively Word message and position coordinates;
Step 906: calling system api interface GetWindowRect sends out message to described key window handle hwnd, to obtain the position coordinates rect of this key window handle hwnd;
Step 907: calculate this first key at the relative coordinate pos of described key window according to the position coordinates rect comprising in position coordinates rect corresponding to described key window handle hwnd and described first key information item;
Step 908: use the same method, the sub-key childHitem of first key of circulation searching item, obtains Word message and the coordinate position of sub-key childHitem, whether identically with given key name mates its Word message;
Step 909: if identical, calling system api interface SendMessage sends out message TVM_EXPAND to described key window handle hwnd, parameter is TVE_EXPAND, this first key is launched, and be presented at middle position, interface, calling system api interface SendMessage sends out message TVM_SELECTITEM to described key window handle hwnd, and parameter is TVGN_CARET, to choose described first key;
Step 910: if not identical, search successively the next key nextitem adjacent with described first key, and make to use the same method, the sub-key of the next key nextitem of circulation searching, until find given key, and obtain the coordinate of this given key.
Figure 10 show utilize the present invention under Windows system, obtain REGEDIT in the detailed embodiment process flow diagram of key assignments item coordinate.As shown in figure 10, the method comprises:
Step 1001: search the window of type SysListView32 by system api interface FindWindow, obtain the window handle hwnd at key assignments item (interface, REGEDIT the right);
Step 1002: the message number that calling system api interface SendMessage sends LVM_GETITEMCOUNT to described key assignments item window handle hwnd, obtain the key assignments item quantity count that described key assignments item window handle hwnd is corresponding, i.e. key assignments item line number;
Step 1003: travel through the information item of the every line unit value item correspondence in described key assignments item window, line number is index, calling system api interface WriteProcessMemory applies for an internal memory rectAddr, its structure form is LVITEM;
Step 1004: calling system api interface SendMessage sends the message number of LVM_GETITEMTEXT to described key assignments item window handle hwnd, parameter is current traveled through key assignments item line number index, obtain the key assignments item information item of current traversal, and be saved in memory block rectAddr;
Step 1005: calling system api interface ReadProcessMemory reads the key assignments item information item of current traversal from memory block rectAddr, the coordinate that this key assignments item information item comprises Word message and this key assignments item correspondence, whether the Word message that this key assignments item information of overmatching item comprises is identical with given key assignments key name;
Step 1006: if not identical, continue traversal and search next line;
Step 1007: if identical, calling system api interface GetWindowRect sends out message to described key assignments item window handle hwnd, obtain the coordinate of described key assignments item window, the relative coordinate of the key assignments item that calculates this current traversal according to the coordinate of the key assignments item of the coordinate of described key assignments item window and current traversal in key assignments item window, as the coordinate of the key assignments item that will obtain.
Figure 11 shows the another kind of embodiment process flow diagram that utilizes the present invention to revise key assignments item in REGEDIT under Windows system.As shown in figure 11, the method comprises:
Step 1101: utilize the definite key assignments item coordinate pos having introduced in method above, transmit MOUSEEVENTF_RIGHTDOWN & MOUSEEVENTF_RIGHTUP parameter simulation right mouse button by system api interface mouse_event and operate;
Step 1102: calling system api interface FindWindow & EnumChildWindows searches the handle hedit of the input frame of window ClassName=" editing character string ", calling system api interface SendMessage sends the message number of WM_SETTEXT to this input frame handle hedit, the content of parameter for revising;
Step 1103: calling system api interface FindWindow & EnumChildWindows searches the button handle hbtn that window WindowsName=" determines ", calling system api interface PostMessage sends BN_CLICKED message to this button handle hbtn, to complete the retouching operation of key assignments item.
Those skilled in the art are to be understood that; above only exemplary introduction a part of embodiment of registry operations method proposed by the invention; wherein only contained a part of mode of operation to registration table; and other can continue to use said method to the concrete operations of registration table; it is expanded or is out of shape, so long as registration table is carried out within corresponding operation is all encompassed in protection scope of the present invention by calling interface function.
From above-mentioned embodiment, can find out, in the such scheme that the present invention proposes, all flow processs are all called interface function registration table are operated, rather than the registry functions that provides of calling system, such as functions such as looking for window, input characters, button click operates registration table.It can be perfectly under the system environments of securing software monitoring; the safe operation of realization to registration table; avoided the executive routine of oneself can not caused the situations such as disabler by securing software wrong report simultaneously; this method is not only limited to the environment to antivirus software or securing software; also be applicable to various Windows homes, can guarantee maximum compatibility simultaneously.
It should be noted that, for embodiment of the method, for simple description, therefore it is all expressed as to a series of combination of actions, but those skilled in the art should know, the application is not subject to the restriction of described sequence of movement, because according to the application, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in instructions all belongs to preferred embodiment, and related action and module might not be that the application is necessary.
Figure 12 shows the modularize structure icon of the device of a kind of Registry that the present invention proposes.As shown in figure 12, this device comprises:
Start module 1201, it is for starting REGEDIT;
Acquisition module 1202, it is for obtaining the window handle of described REGEDIT;
Operational module 1203, it is for operating described REGEDIT by calling interface function according to described window handle.
The function that the Windows operating system of still take below realizes as the included above-mentioned modules of device of the Registry of example detailed description the present invention proposition, those skilled in the art should know, the method is not limited only to Windows system, other graphic interface system that it is also applicable to operate registration table by REGEDIT.
Start module 1201, it is for starting REGEDIT.
In Windows system, the mode of startup REGEDIT can have multiple, and as REGEDIT is opened in the api interface analog subscriber manual operation providing by system, or the api interface that calling system provides directly starts REGEDIT etc.
Alternatively, if REGEDIT is opened in analog subscriber manual operation, can adjust " RUN " window by the Hotkey of simulation Win+R, and in opening path, input Register.exe, then analog subscriber mouse is clicked " the determining " on this " RUN " window, starts REGEDIT.
Start the startup that module 1201 can complete registration editing machine in several ways, wherein as shown in Figure 3 a kind of, it can first recall " RUN " window by transferring system interface, then calling system interface is searched and is obtained input frame handle on " RUN " window, and calling system interface is to the start-up routine title " Register.exe " of described input frame handle input REGEDIT, and analog mouse is clicked " determining " button on " RUN " window, whole process is all to call the mode that interface functional simulation user starts registration table to start described REGEDIT.Owing to having described the content shown in Fig. 3 in the above in detail, at this, just repeat no more.
Certainly in aforesaid way, also can operate by keyboard analog forms such as shortcuts.In addition, in every kind of operating system, the path of opening of REGEDIT is not quite similar, and can operate to start REGEDIT according to actual conditions analog subscriber.
Acquisition module 1202, obtains the window handle of described REGEDIT.In Windows system, each window of opening has specific handle, by obtaining this handle, calls corresponding interface function and can operate on it.
According to the above-mentioned example, by analog subscriber manual operation, open after REGEDIT, can be in a time-out time 5s, poll calling system api interface " FindWindow ", search the handle of window " ClassName=RegisterWindowClass ", search the window handle that obtains Register.exe REGEDIT.
Operational module 1203, it operates described REGEDIT by calling interface function according to described window handle.Particularly, the operation of registration table is comprised and imports or derive register-file, newly-built, deletion or rename key or key assignments item, revise key assignments item etc.For above-mentioned these operations to registration table, can realize by calling interface function.
Alternatively, described operational module comprises menu item operational module, and it is for obtaining the menu item of REGEDIT, and analog mouse and/or keyboard operate described menu item.
The menu item specific implementation process that described menu item operational module obtains REGEDIT is as follows:
The all top-level window handles of the system of obtaining, form first window handle list;
In precalculated position analog mouse clicking operation;
In predetermined time interval, all top-level window handles of the system of again obtaining, form Second Window handle list;
Obtain the difference set of first window handle list and Second Window handle list;
From described difference set, obtain the window handle of menu;
According to the window handle of described menu, obtain menu item.
Alternatively, described precalculated position comprises the coordinate of key assignments item and/or the menu bar of REGEDIT.For different operations, can select directly on corresponding key assignments item, to simulate right mouse button and select corresponding menu to operate, also can be directly at the enterprising line operate of menu bar of REGEDIT.For example, for importing, derivation, newly-built and rename operation, can select to utilize the menu bar of REGEDIT to operate, and other operations can be chosen in and simulate right mouse button on corresponding key assignments item and select corresponding menu to operate, certainly as derive, two kinds of modes of operation such as newly-built and rename all can.
Take newly-built key and/or key assignments item below describes the idiographic flow that menu item operational module obtains menu item in REGEDIT in detail as example.
First, all top-level window handle list that this module is obtained system by system api interface EnumChildWindows, are designated as first window handle list hwndlist1; At preposition place, the api interface mouse_event Transfer Parameters MOUSEEVENTF_RIGHTDOWN & MOUSEEVENTF_RIGHTUP providing by operating system, operates with analog mouse right button.
Secondly, in a time-out time (acquiescence 5s), recursive call system api interface EnumChildWindows obtains current all top-level window handles in a system, is designated as Second Window handle list hwndlist2; Calculate the difference set of Second Window handle list hwndlist2 and first window handle list hwndlist1; In described difference set, search the handle of ClassName=#32768, i.e. the window handle hwnd of popup menu item;
Afterwards, by system api interface GetMenu, the window handle hwnd of described popup menu item is converted to menu handle hmenu; According to described menu handle hmenu calling system api interface GetMenuItemCount, obtain all menu item numbers in this menu, and calling system api interface GetMenuItemInfo travels through each menu item, obtain the menu item that its Word message is " newly-built ", and return to the position coordinates (x at this menu item place, y), analog subscriber is placed on this position coordinates (x by cursor of mouse, y), and search popup menu according to the step of introducing above, so recurrence continues to find Word message for the corresponding position coordinates of menu item of " item ";
Finally, at position coordinates place corresponding to found " item " menu item, analog subscriber mouse clicking operation, and the keyboard operation of analog subscriber, input the title of newly-built key, and simulate carriage return operation, completes the newly-built operation of key.
Seemingly, difference is that what finally to be searched is that Word message is " string value ", " binary value ", " DWORD value ", " many string values " or " extendible string value " etc. for the newly-built operation of key assignments item and the newly-built class of operation of above-mentioned key.
Above-mentioned preposition can be father's key coordinate of the key of wanting newly-built in REGEDIT window on interface, the left side, can be also interface, the right that described father's key the is corresponding coordinate of position of anticipating of taking up an official post.
In addition, described newly-built operation can also complete by the System menu obtaining on REGEDIT, be specially: the window handle that obtains REGEDIT, and obtain its menu handle according to described window handle, according to described menu handle, find after the position coordinates of Edit menu item, simulation is placed in this position coordinates place by cursor of mouse, and search popup menu, so recurrence continues to find Word message for the corresponding position coordinates of menu item of " item ", and carries out corresponding newly-built operation.
Alternatively, described operational module also comprises: coordinate obtaining module, it launches key coordinate and/or launch key assignments item coordinate for obtaining, and analog mouse operates.
Wherein, coordinate obtaining module obtains that to launch the specific implementation process of key coordinate as follows:
First, obtain the interface handle of root key in REGEDIT;
Secondly, according to the interface handle of root key, call interface function and successively search from tree root, obtain the coordinate that launches key.
Wherein, to obtain the specific implementation process of key assignments item coordinate as follows for described coordinate obtaining module:
First, analog mouse operation, carries out clicking operation at the coordinate position of the expansion key getting;
Secondly, the interface handle at an interface, place that finds key value;
Finally, according to the interface handle at described key assignments item place, from this interface list, travel through and search, and obtain the coordinate of described key assignments item.
The modification key assignments item of take is below the example brief description specific implementation process that once device of this Registry operates REGEDIT.
First, start module by calling system interface operation REGEDIT Regedit;
Secondly, described acquisition module obtains the interface handle of Regedit;
Again, described operational module splits target key assignments item path to be modified; Such as revising the key assignments content of the key assignments item LogPixels of key HKEY_CURRENT_CONFIG \ Software \ Fonts, be split into for the first time key HKEY_CURRENT_CONFIG \ Software \ Fonts and key assignments item LogPixels; Key HKEY_CURRENT_CONFIG \ Software \ Fonts is arranged in the tree structure of Regedit interface left-hand component, and key assignments item LogPixels is arranged in the list structure of Regedit interface right-hand component;
Afterwards, operational module, according to the window handle of Regedit, is searched the window handle of the root key key of Regedit interface left-hand component; And according to the window handle of root key key, call GUI function and search layer by layer from tree root, the coordinate position of locator key, such as the HKEY_CURRENT_CONFIG \ Software \ coordinate position of the sub-key Fonts in Fonts is found in final location; After finding the coordinate position of sub-key, analog mouse operation, clicks the coordinate position navigating to, and the key assignments item information that this sub-key is corresponding is presented in the list structure of Regedit interface right part;
Finally, obtain the interface handle of the root key assignments item of Regedit interface right part, and according to the interface handle of described key assignments item, travel through described list structure, finally locate the coordinate position of key assignments item to be found; On the coordinate position of found key assignments item, analog mouse right button operation, popup menu item, and from described menu item, select the operation of modifying of " modification " menu item.
The device that describes the Registry proposing according to the present invention below in detail obtains the specific implementation process of launching key coordinate and obtaining key assignments item coordinate in REGEDIT.
Obtain that in REGEDIT, to launch the specific implementation process of key coordinate as follows:
First, operational module is searched the window of type SysTreeView32 by system api interface FindWindow, obtains the window handle hwnd at key in REGEDIT (interface, the REGEDIT left side); Calling system api interface SendMessage sends message number TVM_GETNEXTITEM to described key window handle hwnd, and its parameter is " TVGN_ROOT ", to obtain the information hitem of root key HKEY_CLASSES_ROOT in REGEDIT; Calling system api interface WriteProcessMemory applies for an internal memory rectAddr, and its structure form is TVITEM;
Secondly, operational module calling system api interface SendMessage sends message number TVM_GETNEXTITEM to described key window handle hwnd, parameter is " 1 ", obtain first key information item under described key HKEY_CLASSES_ROOT, and be saved in memory block rectAddr, the information hitem that is simultaneously root key HKEY_CLASSES_ROOT its father node is also saved in memory block rectAddr; Calling system api interface ReadProcessMemory reads described first key information item from memory block rectAddr, and this key information comprises text and rect, represents respectively Word message and position coordinates;
Afterwards, operational module calling system api interface GetWindowRect sends out message to described key window handle hwnd, to obtain the position coordinates rect of this key window handle hwnd; According to the position coordinates rect comprising in position coordinates rect corresponding to described key window handle hwnd and described first key information item, calculate this first key at the relative coordinate pos of described key window;
Finally, operational module uses the same method, and the sub-key childHitem of first key of circulation searching item obtains Word message and the coordinate position of sub-key childHitem, whether identically with given key name mates its Word message;
If identical, calling system api interface SendMessage sends out message TVM_EXPAND to described key window handle hwnd, parameter is TVE_EXPAND, this first key is launched, and be presented at middle position, interface, calling system api interface SendMessage sends out message TVM_SELECTITEM to described key window handle hwnd, and parameter is TVGN_CARET, to choose described first key;
If not identical, search successively the next key nextitem adjacent with described first key, and make to use the same method, the sub-key of the next key nextitem of circulation searching, until find given key, and obtain the coordinate of this given key.
The specific implementation process of obtaining key assignments item coordinate in REGEDIT is as follows:
First, operational module is searched the window of type SysListView32 by system api interface FindWindow, obtains the window handle hwnd at key assignments item (interface, REGEDIT the right); And calling system api interface SendMessage is to the message number of described key assignments item window handle hwnd transmission LVM_GETITEMCOUNT, obtains the key assignments item quantity count that described key assignments item window handle hwnd is corresponding, i.e. key assignments item line number;
Secondly, operational module travels through the information item of the every line unit value item correspondence in described key assignments item window, and line number is index, and calling system api interface WriteProcessMemory applies for an internal memory rectAddr, and its structure form is LVITEM; Calling system api interface SendMessage sends the message number of LVM_GETITEMTEXT to described key assignments item window handle hwnd, parameter is current traveled through key assignments item line number index, obtain the key assignments item information item of current traversal, and be saved in memory block rectAddr;
Finally, operational module calling system api interface ReadProcessMemory reads the key assignments item information item of current traversal from memory block rectAddr, the coordinate that this key assignments item information item comprises Word message and this key assignments item correspondence, whether the Word message that this key assignments item information of overmatching item comprises is identical with given key assignments key name;
If not identical, continue traversal and search next line;
If identical, calling system api interface GetWindowRect sends out message to described key assignments item window handle hwnd, obtain the coordinate of described key assignments item window, the relative coordinate of the key assignments item that calculates this current traversal according to the coordinate of the key assignments item of the coordinate of described key assignments item window and current traversal in key assignments item window, as the coordinate of the key assignments item that will obtain.
The specific implementation process of revising key assignments item under Windows operating system in REGEDIT is as follows:
First, utilize the definite key assignments item coordinate pos having introduced in method above, operational module transmits MOUSEEVENTF_RIGHTDOWN & MOUSEEVENTF_RIGHTUP parameter simulation right mouse button by system api interface mouse_event and operates;
Secondly, operational module calling system api interface FindWindow & EnumChildWindows searches the handle hedit of the input frame of window ClassName=" editing character string ", calling system api interface SendMessage sends the message number of WM_SETTEXT to this input frame handle hedit, the content of parameter for revising;
Finally, operational module calling system api interface FindWindow & EnumChildWindows searches the button handle hbtn that window WindowsName=" determines ", calling system api interface PostMessage sends BN_CLICKED message to this button handle hbtn, to complete the retouching operation of key assignments item.
Specific implementation process described above is all that to start the window handle that module and acquisition module started REGEDIT and obtained REGEDIT be prerequisite, and above only the introduction of exemplary type a part of operating process of registration table, those skilled in the art should draw by the flow process of introducing other operating processes of registration table above beyond all doubtly.
Because described device embodiment is substantially corresponding to the embodiment of the method shown in earlier figures 1, therefore not detailed part in the description of the present embodiment can, referring to the related description in previous embodiment, just not repeat at this.
The device of c11, Registry as claimed in claim 8, is characterized in that, described operational module comprises:
Coordinate obtaining module, it launches key coordinate and/or launches key assignments item coordinate for obtaining, and analog mouse operates.
The device of c12, Registry as claimed in claim 11, is characterized in that, described coordinate obtaining module is obtained as follows and launched key coordinate:
Obtain the interface handle of root key in REGEDIT;
According to the interface handle of root key, call interface function and successively search from tree root, obtain the coordinate that launches key.
The device of c13, the Registry as described in claim 11 or 13, is characterized in that, coordinate obtaining module is obtained as follows and launched key assignments item coordinate:
Analog mouse operation, carries out clicking operation at the coordinate position of the expansion key getting;
The interface handle at an interface, place finds key value;
According to the interface handle at described key assignments item place, from this interface list, travel through and search, and obtain the coordinate of described key assignments item.
The device of c14, Registry as claimed in claim 10, is characterized in that, described precalculated position comprises launches the coordinate of key assignments item and/or the menu bar of REGEDIT.
The such scheme that the present invention proposes can be used in numerous general or special purpose computingasystem environment or configuration.For example: personal computer, server computer, handheld device or portable set, plate equipment, multicomputer system, the system based on microprocessor, Set Top Box, programmable consumer-elcetronics devices, network PC, small-size computer, mainframe computer, comprise distributed computing environment of above any system or equipment etc.
The present invention can describe in the general context of the computer executable instructions of being carried out by computing machine, for example program module.Usually, program module comprises the routine carrying out particular task or realize particular abstract data type, program, object, assembly, data structure etc.Also can in distributed computing environment, put into practice the application, in these distributed computing environment, by the teleprocessing equipment being connected by communication network, be executed the task.In distributed computing environment, program module can be arranged in the local and remote computer-readable storage medium that comprises memory device.
Finally, also it should be noted that, in this article, relational terms such as the first and second grades is only used for an entity or operation to separate with another entity or operational zone, and not necessarily requires or imply and between these entities or operation, have the relation of any this reality or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thereby the process, method, article or the equipment that make to comprise a series of key elements not only comprise those key elements, but also comprise other key elements of clearly not listing, or be also included as the intrinsic key element of this process, method, article or equipment.The in the situation that of more restrictions not, the key element being limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment that comprises described key element and also have other identical element.
Above-described specific embodiment; object of the present invention, technical scheme and beneficial effect are further described; institute is understood that; the foregoing is only specific embodiments of the invention; be not limited to the present invention; within the spirit and principles in the present invention all, any modification of making, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.