CROSS-REFERENCE TO RELATED APPLICATION
This application is a reissue application of U.S. Pat. No. 6,834,048, which issued on Dec. 21, 2004, claiming benefit therefrom and which is further incorporated by reference. Notice: More than one reissue application has been filed for the reissue of U.S. Pat. No. 6,834,048. The reissue applications are U.S. application Ser. Nos. 11/644,013 (the present application), 12/367,349 (which is a continuation reissue patent application), and 12/367,235 (which is a divisional reissue patent application).
REFERENCE TO APPENDICES
Appendix A, which is an integral part of the present disclosure, includes a computer program listing of components of the Microsoft Visual C++ project used to create a dynamically linked library (DLL) named IEHooker.DLL for implementing the direct telephone dialing scheme according to one embodiment of the present invention.
Appendix B, which is an integral part of the present disclosure, shows modifications to the Microsoft Windows registry for implementing the direct telephone dialing scheme according to one embodiment of the present invention.
Appendices A and B contain copyrighted material. The copyright owner, Dialpad.com,, Inc. has no objection to the facsimile reproduction by anyone of the patent documents or patent disclosure, as it appears in the Patent and Trademark Office patent files or records, but otherwise reserves all copyrights whatsoever.
BACKGROUND OF THE INVENTION
1. Field of the Invention
The present invention generally relates to voice communications; and in particular, the present invention relates to a method for initiating internet telephone service from a web page.
2. Background of the Invention
Voice over internet protocol (VoIP) technology has spawned made available internet telephone services. An internet telephone service allows a caller to place a telephone call from his/her personal computer (PC) through the internet to another audio communication device, such as a wired or wireless telephone. VoIP technology is based on the ITU-T H.323, standard and supports audio, video, data, or fax communications using the internet protocol (IP) on the public internet and within private intranets.
Internet telephone service can take many forms. Typically, a caller accesses an internet telephone service provider's web site which provides an interface to the internet telephone service. The caller enters then the telephone number he wishes to dial. The telephone service “dials” the telephone number and “rings” the destination communication device (e.g. a telephone).
However, improvements over the existing internet telephone services are desired. In particular, it is desirable to provide features to make internet telephone services more convenient and accessible.
SUMMARY OF THE INVENTION
In accordance with an embodiment of the present invention, a method for initiating an internet telephone service from a web page containing at least one telephone number comprises: (a) accessing the web page using a browser; (b) downloading a web page document associated with the web page; (c) parsing the web page document for detecting a character string indicative of a telephone number; (d) modifying the character string in the web page document into a link to the internet telephone service: (e) providing the web page document including the modified character string to the browser; and (f) displaying the web page on the browser including the telephone number.
According to another embodiment of the present invention, the method further comprises: (g) selecting the character string indicative of the telephone number; (h) activating the link to the internet telephone service; (i) passing the telephone number to the internet telephone service; (j) launching a server side script at the internet telephone service for initiating a telephone call to the telephone number; and (k) establishing two-way communications between a caller selecting the character string and a destination audio device designated by the telephone number.
The present invention is better understood upon consideration of the detailed description below and the accompanying drawings.
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1A illustrates one embodiment of a communication system for providing audio communication between a personal computer and an audio communication device.
FIG. 1B illustrates another embodiment of a communication system for providing audio communication between a personal computer and an audio communication device where the personal computer is located behind a firewall.
FIG. 2 illustrates the conventional operation of a browser for downloading and displaying a web page document.
FIG. 3 illustrates the operation of a browser together with the direct telephone dialing scheme of the present invention.
FIG. 4 is a flow diagram illustrating the detailed operation of the direct telephone dialing scheme for internet telephony according to one embodiment of the present invention.
FIG. 5A illustrates an exemplary web page containing telephone numbers displayed by Microsoft Internet Explorer™.
FIG. 5B illustrates the web page of FIG. 5A displayed by Microsoft Internet Explorer™ after the operation of the direct telephone dialing scheme of the present invention.
In the present disclosure, like objects which appear in more than one figure are provided with like reference numerals.
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
In accordance with the present invention, a direct telephone dialing scheme for internet telephony is provided to allow a caller, using an internet telephone service, to place a telephone call to a telephone number appearing on any web page directly from that web page. In one embodiment, a caller navigates on the internet to a desired web page and then clicks on a telephone number appearing on the web page to initiate a telephone call using an internet telephone service. Contrary to a conventional telephone service initialization process, the caller may place a telephone call without the need to navigate to the internet telephone service provider's web site and enter or type in the desired telephone number on the service provider's web site. The direct telephone dialing scheme of the present invention greatly improves the accessibility and ease of use of internet telephone services and provides convenience not realized by conventional internet telephone services.
A direct telephone dialing scheme of the present invention can be used with an internet telephone service, such as those provided by Dialpad.com, Phonefree.com, and Net2phone. In one embodiment, the internet telephone service is based on the communication system described in co-pending and commonly assigned U.S. patent application Ser. No. 09/401,898, entitled “Scaleable Communications System,” of Wongyu Cho et al., filed Sep. 24, 1999, which is incorporated herein by reference in its entirety FIG. 1A illustrates one embodiment of the communication system of the aforementioned patent application by Cho et al. which provides audio communication between a personal computer 11 and an audio communication device 14. In operation, a local caller using computer 11, equipped with a sound card and headset, for example, uses a web browser to access and log onto web site 16 of an internet telephone service provider. After logging-on, the local caller provides the phone number of regular telephone 14 to web site 16, which then directs an Internet Telephone Service Provider (ITSP) gateway 12 to provide a voice communication between computer 11 and telephone 14. ITSP gateways are available from several network service providers including the IDT Corporation and Qwest Communications. ITSP gateway 12 is coupled to a remote caller who, in this example, uses telephone 14 linked to a public switched telephone network (PSTN) 13. PSTN provides either wired or wireless telephone service commonly known as “plain old telephone service” (POTS).
ITSP gateway 12 converts the voice data from computer into corresponding voice signals for transmission to telephone 14 through PSTN 13. Conversely, ITSP gateway converts voice signals received from telephone 14 into a form that is suitable for transmission over the internet to computer 11. The direct-dial internet telephone service initiation scheme of the present invention can also be used with a network in which computer 11 is located behind a firewall 15 as illustrated in FIG. 1B. A method for exchanging data with computers within a secure network is described in copending and commonly assigned U.S. patent application Ser. No. 09/627,723 “Data Exchange With Computers Within A Secure Network”, by Wongyu Cho and Hyungkeun Hong, incorporated herein by reference in its entirety.
To use an internet telephone service to place a telephone call, a caller uses a personal computer (such as PC 11 in FIG. 1A) to access the internet or a private network. The personal computer is equipped with a web browser such as Microsoft Internet Explorer™ or Netscape Navigator™ for accessing a web page with graphical content. To specify a web site, the caller enters a uniform resource locator (URL) specifying both the server and the specific data (“web page”) requested. The URL may specify a hypertext transfer protocol (HTTP) or another transfer protocol for communicating between the server and the browser. In conventional internet telephone service, the caller accesses the web site of an internet telephone service provider and enters the telephone number of the destination communication device on a “console” (e.g., a graphical caller interface) of the provider's web site. The internet telephone service provider then dials the telephone number. However, in many instances, the caller may navigate to a web page containing telephone numbers which the caller wishes to dial. For example, the caller may navigate to the web page of a local restaurant which includes the telephone number of the restaurant. To place a telephone call to the restaurant using internet telephony, such as to make a dinner reservation, the caller has to record the telephone number in some manner and go to the web site of his desired internet telephone service provider by specifying the provider's URL. The caller then enters the recorded telephone number into the console at the web site of the telephone service provider for dialing the telephone number. This telephone dialing process is very cumbersome, particularly when the caller is viewing a page containing several telephone numbers which he wishes to dial in sequence, such as when the caller is viewing a yellow page listing of restaurants in the local area.
The direct telephone dialing scheme of the present invention facilitates convenient internet telephone service by integrating internet telephone services with telephone numbers appearing on any web pages. A caller may dial a telephone number appearing on any web page directly from that web page. In one embodiment, the caller dials the telephone number by placing the cursor on the telephone number and selecting the telephone number (such as by clicking on the number). The caller does not have to leave the web page he is currently viewing and can thus conveniently dial one or more of the telephone numbers appearing on the web page.
According to one embodiment of the present invention, the direct telephone dialing scheme for internet telephony is embodied in a software program operating as a browser level application. The software program, called the Direct Dial software program, is installed in the caller's computer and works cooperatively with the browser application to provide the caller with a more convenient access to internet telephone services. The operation of the direct telephone dialing scheme with a browser application is explained with reference to the flowcharts in FIGS. 2 and 3.
Referring to FIG. 2, when a caller navigates to a new web page identified by a new URL, the browser performs three basic functions. First, the browser downloads the selected web page document (step 200). Typically, the web page document is written using HTML (hypertext markup language). Then, the browser interprets the web page document and prepares the host environment for the document (step 202). Finally, the browser renders the web page on the caller's computer display (step 204). When the direct telephone dialing scheme for internet telephony of the present invention is installed into the caller's computer, the browser operates according to the flowchart in FIG. 3. The direct telephone dialing scheme operates to intercept a web page document downloaded by the browser, and parses and modifies the web page as needed (step 310) before the web page is interpreted by the browser (step 202). Specifically, the direct telephone dialing scheme operates to parse the web page document, detect for text strings matching the criteria of telephone numbers, and modify the text string into a link to an internet telephone service provider so that the caller may activate the internet telephone service upon selecting or clicking on the modified text string. After the direct dial software program operates on the web page, the web page document with the modified text string is returned to the browser, interpreted (step 202), and then rendered on the computer display of the caller's computer (step 204).
FIG. 4 is a flow diagram illustrating the detailed operation of the direct telephone dialing scheme for internet telephony according to one embodiment of the present invention. First, a caller installs the Direct Dial software program that embodies the direct telephone dialing scheme of the present invention (step 402). For instance, the caller can copy the Direct Dial software program to his host computer and install the software program on the computer as is conventionally done. In one implementation, the Direct Dial software program is provided in a dynamically linked library (DLL) file and after the caller copies the DLL file to his host computer, the caller installs the DLL file by registering the file with the Microsoft Windows™ operating system using the “REGSVR32.exe” file. When the Direct Dial software program is installed onto the caller's computer, the program is loaded whenever the browser application is activated.
After the caller installs the Direct Dial software program, the caller can then invoke the browser application and access the internet, selecting web sites she wishes to view. To access a particular web page, the caller specifies the URL of the desired web page and the browser downloads the web page document associated with the URL (step 404). Before the web page is interpreted by the browser for display on the computer screen, the direct telephone dialing program of the present invention intercepts the web page (step 406). The direct telephone dialing scheme of the present invention operates to parse the web page document and detect text strings which constitute telephone numbers appearing in the document (step 408). In one embodiment, the direct telephone dialing scheme examines the character strings in the document and identifies character strings having the following formats as constituting telephone numbers:
-
- (###)###-####,
- (###) ###-####,
- ###.###.####,
- ###/###/####,
- ###/###-####,
- ###-###-####,
- (###-###-####),
- #-###-###-####,
- +# (###) ###-####,
- +# (###)###-####,
- +# ### ### ####,
- +#-### ### ####,
- +#-### ###-###,
- +#-###-###-####,
- ### ### ####,
- ### ###.####,
- ### ###-####, and
- ##########,
where # represents an alphanumeric character from 0 to 9 and from A to Z. Note that the direct telephone dialing scheme recognizes a character string with the format “##########” as a telephone number only when the first three characters are numeric characters from 0 to 9. In the present embodiment, the direct telephone dialing scheme recognizes any 10-digit alphanumeric string or any 11-digit alphanumeric string as telephone numbers. Furthermore, the alphanumeric strings may use any form of character separations including but not limited to: “.”, “/”, “-”, “+”, “(”, and “)”. Thus, the formats given above can be used to recognize United States telephone numbers in any format. The use of alphanumeric characters in the present embodiment allows the recognition of telephone numbers which are spelled in alphabetical characters, such as 1-800-ASK-USPS used by the United States Postal Service. In the present embodiment, the recognized telephone numbers always include the area code, even for local calling. However, the 1 prefix is optional. The advantage of only recognizing telephone numbers including the area code is to ensure that the telephone call is placed to the correct recipient. Since the internet allows the caller to access web pages without geographic limits, a caller often accesses web pages outside of his local telephone dialing areas. By recognizing only telephone numbers including the area code, the direct telephone dialing scheme of the present invention ensures that any telephone call placed will be to the correct recipient. Of course, the area code requirement is optional and the direct telephone dialing scheme can be made to work with telephone numbers not including area codes.
Of course, the direct telephone dialing scheme of the present invention can also operate with international telephone numbers for dialing a telephone number outside of the country the caller is in. Additional telephone number templates can be added to the direct telephone dialing scheme for recognizing international telephone numbers. For example, a typical Korean telephone number has the format: 82-2-2000-1000. If it is important to recognize Korean telephone numbers, a telephone number template such as: ##-#-####-#### can be used. Furthermore, the direct telephone dialing scheme of the present invention can also append the necessary international dialing access code to the international telephone number to facilitate international calling using an internet telephone service. Thus, if the caller is in the United States, the direct telephone dialing scheme can append the code “011” to the beginning of an international telephone number so that an internet telephone service can place the telephone call directly to the oversea recipient.
After the direct telephone dialing scheme identifies certain character strings in the web page document as telephone numbers, the telephone dialing scheme proceeds to modify the identified character strings (step 410). Specifically, the character strings are modified to include a link to an internet telephone service provider. In one embodiment, the appearance of character strings is also modified. For example, the character strings can be underlined, highlighted, or bolded. By modifying the appearance of the character strings, the direct telephone dialing scheme of the present invention identifies to the caller the character strings on the web page which have been designated as telephone numbers and are thus available for direct telephone service initiation. After the direct telephone dialing scheme operates on the web page document, the document is returned to the browser (step 412). The browser interprets the modified web page, and displays the modified web page on the caller's computer screen (step 414). FIG. 5A illustrates an exemplary web page without being modified by the direct telephone dialing scheme of the present invention. In FIG. 5A, a telephone listing of pregnancy centers provided by YellowBook.com™ is shown. FIG. 5B illustrates the same web page after the operation of the direct telephone dialing scheme of the present invention. The character strings in the web page that have been underlined have been designated as telephone numbers and can be used to activate internet telephone service.
To place a telephone call to a telephone number designated by the direct telephone dialing scheme, the caller selects the designated telephone numbers by clicking on the underlined or hi-lighted text (step 416). Because the designated telephone number is a link to an internet telephone service provider, selection of the telephone number launches the internet telephone service (step 418). The internet telephone service proceeds in accordance with the communication protocol of the service provider. In one instance, the service provider requires the caller to login to the service provider's network. Thus, the service provider determines whether or not the caller has already logged into the network (step 419). If the caller has not logged in, then the service provider prompts the call for login information (step 420). After the caller logs into the provider's network, the internet telephone service provider places the telephone call to the designated telephone number (step 422). As mentioned above, any number of internet telephony technology can be used to place the telephone call and accomplish voice communication between the caller and the designated audio communication device. The services provided by Dialpad.com are one exemplary internet telephone service.
According to another embodiment of the present invention, the telephone number detection step 408 of the direct telephone dialing scheme further detects whether the character string identified as a telephone number is itself a hypertext link. If the character string is itself a hypertext link, then the direct telephone dialing scheme will not designate the character string as a telephone number and modification step 410 will not modify the character string into a link to an internet telephone service provider. In this manner, the direct telephone dialing scheme avoids writing over existing links in the web page and preserves the integrity of the web page document. In one embodiment, when the web page is written in HTML format, the direct telephone dialing scheme determines if a character string is a hypertext link by detecting for the anchor element A or a preceding the character string which is used to denote the character string as a hypertext link.
According to yet another embodiment of the present invention, the direct telephone dialing scheme provides a caller interface to allow the caller to enable or disable the direct telephone dialing function. When disabled, the browser operates according to the flow chart illustrated in FIG. 2.
An implementation of the direct telephone dialing scheme of the present invention is now described using Microsoft Internet Explorer™ as an example. Of course, persons of ordinary skill in the art can adapt the present teachings to work with other types of web browsers. Appendix A includes a computer program listing of components of the Microsoft Visual C++IL: project used to create a dynamically linked library (DLL) named IEHooker.DLL which implements the direct telephone dialing scheme according to one embodiment of the present invention. The files contained in the computer program listing detail the customization for implementing the direct telephone dialing scheme in Internet Explorer. When a caller installs IEHooker.DLL onto its computer, the objects in the DLL becomes registered with the Windows Registry and will be available for use by Internet Explorer. In the present implementation, the direct telephone dialing scheme is applied to the internet telephone service provided by Dialpad.com and the direct telephone dialing scheme is called “Dialpad Everywhere.” Appendices A and B are not necessary to the understanding of the invention, but are provided merely as additional examples.
In the present embodiment, the direct telephone dialing scheme is implemented as a Browser Helper Object (BHO) of Internet Explorer. Browser Helper Objects are in-process Component Object Model (COM) components and can be applied to allow one to customize Internet Explorer to create a specialized version of the browser. For a detailed description of Browser Helper Objects, see Browser Helper Objects: The Browser the Way You Want it by Dino Esposito, January 1999, available at the following web site: http://msdn.microsoft.com/library/techart/bho.htm. The article is incorporated herein by reference in its entirety. In brief, BHOs are component objects which Internet Explorer loads each time the application is started. A BHO can be used to detect the browser's typical events or install hooks to monitor messages and actions in Internet Explorer.
A BHO, as a COM in-process server, is registered under a certain registry's key so that Internet Explorer can look up and load the browser help object during startup. The CIE-Hooker.rgs file in Appendix A is a registration script file used to create registry entries for implementing the direct telephone dialing scheme upon installation of the CIEHooker.DLL file. The following Microsoft Windows registry folders are created in one example:
-
- HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Explorer/‘Browser Helper Objects’/{1 6 1 2 2 F 0 2 - 9 7 1 3 - 1 1 D 3 - 9 7 4 4 -005004116944}
- HKEY_CLASSES_ROOT/IEHooker.CIEHooker.1
- HKEY_CLASSES_ROOT/IEHooker.CIEHooker.1/CLSID
- HKEY_CLASSES_ROOT/IEHooker.CIEHooker
- HKEY_CLASSES_ROOT/IEHooker.CIEHooker/CLSID
- HKEY_CLASSES_ROOT/IEHooker.CIEHooker/CurVer
Example modifications to the Windows registry for implementing the direct telephone dialing scheme of the present invention in Internet Explorer is also shown in Appendix B. In the present embodiment, a registry is also created to query the caller to set and determine the operation status of the direct telephone dialing feature. In operation, the registry provides a caller interface where the caller may enable or disable the direct telephone dialing feature.
The file CIEHooker.cpp in Appendix A is a source a file containing the overrides needed to hook the direct telephone dialing feature into Internet Explorer as a browser helper object. The direct telephone dialing BHO executes custom codes when certain events from the browser take place. Here, the custom codes are executed during the events DISPID _DOCUMENTCOMPLETE and DISPID_ONQUIT. CIEHooker.h is a header file for CIEHooker.cpp.
In the present embodiment, the custom codes for the direct telephone dialing feature are CheckNum.h (the header file) and CheckNum.cpp which is a source file containing a program segment for parsing the text in the document for telephone numbers and modifying the telephone numbers into links to an internet telephone service provider. In the present implementation, the links are hyperlinks as will be described in more detail below.
In operation, when Internet Explorer completes downloading of a web page document, typically written in RTML (step 404 in FIG. 4), the program segment embodiment in the CheckNum.cpp code is executed to detect and modify text strings which constitute as telephone numbers ( steps 408 and 410 of FIG. 4). In CheckNum.cpp, the telephone number formats described above are used to detect the presence of telephone numbers in the character strings of the web page document. After a telephone number is detected, the program of CheckNum.cpp inserts three link strings to the telephone number to convert the telephone number to a hyerplink. For example, the original character string in the web page document may appear as follows (note that the telephone number string is denoted by the argument phonenumber):
<Foot>phonenumber</Font>
In the present implementation the direct telephone dialing scheme inserts three link strings into the character string above as follows:
-
- [Link String1]phonenumber[Link String2]phonenumber [Link String3].
The three link strings are defined as follows:
- Link String]
- <FONT CLASS=‘PHONE’ STYLE=‘CURSOR=HAND;’
- COLOR=‘#0000FF’
- OnMouseOut=window.event.srcElement.style.color=‘#0000FF’
- OnMouseOver=window.event.srcElement.style.color=‘#FF0000’
- OnClick=window.open(‘http://www.dialpad.com/cgi-bin/launch.pl?Number=
- Link String2
- ‘,’Dialpad‘,’scrollbars=no,resizable=no,width=420, height=370)><U>
- Link String3
- </U></Font>
In the present example, Link String1 contains commands for controlling the rendering and style of the mouse on the caller's host computer, such as the “OnMouseOut” and “OnMouseOver” commands. These commands are of course optional. The “OnClick command” in Link String1 modifies the character string into a link for launching a server side script of an internet telephone service provider. Here, the internet telephone service provider is Dialpad.com. When the OnClick command is executed, the phonenumber parameter appended to the end of Link String1 is passed with the link to the server side script of the internet telephone service provider (i.e., Dialpad.com). The server side script is linked to an applet for activating the internet telephone service at the provider's server. When the applet is launched, the service provider dials the telephone number received via the phonenumber parameter. Here, the server side script launches the Dialpad applet for initiating voice communication over the internet using the network described in aforementioned patent application Ser. No. 09/401,898, entitled Scaleable Communications System, of Wongyu Cho et al.
When the OnClick command is executed, the service provider may provide a window on the computer display identifying the telephone service provider and the status of the telephone call. Link String2 contains standard window sizing parameters and properties for defining the display widow of the telephone service provider. In the present example, Link String2 is used for the Dialpad.com telephone service. Link String2 or similar command strings may be optional for other telephone service providers. At the end of Link String2, the phonenumber parameter is again inserted for providing to the computer display the character string which has been identified as a telephone number. In the present implementation, the character string is being underlined by the action of Link String3. Of course, other formatting functions can be used. After the execution of the program CheckNum.cpp, the web page is returned to Internet Explorer for display.
In the present embodiment, CheckNum.cpp includes a routine for excluding modification of character strings which are already a hypertext link. In HTML, an anchor element, A or a, is used to denote a text string as a hypertext link. CheckNum.cpp checks for the presence of the anchor element A and if a character string is preceded by <A> or <a, the string is skipped to avoid modifying any existing hypertext link in the web page document.
The direct telephone dialing scheme can also be implemented in Netscape navigator. The Direct Dial software program can be written as a Java script. Then, the Java script is installed and activated using Script Signing. A description of Script Signing can be found at the web site: http://msdn.microsoft.com/library/partbook/instantj/scriptbasedsecurity.htm.
The direct telephone dialing scheme for internet telephony has many advantages. First, a caller can dial telephone numbers from any web pages and do not need to switch to an internet service provider's web site to access the internet telephone service. This is particularly useful when the caller is using internet yellow pages to generate a list of telephone numbers to call. Second, the caller can dial any of the telephone numbers identified by the scheme without the need to record the telephone number and type in the number onto a console of the service provider. Third, the caller does not have to leave the web site from which he makes the call and thus can inquire about information on the web site while communicating with the destination telephone number.
The above detailed descriptions are provided to illustrate specific embodiments of the present invention and are not intended to be limiting. Numerous modifications and variations within the scope of the present invention are possible. The present invention is defined by the appended claims.
APPENDIX A |
|
Filename: IEHooker.idl |
// IEHooker.idl : IDL sources for IEHooker.dil |
// |
// This file will be processed by the MIDL tool to |
// produce the type library (IEHooker.tlb) and marshalling code. |
import “oaidl.idl”; |
import “ocidl.idl”; |
|
object, |
|
uuid(16122F01-9713-11D3-9744-005004116944), |
|
dual, |
|
helpstring(“ICIEHooker Interface”), |
|
pointer_default(unique) |
|
] |
|
interface ICIEHooker : IDispatch |
|
{ |
|
}; |
|
uuid(16122EF1-9713-11D3-9744-005004116944), |
|
version(1.0), |
|
helpstring(“IEHooker 1.0 Type Library”) |
|
importlib(“stdole32.tlb”); |
|
importlib(“stdole2.tlb”); |
|
[ |
|
uuid(16122F03-9713-11D3-9744-005004116944), |
|
helpstring(“_ICIEHookerEvents Interface”), |
|
dispinterface _ICIEHookerEvents |
|
{ |
|
properties: |
|
methods: |
|
[id(1), helpstring(“method MakeCall”)] HRESULT MakeCall(BSTR bstr); |
|
uuid(16122F02-9713-11D3-9744-005004116944), |
|
helpstring(“CIEHooker Class”) |
|
[default] interface ICIEHooker; |
|
[default] dispinterface _ICIEHookerEvents; |
}; |
Filename: checkNum.h |
#ifndef CHECK_NUM_H |
#define CHECK_NUM_H |
#include “mshtml.h” |
#define DO_IDLE |
0 |
#define DO_START |
1 |
#define DO_CONTINUE |
2 |
#define DO_SUCCESSEND |
3 |
#define DO_FAILEND |
4 |
typedef struct DATA_tag |
{ |
|
char* input_buf; |
|
int input_size; |
|
char* output_buf; |
|
int output_size; |
|
int iCheckStatus; |
|
BOOL bUserStop; |
|
struct DATA_tag* pNext; |
|
IHTMLDocument2* pDocument; |
}STRUCT_PROCESS; |
void checkPhoneNumThread(void *pVoid); |
void checkPhoneNumProc(STRUCT_PROCESS *pData); |
BOOL checkPhoneNum(STRUCT_PROCESS *pData); |
#endif |
Filename: checkNum.cpp |
#include “stdafx.h” |
#include “checkNum.h” |
#define MIN_PHONENUM_COUNT 10 |
static char* szNumMapTable[ ] = { |
|
“(###)###-####”, |
|
“(###) ###-####”, |
|
“###.###.####”, |
|
“###/###/####”, |
|
“###/###-####”, |
|
“###-###-####”, |
|
“(###-###-####)”, |
|
“#-###-###-####”, |
|
“+# (###) ###-####”, |
|
“+# (###)###-####”, |
|
“+# ### ### ####”, |
|
“+#-### ### ####”, |
|
“+#-### ###-####”, |
|
“+#-###-###-####”, |
|
“### ### ####”, |
|
“### ###.####”, |
|
“### ###-####”, |
|
“##########” |
}; |
static const MAX_MAP_COUNT = sizeof( szNumMapTable )/sizeof( szNumMapTable[0]); |
static char szInsertString1[ ] = { |
|
“<Font CLASS=‘PHONE’ STYLE=‘CURSOR=HAND;’ COLOR=‘#66CC00’ |
OnMouseOut=window.event.srcElement.style.color=‘#66CC00’ |
OnMouseOver=window.event.srcElement.style.color=‘#FF0000’ |
OnClick=window.open(‘http://www.dialpad.com/dialpad/launch.php3?Number=“//cgi-bin/launch.pl?Number=” |
}; |
static char szInsertString2[ ] = { |
|
“‘,’Dialpad‘,’scrollbars=no,resizable=no,width=420,height=370’)><U>” |
}; |
static char szInsertString3[ ] = { |
}; |
static const int nInsertLen = strlen(szInsertString1) + strlen(szInsertString2) + strlen(szInsertString3); |
BOOL IsValidNum(char* phoneNum) |
{ |
|
char num[MAX_PATH]; |
|
|
strcpy(num,phoneNum); |
|
int nDigitCount = 0; |
// track digits because since we also consider letters |
|
|
// in addition to numbers we need to make sure that here |
|
|
// is at least three digits (for area code) |
|
if(strlen(phoneNum) >= MIN_PHONENUM_COUNT) |
|
{ |
|
for(int i = 0; i < (int) strlen(num) ; i++) |
|
{ |
|
if( (num[i] >= ‘0’ && num[i] <= ‘9’) ) |
|
{ |
|
nDigitCount++; |
|
num[i] = ‘#’; |
|
} |
|
else if ( (num[i] >= ‘A’ && num[i] <= ‘Z’) ) |
|
{ |
|
} |
|
for(i = (int)strlen(num) − 1 ; i <= 0; i−−) |
|
{ |
|
if(num[i] == ‘#’) break; |
|
if( num[i] == ‘ ’ ) num[i] = NULL; |
|
} |
|
for(i = 0; i < MAX_MAP_COUNT ; i++) |
|
{ |
|
if( (strcmp(szNumMapTable[i],num) == 0) |
} |
BOOL isLinkTag( char* strTag) |
{ |
|
if(strcmp(strTag,“a”) == 0 || strcmp(strTag,“A”) == 0) |
} |
BOOL isLinkEndTag( char* strTag) |
{ |
|
if(strcmp(strTag,“a”) == 0 || strcmp(strTag,“A”) == 0) |
} |
BOOL checkPhoneNum(STRUCT_PROCESS *pData) |
{ |
|
char *copyText; |
|
|
char ch; |
|
BOOL bRtn |
= FALSE; |
|
BOOL bSkip |
= FALSE; |
|
BOOL bNum |
= FALSE; |
|
BOOL bLinkTag |
= FALSE; |
|
BOOL bTag |
= FALSE; |
|
int checkSpace = nInsertLen * 10;//strlen(szInsertString1) * 10; |
|
char phoneNum[MAX_PATH]; |
|
char dummyPhoneNum[MAX_PATH]; |
|
char strTAG[MAX_PATH]; |
|
if(pData-->iCheckStatus != DO_START) return FALSE; |
|
copyText = new char[pData-->input_size + checkSpace]; |
|
pData-->output_buf = new char[pData-->input_size + checkSpace]; |
|
int insize = pData-->output_size = pData-->input_size; |
|
memset(phoneNum,NULL,MAX_PATH); |
|
memset(dummyPhoneNum,NULL,MAX_PATH); |
|
memset(copyText,NULL,insize); |
|
memset(strTag,NULL,MAX_PATH); |
|
int j = 0; |
|
int k = 0; |
|
int l = 0; |
|
int m = 0; |
|
pData-->iCheckStatus = DO_CONTINUE; |
|
for(int i = 0; i < insize ; i++) { |
|
} |
|
ch = pData-->input_buf[i]; |
|
if ( ( ch >= ‘0’ && ch <= ‘9’) |
|
|| ( ch >= ‘A’ && ch <= ‘Z’ && TRUE == bNum ) ) |
|
phoneNum[j++] = ch; |
|
dummyPhoneNum[l++] = ch; |
|
bNum = TRUE; |
|
if(bNum && (l == 3 || l == 7)) { |
|
} |
|
// the ‘.’ might be a sentence terminator |
|
else if (bNum && (l == 8 || l == 12 || l == 14)) |
|
{ |
|
for(int i = 0; i < (int)strlen(dummyPhoneNum) ; i++) { |
|
copyText[k++] = dummyPhoneNum[i]; |
|
} |
|
copyText[k++] = ch; |
|
bNum = FALSE; |
|
memset(dummyPhoneNum,NULL,MAX_PATH); |
|
memset(phoneNum,NULL,MAX_PATH); |
|
j = 0; |
|
l = 0; |
|
if(bNum && (l == 3 || l == 7)) { |
|
for(int i = 0; i < (int)strlen(dummyPhoneNum) ; i++) { |
|
copyText[k++] = dummyPhoneNum[i]; |
|
} |
|
copyText[k++] = ch; |
|
bNum = FALSE; |
|
memset(dummyPhoneNum,NULL,MAX_PATH); |
|
memset(phoneNum,NULL,MAX_PATH); |
|
j = 0; |
|
l = 0; |
|
for(int i = 0; i < (int)strlen(dummyPhoneNum) ; i++) { |
|
copyText[k++] = dummyPhoneNum[i]; |
|
} |
|
copyText[k++] = ch; |
|
bNum = FALSE; |
|
memset(dummyPhoneNum,NULL,MAX_PATH); |
|
memset(phoneNum,NULL,MAX_PATH); |
|
j = 0; |
|
l = 0; |
|
// check if ‘ ’ is a terminator for the number |
|
if (bNum && (1 > 10)) |
|
{ |
|
pData-->input_buf[1+1] >= ‘0’ && pData-->onput_buf[i+1] <= ‘9’) { |
|
dummyPhoneNum[l++] = ch; |
|
bNum = TRUE; |
|
if ( FALSE == bLinkTag ) |
|
{ |
|
} |
|
bTag = FALSE; |
|
//if(bNum) |
|
// dummyPhoneNum[l++] = ch; |
|
//else - - - >why? 3/30/200 |
|
copyText[k++] = ch; |
|
break; |
|
if(bNum) { |
|
if( bLinkTag == TRUE) { |
|
for(int i = 0; i < (int)strlen(dummyPhoneNum) ; i++) { |
|
copyText[k++] = dummyPhoneNum[i]; |
|
} |
|
memset(dummyPhoneNum,NULL,MAX_PATH); |
|
l = 0; |
|
copyText[k++] = ch; |
|
if(!IsValidNum(dummyPhoneNum)) { |
|
for(int i = 0; i < (int)strlen(dummyPhoneNum) ; i++) { |
|
copyText[k++] = dummyPhoneNum[i]; |
|
} |
|
memset(dummyPhoneNum,NULL,MAX_PATH); |
|
l = 0; |
|
copyText[k++] = ch; |
|
for(int i = 0; i < (int)strlen(dummyPhoneNum) ; i++) { |
|
copyText[k++] = szInsertString1[i]; |
|
} |
|
for(int i = 0; i < (int)strlen(dummyPhoneNum) ; i++) { |
|
if(dummyPhoneNum[i] >= ‘0’ && dummyPhoneNum[i] ’= ‘9’) |
|
copyText[k++] = dummyPhoneNum[i]; |
|
} |
|
for(i = 0; i < (int)strlen(szInsertString2) ; i++) { |
|
copyText[k++] = szInsertString2[i]; |
|
} |
|
for(i = 0; i < (int)strlen(dummyPhoneNum) ; i++) { |
|
copyText[k++] = dummyPhoneNum[i]; |
|
} |
|
memset(dummyPhoneNum,NULL,MAX_PATH); |
|
l = 0; |
|
for(i = 0; i < (int)strlen(szInsertString3) ; i++) { |
|
copyText[k++] = szInsertString3[i]; |
|
} |
|
memset(PhoneNum,NULL,MAX_PATH); |
|
bNum = FALSE; |
|
j = 0; |
|
// bNum is false |
|
bLinkTag = FALSE; |
|
copyText[k++] = ch; |
|
memset(strTag,NULL,MAX_PATH); |
|
int idx = 1; |
|
while (1) { |
|
if((insize >= i + idx) && |
|
(pData-->input_buf[i + idx] == ‘>’ || pData-->input_buf[i + idx] == ‘ ’)) |
|
else if(isLinkEndTag(strTag)) |
|
strTag[idx−1] = pData-->input_buf[i + idx]; |
|
} else { // bSkip is true |
|
copyText[k++] = ch; |
|
// reset bLinkTag is reached end anchor |
|
if(ch == ‘<’) { |
|
memset(strTag,NULL,MAX_PATH); |
|
int idx = 1; |
|
while (1) { |
|
if((insize >= i + idx) && |
|
(pData-->input_buf[i + idx] == ‘>’ || pData-->input_buf[i + idx] == ‘ ’)) |
|
else if(isLinkEndTag(strTag)) |
|
strTag[idx−1] = pData-->input_buf[i + idx]; |
|
} |
|
if( (k + checkSpace) >= pData-->output_size) { |
|
int resize; |
|
resize = pData-->output_size + checkSpace; |
|
strcpy(pData-->output_buf,copyText); |
|
delete[ ] copyText; |
|
copyText=new char[resize]; |
|
memset(copyText,NULL,resize); |
|
strcpy(copyText,pData-->output_buf); |
|
delete[ ] pData-->output_buf; |
|
pData-->output_buf = new char[resize]; |
|
memset(pData-->output_buf,NULL,resize); |
|
pData-->output_size = resize; |
|
if( k + checkSpace) >= pData-->output_size) { |
|
int resize; |
|
resize = pData-->output_size + checkSpace; |
|
strcpy(pData-->output_buf,copyText); |
|
delete[ ] copyText; |
|
copyText=new char[resize]; |
|
memset(copyText,NULL,resize); |
|
strcpy(copyText,pData-->output_buf); |
|
delete[ ] pData-->output_buf; |
|
pData-->output_buf = new char[resize]; |
|
memset(pData-->output_buf,NULL,resize); |
|
pData-->output_size = resize; |
|
} |
|
if(!IsValidNum(phoneNum)) { |
|
for(int n = 0; n < (int)strlen(dummyPhoneNum) ; n++) { |
|
copyText[k++] = dummyPhoneNum[n]; |
|
} |
|
memset(dummyPhoneNum,NULL,MAX_PATH); |
|
} else { // phone number is invalid |
|
for(int i = 0; i < (int)strlen(szInsertString1) ; i++) { |
|
copyText[k++] = szInsertString1[i]; |
|
} |
|
for(i = 0; i < (int)strlen(dummyPhoneNum) ; i++) { |
|
if(dummyPhoneNum[i] >= ‘0’ && dummyPhoneNum[i] <= ‘9’) |
|
copyText[k++] = dummyPhoneNum[i]; |
|
} |
|
for(i = 0; i < (int)strlen(szInsertString2) ; i++) { |
|
copyText[k++] = szInsertString2[i]; |
|
} |
|
for(i = 0; i < (int)strlen(dummyPhoneNum) ; i++) { |
|
copyText[k++] = dummyPhoneNum[i]; |
|
} |
|
for(i = 0; i < (int)strlen(szInsertString3) ; i++) { |
|
copyText[k++] = szInsertString3[i]; |
|
delete[ ] pData-->output_buf; |
|
pData-->output_buf = new char[k + 1];//−1]; |
|
memset(pData-->output_buf,NULL,k + 1);//−1); |
|
memcpy(pData-->output_buf,copyText,k−1);//2); |
|
} |
|
delete[ ] copyText; |
|
return bRtn; |
} |
void checkPhoneNumThread(void *pVoid) |
{ |
|
STRUCT_PROCESS *pData =(STRUCT_PROCESS *)pVoid; |
|
if(checkPhoneNum(pData)) |
|
pData-->iCheckStatus = DO_SUCCESSEND; |
|
pData-->iCheckStatus = DO_FAILEND; |
} |
void checkPhoneNumProc(STRUCT_PROCESS *pData) |
{ |
|
HANDLE hThread; |
|
DWORD nID; |
|
pData-->iCheckStatus = DO_START; |
|
hThread = CreateThread( |
|
(LPSECURITY_ATTRIBUTES)NULL, |
// No security attributes. |
|
(DWORD)0, |
// Use same stack size. |
|
(LPTHREAD_START_ROUTINE)checkPhoneNumThread, // Thread procedure. |
|
(LPVOID)pData, |
// Parameter to pass. |
|
(DWORD)0, |
// Run immediately. |
|
(LPDWORD)&nID); |
} |
Filename: CIEHooker.h |
// CIEHooker.h : Declaration of the CCIEHooker |
#ifndef_CIEHOOKER_H— |
#define_CIEHOOKER_H— |
#include “resource.h” |
// main symbols |
#include “IEHookerCP.h” |
#include “ExDispID.h” |
#include “mshtmdid.h” |
#include “mshml.h” |
#include <strstrea.h> |
#include “checkNum.h” |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
// CCIEHooker |
class ATL_NO_VTABLE CCIEHooker : |
|
public CComObjectRootEx<CComSingleThreadModel>, |
|
public CComCoClass<CCIEHooker, &CLSID_CIEHooker>, |
|
public IObjectWithSiteImpl<CCIEHooker>, |
|
public ISupportErrorInfo, |
|
public IConnectionPointContainerImpl<CCIEHooker>, |
|
public IDispatchImpl<ICIEHooker, &HD_ICIEHooker, &LIBID_IEHookerLib>, |
|
public CProxy_ICIEHookerEvents< CCIEHooker > |
{ |
public: |
DECLARE_REGISTRY_RESOURCEID(IDR_CIEHOOKER) |
DECLARE_PROTECT_FINAL_CONSTRUCT( ) |
BEGIN_COM_MAP(CCIEHooker) |
|
COM_INTERFACE_ENTRY(ICIEHooker) |
|
COM_INTERFACE_ENTRY(IDispatch) |
|
COM_INTERFACE_ENTRY(ISupportErrorInfo) |
|
COM_INTERFACE_ENTRY(IConnentionPointContainer) |
|
COM_INTERFACE_ENTRY(IObjectWithSite) |
|
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer) |
END_COM_MAP( ) |
BEGIN_CONNECTION_POINT_MAP(CCIEHooker) |
|
CONNECTION_POINT_ENTRY(DIID_ICIEHookerEvents) |
END_CONNECTION_POINT_MAP( ) |
public: |
|
CCIEHooker( ); |
|
˜CCIEHooker( ); |
|
// |
|
// ISupportsErrorInfo |
|
// |
|
STDMETHOD(InterfaceSupportsErrorInfo) (REFIID riid); |
|
// |
|
// IDispatch Methods |
|
// |
|
STDMETHOD(Invoke)(DISPID dispidMember,REFIID riid, LCID lcid, WORD wFlags, |
|
DISPPARAMS * pdispparams, VARIANT * pvasResult, |
|
EXCEPINFO * pexcepinfo, UINT * puArgErr); |
|
// |
|
// IOleObjectWithSite Methods |
|
// |
|
STDMETHOD(SetSite)(IUnknown *pUnkSite); |
|
DWORD m_dwCookie; // Connection Token -- used for Advise and Unadvise |
|
CComQIPtr<IWebBrowser2, &IID_IWebBrowser2> m_spWebBrowser2; |
|
enum ConnectType { Advise, Unadvise }; // What to do when managing the connection |
|
BOOL ManageConnection(enum ConnectType eConnectType); |
|
void checkAllData( ); |
|
void checkUpdate(STRUCT_PROCESS* pData); |
|
void EnumFrames( ); |
|
void RecurseWindows(IHTMLDocument2* pDocument); |
|
BOOL GetPageBody(IHTMLDocument2* pDocument); |
|
BOOL AddData(STRUCT_PROCESS* pData); |
|
BOOL RemoveAll( ); |
|
BOOL RemoveData(STRUCT_PROCESS* pData); |
public: |
}; |
#endif //_CIEHOOKER_H_ |
Filename: CIEHooker.cpp |
// CIEHooker.cpp : Implementation of CCIEHooker |
#“stdafx.h” |
#“IEHooker.h” |
#“CIEHooker.h” |
#<comdef.h> |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
// CCIEHooker |
#ifdef_DEBUG |
#define new DEBUG_NEW |
#undef THIS_FILE |
static char THIS_FILE[ ]= _FILE_; |
#endif |
STRUCT_PROCESS *g_pHeaderData = NULL; |
DWORD iCurrentTick = 0; |
void EnablePhoneParse(BOOL bEnablePhoneParse) |
{ |
|
HKEY |
hAppKey; |
|
DWORD |
dwDisposition; |
|
if(RegCreateKeyEx(HKEY_LOCAL_MACHINE, TEXT(“Software\\DialPad.com”), 0, NULL, |
|
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hAppKey, &dwDisposition) == ERROR_SUCCESS) |
|
RegSetValueEx(hAppKey, TEXT(“EnablePhoneParse”), 0, REG_BINARY,(LPBYTE)&bEnablePhoneParse, sizeof(WORD)); |
|
RegCloseKey(hAppKey); |
} |
BOOL IsEnablePhoneParse( ) |
{ |
|
HKEY |
hAppKey; |
|
DWORD |
bEnablePhoneParse = 0; |
|
DWORD |
ulSize; |
|
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT(“Software\\DialPad.com”), 0, KEY_READ, |
|
&hAppKey) == ERROR_SUCCESS) |
|
ulSize = sizeof(DWORD); |
|
RegQueryValueEx(hAppKey, TEXT(“EnablePhoneParse”), NULL, NULL,(LPBYTE)&bEnablePhoneParse, %ulSiz); |
|
RegCloseKey(hAppKey); |
|
} |
|
return (BOOL)bEnablePhoneParse; |
} |
CCIEHooker::CCIEHooker( ) |
{ |
} |
CCIEHooker::˜CCIEHooker( ) |
{ |
} |
STDMETHODIMP CCIEHooker::InterfaceSupportsErrorInfo(REFIID riid) |
{ |
/* |
static const IID* arr[ ] = |
|
}; |
|
for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++) |
|
{ |
|
if (InlineIsEqualGUID(*arr[0]),riid)) |
} |
BOOL CCIEHooker::ManageConnection(enum ConnectType eConnectType) |
{ |
|
HRESULT hr; |
|
if (!m_spWebBrowser2) return S_OK; |
|
CComQIPtr<IConnectionPointContainer, |
|
&HD_IConnectionPointContainer> spCPContainer(m_spWebBrowser2); |
|
if (spCPContainer != NULL) { |
|
CComPtr<IConnectionPoint> spConnectionPoint; |
|
hr = spCPContainer-->FindConnectionPoint(DIID_DWebBrowserEvents2, &spConnectionPoint); |
|
if (SUCCEEDED(hr)) { |
|
if (eConnectType == Advise) { |
|
hr = spConnectionPoint-->Advise((IDispatch*)this, &m_dwCookie); |
|
hr = spConnectionPoint-->Unadvise(m_dwCookie); |
|
} |
|
return (SUCCEEDED(hr)); |
} |
STDMETHODIMP CCIEHooker::SetSite(IUnknown *pUnkSite) |
{ |
|
USES_CONVERSION; |
|
if (!pUnkSite) { |
|
ATLTRACE(“\nSetSite( ): pUnkSite is NULL\n\n”); |
|
m_spWebBrowser2 = pUnkSite; |
|
if (m_spWebBrowser2) { |
|
if (!ManageConnection(Advise)) { |
|
ATLTRACE(“Failure sinking events from IWebBrowser2”); |
} |
STDMETHODIMP CCIEHooker::Invoke(DISPID dispidMember, |
|
REFID riid, |
|
LCID lcid, |
|
WORD wFlags, |
|
USES_CONVERSION; |
|
if (!pDispParams) |
|
DWORD iTmpTick = ::GetTickCount( ); |
|
if(iTmpTick − iCurrentTick > 2000) { |
|
iCurrentTick = 0; |
|
EnumFrames( ); |
} |
switch (dispidMember) |
{ |
|
case DISPID_DOCUMENTCOMPLETE; |
|
if(IsEnablePhoneParse( )) { |
|
if (pDispParams-->cArgs >= 2 && pDispParams-->rgvarg[1].vt == VT_DISPATCH) { |
|
if(m_spWebBrowser2 == pDispParams-->rgvarg[1].pdispVal) { |
|
iCurrentTick = 0; |
|
RemoveAll( ); |
|
EnumFrames( ); |
|
iCurrentTick = ::GetTickCount( ); |
|
case DISPID_BEFORENAVIGATE2: |
|
case DISPID_NAVIGATECOMPLETE2: |
|
case DISPID_STATUSTEXTCHANGE: |
|
case DISPID_PROGRESSCHANGE: |
|
case DISPID_DOWNLOADBEGIN: |
|
case DISPID_DOWNLOADCOMPLETE: |
|
case DISPID_COMMANDSTATECHANGE: |
|
case DISPID_NEWWINDOW2: |
|
case DISPID_BEFORENAVIGATE: |
|
RemoveAll( ); |
|
ManageConnection(Unadvise); |
|
break; |
} |
void CCIEHooker::checkAllData( ) |
{ |
|
STRUCT_PROCESS* pCurData = NULL; |
|
STRUCT_PROCESS* pNextData = NULL; |
|
if(g_pHeaderData) { |
|
pCurData = pNextData = g_pHeaderData; |
|
while(pNextData) { |
|
pCurData = pNextData; |
|
if(pCurData-->iCheckStatus == DO_SUCCESSEND) |
|
pNextData = pCurData-->pNext; |
|
ATLTRACE(_T(“Unspecified exception thrown in checkAllData\n”)); |
} |
void CCIEHooker::checkUpdate(STRUCT_PROCESS* pData) |
{ |
|
if(pData-->iCheckStatus == DO_SUCCESSEND) { |
|
pData-->iCheckStatus = DO_IDLE; |
|
int size = MultiByteToWideChar(CP_ACP,0,pData-->output_buf,−1,0,0); |
|
if(pData-->output_size − pData-->input_size >= 0) { |
|
IHTMLElement* pbody = NULL; |
|
IHTMLDocument2* pHtmlDocument = pData-->pDocument; |
|
if (pHtmlDocument) { |
|
if (SUCCEEDED(pHtmlDocument-->gct_body( &pbody))) { |
|
BSTR bstr; |
|
OLECHAR* olestr = new OLECHAR[size+1]; |
|
olestr[0] = 0; |
|
int irtn = MultiByteToWideChar(CP_ACP,0,pData-->output_buf,size,olestr,size); |
|
bstr = SysAllocString(olestr); |
|
pbody-->put_innerHTML(bstr); |
|
SysFreeString(bstr); |
|
delete[ ] olestr; |
|
}catch(_com_error Error) { |
|
ATLTRACE(Error.ErrorMessage( )); |
|
ATLTRACE(_T(“Unspecified exception thrown in checkUpdate\n”)); |
} |
BOOL checkChange(IHTMLDocument2* pDocument) |
{ |
|
STRUCT_PROCESS *pNextData = NULL; |
|
STRUCT_PROCESS *pCurData = NULL; |
|
if(g_pHeaderData == NULL) |
|
if(pDocument != g_pHeaderData-->pDocument) |
|
pCurData = pNextData = g_pHeaderData-->pNext; |
|
try { |
|
IHTMLFrmesCollection2* pFrameset = NULL; |
|
pDocument-->get_frames(&pFrameset): |
|
if(pFrameset) { |
|
IHTMLWindow2* pWindow2Next; |
|
IHTMLDocument2* pNextDoc; |
|
IHTMLElement* pbody; |
|
long len; |
|
pFrameset-->get_length(&len); |
|
for(long i = 0; i <len ; i++) { |
|
_variant_t va(i, VT_I4); |
|
VARIANT_result; |
|
VariantInit(&_result); |
|
pFrameset-->item(&va, &_result); |
|
pWindow2Next = (IHTMLWindow2*)_result.pdispVal; |
|
pWindow2Next-->get_document(&pNextDoc); |
|
pCurData = pNextData; |
|
if(pCurData) { |
|
if(pCurData-->pDocument != pNextDoc) return TRUE; |
|
pNextData = pCurData-->pNext; |
|
if(pNextDoc) { |
|
if(checkChange(pNextDoc)) return TRUE; |
|
if(SUCCEEDED(pNextDoc-->get_body(&pbody))) { |
|
BSTR bstr; |
|
if(SUCCEEDED(pbody-->get_innerHTML(&bstr))) { |
|
} |
|
if(checkChange(pNextDoc)) return TRUE; |
|
ATLTRACE(_T(“Unspecified exception checkChange\n”)); |
} |
void CCIEHooker::EnumFrames( ) |
{ |
|
IDispatch * pDisp; |
|
IHTMLDocument2* pDocument; |
|
try { |
|
if(SUCCEEDED(m_spWebBrowser2-->gct_Document(&pDisp))) { |
|
if(SUCCEEDED(pDisp-->QueryInterface(IID_IHTMLDocument2,void**)&pDocument))) { |
|
BOOL bcheck = checkChange(pDocument); |
|
if(bcheck) { |
|
RemoveAll( ); |
|
RecurseWindows(pDocument); |
|
} catch( . . . ) { |
|
ATLTRACE(_T(“Unspecified exception EnumFrames\n”)); |
|
} |
} |
void CCIEHooker::RecurseWindows(IHTMLDocument2* pDocument) |
{ |
|
IHTMLElement* pbody; |
|
if(pDocument == NULL) return; |
|
try { |
|
pDocument-->get_body( &pbody (; |
|
if(pbody) { |
|
GetPageBody(pDocument); |
|
// Get the IDispatch of the document |
|
LPDISPATCH lpDisp = pDocument; |
|
//lpDisp = m_webBrowser.GetDocument( ); |
|
if (lpDisp) |
|
{ |
|
IOleContainer* pContainer; |
|
// Get the container |
|
HRESULT hr = lpDisp-->QueryInterface(IID_IOleContainer, (void**)&pContainer); |
|
lpDisp-->Release( ); |
|
if (FAILED(hr)) |
|
{ |
|
} |
|
IEnumUnknown* pEnumerator; |
|
hr = pContainer-->EnumObjects(OLECONTF_EMBEDDINGS, &pEnumerator); |
|
pContainer-->Release( ); |
|
if (FAILED(hr)) |
|
{ |
|
} |
|
IUnknown* pUnk; |
|
ULONG uFetched; |
|
// Enumerate all the frames and process their html info |
|
for (UINT i = 0; S_OK == pEnumerator-->NEXT(1, &pUnk, &uFetched); i++) |
|
{ |
|
IWebBrowser2* pBrowser; |
|
hr = pUnk-->QueryInterface(IID_IWebBrowser2,(void**)&pBrowser); |
|
pUnk-->Release( ); |
|
if(SUCCEEDED(hr)) |
|
{ |
|
IDispatch* pDisp; |
|
IHTMLDocument2* pDocument; |
|
try { |
|
if(SUCCEEDED(pBrowser-->get_Document(&pDisp))) { |
|
if(SUCCEEDED(pDisp-->QueryInterface(IID_IHTMLDocument2,void**)&pDocument))) { |
|
RecurseWindows(pDocument); |
|
pDocument-->Release( ); |
|
ATLTRACE(_T(“Unspecified exception EnumFrames\n”)); |
|
} |
|
pEnumerator-->Release( ); |
|
ATLTRACE(_T(“Unspecified exception RecurseWindows\n”)); |
} |
BOOL CCIEHooker::GetPageBody(IHTMLDocument2* pDocument) |
{ |
|
BSTR bstr; |
|
IHTMLElement* pbody = NULL; |
|
BOOL bSuccess = FALSE; |
|
try { |
|
STRUCT_PROCESS* pData = STRUCT_PROCESS; |
|
memset(pData,NULL,sizeof(STRUCT_PROCESS)); |
|
if(SUCCEEDED(pDocument-->get_body(&pbody))) { |
|
pbody-->get_innerHTML(&bstr); |
|
if (bstr) { |
|
int bytes=WideCharToMultiByte(CP_ACP,0,bstr,−1,0,0,0,0); |
|
if (bytes) { |
|
char *buf=new char[bytes]; |
|
memset(buf,NULL,bytes); |
|
WideCharToMultiByte(CP_ACP,0,bstr,−1,buf,bytes,0,0); |
|
pData-->input_buf = buf; |
|
pData-->input_size = bytes; |
|
pData-->pDocument = pDocument; |
|
checkPhoneNumProc(pData); |
|
bSuccess = TRUE; |
|
} |
|
if (bSuccess) AddData(pData); |
|
else RemoveData(pData); |
|
ATLTRACE(_T(“Unspecified exception thrown in GetPageBody\n”)); |
} |
BOOL CCIEHooker::AddData(STRUCT_PROCESS* pData) |
{ |
|
STRUCT_PROCESS* pCurData; |
|
STRUCT_PROCESS* pNextData; |
|
try { |
|
pCurData = pNextData = g_pHeaderData; |
|
while(pNextData) { |
|
pCurData = pNextData; |
|
pNextData = pNextData-->pNext; |
|
} |
|
pCurData-->pNext = pData; |
|
ATLTRACE(_T(“Unspecified exception thrown in AddData\n”)); |
} |
BOOL CCIEHooker::RemoveAll( ) |
{ |
|
STRUCT_PROCESS* pCurData = g_pHeaderData; |
|
g_pHeaderData = pCurData-->pNext; |
|
RemoveData(pCurData); |
|
ATLTRACE(_T(“Unspecified exception thrown in RemoveAll\n”)); |
} |
BOOL CCIEHooker::RemoveData(STRUCT_PROCESS* pData) |
{ |
|
pData-->bUserStop = TRUE; |
|
while(pData-->iCheckStatus == DO_CONTINUE) { |
|
} |
|
if(pData-->pDocument) { |
|
pData-->pDocument-->Release( ); |
|
pData-->pDocument = NULL; |
|
} |
|
if(pData-->input_buf) { |
|
delete[ ] pData-->input_buf; |
|
pData-->input_buf = NULL; |
|
} |
|
if(pData-->output_buf) { |
|
delete[ ] pData-->output_buf; |
|
pData-->output_buf = NULL; |
|
} |
|
delete pData; |
|
pData = NULL; |
|
ATLTRACE(_T(“Unspecified exception thrown in RemoveData\n”)); |
} |
Filename: CIEHooker.lgs |
HKCR |
{ |
|
IEHooker.CIEHooker.1 = s ‘CIEHooker Class’ |
|
{ |
|
CLSID = s ‘{16122F02-9713-11D3-9744-005004116944}’ |
|
} |
|
IEHooker.CIEHooker = s ‘CIEHooker Class’ |
|
{ |
|
CLSID = s ‘{16122F02-9713-11D3-9744-005004116944}’ |
|
CurVer = s ‘IEHooker.CIEHooker.1’ |
|
ForceRemove {16122F02-9713-11D3-9744-005004116944} = s ‘CIEHooker Class’ |
|
{ |
|
ProgID = s ‘IEHooker.CIEHooker.1’ |
|
VersionIndependentProgID = s ‘IEHooker.CIEHooker’ |
|
ForceRemove ‘Programmable’ |
|
InprocServer32 = s ‘%Module%’ |
|
{ |
|
val ThreadingModel = ‘Apartment’ |
|
} |
|
‘TypeLib’ = s ‘{16122EF1-9713-11D3-9744-005004116944}’ |
|
‘Browser Helper Objects’ |
|
{ |
|
{16122F02-9713-11D3-9744-005004116944} |
APPENDIX B |
|
Registry Modifications During Installation: |
When Dialpad Everywhere is installed, the following folders are created: |
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Explorer/‘Browser Helper |
Objects’/{16122F02-9713-11D3-9744-005004116944} |
HKEY_CLASSES_ROOT/IEHooker.CIEHooker.1 |
HKEY_CLASSES_ROOT/IEHooker.CIEHooker.1/CLSID |
HKEY_CLASSES_ROOT/IEHooker.CIEHooker |
HKEY_CLASSES_ROOT/IEHooker.CIEHooker/CLSID |
HKEY_CLASSES_ROOT/IEHooker.CIEHooker/CurVer |
The script for modifying the registry is contained in the CIEHooker.RGS file (text shown here): |
HKCR |
{ |
|
IEHooker.CIEHooker.1 = s ‘CIEHooker Class’ |
|
{ |
|
CLSID = s ‘{16122F02-9713-11D3-9744-005004116944}’ |
|
} |
|
IEHooker.CIEHooker = s ‘CIEHooker Class’ |
|
{ |
|
CLSID = s ‘{16122F02-9713-11D3-9744-005004116944}’ |
|
CurVer = s ‘IEHooker.CIEHooker.1’ |
|
ForceRemove {16122F02-9713-11D3-9744-005004116944} = s ‘CIEHooker Class’ |
|
{ |
|
ProgID = s ‘IEHooker.CIEHooker.1’ |
|
VersionIndependentProgID = s ‘IEHooker.CIEHooker’ |
|
ForceRemove ‘Programmable’ |
|
InprocServer32 = s ‘%Module%’ |
|
{ |
|
val ThreadingModel = ‘Apartment’ |
|
} |
|
‘TypeLib’ = s ‘{16122EF1-9713-11D3-9744-005004116944}’ |
|
‘Browser Helper Objects’ |
|
{ |
|
{16122F02-9713-11D3-9744- |
} |
Registry queries for setting/determining if phone parsing is turned on/off: |
void EnablePhoneParse (BOOL bEnablePhoneParse) |
{ |
|
HKEY hAppKey; |
|
DWORD dwDisposition; |
|
if(RegCreateKeyEx (HKEY_LOCAL_MACHINE, |
TEXT(“Software\\DialPad.com”), 0, NULL, |
|
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hAppKey, |
|
RegSetValueEx (hAppKey, TEXT {“EnablePhoneParse”), 0, |
REG_BINARY, (LPBYTE) &bEnablePhoneParse, sizeof(WORD)); |
} |
BOOL IsEnablePhoneParse( ) |
{ |
|
HKEY hAppKey; |
|
DWORD bEnablePhoneParse = 0; |
|
DWORD ulSize; |
|
if(RegCreateKeyEx (HKEY_LOCAL_MACHINE, |
TEXT(“Software\\DialPad.com”), 0, KEY_READ, |
|
&hAppKey} == ERROR_SUCCESS) |
|
ulSize = sizeof(DWORD); |
|
RegQueryValueEx(hAppKey, TEXT(“EnablePhoneParse”), NULL, |
NULL, (LPBYTE) &bEnablePhoneParse, &ulSize); |
|
} |
|
return (BOOL) bEnablePhoneParse; |
|
} |
|
|