title: Why does OpenSemaphore always return zero in 64-bit Windows 7 when CreateSemaphore works?
body: <p>I ported my appliction from Windows 7 32-bit to Windows 7 64-bit. I find that the API function <code>OpenSemaphore</code> is always returning zero. This call works well in 32-bit Windows, but not in 64-bit Windows. </p>
  
  <p>When I call <code>GetLastError()</code>, it returns 2. </p>
  
  <p>Also I replaced my <code>OpenSemaphore</code> with the <code>CreateSemaphore</code> function and my application works fine, but I am still confused about why the <code>OpenSemaphore</code> function is failing in 64-bit code.</p>
  
  <p>Can anyone who knows something about this issue please clarify?</p>