Skip to content

Commit

Permalink
Ensure program runs as 32 bit, fix window layout, start as maximized
Browse files Browse the repository at this point in the history
  • Loading branch information
SamVanheer committed Aug 13, 2023
1 parent bb8d11a commit 2a3b921
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 18 deletions.
31 changes: 24 additions & 7 deletions NativeDllTester/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,31 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:NativeDllTester"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
Title="Native Dll Tester" Height="450" Width="800"
WindowStartupLocation="CenterScreen"
WindowState="Maximized">
<Grid>
<TextBox Name="FilePath" HorizontalAlignment="Left" Height="23" Margin="10,10,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="550" />
<Button Content="Browse" Click="OnBrowse" HorizontalAlignment="Left" Margin="565,13,0,0" VerticalAlignment="Top" Width="75"/>
<Button Content="Load" Click="OnLoad" HorizontalAlignment="Left" Margin="645,13,0,0" VerticalAlignment="Top" Width="75"/>
<TextBox Name="ErrorCode" HorizontalAlignment="Left" Height="23" Margin="82,38,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="478" IsReadOnly="True"/>
<Label Content="Error code:" HorizontalAlignment="Left" Margin="10,35,0,0" VerticalAlignment="Top"/>
<TextBox Name="ErrorMessage" HorizontalAlignment="Left" Height="94" Margin="10,66,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="550" IsReadOnly="True"/>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>

<Label Grid.Row="0" Grid.Column="0" Content="Mod dll:"/>
<TextBox Grid.Row="0" Grid.Column="1" Name="FilePath" TextWrapping="Wrap"/>
<Button Grid.Row="0" Grid.Column="2" Content="Browse" Click="OnBrowse"/>


<Label Grid.Row="1" Grid.Column="0" Content="Error code:"/>
<TextBox Grid.Row="1" Grid.Column="1" Name="ErrorCode" TextWrapping="Wrap" IsReadOnly="True"/>
<Button Grid.Row="1" Grid.Column="2" Content="Load" Click="OnLoad"/>

<TextBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" Name="ErrorMessage" TextWrapping="Wrap" IsReadOnly="True"/>
</Grid>
</Window>
2 changes: 1 addition & 1 deletion NativeDllTester/NativeDllTester.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
Expand Down
8 changes: 4 additions & 4 deletions NativeDllTester/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
[assembly: AssemblyTitle("NativeDllTester")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("Sam Vanheer")]
[assembly: AssemblyProduct("NativeDllTester")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

This is a small tool to get the error code returned by `LoadLibrary` when it fails to load a library.

Enter the path to the dll or click Browse to select it, then click Load

If an error occurs, the `Error Code` field contains the native error code

1. Place the executable in your Half-Life directory
2. Launch the program
3. Enter the path to the dll or click Browse to select it, then click Load
4. If an error occurs, the `Error Code` field contains the native error code.
The translated error message is displayed in the field below

Error messages are translated by C#'s `Win32Exception` class, so it can't be displayed in English
Error messages are translated by C#'s `Win32Exception` class, so it can't be displayed in English.

See the [List of Error Codes](https://docs.microsoft.com/en-us/windows/desktop/debug/system-error-codes) to find the corresponding name and description in English
See the [List of Error Codes](https://docs.microsoft.com/en-us/windows/desktop/debug/system-error-codes) to find the corresponding name and description in English.

0 comments on commit 2a3b921

Please sign in to comment.