Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src-native-c/THNETII.WinApi.Sample.Native/main.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include <AccCtrl.h>
#include <Windows.h>

int main(int argc, char* argv[])
{
ACE_HEADER instance;
DWORD_PTR instance;
const int size = sizeof(instance);
const int value = ACE_OBJECT_TYPE_PRESENT;
const int value = FORMAT_MESSAGE_ALLOCATE_BUFFER;

const void* ptr = AccFree;
const void* ptr = FormatMessage;

return EXIT_SUCCESS;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.InteropServices;
using System.Text;
using THNETII.WinApi.Native.WinBase;
Expand All @@ -25,7 +25,7 @@ public static class ErrHandlingApiFunctions
/// </returns>
/// <remarks>
/// <para>Functions executed by the calling thread set this value by calling the <see cref="SetLastError"/> function. You should call the <see cref="GetLastError"/> function immediately when a function's return value indicates that such a call will return useful data. That is because some functions call <see cref="SetLastError"/> with a zero when they succeed, wiping out the error code set by the most recently failed function.</para>
/// <para>To obtain an error string for system error codes, use the <see cref="FormatMessage(FORMAT_MESSAGE_OPTIONS, IntPtr, int, int, StringBuilder, int, IntPtr)"/> function. For a complete list of error codes provided by the operating system, see <a href="https://msdn.microsoft.com/en-us/library/ms681381.aspx">System Error Codes</a>.</para>
/// <para>To obtain an error string for system error codes, use the <see cref="FormatMessage"/> function. For a complete list of error codes provided by the operating system, see <a href="https://msdn.microsoft.com/en-us/library/ms681381.aspx">System Error Codes</a>.</para>
/// <para>The error codes returned by a function are not part of the Windows API specification and can vary by operating system or device driver. For this reason, we cannot provide the complete list of error codes that can be returned by each function. There are also many functions whose documentation does not include even a partial list of error codes that can be returned.</para>
/// <para>Error codes are 32-bit values (bit 31 is the most significant bit). Bit 29 is reserved for application-defined error codes; no system error code has this bit set. If you are defining an error code for your application, set this bit to one. That indicates that the error code has been defined by an application, and ensures that your error code does not conflict with any error codes defined by the system.</para>
/// <para>To convert a system error into an <see cref="T:THNETII.WindowsProtocols.WindowsErrorCodes.HRESULT"/> value, use the <see cref="M:THNETII.WindowsProtocols.WindowsErrorCodes.HRESULT.FromWin32(System.Int32)"/> function.</para>
Expand All @@ -41,7 +41,7 @@ public static class ErrHandlingApiFunctions
/// </remarks>
/// <exception cref="DllNotFoundException">The native library containg the function could not be found.</exception>
/// <exception cref="EntryPointNotFoundException">Unable to find the entry point for the function in the native library.</exception>
/// <seealso cref="FormatMessage(FORMAT_MESSAGE_OPTIONS, IntPtr, int, int, StringBuilder, int, IntPtr)"/>
/// <seealso cref="FormatMessage"/>
/// <seealso cref="M:THNETII.WindowsProtocols.WindowsErrorCodes.HRESULT.FromWin32(System.Int32)"/>
/// <seealso cref="SetLastError"/>
/// <seealso cref="M:THNETII.WinApi.Native.WinUser.WinUserFunctions.SetLastErrorEx(System.Int32,THNETII.WinApi.Native.WinUser.SLE_TYPE)"/>
Expand Down
100 changes: 0 additions & 100 deletions src-native/THNETII.WinApi.Headers.WinBase/FORMAT_MESSAGE_OPTIONS.cs

This file was deleted.

28 changes: 19 additions & 9 deletions src-native/THNETII.WinApi.Headers.WinBase/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@


// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("Interoperability", "CA1401: P/Invokes should not be visible")]
[assembly: SuppressMessage("Usage", "PC003: Native API not available in UWP")]
[assembly: SuppressMessage("Globalization", "CA2101: Specify marshaling for P/Invoke string arguments")]
[assembly: SuppressMessage("Naming", "CA1707: Identifiers should not contain underscores")]
[assembly: SuppressMessage("Design", "CA1051: Do not declare visible instance fields")]
[assembly: SuppressMessage("Performance", "CA1815: Override equals and operator equals on value types")]
[assembly: SuppressMessage("Naming", "CA1714: Flags enums should have plural names")]
[assembly: SuppressMessage("Documentation", "CA1200: Avoid using cref tags with a prefix")]
[assembly: SuppressMessage("Design",
"CA1051: Do not declare visible instance fields")]
[assembly: SuppressMessage("Documentation",
"CA1200: Avoid using cref tags with a prefix")]
[assembly: SuppressMessage("Interoperability",
"CA1401: P/Invokes should not be visible")]
[assembly: SuppressMessage("Naming",
"CA1707: Identifiers should not contain underscores")]
[assembly: SuppressMessage("Naming",
"CA1714: Flags enums should have plural names")]
[assembly: SuppressMessage("Performance",
"CA1815: Override equals and operator equals on value types")]
[assembly: SuppressMessage("Globalization",
"CA2101: Specify marshaling for P/Invoke string arguments")]
[assembly: SuppressMessage("Documentation",
"CS0419: Ambiguous reference in cref attribute")]
[assembly: SuppressMessage("Usage",
"PC003: Native API not available in UWP")]
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<LangVersion>7.2</LangVersion>
<LangVersion>8</LangVersion>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>netstandard1.3;netstandard1.6;netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>CS1591</NoWarn>
<NoWarn>$(NoWarn);CS0419;CS1591</NoWarn>
<RootNamespace>THNETII.WinApi.Native.WinBase</RootNamespace>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Runtime.InteropServices;

namespace THNETII.WinApi.Native.WinBase
{

public static partial class WinBaseFunctions
{
// C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\um\errhandlingapi.h, line 96
#region SetLastError function
/// <inheritdoc cref="M:THNETII.WinApi.Native.ErrHandlingApi.ErrHandlingApiFunctions.SetLastError(System.Int32)"/>
[DllImport(NativeLibraryNames.Kernel32, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
private static extern void SetLastError(
[In] int dwErrCode
);
#endregion
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using System;
using System;
using System.Runtime.InteropServices;

using THNETII.WinApi.Native.MinWinDef;

using static THNETII.WinApi.Native.MinWinBase.LMEM_FLAGS;
#if NETSTANDARD1_3

#if NETSTANDARD1_6
using EntryPointNotFoundException = System.Exception;
#endif

Expand Down
Loading