[The AD RMS SDK leveraging functionality exposed by
the client in Msdrm.dll is available for use in Windows Server 2008, Windows Vista, Windows Server 2008 R2, Windows 7, Windows Server 2012, and Windows 8. It may be altered or
unavailable in subsequent versions. Instead, use Active Directory Rights Management Services SDK 2.1,
which leverages functionality exposed by the client in Msipc.dll.]
The DRMLoadLibrary function loads a handle to an approved library, as determined by the credentials.
DRMEXPORT HRESULT UDAPICALL DRMLoadLibrary( IN DRMENVHANDLE hEnv, IN DRMSPECTYPE eSpecification, PWSTR wszLibraryProvider, PWSTR wszCredentials, OUT DRMHANDLE *phLibrary );
A handle to an environment, created by DRMInitEnvironment.
The library provider type.
Name and optional path to the DLL. Every DLL must have a unique name. If similarly named DLLs are loaded, even if they are in different paths, only the first item will be included in the manifest and checked.
Reserved, must be NULL. The DLL that is loaded must be referenced in the application manifest loaded by DRMInitEnvironment.
A handle to the library.
If the function succeeds, the function returns S_OK.
If the function fails, it returns an HRESULT value that indicates the error. Possible values include, but are not limited to, those in the following list. For a list of common error codes, see Common HRESULT Values.
This function is a secure version of the LoadLibrary function, however it does not support the extra options of LoadLibraryEx. The returned handle corresponds to the HMODULE output by LoadLibrary. To close the handle returned, call DRMCloseHandle, not FreeLibrary. By default, the current directory is the only location this function searches for a library. Any other directory must be specified by either a full path, or a path relative to the current directory. Use DRMGetProcAddress, the secure version of the GetProcAddress function, to get function addresses in loaded libraries.
Dependencies of the loaded DLL will also be loaded, provided they are included in the plug-in credentials and are properly signed. If the DLL has already been loaded, the function will return S_OK and return a pointer to the same handle.