Wednesday, December 17, 2008

Search Engine Plugin

Firefox was one of the first browsers to have this neat feature of incorporating a textbox in which u enter search terms to look for instead of visiting the search engine site and typing ur keywords in the site's search area, this feature saves alot of inconvenience and little time...

The basis for this feature is that there is a folder in firefox called "searchplugins" which contains a plethora of xml files which dictate which search form is selected and how keywords are submitted, and whether suggestions for keywords should appear in case user was writing into search plugin's textbox.
Below is an example of a typical xml search plugin file,

<SearchPlugin xmlns="">
<ShortName>BlahBlah search</ShortName>
<Description>BlahBlah Search Engine Plugin</Description>
<Image width="16" height="16">data:image/x-icon;base64,R0lGODlhEAAQAJECAP8AAAAAAP///wAAACH5BAEAAAIALAAAAAAQABAAAAIplI+py+0NogQuyBDEnEd2kHkfFWUamEzmpZSfmaIHPHrRguUm/fT+UwAAOw==</Image>
<Url type="text/html" method="GET" template="">
<Param name="p" value="{searchTerms}"/>
<Param name="ei" value="UTF-8"/>
<MozParam name="fr" condition="pref" pref="Blah-fr" />

As u can see the First line (<SearchPlugin...>)is a tag for the file, the 2nd line (<ShortName>)is the name u c inside the search box when its empty and is not selected for writing, and when u click on the list of search plugins available for ur browser.
<Description> tag is the description info about the plugin that is usually seen when the plugin is inspected further by browser.
<InputEncoding> tag tells the plugin how to treat the keywords enterd, UTF-8 is the most widely used encoding, however, some plugins might use others, so choose according to ur search keywords and language.
the next part (<Image ..../Image>) tells the browser which image should appear next to the search box, and wat kind of image, in addition to its dimensions, in this case (which is the most widely used method) tje image is 16x16 pixels and is of PNG type icon, the next few lines represent image data encoded in the mentioned base64 format.
the following tag (<Url.../Url>) states how to treat the keywords entered and whether or not to show suggestions related to keywords entered, in the previous example no suggestions will be presented as focus is mainly on how to submit search request.
The Last line (<SearchForm>) states which form to submit the written keywords to for the search engine to process.
A number of situations can arise in day to day use of browsers, for example u might like ur search plugin to search images section of search engine instead of web or vice versa, and u might want to remove the suggestions feature or u might want to decrease the amount of info ur search plugin submits to the search engine and limit it to the keywords only....
To change search of google from web search to image search change the template to" and save it into a different name so as to keep both, remember to change the Short name at least, so that u would be able to tell which is which when u search!

<Url type="text/html" method="GET" template="">
<Param name="q" value="{searchTerms}"/>

One last issue can arise, the icon, in order to change the icon u have either to modify the existing icon, in which case u have to decode the base 64 encryption and revert it to the icon and then modify it and re-encode it, then paste it into the search plugin...or most commonly, create, or obtain the image from other sources, ie, web pages, when encode it to base 64 format, by using many of the availabe programs in the web, for example B64Dcode to encode ur image, open the b64 file, copy the base 64 encryted data and paste it over the template search plugin data, but make sure that ur source is a 16x16 PNG icon....

have fun!

Labels: ,

Smilar pages

Win32 PE :adding entry to import table

I was having hard time trying to add specific dll with certain function to an executable PE file until I reached two great tuts about this subject
here and here
The first thing we have to have extra space in that PE file, for me I am accustomed with adding new section using some article from Sunshine( the same site of the latter link) but the problem was the conflict that I faced while investigating assembled file using masm32 compared toother executable files, the difference was easy, but hard to find for a novice coder like me, in the articles(above) pointed that OriginalFirstThunk and FirstThunk in the ImportDirectory may be put same,but they are not similar in masm32 assembled files, and the other thing regarding masm32 is that creates JMP table, so when call user32!MessageBoxA, it actually redirect that into JMP user32!MessageBoxA.
The other thing I sought in whole this die hard one day of trial and error of coding, is that don't ever try to remove the original ImportTable nor modify it after copying it to the new location, just temper by adding new ImportDirectory, if it sounds confusing now I will try to throw a tutorial/Code snippet in upcoming post(s), cause JMP and CALLs point to the FirstThunk values, so if you want to change those values you should go on though the whole code trying to find the RVAs and changing them accordingly.
Now, I am too thrilled to re-adjust and optimize my current example code, But first I need to have a rest ;)

Music: Cymphony of Pain[Snakeskin], this is Duetsch[Esibrecher]., 1000 flammen[Eisbrecher]..etc(whole day music hardly memorizing them)

Labels: ,

Smilar pages

Tuesday, December 09, 2008

Extremly Lame

After aching my head with winedump/winebuild to figure out a way to add dynamic-libraries to Wine I found that I can add whatever dll directly to wine simulated windows directory.
Where [users] substitued by by user name of the system.
Just copying the dll to that path and you got it working or putting the required dll in the same directory of that program which needs it.

Labels: ,

Smilar pages