Use PascalCase with enum and struct names
MODIFY
WalletWasabi.Packager/NSubsys/NSubsysUtil.cs
WalletWasabi.Packager/NSubsys/NSubsysUtil.cs
@@ -22,19 +22,19 @@ namespace NSubsys
var subsysOffset = peFile.MainHeaderOffset;
subsysVal = (SubSystemType)peFile.OptionalHeader.Subsystem;
- subsysOffset += Marshal.OffsetOf<IMAGE_OPTIONAL_HEADER>(nameof(IMAGE_OPTIONAL_HEADER.Subsystem)).ToInt32();
+ subsysOffset += Marshal.OffsetOf<ImageOptionalHeader>(nameof(ImageOptionalHeader.Subsystem)).ToInt32();
switch (subsysVal)
{
- case PeUtility.SubSystemType.IMAGE_SUBSYSTEM_WINDOWS_GUI:
+ case PeUtility.SubSystemType.ImageSubSystemWindowsGui:
Console.WriteLine("NSubsys: Executable file is already a Win32 App!");
return true;
- case PeUtility.SubSystemType.IMAGE_SUBSYSTEM_WINDOWS_CUI:
+ case PeUtility.SubSystemType.ImageSubSystemWindowsCui:
Console.WriteLine("NSubsys: Console app detected...");
Console.WriteLine("NSubsys: Converting...");
- var subsysSetting = BitConverter.GetBytes((ushort)SubSystemType.IMAGE_SUBSYSTEM_WINDOWS_GUI);
+ var subsysSetting = BitConverter.GetBytes((ushort)SubSystemType.ImageSubSystemWindowsGui);
if (!BitConverter.IsLittleEndian)
{

MODIFY
WalletWasabi.Packager/NSubsys/PeUtility.cs
WalletWasabi.Packager/NSubsys/PeUtility.cs
@@ -9,19 +9,19 @@ namespace NSubsys
{
public enum SubSystemType : ushort
{
- IMAGE_SUBSYSTEM_WINDOWS_GUI = 2,
- IMAGE_SUBSYSTEM_WINDOWS_CUI = 3
+ ImageSubSystemWindowsGui = 2,
+ ImageSubSystemWindowsCui = 3
}
[StructLayout(LayoutKind.Explicit)]
- public struct IMAGE_DOS_HEADER
+ public struct ImageDosHeader
{
[FieldOffset(60)]
public uint e_lfanew;
}
[StructLayout(LayoutKind.Explicit)]
- public struct IMAGE_OPTIONAL_HEADER
+ public struct ImageOptionalHeader
{
[FieldOffset(68)]
public ushort Subsystem;
@@ -30,7 +30,7 @@ namespace NSubsys
/// <summary>
/// Gets the optional header
/// </summary>
- public IMAGE_OPTIONAL_HEADER OptionalHeader { get; }
+ public ImageOptionalHeader OptionalHeader { get; }
/// <summary>
/// Gets the PE file stream for R/W functions.
@@ -47,14 +47,14 @@ namespace NSubsys
var reader = new BinaryReader(Stream);
- var dosHeader = FromBinaryReader<IMAGE_DOS_HEADER>(reader);
+ var dosHeader = FromBinaryReader<ImageDosHeader>(reader);
// Seek the new PE Header and skip NtHeadersSignature (4 bytes) & IMAGE_FILE_HEADER struct (20bytes).
Stream.Seek(dosHeader.e_lfanew + 4 + 20, SeekOrigin.Begin);
MainHeaderOffset = Stream.Position;
- OptionalHeader = FromBinaryReader<IMAGE_OPTIONAL_HEADER>(reader);
+ OptionalHeader = FromBinaryReader<ImageOptionalHeader>(reader);
InternalBinReader = reader;
}

Use PascalCase with enum and struct names