forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
System.Diagnostics.EventLog . Refactor DllImports (dotnet/corefx#33835)
* System.Diagnostics.EventLog . Refactor DllImports into Common\src\Interop * Using SafeEventLogReadHandle/SafeEventLogWriteHandle instead of SafeHandle Commit migrated from dotnet/corefx@547f7c4
- Loading branch information
Showing
15 changed files
with
220 additions
and
76 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
src/libraries/Common/src/Interop/Windows/advapi32/Interop.ClearEventLog.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Runtime.InteropServices; | ||
using Microsoft.Win32.SafeHandles; | ||
|
||
internal partial class Interop | ||
{ | ||
internal partial class Advapi32 | ||
{ | ||
[DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] | ||
public static extern bool ClearEventLog(SafeEventLogReadHandle hEventLog, string lpBackupFileName); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/libraries/Common/src/Interop/Windows/advapi32/Interop.CloseEventLog.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
internal partial class Interop | ||
{ | ||
internal partial class Advapi32 | ||
{ | ||
[DllImport(Libraries.Advapi32, SetLastError = true)] | ||
internal static extern bool CloseEventLog(IntPtr hEventLog); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/libraries/Common/src/Interop/Windows/advapi32/Interop.DeregisterEventSource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
internal partial class Interop | ||
{ | ||
internal partial class Advapi32 | ||
{ | ||
[DllImport(Libraries.Advapi32, SetLastError = true)] | ||
internal static extern bool DeregisterEventSource(IntPtr hEventLog); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/libraries/Common/src/Interop/Windows/advapi32/Interop.GetNumberOfEventLogRecords.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Runtime.InteropServices; | ||
using Microsoft.Win32.SafeHandles; | ||
|
||
internal partial class Interop | ||
{ | ||
internal partial class Advapi32 | ||
{ | ||
[DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] | ||
public static extern bool GetNumberOfEventLogRecords(SafeEventLogReadHandle hEventLog, out int NumberOfRecords); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/libraries/Common/src/Interop/Windows/advapi32/Interop.GetOldestEventLogRecord.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Runtime.InteropServices; | ||
using Microsoft.Win32.SafeHandles; | ||
|
||
internal partial class Interop | ||
{ | ||
internal partial class Advapi32 | ||
{ | ||
[DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] | ||
[return: MarshalAs(UnmanagedType.Bool)] | ||
public static extern bool GetOldestEventLogRecord(SafeEventLogReadHandle hEventLog, out int OldestRecord); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/libraries/Common/src/Interop/Windows/advapi32/Interop.NotifyChangeEventLog.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Runtime.InteropServices; | ||
using Microsoft.Win32.SafeHandles; | ||
|
||
internal partial class Interop | ||
{ | ||
internal partial class Advapi32 | ||
{ | ||
[DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] | ||
[return: MarshalAs(UnmanagedType.Bool)] | ||
public static extern bool NotifyChangeEventLog(SafeEventLogReadHandle hEventLog, SafeWaitHandle hEvent); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/libraries/Common/src/Interop/Windows/advapi32/Interop.OpenEventLog.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Runtime.InteropServices; | ||
using Microsoft.Win32.SafeHandles; | ||
|
||
internal partial class Interop | ||
{ | ||
internal partial class Advapi32 | ||
{ | ||
[DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] | ||
internal static extern SafeEventLogReadHandle OpenEventLog(string lpUNCServerName, string lpSourceName); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/libraries/Common/src/Interop/Windows/advapi32/Interop.ReadEventLog.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Runtime.InteropServices; | ||
using Microsoft.Win32.SafeHandles; | ||
|
||
internal partial class Interop | ||
{ | ||
internal partial class Advapi32 | ||
{ | ||
[DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] | ||
[return: MarshalAs(UnmanagedType.Bool)] | ||
public static extern bool ReadEventLog( | ||
SafeEventLogReadHandle hEventLog, | ||
int dwReadFlags, | ||
int dwRecordOffset, | ||
byte[] lpBuffer, | ||
int nNumberOfBytesRead, | ||
out int pnBytesRead, | ||
out int pnMinNumberOfBytesNeeded); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/libraries/Common/src/Interop/Windows/advapi32/Interop.RegisterEventSource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Runtime.InteropServices; | ||
using Microsoft.Win32.SafeHandles; | ||
|
||
internal partial class Interop | ||
{ | ||
internal partial class Advapi32 | ||
{ | ||
[DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] | ||
internal static extern SafeEventLogWriteHandle RegisterEventSource(string lpUNCServerName, string lpSourceName); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/libraries/Common/src/Interop/Windows/advapi32/Interop.ReportEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
using Microsoft.Win32.SafeHandles; | ||
|
||
internal partial class Interop | ||
{ | ||
internal partial class Advapi32 | ||
{ | ||
[DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] | ||
public static extern bool ReportEvent( | ||
SafeEventLogWriteHandle hEventLog, | ||
short wType, | ||
ushort wcategory, | ||
uint dwEventID, | ||
byte[] lpUserSid, | ||
short wNumStrings, | ||
int dwDataSize, | ||
IntPtr lpStrings, | ||
byte[] lpRawData); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.