PageRenderTime 16ms CodeModel.GetById 10ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/Visual Studio 2008/VBMonitorRegistryChange/RegistryKeyChangeEventArg.vb

#
Visual Basic | 80 lines | 47 code | 9 blank | 24 comment | 0 complexity | 4cc18bad4f5e50eebd807e43944c6221 MD5 | raw file
 1'*************************** Module Header ******************************\
 2' Module Name:  RegistryKeyChangeEventArgs.vb
 3' Project:	    VBMonitorRegistryChange
 4' Copyright (c) Microsoft Corporation.
 5' 
 6' This class derived from EventArgs. It is used to wrap the ManagementBaseObject of
 7' EventArrivedEventArgs.
 8' 
 9' This source is subject to the Microsoft Public License.
10' See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
11' All other rights reserved.
12' 
13' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
14' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
15' WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
16'**************************************************************************
17
18Imports System.Management
19
20Friend Class RegistryKeyChangeEventArgs
21    Inherits EventArgs
22
23    Dim _hive As String
24    Public Property Hive() As String
25        Get
26            Return _hive
27        End Get
28        Set(ByVal value As String)
29            _hive = value
30        End Set
31    End Property
32
33    Dim _keyPath As String
34    Public Property KeyPath() As String
35        Get
36            Return _keyPath
37        End Get
38        Set(ByVal value As String)
39            _keyPath = value
40        End Set
41    End Property
42
43    Dim _SECURITY_DESCRIPTOR As UInteger()
44    Public Property SECURITY_DESCRIPTOR() As UInteger()
45        Get
46            Return _SECURITY_DESCRIPTOR
47        End Get
48        Set(ByVal value As UInteger())
49            _SECURITY_DESCRIPTOR = value
50        End Set
51    End Property
52
53    Dim _TIME_CREATED As Date
54    Public Property TIME_CREATED() As Date
55        Get
56            Return _TIME_CREATED
57        End Get
58        Set(ByVal value As Date)
59            _TIME_CREATED = value
60        End Set
61    End Property
62
63    Public Sub New(ByVal arrivedEvent As ManagementBaseObject)
64
65        ' Class RegistryKeyChangeEvent has following properties: Hive, KeyPath, 
66        ' SECURITY_DESCRIPTOR and TIME_CREATED. These properties could get from
67        ' arrivedEvent.Properties.
68        Me.Hive = TryCast(arrivedEvent.Properties("Hive").Value, String)
69        Me.KeyPath = TryCast(arrivedEvent.Properties("KeyPath").Value, String)
70
71        ' The property TIME_CREATED is a unique value that indicates the time 
72        ' when an event is generated. 
73        ' This is a 64-bit FILETIME value that represents the number of 
74        ' 100-nanosecond intervals after January 1, 1601. The information is in
75        ' the Coordinated Universal Time (UTC) format. 
76        Me.TIME_CREATED = New Date( _
77            CLng(Fix(CULng(arrivedEvent.Properties("TIME_CREATED").Value))), _
78            DateTimeKind.Utc).AddYears(1600)
79    End Sub
80End Class