Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / MS / Internal / Security / RightsManagement / NativeRightsManagementAPIsStructures.cs / 1305600 / NativeRightsManagementAPIsStructures.cs
//------------------------------------------------------------------------------
//
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Description:
// These are the Structure declarations for interop services required to call into unmanaged
// Promethium Rights Management SDK APIs
//
// History:
// 06/13/2005: IgorBel: Initial implementation.
//
//-----------------------------------------------------------------------------
#define PRESENTATION_HOST_DLL
// for "PresentationHostDLL.dll"
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Security;
namespace MS.Internal.Security.RightsManagement
{
///
/// Critical: This class server as a wrapper on top of private class UnsafeNativeMethods.
/// UnsafeNativeMethods has suppress unamanged code attribute set.
/// It is up to this class to ensure that the only calls that can go through must beeither done in Full Trust
/// or with RightsManagementPermission. This class exposes DRMFoo functions that perform demand on the
/// RightsManagementPermission and then call through to the matching member of the Private Static class
/// UnsafeNativeMethods
///
[SecurityCritical(SecurityCriticalScope.Everything)]
[StructLayout(LayoutKind.Sequential)]
internal class ActivationServerInfo
{
public uint Version;
[MarshalAs( UnmanagedType.LPWStr )]internal string PubKey = "";
[MarshalAs( UnmanagedType.LPWStr )]internal string Url = "";
}
///
/// Critical: This class server as a wrapper on top of private class UnsafeNativeMethods.
/// UnsafeNativeMethods has suppress unamanged code attribute set.
/// It is up to this class to ensure that the only calls that can go through must beeither done in Full Trust
/// or with RightsManagementPermission. This class exposes DRMFoo functions that perform demand on the
/// RightsManagementPermission and then call through to the matching member of the Private Static class
/// UnsafeNativeMethods
///
[SecurityCritical(SecurityCriticalScope.Everything)]
// Declare a class to represent unmanaged SYSTEMTIME structure expected by DRM SDK
[ StructLayout( LayoutKind.Sequential )]
internal class SystemTime
{
internal SystemTime (DateTime dateTime)
{
Year = (ushort)dateTime.Year;
Month = (ushort)dateTime.Month;
DayOfWeek = (ushort)dateTime.DayOfWeek;
Day = (ushort)dateTime.Day;
Hour = (ushort)dateTime.Hour;
Minute = (ushort)dateTime.Minute;
Second = (ushort)dateTime.Second;
Milliseconds = (ushort)dateTime.Millisecond;
}
static internal uint Size
{
get
{
return 8 * sizeof(short);
}
}
// construct it from memory buffer
internal SystemTime(byte[] dataBuffer)
{
Year = BitConverter.ToUInt16(dataBuffer,0);
Month = BitConverter.ToUInt16(dataBuffer,2);
DayOfWeek = BitConverter.ToUInt16(dataBuffer,4);
Day = BitConverter.ToUInt16(dataBuffer,6);
Hour = BitConverter.ToUInt16(dataBuffer,8);
Minute = BitConverter.ToUInt16(dataBuffer,10);
Second = BitConverter.ToUInt16(dataBuffer,12);
Milliseconds = BitConverter.ToUInt16(dataBuffer,14);
}
internal DateTime GetDateTime (DateTime defaultValue)
{
// It seems that unmanaged APIs use the all 0s values to indicate
// that Date Time isn't present
if ((Year == 0) &&
(Month == 0) &&
(Day == 0) &&
(Hour == 0) &&
(Minute == 0) &&
(Second == 0) &&
(Milliseconds == 0))
{
return defaultValue;
}
else
{
return new DateTime(Year, Month, Day,
Hour, Minute, Second, Milliseconds);
}
}
ushort Year =0;
ushort Month =0;
ushort DayOfWeek =0;
ushort Day =0;
ushort Hour =0;
ushort Minute =0;
ushort Second =0;
ushort Milliseconds =0;
}
///
/// Critical: This class server as a wrapper on top of private class UnsafeNativeMethods.
/// UnsafeNativeMethods has suppress unamanged code attribute set.
/// It is up to this class to ensure that the only calls that can go through must beeither done in Full Trust
/// or with RightsManagementPermission. This class exposes DRMFoo functions that perform demand on the
/// RightsManagementPermission and then call through to the matching member of the Private Static class
/// UnsafeNativeMethods
///
[SecurityCritical(SecurityCriticalScope.Everything)]
[StructLayout(LayoutKind.Sequential)]
internal class BoundLicenseParams
{
internal uint uVersion = 0;
internal uint hEnablingPrincipal = 0;
internal uint hSecureStore = 0;
[MarshalAs( UnmanagedType.LPWStr )]public string wszRightsRequested = null;
[MarshalAs( UnmanagedType.LPWStr )]public string wszRightsGroup = null;
//Actual members of DRMID
internal uint DRMIDuVersion = 0;
[MarshalAs( UnmanagedType.LPWStr )]public string DRMIDIdType = null;
[MarshalAs( UnmanagedType.LPWStr )]public string DRMIDId = null;
internal uint cAuthenticatorCount = 0;//reserved.should be 0.
internal IntPtr rghAuthenticators = IntPtr.Zero;
[MarshalAs( UnmanagedType.LPWStr )]public string wszDefaultEnablingPrincipalCredentials = null;
internal uint dwFlags = 0;
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Description:
// These are the Structure declarations for interop services required to call into unmanaged
// Promethium Rights Management SDK APIs
//
// History:
// 06/13/2005: IgorBel: Initial implementation.
//
//-----------------------------------------------------------------------------
#define PRESENTATION_HOST_DLL
// for "PresentationHostDLL.dll"
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Security;
namespace MS.Internal.Security.RightsManagement
{
///
/// Critical: This class server as a wrapper on top of private class UnsafeNativeMethods.
/// UnsafeNativeMethods has suppress unamanged code attribute set.
/// It is up to this class to ensure that the only calls that can go through must beeither done in Full Trust
/// or with RightsManagementPermission. This class exposes DRMFoo functions that perform demand on the
/// RightsManagementPermission and then call through to the matching member of the Private Static class
/// UnsafeNativeMethods
///
[SecurityCritical(SecurityCriticalScope.Everything)]
[StructLayout(LayoutKind.Sequential)]
internal class ActivationServerInfo
{
public uint Version;
[MarshalAs( UnmanagedType.LPWStr )]internal string PubKey = "";
[MarshalAs( UnmanagedType.LPWStr )]internal string Url = "";
}
///
/// Critical: This class server as a wrapper on top of private class UnsafeNativeMethods.
/// UnsafeNativeMethods has suppress unamanged code attribute set.
/// It is up to this class to ensure that the only calls that can go through must beeither done in Full Trust
/// or with RightsManagementPermission. This class exposes DRMFoo functions that perform demand on the
/// RightsManagementPermission and then call through to the matching member of the Private Static class
/// UnsafeNativeMethods
///
[SecurityCritical(SecurityCriticalScope.Everything)]
// Declare a class to represent unmanaged SYSTEMTIME structure expected by DRM SDK
[ StructLayout( LayoutKind.Sequential )]
internal class SystemTime
{
internal SystemTime (DateTime dateTime)
{
Year = (ushort)dateTime.Year;
Month = (ushort)dateTime.Month;
DayOfWeek = (ushort)dateTime.DayOfWeek;
Day = (ushort)dateTime.Day;
Hour = (ushort)dateTime.Hour;
Minute = (ushort)dateTime.Minute;
Second = (ushort)dateTime.Second;
Milliseconds = (ushort)dateTime.Millisecond;
}
static internal uint Size
{
get
{
return 8 * sizeof(short);
}
}
// construct it from memory buffer
internal SystemTime(byte[] dataBuffer)
{
Year = BitConverter.ToUInt16(dataBuffer,0);
Month = BitConverter.ToUInt16(dataBuffer,2);
DayOfWeek = BitConverter.ToUInt16(dataBuffer,4);
Day = BitConverter.ToUInt16(dataBuffer,6);
Hour = BitConverter.ToUInt16(dataBuffer,8);
Minute = BitConverter.ToUInt16(dataBuffer,10);
Second = BitConverter.ToUInt16(dataBuffer,12);
Milliseconds = BitConverter.ToUInt16(dataBuffer,14);
}
internal DateTime GetDateTime (DateTime defaultValue)
{
// It seems that unmanaged APIs use the all 0s values to indicate
// that Date Time isn't present
if ((Year == 0) &&
(Month == 0) &&
(Day == 0) &&
(Hour == 0) &&
(Minute == 0) &&
(Second == 0) &&
(Milliseconds == 0))
{
return defaultValue;
}
else
{
return new DateTime(Year, Month, Day,
Hour, Minute, Second, Milliseconds);
}
}
ushort Year =0;
ushort Month =0;
ushort DayOfWeek =0;
ushort Day =0;
ushort Hour =0;
ushort Minute =0;
ushort Second =0;
ushort Milliseconds =0;
}
///
/// Critical: This class server as a wrapper on top of private class UnsafeNativeMethods.
/// UnsafeNativeMethods has suppress unamanged code attribute set.
/// It is up to this class to ensure that the only calls that can go through must beeither done in Full Trust
/// or with RightsManagementPermission. This class exposes DRMFoo functions that perform demand on the
/// RightsManagementPermission and then call through to the matching member of the Private Static class
/// UnsafeNativeMethods
///
[SecurityCritical(SecurityCriticalScope.Everything)]
[StructLayout(LayoutKind.Sequential)]
internal class BoundLicenseParams
{
internal uint uVersion = 0;
internal uint hEnablingPrincipal = 0;
internal uint hSecureStore = 0;
[MarshalAs( UnmanagedType.LPWStr )]public string wszRightsRequested = null;
[MarshalAs( UnmanagedType.LPWStr )]public string wszRightsGroup = null;
//Actual members of DRMID
internal uint DRMIDuVersion = 0;
[MarshalAs( UnmanagedType.LPWStr )]public string DRMIDIdType = null;
[MarshalAs( UnmanagedType.LPWStr )]public string DRMIDId = null;
internal uint cAuthenticatorCount = 0;//reserved.should be 0.
internal IntPtr rghAuthenticators = IntPtr.Zero;
[MarshalAs( UnmanagedType.LPWStr )]public string wszDefaultEnablingPrincipalCredentials = null;
internal uint dwFlags = 0;
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RoutedEventConverter.cs
- NumericUpDown.cs
- HttpCachePolicyWrapper.cs
- PenLineCapValidation.cs
- PersonalizableAttribute.cs
- ListenerElementsCollection.cs
- ResumeStoryboard.cs
- WebPartVerbCollection.cs
- TagMapInfo.cs
- LayoutDump.cs
- ArgumentException.cs
- SmtpNegotiateAuthenticationModule.cs
- HeaderedContentControl.cs
- Propagator.cs
- SerialReceived.cs
- LiteralControl.cs
- InternalMappingException.cs
- ISessionStateStore.cs
- OpenTypeMethods.cs
- MimeXmlImporter.cs
- ToolStripDropTargetManager.cs
- ParseHttpDate.cs
- PropertyChangeTracker.cs
- webproxy.cs
- FastPropertyAccessor.cs
- Socket.cs
- DecimalKeyFrameCollection.cs
- FunctionOverloadResolver.cs
- OperationFormatStyle.cs
- MsdtcClusterUtils.cs
- XamlVector3DCollectionSerializer.cs
- WindowsGraphicsWrapper.cs
- XmlSerializerAssemblyAttribute.cs
- SoapObjectInfo.cs
- XmlWellformedWriter.cs
- BamlTreeNode.cs
- VirtualPathProvider.cs
- AsyncPostBackErrorEventArgs.cs
- OdbcErrorCollection.cs
- PreservationFileReader.cs
- UiaCoreProviderApi.cs
- UrlMappingsSection.cs
- StandardOleMarshalObject.cs
- TextOptionsInternal.cs
- IntSecurity.cs
- QueryStringParameter.cs
- HtmlUtf8RawTextWriter.cs
- StorageRoot.cs
- MessageSecurityVersion.cs
- ExpressionCopier.cs
- ExpressionParser.cs
- OperationPickerDialog.cs
- ContractTypeNameElement.cs
- DbParameterHelper.cs
- FormatterServices.cs
- PageTheme.cs
- MailDefinitionBodyFileNameEditor.cs
- Matrix3D.cs
- documentsequencetextpointer.cs
- FlowDocumentView.cs
- ImageCollectionEditor.cs
- OleDbTransaction.cs
- GridToolTip.cs
- UnsafeNativeMethods.cs
- InputLanguageSource.cs
- MailBnfHelper.cs
- CultureTable.cs
- DataGridViewCellStyleConverter.cs
- DataGridPagerStyle.cs
- DiscoveryDocumentSerializer.cs
- ExpressionVisitorHelpers.cs
- ReflectPropertyDescriptor.cs
- altserialization.cs
- OleDbSchemaGuid.cs
- OwnerDrawPropertyBag.cs
- Root.cs
- PersonalizablePropertyEntry.cs
- DetailsViewRow.cs
- WebServiceTypeData.cs
- StyleSelector.cs
- _SslState.cs
- ExceptionUtil.cs
- ManualResetEvent.cs
- PointConverter.cs
- RelationalExpressions.cs
- MinimizableAttributeTypeConverter.cs
- WebServiceData.cs
- WebUtil.cs
- CellLabel.cs
- RadioButtonPopupAdapter.cs
- Icon.cs
- LinqMaximalSubtreeNominator.cs
- CodeArrayCreateExpression.cs
- CommandConverter.cs
- MDIControlStrip.cs
- MappingItemCollection.cs
- XmlWhitespace.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- TextTabProperties.cs
- Base64WriteStateInfo.cs