title: Create new certificate store in C/C++
body: <p>I am trying to create a new certificate store in Windows programmatically using C/C++.</p>
  
  <p>I started with this function - <code>CryptAcquireContext</code>, and wrote this piece of code:</p>
  
  <pre><code>#include&lt;windows.h&gt;
  
  int _tmain(int argc, _TCHAR* argv[])
  {
      HCRYPTPROV hCryptProvider;
      PCWSTR DefaultContainerName = L"MyStoreName";
      PCWSTR DefaultProviderName = MS_STRONG_PROV;
      DWORD DefaultProviderType = PROV_RSA_FULL;
      DWORD DefaultProviderFlags = CRYPT_MACHINE_KEYSET | CRYPT_SILENT | CRYPT_NEWKEYSET;
  
      printf("%d\n", CryptAcquireContext(&amp;hCryptProvider, DefaultContainerName, DefaultProviderName, DefaultProviderType, DefaultProviderFlags));
  
      return 0;
  }
  </code></pre>
  
  <p>The container name and provider name values have been picked up from a design document that I am supposed to follow.</p>
  
  <p>I dont know if this is the correct way to create stores, because after running this and opening the Certificate snap-in of MMC, I do not see the store of the given name. The program prints 1 on being run first time, and 0 from the second time onward.</p>
  
  <p>Is this the correct way ? If yes, why don't I see the store in MMC ? If no, what is the correct way to create new certificate stores using C/C++ ?</p>
  
  <p>Please feel free to point out any mistakes in the code.</p>