diff options
author | jmpoep <OriginalEntryPoint@qq.com> | 2023-12-07 16:51:07 +0800 |
---|---|---|
committer | jmpoep <OriginalEntryPoint@qq.com> | 2023-12-07 16:51:07 +0800 |
commit | 28008a746a31abb7909dd86cb0cd413ac8943b0b (patch) | |
tree | a30b74b8cad548048c3c1551d652828ab76fa9bd /examples/dotnet/forms_cil | |
download | vmprotect-3.5.1-master.tar vmprotect-3.5.1-master.tar.gz vmprotect-3.5.1-master.tar.bz2 vmprotect-3.5.1-master.zip |
Diffstat (limited to 'examples/dotnet/forms_cil')
-rw-r--r-- | examples/dotnet/forms_cil/App.config | 6 | ||||
-rw-r--r-- | examples/dotnet/forms_cil/Form1.Designer.cs | 86 | ||||
-rw-r--r-- | examples/dotnet/forms_cil/Form1.cs | 33 | ||||
-rw-r--r-- | examples/dotnet/forms_cil/Form1.resx | 120 | ||||
-rw-r--r-- | examples/dotnet/forms_cil/Program.cs | 19 | ||||
-rw-r--r-- | examples/dotnet/forms_cil/Properties/AssemblyInfo.cs | 19 | ||||
-rw-r--r-- | examples/dotnet/forms_cil/forms_cil.csproj | 68 |
7 files changed, 351 insertions, 0 deletions
diff --git a/examples/dotnet/forms_cil/App.config b/examples/dotnet/forms_cil/App.config new file mode 100644 index 0000000..58262a1 --- /dev/null +++ b/examples/dotnet/forms_cil/App.config @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> + </startup> +</configuration> diff --git a/examples/dotnet/forms_cil/Form1.Designer.cs b/examples/dotnet/forms_cil/Form1.Designer.cs new file mode 100644 index 0000000..f9d0410 --- /dev/null +++ b/examples/dotnet/forms_cil/Form1.Designer.cs @@ -0,0 +1,86 @@ +namespace forms_cil +{ + partial class Form1 + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.txtPassword = new System.Windows.Forms.TextBox(); + this.btnCheckPassword = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(13, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(56, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Password:"; + // + // txtPassword + // + this.txtPassword.Location = new System.Drawing.Point(75, 10); + this.txtPassword.Name = "txtPassword"; + this.txtPassword.Size = new System.Drawing.Size(192, 20); + this.txtPassword.TabIndex = 1; + // + // btnCheckPassword + // + this.btnCheckPassword.DialogResult = System.Windows.Forms.DialogResult.OK; + this.btnCheckPassword.Location = new System.Drawing.Point(273, 8); + this.btnCheckPassword.Name = "btnCheckPassword"; + this.btnCheckPassword.Size = new System.Drawing.Size(98, 23); + this.btnCheckPassword.TabIndex = 2; + this.btnCheckPassword.Text = "Check password"; + this.btnCheckPassword.UseVisualStyleBackColor = true; + this.btnCheckPassword.Click += new System.EventHandler(this.btnCheckPassword_Click); + // + // Form1 + // + this.AcceptButton = this.btnCheckPassword; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(384, 40); + this.Controls.Add(this.btnCheckPassword); + this.Controls.Add(this.txtPassword); + this.Controls.Add(this.label1); + this.Name = "Form1"; + this.Text = "VMProtect test [FormsCIL]"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox txtPassword; + private System.Windows.Forms.Button btnCheckPassword; + } +} + diff --git a/examples/dotnet/forms_cil/Form1.cs b/examples/dotnet/forms_cil/Form1.cs new file mode 100644 index 0000000..a19ec42 --- /dev/null +++ b/examples/dotnet/forms_cil/Form1.cs @@ -0,0 +1,33 @@ +using System; +using System.Reflection; +using System.Windows.Forms; + +namespace forms_cil +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + private bool CheckPassword(string pwd) + { + UInt64 magicNum; + return (UInt64.TryParse(pwd, out magicNum) && magicNum % 17 == 13); + } + + [VMProtect.BeginVirtualization] + private void btnCheckPassword_Click(object sender, EventArgs e) + { + if (CheckPassword(txtPassword.Text)) + { + MessageBox.Show(VMProtect.SDK.DecryptString("Correct password"), VMProtect.SDK.DecryptString("Password check"), MessageBoxButtons.OK, MessageBoxIcon.Information); + } else + { + MessageBox.Show(VMProtect.SDK.DecryptString("Incorrect password"), VMProtect.SDK.DecryptString("Password check"), MessageBoxButtons.OK, MessageBoxIcon.Error); + txtPassword.Focus(); + } + } + } +}
\ No newline at end of file diff --git a/examples/dotnet/forms_cil/Form1.resx b/examples/dotnet/forms_cil/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/examples/dotnet/forms_cil/Form1.resx @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/examples/dotnet/forms_cil/Program.cs b/examples/dotnet/forms_cil/Program.cs new file mode 100644 index 0000000..a9d0f2c --- /dev/null +++ b/examples/dotnet/forms_cil/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Windows.Forms; + +namespace forms_cil +{ + static class Program + { + /// <summary> + /// The main entry point for the application. + /// </summary> + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/examples/dotnet/forms_cil/Properties/AssemblyInfo.cs b/examples/dotnet/forms_cil/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..bc8caf9 --- /dev/null +++ b/examples/dotnet/forms_cil/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +using System.Diagnostics; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Versioning; + +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: RuntimeCompatibility(WrapNonExceptionThrows=true)] +[assembly: AssemblyTrademark("")] +[assembly: CompilationRelaxations(8)] +[assembly: AssemblyTitle("forms_cil")] +[assembly: AssemblyProduct("forms_cil")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: ComVisible(false)] +[assembly: Guid("31c4f344-7d2d-4fcc-8cf5-3c6d368ad135")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Debuggable((DebuggableAttribute.DebuggingModes.DisableOptimizations | (DebuggableAttribute.DebuggingModes.EnableEditAndContinue | (DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.Default))))]
\ No newline at end of file diff --git a/examples/dotnet/forms_cil/forms_cil.csproj b/examples/dotnet/forms_cil/forms_cil.csproj new file mode 100644 index 0000000..60fe8ca --- /dev/null +++ b/examples/dotnet/forms_cil/forms_cil.csproj @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{A4B06446-0E0E-468B-B07C-AA45583A031A}</ProjectGuid> + <OutputType>WinExe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>forms_cil</RootNamespace> + <AssemblyName>forms_cil</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <TargetFrameworkProfile /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="VMProtect.SDK"> + <HintPath>..\..\..\bin\VMProtect.SDK.dll</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="Form1.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="Form1.Designer.cs"> + <DependentUpon>Form1.cs</DependentUpon> + </Compile> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <EmbeddedResource Include="Form1.resx"> + <DependentUpon>Form1.cs</DependentUpon> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file |