訓練
模組
Implement device registration - Training
This module examines the process of device restrigration and discusses how to register and enroll devices in Active Directory.
必須在新的 DLL 中提供在系統登錄中註冊新功能的支援,以及新的函式。 OID 支援函式 會提供此註冊的協助。 Regsvr32.exe註冊新的函式。 此工具隨附于 Windows。
新的 DLL 必須提供 DllRegisterServer 和 DllUnregisterServer 進入點,以供Regsvr32.exe使用。 CryptRegisterOIDFunction或CryptUnregisterOIDFunction等CryptoAPI函式可以在這些進入點內使用,如下列範例所示。
// The DllRegisterServer Entry Point
STDAPI DllRegisterServer(void)
{
if(!CryptRegisterOIDFunction(
X509_ASN_ENCODING, // Encoding type
CRYPT_OID_ENCODE_OBJECT_FUNC, // Function name
szOID_NEW_CERTIFICATE_TYPE, // OID
L"NewCert.dll", // Dll name
L"NewCertificateTypeEncodeObject" // Override function
)) // name
{
return E_FAIL;
}
else
{
return S_OK;
}
}
// The DllUnregisterServer Entry Point
STDAPI DllUnregisterServer(void)
{
HRESULT hr = S_OK;
if(!CryptUnregisterOIDFunction(
X509_ASN_ENCODING, // Encoding type
CRYPT_OID_ENCODE_OBJECT_FUNC, // Function name
szOID_NEW_CERTIFICATE_TYPE // OID
))
{
if(ERROR_FILE_NOT_FOUND != GetLastError())
hr = E_FAIL;
}
return hr;
}
這個範例必須編譯並連結至新的 DLL。 必須匯出這兩個進入點以及函式進入點。
若要在電腦上安裝新功能,請從命令提示字元執行Regsvr32.exe,並指定新 DLL 的名稱和路徑。 Regsvr32.exe透過DllRegisterServer函式進入點存取CryptRegisterOIDFunction函式,並註冊新的函式和 DLL。
訓練
模組
Implement device registration - Training
This module examines the process of device restrigration and discusses how to register and enroll devices in Active Directory.