CertRegisterSystemStore

[This is preliminary documentation and subject to change.]

The CertRegisterSystemStore function registers a system store.

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

Parameters

pvSystemStore
Identifier of the system store to be registered. If CERT_SYSTEM_STORE_RELOCATE_FLAG is set in dwFlags, pvSystemStore points to a CERT_SYSTEM_STORE_RELOCATE_PARA data structure; else it points to a NULL terminated unicode string that names the system store. With the appropriate settings of dwFlags, this may be a system store on a remote local machine. Stores on remote computers can be registered with the computer name as a prefix to the name of the system store. For example, a remote local machine store could be registered with pvSystemStore pointing to the string "\\ComputerName\Trust" or "ComputerName\Trust."

Leading "\\" backslashes are optional before a ComputerName.

dwFlags
The HIWORD of the dwFlags parameter is used to specify the location of the system store.

The following HIWORD dwFlags are defined:

CERT_SYSTEM_STORE_CURRENT_USER

CERT_SYSTEM_STORE_CURRENT_SERVICE

CERT_SYSTEM_STORE_SERVICES

CERT_SYSTEM_STORE_USERS

CERT_SYSTEM_STORE_LOCAL_MACHINE

CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY

When CERT_SYSTEM_STORE_CURRENT_USER is set, pvSystemStore may be a system store name that is prefixed with the UserName.

When CERT_SYSTEM_STORE_CURRENT_SERVICE is set, pvSystemStore may be a system store name that is prefixed with the ServiceName.

When CERT_SYSTEM_STORE_SERVICES or CERT_SYSTEM_STORE_USERS is set pvSystemStore must be a system store name that is prefixed with the ServiceName or UserName.

Stores on remote computers can be registered for CERT_SYSTEM_STORE_LOCAL_MACHINE, CERT_SYSTEM_STORE_SERVICES, CERT_SYSTEM_STORE_USERS or CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY

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 register 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 system store already exists in the store location.
pStoreInfo
This parameter is reserved for future use and must be set to NULL.
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

DWORD dwFlags= CERT_SYSTEM_STORE_CURRENT_USER;
LPCWSTR pySystemName= L"NEWSTORE";  // for this setting of 
                                    // dwFlags, the store name may 
                                    // be prefixed with a user name.
if(CertRegisterSystemStore(
pvSystemName,
dwFlags,
NULL,
NULL
       ))
   printf("System store %S is registered \n",pvSystemName);
else
   printf("The system store did not register. \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

CertRegisterPhysicalStore, CertUnregisterSystemStore, CertUnregisterPhysicalStore, CertEnumSystemStoreLocation, CertEnumSystemStore, CertEnumPhysicalStore