IX509AttributeClientId::InitializeEncode method (certenroll.h)
The InitializeEncode method initializes the attribute from information about the user, client computer, and application that submitted the certificate request.
HRESULT InitializeEncode( RequestClientInfoClientId ClientId, BSTR strMachineDnsName, BSTR strUserSamName, BSTR strProcessName );
A RequestClientInfoClientId enumeration value that identifies the type of application that created the request. Examples include autoenrollment services, command-line request tools, and custom request applications.
A BSTR variable that contains the Domain Name System (DNS) name of the computer on which the request was created, for example ComputerName.contoso.com. If you do not supply a name, the method calls the GetComputerNameEx function. If a name cannot be found, the method fails.
A BSTR variable that contains the Security Accounts Manager (SAM) name for the user in the form DomainName\UserName. If you do not supply a name, the method calls the GetUserNameEx function. If a name cannot be found, the method fails.
A BSTR variable that contains the name of the application that created the certificate request. If you do not supply a name, the method calls the GetCommandLine() function and parses the command line. If a name cannot be found, the method fails.
If the function succeeds, the function returns S_OK.
If the function fails, it returns an HRESULT value that indicates the error. For a list of common error codes, see Common HRESULT Values.
The object identifier (OID) for this attribute is XCN_OID_REQUEST_CLIENT_INFO (220.127.116.11.4.1.311.21.20). For more information, see CERTENROLL_OBJECTID. The attribute is created as an Abstract Syntax Notation One (ASN.1) structure that is encoded by using Distinguished Encoding Rules (DER).
You must call either InitializeEncode or InitializeDecode before you can use an IX509AttributeClientId object. The two methods complement each other. The InitializeEncode method enables you to construct an encoded ASN.1 structure from raw data, and the InitializeDecode method enables you to initialize raw data from an encoded ASN.1 structure. You can call the following properties to retrieve the raw data:
|Minimum supported client||Windows Vista [desktop apps only]|
|Minimum supported server||Windows Server 2008 [desktop apps only]|