title: Difference between dword ptr and dword ptr:es
body: <p>I was just checking the disassembly of my C++ program in VS2010. Here it is : </p>
  
  <pre><code>int main()
  {
  00B613A0  push        ebp  
  00B613A1  mov         ebp,esp  
  00B613A3  sub         esp,0D4h  
  00B613A9  push        ebx  
  00B613AA  push        esi  
  00B613AB  push        edi  
  00B613AC  lea         edi,[ebp-0D4h]  
  00B613B2  mov         ecx,35h  
  00B613B7  mov         eax,0CCCCCCCCh  
  00B613BC  rep stos    dword ptr es:[edi]  
  00B613BE  mov         eax,dword ptr [___security_cookie (0B67000h)]  
  00B613C3  xor         eax,ebp  
  00B613C5  mov         dword ptr [ebp-4],eax  
      char temp[] = "hello";
  00B613C8  mov         eax,dword ptr [string "hello" (0B6573Ch)]  
  00B613CD  mov         dword ptr [ebp-10h],eax  
  00B613D0  mov         cx,word ptr ds:[0B65740h]  
  00B613D7  mov         word ptr [ebp-0Ch],cx  
  
      return 0;
  00B613DB  xor         eax,eax  
  }
  </code></pre>
  
  <p>The lines in question are:</p>
  
  <pre><code>00B613BC  rep stos    dword ptr es:[edi]  
  
  00B613D0  mov         cx,word ptr ds:[0B65740h] 
  </code></pre>
  
  <p>I do not get why they use <code>dword ptr es:[edi]</code> and <code>word ptr ds:[0B65740h]</code>. Although I'm aware of what dword ptr means, I do not get the last part that is added, <code>:es</code> and <code>:ds</code>. I have seen this syntax quite a few times now to let it go unnoticed.</p>
  
  <p>Thanks,</p>
  
  <p>Devjeet</p>