CN1940865A - Applied-programm interface controlling method and its controlling functional module - Google Patents

Applied-programm interface controlling method and its controlling functional module Download PDF

Info

Publication number
CN1940865A
CN1940865A CN 200510108123 CN200510108123A CN1940865A CN 1940865 A CN1940865 A CN 1940865A CN 200510108123 CN200510108123 CN 200510108123 CN 200510108123 A CN200510108123 A CN 200510108123A CN 1940865 A CN1940865 A CN 1940865A
Authority
CN
China
Prior art keywords
api interface
interface
application example
external program
api
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN 200510108123
Other languages
Chinese (zh)
Other versions
CN100498697C (en
Inventor
林友尧
陈启祥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CNB2005101081238A priority Critical patent/CN100498697C/en
Publication of CN1940865A publication Critical patent/CN1940865A/en
Application granted granted Critical
Publication of CN100498697C publication Critical patent/CN100498697C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

A controlling method of application programming interface includes leading in API interface management program and setting up API interface listing to maintain API interface of application instance, enabling to obtain API interface of operation instance by external program only requiring external program to call API interface management program in standard COM mode.

Description

A kind of applied-programm interface controlling method and control function module
Technical field
The present invention relates to the Windows application technology, the control function module of particularly a kind of applied-programm interface controlling method and this method of application.
Background technology
In the Windows program, swap data between each process carries out data communication, is called Inter-Process Communication.IDispatch (Dispatch interface) is that the application program of Windows provides its attribute and method to use a kind of mode of its function to external program, a most important function is IDispatch ∷ Invoke in this interface mechanism, by this function and call parameters DISPID (digital number) thereof, can have access to the different attribute and the method for application program, thus communication between implementation process.
API (Application Programming Interface, application programming interface) be that a program offers a kind of mode that external program is visited its attribute and method, by visiting this socket, can realize the Inter-Process Communication between a plurality of programs, thereby reach the purpose of swap data.
The design of application programming interface can have multiple, modal windows application programming interface is outer COM (the Component Obiect Model of process, The Component Object Model) interface, the outer com interface of process is that application program offers the com interface that external application uses, and external program uses these interfaces must follow windows COM management regulation.The Dispatch interface is the outer com interface of wherein a kind of process.The application programming interface of mentioning herein all is to refer in particular to the outer com interface of this process.
Single example refers to that application program can only move an example simultaneously, must could start another time operation withdrawing from current operation.Many examples refer to that application program can start operation repeatedly simultaneously, and the corresponding process independently of each example all is the program of many examples as WORD, IE.Most of softwares all can only move a example in operating system, the program of this single example can realize the outer com interface of the common process of a cover, and guarantee normally carrying out of Inter-Process Communication by the COM system of windows.
Windows COM system all is mapped to an IID one by one with each com interface, and external program can be inquired about corresponding com interface by assigned I ID.Therefore, the program of many examples can not be simply be mapped to a fixing IID with the application programming interface of its a plurality of examples, and external program can not have access to the application programming interface of a plurality of examples by specifying an IID.
The application program of many examples, if each example all needs externally to provide application programming interface, so, each interface need use different IID.Here there are two problems:
1, the application program support dynamically binds to different IID with its interface, and is registered in the COM system;
2, external program need inquire the IID that each example interface of application program uses.
As shown in Figure 1, in order to solve above-mentioned middle problem 1, application program need arrive first among a series of IID that registration is good from installation process in registration table or the configuration file when starting operation and inquire a untapped IID, and uses its establishment application programming interface; Perhaps, generate a new GUID (GloballyUnique Identifier) temporarily, create application programming interface and note, so that external program can be inquired about as interface IID.GUID is the global unique identification symbol, is made up of the alpha-numeric string of 16 byte lengths, and 32 alpha-numeric strings that representation normally couples together with horizontal line are as 7111BD1A-7F0B-4CEE-B411-260DADFEFA2A; IID (Interface Identifier) interface identifier, the interface identifier of using GUID to represent.In addition, in order to safeguard the operating position of IID, when the example end of run, need in registration table or configuration file, nullify the service recorder of corresponding IID.
As shown in Figure 2, during the DLL (dynamic link library) of external program access application, need visit registration table or configuration file earlier, obtain interface IID, again according to normal COM using method calling interface.
Use above scheme, following shortcoming arranged:
Each example all needs inquiry and registration table or configuration file when starting, built after the com interface, the IID that self uses need have been recorded registration table or configuration file, and when end of run, the service recorder that needs cancellation self IID, the synchronous processing of system data are comparatively complicated; During same external application access application DLL (dynamic link library), need the IID of visit registration table or configuration file inquiry DLL (dynamic link library); If the example of application program is unexpected when stopping, the service recorder of self IID can not be canceled, and makes mistakes when causing the external program visit.
The application programming interface of each example correspondence need be provided external program for the program that allows many parts of examples of operation, Windows does not provide corresponding mechanism or method, therefore, use traditional method and thinking to realize that this function can be very complicated, loaded down with trivial details, and external program want the difficulty of communication between implementation process also very big.
Summary of the invention
The invention provides a kind of applied-programm interface controlling method and control function module, have control method complexity, loaded down with trivial details now to solve, and external program is wanted the bigger problem of the difficulty of communication between implementation process.
A kind of applied-programm interface controlling method comprises the steps:
S1, the api interface registration request when catching application example startup operation, described api interface is used for external program and visits this application example; And
S2, for this application example produces corresponding interface identifier (IID) or obtains the existing IID of this application example and create api interface, with this api interface to should the IID registration and preservation.
Described method also comprises the steps: S3, the api interface de-registration request when catching application example end operation, and the corresponding api interface of deletion.
Described method also comprises: described api interface and corresponding IID registration and preservation safeguard in the tabulation that at api interface this api interface is safeguarded the also corresponding binding information of preserving application example in the tabulation.
Described method also comprises: catch the request of external program inquiry application example api interface, comprise the binding information of application example in this request; And safeguard that from described api interface the corresponding application example api interface of inquiry sends to external program the tabulation according to the binding information of described application example.
Described method also comprises: after inquiring corresponding application example api interface, whether the process of verifying this api interface correspondence exists and/or moves, if all be to be then described api interface is sent to external program, otherwise, wrong indication returned to external program.
A kind of application example api interface control function module comprises:
The api interface information memory cell is used to store the api interface of registering application example;
The information capture unit is used to catch the api interface registration/de-registration request of application example and the request of external program inquiry application example api interface;
Control module is handled the request of accepting described information capture unit and is safeguarded canned data in the described api interface information memory cell;
Information transmitting unit is used for sending the api interface or the miscue information of being inquired about to external program.
Described control module comprises:
Api interface registration process subelement is used to handle the api interface registration request of application example and deposits the api interface of creating in described api interface information memory cell;
Api interface is nullified and is handled subelement, is used to handle the api interface de-registration request of application example, and the api interface of described api interface information memory cell deletion cancellation;
Api interface inquiry subelement is used to handle the request of external program inquiry application example api interface, and sends to the afterbody program by information transmitting unit after inquiring about corresponding api interface in the described api interface information memory cell.
Api interface state-detection subelement, whether the process that is used to detect the api interface correspondence exists and/or moves, be then indicate described api interface inquiry subelement that described api interface is sent to external program if all be, otherwise, indicate described api interface inquiry subelement to return wrong indication to external program.
Beneficial effect of the present invention is as follows:
The present invention introduces the api interface supervisory routine by setting up the api interface of api interface tabulation maintenance application example, and the external interface of Application Instance elder generation's supervisor call when starting obtains the IID that can bind in supervisory routine, and carries out registration work.When example withdrawed from, supervisor call carried out cancellation work, and whole process no longer needs with registration table or configuration file synchrodata, had reduced the complexity that system synchronization is handled; External program only need be visited the api interface that the api interface supervisory routine can obtain running example according to standard C OM mode, compared to existing technology, only needs a job step just can finish, and realizes simpler; Simultaneously, when running example was made mistakes, the maintenance work of api interface supervisory routine can start running example or return error message to external program, thereby improve the reliability of system, has also reduced the realization cost of external program visit.
Description of drawings
Fig. 1 is in the prior art, and application program creates and nullify the flow process of example com interface by visit registration table or configuration file;
Fig. 2 is in the prior art, the process flow diagram of external program access application DLL (dynamic link library);
Fig. 3 is the method synoptic diagram that utilizes api interface supervisory routine control api interface of the present invention;
Fig. 4 is the flow process that the example com interface was created and nullified to application program of the present invention by visit api interface supervisory routine;
Fig. 5 is the process flow diagram of external program access application DLL (dynamic link library) of the present invention;
Fig. 6 is the synoptic diagram of api interface supervisory routine maintenance interface corresponding tables of the present invention;
Fig. 7 is the structural representation of api interface control function module of the present invention.
Embodiment
In the existing implementation, external program can only be by oneself searching the DLL (dynamic link library) IID that system registry or software configuration file obtain many examples program, so just increased the complicacy of programming, the stationary problem that also has simultaneously recorded information such as IID, stop if running example is unexpected, certainly will cause the asynchronous of information, can cause the failure of external program access interface, also can not get any help information.
The present invention is directed to the problems referred to above, introduce the api interface supervisory routine by setting up the api interface of api interface tabulation maintenance application example, external program only need be visited the api interface that the api interface supervisory routine can obtain running example according to standard C OM mode, compared to existing technology, only need a job step just can finish, realize simpler.Simultaneously, when running example was made mistakes, the api interface supervisory routine can be done the work of maintenance, started running example or returned error message to external program, thereby improved the reliability of system, had also reduced the realization cost of external program visit.
As shown in Figure 3, the present invention solves problem in the classic method by introducing a DLL (dynamic link library) supervisory routine.The API supervisory routine is inner by safeguarding the interface management corresponding tables of an inside, manage the api interface and the corresponding relation thereof of each application example, and when accepting the interview, check for the validity of application example interface at every turn, make mistakes to guarantee that external program can not visited, table 1 is depicted as an example of interface management corresponding tables.
Table 1. interface corresponding tables:
Example binding information (essential) Application example title (optional) Example Program path (optional) Example program interface IID (essential) Example program interface pointer (optional)
abc@abc.com mailMngr C:dddMailMngr .exe {72E42628-989C-4 lec-8CFD-D37488 35BEE7} IMailMngrApi
…… …… …… …… ……
Wherein, distinguishing each application program by the Application Instance binding information in the corresponding tables, be similar to coded message, can be a numeric string number, as phone number, QQ number, also can be a character string such as name, email or the like.The example binding information has uniqueness, and example registers in the interface corresponding tables by this binding information, during the external program visit, carries the binding information of the example that will visit.
The api interface supervisory routine comprises has handled all with the relevant work of api interface, in the whole operation system, have only a example to belong to the outer com interface program of process of standard, can use normal COM access control method to carry out interactive communicate, the api interface supervisory routine is finished following function:
1, use windows COM system function to create the IID of application programming interface, system function itself guarantees that the IID that creates out is unique, does not produce conflict;
2, create the application programming interface of running example;
3, the life cycle of the application programming interface of control running example both can start the operation of example program interface, also can stop its operation;
4, management maintenance interface corresponding tables;
5, the interface IID or the interface pointer of running example externally are provided;
6, the fault processing flow process of the application programming interface of maintenance operation example;
The flow process of COM access control method is meant the COM access control method of windows acquiescence, automatically search the relevant information of registration table and kernel system and the outer communication of the process of carrying out by system COM storehouse, the interface interchange mode form of expression is similar to internal interface or intrinsic function.
As shown in Figure 4, the external interface of Application Instance elder generation's supervisor call when starting obtains the IID that can bind in supervisory routine, and carries out registration work.When example withdrawed from, supervisor call carried out cancellation work.Whole process no longer needs with registration table or configuration file synchrodata.
As shown in Figure 5, external program is obtained corresponding api interface application programs example and is conducted interviews by supervisor call.Whole process no longer needs with registration table or configuration file synchrodata.
During the external program query interface, the binding information of some examples need be provided, supervisory routine is by searching these information in the interface binding information of interface corresponding tables, determine the interface that external program will be visited, if there is not corresponding interface, whether also may start an example of operation and create its corresponding DLL (dynamic link library), finish the corresponding relation of binding information and interface simultaneously, specifying when the strategy of this constructive process can be called by external program needs.
As shown in Figure 6, the API supervisory routine is inner by safeguarding the interface corresponding tables of an inside, manage the api interface and the corresponding relation thereof of each application example, and when accepting the interview, check at every turn, make mistakes to guarantee that external program can not visited for the validity of application example interface.
Whether validity check is meant that supervisory routine has found after the corresponding interface, checks whether this interface is available, specifically can exist by the process of checking this interface place or be in active state and check affirmation.
Usually whether detecting process exists or the method that is in active state is by enumerating the process list of system, and whether inquiry exists the progress information that will check in tabulation.The also active situation that can come detecting process by the mutual send window message of the process at supervisory routine and DLL (dynamic link library) place.An independently query function can also be provided in the application programming interface of process, supervisory routine can be by calling this function and obtaining feedback information, come detecting process ruuning situation whether normal, perhaps, constantly adjust back the heartbeat callback events interface that supervisory routine provides by the process at DLL (dynamic link library) place, come the inquiry of maintenance process ruuning situation.Also having certain methods is by using modes such as shared drive, pipeline or file, safeguarding some synchronizing informations, thereby reach the purpose of inspection.Wherein, the first method in the said method is enumerated process list, and is fairly simple effective.
As shown in Figure 7, for realizing the method for the invention, the present invention also provides the application example api interface control function module in a kind of application and the Windows system, comprising:
The api interface information memory cell is used to store the api interface of registering application example;
The information capture unit is used to catch the api interface registration/de-registration request of application example and the request of external program inquiry application example api interface;
Control module is handled the request of accepting described information capture unit and is safeguarded canned data in the described api interface information memory cell;
Information transmitting unit is used for sending the api interface or the miscue information of being inquired about to external program.
Wherein control module can comprise following subelement, is respectively applied for to carry out different functions:
Api interface registration process subelement is used to handle the api interface registration request of application example and deposits the api interface of creating in described api interface information memory cell;
Api interface is nullified and is handled subelement, is used to handle the api interface de-registration request of application example, and the api interface of described api interface information memory cell deletion cancellation;
Api interface inquiry subelement is used to handle the request of external program inquiry application example api interface, and sends to the afterbody program by information transmitting unit after inquiring about corresponding api interface in the described api interface information memory cell.
For realizing that control module also comprises to using the detection of example:
Api interface state-detection subelement, whether the process of api interface correspondence exists and/or moves, be then indicate described api interface inquiry subelement that described api interface is sent to external program if all be, otherwise, indicate described api interface inquiry subelement to return wrong indication to external program.
Technical solution of the present invention, by introducing the API supervisory routine, safeguarded the interface corresponding relation separately, computational complexity when having saved application example cost of development and operation thereof greatly, also make simultaneously external program visit each example API and become convenient simple, only need the relevant work of Processing Interface, do not need to relate to operations such as visit registration table, configuration file, and the validity by supervisory routine test case interface, can avoid the unexpected access errors that brought of stopping of running example.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.

Claims (8)

1, a kind of applied-programm interface controlling method is characterized in that, comprises the steps:
S1, application programming interface (API) the registration request when catching application example startup operation, described api interface is used for external program and visits this application example;
S2, for this application example produces corresponding interface identifier (IID) or obtains the existing IID of this application example and create api interface, with this api interface to should the IID registration and preservation.
2, the method for claim 1 is characterized in that, described method also comprises the steps:
S3, the api interface de-registration request when catching application example end operation, and the corresponding api interface of deletion.
3, method as claimed in claim 2 is characterized in that, described method also comprises: described api interface and corresponding IID registration and preservation safeguard in the tabulation that at api interface this api interface is safeguarded the also corresponding binding information of preserving application example in the tabulation.
4, method as claimed in claim 3 is characterized in that, described method also comprises:
Catch the request of external program inquiry application example api interface, comprise the binding information of application example in this request; And
Binding information according to described application example safeguards that from described api interface the corresponding application example api interface of inquiry sends to external program the tabulation.
5, method as claimed in claim 4, it is characterized in that, described method also comprises: after inquiring corresponding application example api interface, whether the process of verifying this api interface correspondence exists and/or moves, be then described api interface is sent to external program if all be, otherwise, return wrong indication to external program.
6, a kind of application example api interface control function module is characterized in that, comprising:
The api interface information memory cell is used to store the api interface of registering application example;
The information capture unit is used to catch the api interface registration/de-registration request of application example and the request of external program inquiry application example api interface;
Control module is handled the request of accepting described information capture unit and is safeguarded canned data in the described api interface information memory cell;
Information transmitting unit is used for sending the api interface or the miscue information of being inquired about to external program.
7, control module as claimed in claim 6 is characterized in that, described control module comprises:
Api interface registration process subelement is used to handle the api interface registration request of application example and deposits the api interface of creating in described api interface information memory cell;
Api interface is nullified and is handled subelement, is used to handle the api interface de-registration request of application example, and the api interface of described api interface information memory cell deletion cancellation;
Api interface inquiry subelement is used to handle the request of external program inquiry application example api interface, and sends to the afterbody program by information transmitting unit after inquiring about corresponding api interface in the described api interface information memory cell.
8, control module as claimed in claim 7 is characterized in that, described control module also comprises:
Api interface state-detection subelement, whether the process that is used to detect the api interface correspondence exists and/or moves, be then indicate described api interface inquiry subelement that described api interface is sent to external program if all be, otherwise, indicate described api interface inquiry subelement to return wrong indication to external program.
CNB2005101081238A 2005-09-29 2005-09-29 Applied-programm interface controlling method and its controlling functional module Active CN100498697C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2005101081238A CN100498697C (en) 2005-09-29 2005-09-29 Applied-programm interface controlling method and its controlling functional module

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2005101081238A CN100498697C (en) 2005-09-29 2005-09-29 Applied-programm interface controlling method and its controlling functional module

Publications (2)

Publication Number Publication Date
CN1940865A true CN1940865A (en) 2007-04-04
CN100498697C CN100498697C (en) 2009-06-10

Family

ID=37959077

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2005101081238A Active CN100498697C (en) 2005-09-29 2005-09-29 Applied-programm interface controlling method and its controlling functional module

Country Status (1)

Country Link
CN (1) CN100498697C (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102567023A (en) * 2010-12-28 2012-07-11 微软公司 Parameterized interface identifier techniques
CN101615116B (en) * 2008-06-23 2012-12-12 成都市华为赛门铁克科技有限公司 Method, device and system for acquiring interface
CN103036693A (en) * 2011-09-29 2013-04-10 中国移动通信集团江苏有限公司 Support system interface and interface fault-tolerant method
CN105229603A (en) * 2013-04-22 2016-01-06 微软技术许可有限责任公司 Access when controlling the operation to application programming interface
CN106648557A (en) * 2015-10-28 2017-05-10 华为技术有限公司 Application programming interface API sharing method and device
CN107656728A (en) * 2017-09-15 2018-02-02 网宿科技股份有限公司 The creation method and Cloud Server of a kind of Application Instance
CN108089972A (en) * 2016-11-22 2018-05-29 北京京东尚科信息技术有限公司 interface test method and device

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101615116B (en) * 2008-06-23 2012-12-12 成都市华为赛门铁克科技有限公司 Method, device and system for acquiring interface
CN102567023A (en) * 2010-12-28 2012-07-11 微软公司 Parameterized interface identifier techniques
CN102567023B (en) * 2010-12-28 2016-03-16 微软技术许可有限责任公司 Parameterized interface identifier techniques
CN103036693A (en) * 2011-09-29 2013-04-10 中国移动通信集团江苏有限公司 Support system interface and interface fault-tolerant method
CN103036693B (en) * 2011-09-29 2015-11-25 中国移动通信集团江苏有限公司 A kind of support system interface and interface fault-tolerance approach
CN105229603A (en) * 2013-04-22 2016-01-06 微软技术许可有限责任公司 Access when controlling the operation to application programming interface
CN105229603B (en) * 2013-04-22 2019-03-22 微软技术许可有限责任公司 It is accessed when controlling the operation to Application Programming Interface
US11003511B2 (en) 2013-04-22 2021-05-11 Microsoft Technology Licensing, Llc Controlling runtime access to application program interfaces
CN106648557A (en) * 2015-10-28 2017-05-10 华为技术有限公司 Application programming interface API sharing method and device
CN106648557B (en) * 2015-10-28 2020-04-03 华为技术有限公司 Sharing method and device of Application Programming Interface (API)
CN108089972A (en) * 2016-11-22 2018-05-29 北京京东尚科信息技术有限公司 interface test method and device
CN107656728A (en) * 2017-09-15 2018-02-02 网宿科技股份有限公司 The creation method and Cloud Server of a kind of Application Instance

Also Published As

Publication number Publication date
CN100498697C (en) 2009-06-10

Similar Documents

Publication Publication Date Title
US7769734B2 (en) Managing long-lived resource locks in a multi-system mail infrastructure
CN1940865A (en) Applied-programm interface controlling method and its controlling functional module
US7877091B2 (en) Method and system for executing a container managed application on a processing device
CN101169733B (en) Method and system for providing operation system service based on strategy
CN102591726A (en) Multiprocess communication method
CN102279765A (en) Pre-compiling hosted managed code
WO2012045238A1 (en) Startup method and device for application program on mobile device
CN1306430C (en) User self-defining event mechanism based on structure
CN100351785C (en) Method for debuging embedded system and equipment
CN1786915A (en) Management method for managing software module and information processor
CN1140500A (en) Distributed data base system
US20060026573A1 (en) Method and system for accepting precompiled information
CN104102502A (en) Processing method and device for realizing hot deployment and server
CN103077034B (en) hybrid virtualization platform JAVA application migration method and system
CN1863196A (en) Service agent method for multi-protocol domain analytical service
CN101951529A (en) Method and system for testing functions of set top box
CN100365583C (en) Package realizing method and system
CN101236503A (en) Hot-deployment entity component
US20100332582A1 (en) Method and System for Service Contract Discovery
CN1514353A (en) Method of realizing cross address space establishing construction member target based on dynamic core
CN116204239A (en) Service processing method, device and computer readable storage medium
US8442939B2 (en) File sharing method, computer system, and job scheduler
CN1949173A (en) Software assembling method and apparatus thereof
US7493616B2 (en) Mobile communication device application processing system
US10110670B2 (en) Allocation of service endpoints to servers

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant