CertRegisterPhysicalStore

[This is preliminary documentation and subject to change.]

The CertRegisterPhysicalStore function adds a physical Store to a registry system store collection.

#include <wincrypt.h>
BOOL WINAPI CertRegisterPhysicalStore(
  const void *pvSystemStore,                // in
  DWORD dwFlags,                            // in
  LPCWSTR pwszStoreName,                    // in
  PCERT_PHYSICAL_STORE_INFO pStoreInfo,     // in
  void *pvReserved                          // in/optional
);
 

Parameters

pvSystemStore
Identifies the system store collect to which the physical store will be added. It points to either a NULL terminated unicode string or to a CERT_SYSTEM_STORE_RELOCATE_PARA data structure. See CertRegisterSystemStore for details on using the data structure and on prepending a ServiceName or Computer name to the system store name string.
dwFlags
The HIWORD of the dwFlags parameter specifies the location of the system store. See CertRegisterSystemStore for details on defined HIWORD dwFlags and prepending ServiceName, UserNames, and ComputerNames to the system store name.

The following LOWORD dwFlags are also defined and may be ORed with HIWORD flags.

CERT_SYSTEM_STORE_RELOCATE_FLAG
When this flag is set, the system store is not in its default registry location and pvSystemStore must be a pointer to a CERT_SYSTEM_STORE_RELOCATE_PARA data structure.
CERT_STORE_CREATE_NEW_FLAG
When this flag is set, the function fails if the physical store already exists in the store location.
pwszStoreName
Pointer to a unicode string that names the physical store to be added to the system store collection.
pStoreInfo
Pointer to a CERT_PHYSICAL_STORE_INFO data structure that provides basic information about the physical store.
pvReserved
This parameter is reserved for future use and must be set to NULL.

Return Values

TRUE if the function succeeded. FALSE if the function failed.

Remarks

To access a remote store, the Security Permissions in the registry keys on that remote computer must be set to allow access. For more information on setting Security Permissions in an NT registry, see MDSN Article ID Q155363. For information on what to do to enable remote administration on a Win95 registry.

Example

LPCWSTR pwszSystemStore = L"My";
LPcWSTR pwszStoreName = L"newstore";
CERT_PHYSICAL_STORE_INFO PhysicalStoreInfo
DWORD dwFlags= CERT_SYSTEM_STORE_CURRENT_USER;

// Initalize the PhysicalStoreInfo data structure.
PhysicalStoreInfo.cbSize=sizeof(CERT_PHYSICAL_STORE_INFO);
PhysicalStoreInfo.pszOpenStoreProvider=CERT_STORE_PROV_FILENAME;
PhysicalStoreInfo.dwFlags=CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG;
PhysicalStoreInfo.dwPriority=1;
PhysicalStoreInfo.dwOpenEncodingType=PKCS_7_ASN_ENCODING | X509_ASN_ENCODING;
if(CertRegisterPhysicalStore(
     pwszSystemStoreName),
     dwFlags,
     pwszStoreName,
     &PhyStoreInfo,
     NULL
              ))
       {
printf("Physical store %S is registered \n",pwszStoreName);
printf("As a store under %S \n",pvSystemStore);
       }
else
printf("The physical store was not registered. \n");
 

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in wincrypt.h.
  Import Library: Use crypt32.lib.

See Also

CertRegisterSystemStore, CertUnregisterPhysicalStore, CertEnumSystemStoreLocation, CertEnumSystemStore, CertEnumPhysicalStore