|I need to invoke functions of the Microsoft Office Protector (OpcIrmProtector) from C#. This protector implements the
I_IrmProtector interface (details: http://msdn.microsoft.com/en-us/library/ms475158%28v=office.14%29.aspx[^]). Calling
HrInit() is no problem.
But for e.g.
HrIsProtected() I need to provide an implementation of
ILockBytes. Has anybody experience how to correctly implement
ILockBytes in managed code? I am a bit at a loss as to what is expected here.
For unmanaged code I found a sample that uses
CreateILockBytesOnHGlobal(). This returns an unmanaged instance of
ILockBytes. Is there any chance of using this unmanaged instance from managed code (probably not...) or marshalling it into a managed structure? Or is there a similar method for C#? In that case I wouldn't have to implement
ILockBytes, which would save me a lot of time.
Of course, I could implement this part in unmanaged code, but I'd prefer a solution in managed code, if possible...