You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(128) |
Jun
(97) |
Jul
(13) |
Aug
(40) |
Sep
(50) |
Oct
(27) |
Nov
(7) |
Dec
(15) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(18) |
Feb
(47) |
Mar
(7) |
Apr
|
May
|
Jun
|
Jul
(32) |
Aug
|
Sep
(14) |
Oct
(22) |
Nov
|
Dec
|
From: <br...@us...> - 2008-06-09 13:08:22
|
Revision: 231 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=231&view=rev Author: brus07 Date: 2008-06-09 06:08:31 -0700 (Mon, 09 Jun 2008) Log Message: ----------- Scroll to end of textlog, when update text Modified Paths: -------------- ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs ACMServer/trunk/TesterSolution/Tester/Form1.cs Modified: ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs 2008-06-09 11:52:40 UTC (rev 230) +++ ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs 2008-06-09 13:08:31 UTC (rev 231) @@ -52,6 +52,7 @@ this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.textBox1.Size = new System.Drawing.Size(268, 158); this.textBox1.TabIndex = 0; + this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); // // button1 // @@ -135,8 +136,8 @@ this.Controls.Add(this.textBox1); this.Name = "Form1"; this.Text = "Tester"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.Load += new System.EventHandler(this.Form1_Load); - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); this.ResumeLayout(false); Modified: ACMServer/trunk/TesterSolution/Tester/Form1.cs =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-06-09 11:52:40 UTC (rev 230) +++ ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-06-09 13:08:31 UTC (rev 231) @@ -81,5 +81,11 @@ StreamWriter sw = File.AppendText("testerlog.txt"); Log log = Log.GetLog(sw, Log.Priority.EMPTY); } + + private void textBox1_TextChanged(object sender, EventArgs e) + { + textBox1.Select(textBox1.Text.Length, 0); + textBox1.ScrollToCaret(); + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-09 11:52:33
|
Revision: 230 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=230&view=rev Author: brus07 Date: 2008-06-09 04:52:40 -0700 (Mon, 09 Jun 2008) Log Message: ----------- Sample to solve task "Load_from_dll" Added Paths: ----------- ACMServer/trunk/tasks/Load_from_dll/ ACMServer/trunk/tasks/Load_from_dll/BasePlug/ ACMServer/trunk/tasks/Load_from_dll/BasePlug/BasePlug.csproj ACMServer/trunk/tasks/Load_from_dll/BasePlug/ICreaterPlugin.cs ACMServer/trunk/tasks/Load_from_dll/BasePlug/Properties/ ACMServer/trunk/tasks/Load_from_dll/BasePlug/Properties/AssemblyInfo.cs ACMServer/trunk/tasks/Load_from_dll/Plugin1/ ACMServer/trunk/tasks/Load_from_dll/Plugin1/CreaterPlugin.cs ACMServer/trunk/tasks/Load_from_dll/Plugin1/Plugin1.csproj ACMServer/trunk/tasks/Load_from_dll/Plugin1/Plugin1.csproj.user ACMServer/trunk/tasks/Load_from_dll/Plugin1/Properties/ ACMServer/trunk/tasks/Load_from_dll/Plugin1/Properties/AssemblyInfo.cs ACMServer/trunk/tasks/Load_from_dll/PluginLoader.cs ACMServer/trunk/tasks/Load_from_dll/taskDll/ ACMServer/trunk/tasks/Load_from_dll/taskDll/PluginLoader.cs ACMServer/trunk/tasks/Load_from_dll/taskDll/Program.cs ACMServer/trunk/tasks/Load_from_dll/taskDll/Properties/ ACMServer/trunk/tasks/Load_from_dll/taskDll/Properties/AssemblyInfo.cs ACMServer/trunk/tasks/Load_from_dll/taskDll/taskDll.csproj ACMServer/trunk/tasks/Load_from_dll/taskDll/taskDll.csproj.user ACMServer/trunk/tasks/Load_from_dll/taskDll.sln Property changes on: ACMServer/trunk/tasks/Load_from_dll ___________________________________________________________________ Name: svn:ignore + *.suo Property changes on: ACMServer/trunk/tasks/Load_from_dll/BasePlug ___________________________________________________________________ Name: svn:ignore + bin obj Added: ACMServer/trunk/tasks/Load_from_dll/BasePlug/BasePlug.csproj =================================================================== --- ACMServer/trunk/tasks/Load_from_dll/BasePlug/BasePlug.csproj (rev 0) +++ ACMServer/trunk/tasks/Load_from_dll/BasePlug/BasePlug.csproj 2008-06-09 11:52:40 UTC (rev 230) @@ -0,0 +1,47 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{3DE17E44-206E-4FC6-A700-0EA0161A2DC4}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>BasePlug</RootNamespace> + <AssemblyName>BasePlug</AssemblyName> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <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' "> + <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.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="ICreaterPlugin.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\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 Added: ACMServer/trunk/tasks/Load_from_dll/BasePlug/ICreaterPlugin.cs =================================================================== --- ACMServer/trunk/tasks/Load_from_dll/BasePlug/ICreaterPlugin.cs (rev 0) +++ ACMServer/trunk/tasks/Load_from_dll/BasePlug/ICreaterPlugin.cs 2008-06-09 11:52:40 UTC (rev 230) @@ -0,0 +1,9 @@ +using System; + +namespace BasePlug +{ + public interface ICreaterPlugin + { + int calc(); + } +} Added: ACMServer/trunk/tasks/Load_from_dll/BasePlug/Properties/AssemblyInfo.cs =================================================================== --- ACMServer/trunk/tasks/Load_from_dll/BasePlug/Properties/AssemblyInfo.cs (rev 0) +++ ACMServer/trunk/tasks/Load_from_dll/BasePlug/Properties/AssemblyInfo.cs 2008-06-09 11:52:40 UTC (rev 230) @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("BasePlug")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Home")] +[assembly: AssemblyProduct("BasePlug")] +[assembly: AssemblyCopyright("Copyright © Home 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("94cb392c-2ca8-49c5-9368-31828939adbd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] Property changes on: ACMServer/trunk/tasks/Load_from_dll/Plugin1 ___________________________________________________________________ Name: svn:ignore + bin obj Added: ACMServer/trunk/tasks/Load_from_dll/Plugin1/CreaterPlugin.cs =================================================================== --- ACMServer/trunk/tasks/Load_from_dll/Plugin1/CreaterPlugin.cs (rev 0) +++ ACMServer/trunk/tasks/Load_from_dll/Plugin1/CreaterPlugin.cs 2008-06-09 11:52:40 UTC (rev 230) @@ -0,0 +1,13 @@ +using System; +using BasePlug; + +namespace Dll.Plugins +{ + public class CreaterPlugin: ICreaterPlugin + { + public int calc() + { + return 2+3; + } + } +} Added: ACMServer/trunk/tasks/Load_from_dll/Plugin1/Plugin1.csproj =================================================================== --- ACMServer/trunk/tasks/Load_from_dll/Plugin1/Plugin1.csproj (rev 0) +++ ACMServer/trunk/tasks/Load_from_dll/Plugin1/Plugin1.csproj 2008-06-09 11:52:40 UTC (rev 230) @@ -0,0 +1,53 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{CDE3968A-F7DE-4938-A5C8-22B0949B8565}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Plugin1</RootNamespace> + <AssemblyName>Plugin1</AssemblyName> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <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' "> + <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.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="CreaterPlugin.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\BasePlug\BasePlug.csproj"> + <Project>{3DE17E44-206E-4FC6-A700-0EA0161A2DC4}</Project> + <Name>BasePlug</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\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 Added: ACMServer/trunk/tasks/Load_from_dll/Plugin1/Plugin1.csproj.user =================================================================== --- ACMServer/trunk/tasks/Load_from_dll/Plugin1/Plugin1.csproj.user (rev 0) +++ ACMServer/trunk/tasks/Load_from_dll/Plugin1/Plugin1.csproj.user 2008-06-09 11:52:40 UTC (rev 230) @@ -0,0 +1,5 @@ +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <ProjectView>ProjectFiles</ProjectView> + </PropertyGroup> +</Project> \ No newline at end of file Added: ACMServer/trunk/tasks/Load_from_dll/Plugin1/Properties/AssemblyInfo.cs =================================================================== --- ACMServer/trunk/tasks/Load_from_dll/Plugin1/Properties/AssemblyInfo.cs (rev 0) +++ ACMServer/trunk/tasks/Load_from_dll/Plugin1/Properties/AssemblyInfo.cs 2008-06-09 11:52:40 UTC (rev 230) @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Plugin1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Home")] +[assembly: AssemblyProduct("Plugin1")] +[assembly: AssemblyCopyright("Copyright © Home 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("85c28bc9-eb2b-4087-8ede-502cc7aafba7")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] Added: ACMServer/trunk/tasks/Load_from_dll/PluginLoader.cs =================================================================== --- ACMServer/trunk/tasks/Load_from_dll/PluginLoader.cs (rev 0) +++ ACMServer/trunk/tasks/Load_from_dll/PluginLoader.cs 2008-06-09 11:52:40 UTC (rev 230) @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using TvEngine; +using TvLibrary.Log; +namespace SetupTv +{ + public class PluginLoader + { + List<ITvServerPlugin> _plugins = new List<ITvServerPlugin>(); + + /// <summary> + /// returns a list of all plugins loaded. + /// </summary> + /// <value>The plugins.</value> + public List<ITvServerPlugin> Plugins + { + get { return _plugins; } + } + /// <summary> + /// Loads all plugins. + /// </summary> + public void Load() + { + _plugins.Clear(); + try + { + if (System.IO.Directory.Exists("plugins")) + { + string[] strFiles = System.IO.Directory.GetFiles("plugins", "*.dll"); + foreach (string strFile in strFiles) + LoadPlugin(strFile); + } + } + catch (Exception) + { + } + } + /// <summary> + /// Loads the plugin. + /// </summary> + /// <param name="strFile">The STR file.</param> + void LoadPlugin(string strFile) + { + Type[] foundInterfaces = null; + + try + { + Assembly assem = Assembly.LoadFrom(strFile); + if (assem != null) + { + Type[] types = assem.GetExportedTypes(); + + foreach (Type t in types) + { + try + { + if (t.IsClass) + { + if (t.IsAbstract) continue; + + Object newObj = null; + ITvServerPlugin plugin = null; + TypeFilter myFilter2 = new TypeFilter(MyInterfaceFilter); + try + { + foundInterfaces = t.FindInterfaces(myFilter2, "TvEngine.ITvServerPlugin"); + if (foundInterfaces.Length > 0) + { + newObj = (object)Activator.CreateInstance(t); + plugin = (ITvServerPlugin)newObj; + _plugins.Add(plugin); + } + } + catch (System.Reflection.TargetInvocationException) + { + Log.WriteFile("PluginManager: {0} is incompatible with the current tvserver version and won't be loaded!", t.FullName); + continue; + } + catch (Exception iPluginException) + { + Log.WriteFile("Exception while loading IPlugin instances: {0}", t.FullName); + Log.WriteFile(iPluginException.ToString()); + Log.WriteFile(iPluginException.Message); + Log.WriteFile(iPluginException.StackTrace); + } + } + } + catch (System.NullReferenceException) + { } + } + } + } + catch (Exception ex) + { + Log.WriteFile("PluginManager: Plugin file {0} is broken or incompatible with the current tvserver version and won't be loaded!", strFile.Substring(strFile.LastIndexOf(@"\") + 1)); + Log.WriteFile("PluginManager: Exception: {0}", ex); + } + } + + bool MyInterfaceFilter(Type typeObj, Object criteriaObj) + { + return (typeObj.ToString().Equals(criteriaObj.ToString())); + } + + } +} Property changes on: ACMServer/trunk/tasks/Load_from_dll/taskDll ___________________________________________________________________ Name: svn:ignore + bin obj Added: ACMServer/trunk/tasks/Load_from_dll/taskDll/PluginLoader.cs =================================================================== --- ACMServer/trunk/tasks/Load_from_dll/taskDll/PluginLoader.cs (rev 0) +++ ACMServer/trunk/tasks/Load_from_dll/taskDll/PluginLoader.cs 2008-06-09 11:52:40 UTC (rev 230) @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using BasePlug; +using System.Reflection; + +namespace Other +{ + public class PluginLoader + { + List<ICreaterPlugin> _plugins = new List<ICreaterPlugin>(); + + /// <summary> + /// returns a list of all plugins loaded. + /// </summary> + /// <value>The plugins.</value> + public List<ICreaterPlugin> Plugins + { + get { return _plugins; } + } + /// <summary> + /// Loads all plugins. + /// </summary> + public void Load() + { + _plugins.Clear(); + try + { + if (System.IO.Directory.Exists("Dll")) + { + string[] strFiles = System.IO.Directory.GetFiles("Dll", "*.dll"); + foreach (string strFile in strFiles) + LoadPlugin(strFile); + } + } + catch (Exception ex) + { + throw ex; + } + } + /// <summary> + /// Loads the plugin. + /// </summary> + /// <param name="strFile">The STR file.</param> + void LoadPlugin(string strFile) + { + Type[] foundInterfaces = null; + + try + { + Assembly assem = Assembly.LoadFrom(strFile); + if (assem != null) + { + Type[] types = assem.GetExportedTypes(); + + foreach (Type t in types) + { + try + { + if (t.IsClass) + { + if (t.IsAbstract) continue; + + Object newObj = null; + ICreaterPlugin plugin = null; + TypeFilter myFilter2 = new TypeFilter(MyInterfaceFilter); + try + { + foundInterfaces = t.FindInterfaces(myFilter2, "BasePlug.ICreaterPlugin"); + if (foundInterfaces.Length > 0) + { + newObj = (object)Activator.CreateInstance(t); + plugin = (ICreaterPlugin)newObj; + _plugins.Add(plugin); + } + } + catch (System.Reflection.TargetInvocationException ex) + { + throw ex; + } + catch (Exception ex) + { + throw ex; + } + } + } + catch (System.NullReferenceException ex) + { + throw ex; + } + } + } + } + catch (Exception ex) + { + throw ex; + } + } + + bool MyInterfaceFilter(Type typeObj, Object criteriaObj) + { + return (typeObj.ToString().Equals(criteriaObj.ToString())); + } + + } +} Added: ACMServer/trunk/tasks/Load_from_dll/taskDll/Program.cs =================================================================== --- ACMServer/trunk/tasks/Load_from_dll/taskDll/Program.cs (rev 0) +++ ACMServer/trunk/tasks/Load_from_dll/taskDll/Program.cs 2008-06-09 11:52:40 UTC (rev 230) @@ -0,0 +1,26 @@ +using System; +using Other; +using BasePlug; + +namespace taskDll +{ + class Program + { + + /// <summary> + /// \xC4\xE5\xFF\xEA\xE8\xE9 Plugin \xEC\xE0\xBA \xED\xE0\xF1\xEB\xB3\xE4\xF3\xE2\xE0\xF2\xE8 \xB3\xED\xF2\xE5\xF0\xF4\xE5\xE9\xF1 ICreaterPlugin + /// \xCA\xEE\xE6\xE5\xED \xEF\xEB\xE0\xE3\xB3\xED \xEC\xE0\xBA \xEC\xB3\xF1\xF2\xE8\xF2\xE8\xF1\xFF \xF3 \xEF\xE0\xEF\xF6\xB3 Dll + /// </summary> + /// <param name="args"></param> + static void Main(string[] args) + { + PluginLoader plugins = new PluginLoader(); + plugins.Load(); + + foreach(ICreaterPlugin cp in plugins.Plugins) + { + Console.Out.WriteLine(cp.calc()); + } + } + } +} Added: ACMServer/trunk/tasks/Load_from_dll/taskDll/Properties/AssemblyInfo.cs =================================================================== --- ACMServer/trunk/tasks/Load_from_dll/taskDll/Properties/AssemblyInfo.cs (rev 0) +++ ACMServer/trunk/tasks/Load_from_dll/taskDll/Properties/AssemblyInfo.cs 2008-06-09 11:52:40 UTC (rev 230) @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("taskDll")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Home")] +[assembly: AssemblyProduct("taskDll")] +[assembly: AssemblyCopyright("Copyright © Home 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("013e5e40-00b8-437c-acd5-1ce439602fd4")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] Added: ACMServer/trunk/tasks/Load_from_dll/taskDll/taskDll.csproj =================================================================== --- ACMServer/trunk/tasks/Load_from_dll/taskDll/taskDll.csproj (rev 0) +++ ACMServer/trunk/tasks/Load_from_dll/taskDll/taskDll.csproj 2008-06-09 11:52:40 UTC (rev 230) @@ -0,0 +1,55 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{0AC9B72D-57AE-4EF9-9745-837F8E4343E5}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>taskDll</RootNamespace> + <AssemblyName>taskDll</AssemblyName> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <RunCodeAnalysis>false</RunCodeAnalysis> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <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.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="PluginLoader.cs" /> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\BasePlug\BasePlug.csproj"> + <Project>{3DE17E44-206E-4FC6-A700-0EA0161A2DC4}</Project> + <Name>BasePlug</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\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 Added: ACMServer/trunk/tasks/Load_from_dll/taskDll/taskDll.csproj.user =================================================================== --- ACMServer/trunk/tasks/Load_from_dll/taskDll/taskDll.csproj.user (rev 0) +++ ACMServer/trunk/tasks/Load_from_dll/taskDll/taskDll.csproj.user 2008-06-09 11:52:40 UTC (rev 230) @@ -0,0 +1,17 @@ +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <PublishUrlHistory>publish\</PublishUrlHistory> + <InstallUrlHistory> + </InstallUrlHistory> + <SupportUrlHistory> + </SupportUrlHistory> + <UpdateUrlHistory> + </UpdateUrlHistory> + <BootstrapperUrlHistory> + </BootstrapperUrlHistory> + <ApplicationRevision>0</ApplicationRevision> + <FallbackCulture>en-US</FallbackCulture> + <VerifyUploadedFiles>false</VerifyUploadedFiles> + <ProjectView>ProjectFiles</ProjectView> + </PropertyGroup> +</Project> \ No newline at end of file Added: ACMServer/trunk/tasks/Load_from_dll/taskDll.sln =================================================================== --- ACMServer/trunk/tasks/Load_from_dll/taskDll.sln (rev 0) +++ ACMServer/trunk/tasks/Load_from_dll/taskDll.sln 2008-06-09 11:52:40 UTC (rev 230) @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "taskDll", "taskDll\taskDll.csproj", "{0AC9B72D-57AE-4EF9-9745-837F8E4343E5}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dll", "Dll", "{CBD74D91-5EB9-4E4E-BF4B-D513ADD2B5D8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin1", "Plugin1\Plugin1.csproj", "{CDE3968A-F7DE-4938-A5C8-22B0949B8565}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasePlug", "BasePlug\BasePlug.csproj", "{3DE17E44-206E-4FC6-A700-0EA0161A2DC4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0AC9B72D-57AE-4EF9-9745-837F8E4343E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0AC9B72D-57AE-4EF9-9745-837F8E4343E5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0AC9B72D-57AE-4EF9-9745-837F8E4343E5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0AC9B72D-57AE-4EF9-9745-837F8E4343E5}.Release|Any CPU.Build.0 = Release|Any CPU + {CDE3968A-F7DE-4938-A5C8-22B0949B8565}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CDE3968A-F7DE-4938-A5C8-22B0949B8565}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CDE3968A-F7DE-4938-A5C8-22B0949B8565}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CDE3968A-F7DE-4938-A5C8-22B0949B8565}.Release|Any CPU.Build.0 = Release|Any CPU + {3DE17E44-206E-4FC6-A700-0EA0161A2DC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3DE17E44-206E-4FC6-A700-0EA0161A2DC4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3DE17E44-206E-4FC6-A700-0EA0161A2DC4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3DE17E44-206E-4FC6-A700-0EA0161A2DC4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {CDE3968A-F7DE-4938-A5C8-22B0949B8565} = {CBD74D91-5EB9-4E4E-BF4B-D513ADD2B5D8} + EndGlobalSection +EndGlobal This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-09 10:58:10
|
Revision: 229 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=229&view=rev Author: brus07 Date: 2008-06-09 03:58:14 -0700 (Mon, 09 Jun 2008) Log Message: ----------- Add folder for working with task Added Paths: ----------- ACMServer/trunk/tasks/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-08 16:05:00
|
Revision: 228 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=228&view=rev Author: Oracle_ Date: 2008-06-08 09:05:03 -0700 (Sun, 08 Jun 2008) Log Message: ----------- Fixed bug with Temp path. Modified Paths: -------------- ACMServer/branches/sharp tester/ReadMe.txt ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp ACMServer/branches/sharp tester/SourceTest/SourceTest.h Modified: ACMServer/branches/sharp tester/ReadMe.txt =================================================================== --- ACMServer/branches/sharp tester/ReadMe.txt 2008-06-07 19:51:51 UTC (rev 227) +++ ACMServer/branches/sharp tester/ReadMe.txt 2008-06-08 16:05:03 UTC (rev 228) @@ -26,13 +26,14 @@ \xF6\xE5 \xF8\xEB\xFF\xF5 \xE4\xEE \xF1\xEE\xF0\xF1\xE0, \xE0 \xE4\xF0\xF3\xE3\xE8\xE9 - \xF6\xE5 \xF8\xEB\xFF\xF5, \xE4\xE5 \xEF\xEE\xE2\xE8\xED\xED\xE8\xE9 \xF1\xF2\xE2\xEE\xF0\xE8\xF2\xE8\xF1\xFC EXE \xF4\xE0\xE9\xEB. \xC2\xF1\xB3 \xB3\xED\xF8\xB3 \xEE\xEF\xF6\xB3\xBF \xE2\xE8 \xEF\xEE\xE2\xE8\xED\xED\xB3 \xE2\xF1\xF2\xE0\xED\xEE\xE2\xE8\xF2\xE8 \xF1\xE0\xEC\xEE\xF1\xF2\xB3\xE9\xED\xEE (\xED\xE0\xEF\xF0\xE8\xEA\xEB\xE0\xE4 \xE7\xE0 \xE4\xEE\xEF\xEE\xEC\xEE\xE3\xEE\xFE *.bat \xF4\xE0\xE9\xEB\xF3). 4. TestLibrary \xCE\xC1\xCE\xC2'\xDF\xC7\xCA\xCE\xC2\xCE \xEF\xEE\xE2\xE8\xED\xED\xE0 \xE5\xEA\xF1\xEF\xEE\xF0\xF2\xF3\xE2\xE0\xF2\xE8 \xF2\xE0\xEA\xB3 \xF4\xF3\xED\xEA\xF6\xB3\xBF (\xB3\xED\xE0\xEA\xF8\xE5 \xF2\xE5\xF1\xF2\xF3\xE2\xE0\xEB\xEA\xE0 \xEF\xF0\xEE\xF1\xF2\xEE \xE2\xEF\xE0\xE4\xE5): - bool CheckCL(char* src, int cl, char*& details) - must check codelimit - bool CheckDF(char* src, int lang, char*& details) - must check DF - bool CheckRTL(int usedrealtime, int realtimelimit) - must check RTL - bool CheckTL(int usedtime, int timelimit) - must check TL - int CheckAnswer(char* input, char* output, char* rightoutput, char*& Details) - checks WA,OE,PE - void FreeChar(char* buf); - must free memory used by buf - \xE4\xE5\xF2\xE0\xEB\xB3 \xF0\xE5\xE0\xEB\xB3\xE7\xE0\xF6\xB3\xBF \xF6\xE8\xF5 \xF4\xF3\xED\xEA\xF6\xB3\xE9 \xE2 SourceTest.h + bool CheckCL(char* src, int cl, char*& details) - must check codelimit + bool CheckDF(char* src, int lang, char*& details) - must check DF + bool CheckRTL(int usedrealtime, int realtimelimit) - must check RTL + bool CheckTL(int usedtime, int timelimit) - must check TL + int CheckAnswer(char* input, char* output, char* rightoutput, char*& Details) - checks WA,OE,PE + void FreeChar(char* buf); - must free memory used by buf + \xC1\xB3\xE1\xEB\xB3\xEE\xF2\xE5\xEA\xE0 \xEF\xEE\xE2\xE8\xED\xED\xE0 \xF1\xE0\xEC\xE0 \xE2\xE8\xE4\xB3\xEB\xFF\xF2\xE8 \xEF\xE0\xEC'\xFF\xF2\xFC \xEF\xB3\xE4 details, \xE0 \xE2\xE8\xE4\xE0\xEB\xFF\xF2\xE8 \xE1\xF3\xE4\xE5 \xF1\xE0\xEC\xE0 \xF2\xE5\xF1\xF2\xF3\xE2\xE0\xEB\xEA\xE0. + \xC4\xE5\xF2\xE0\xEB\xB3 \xF0\xE5\xE0\xEB\xB3\xE7\xE0\xF6\xB3\xBF \xF6\xE8\xF5 \xF4\xF3\xED\xEA\xF6\xB3\xE9 \xE2 SourceTest.h. //////////////////////////////////////////////////////////////////////// ///////////////////////\xD1\xD2\xD0\xD3\xCA\xD2\xD3\xD0\xC0 \xD4\xC0\xC9˲\xC2///////////////////////////////// //////////////////////////////////////////////////////////////////////// @@ -41,7 +42,7 @@ 2. InData.txt - \xEC\xB3\xF1\xF2\xE8\xF2\xFC 4 \xF0\xFF\xE4\xEA\xE8: \xE2 \xEF\xE5\xF0\xF8\xEE\xEC\xF3 - \xF8\xEB\xFF\xF5 \xE4\xEE \xEA\xEE\xEC\xEF\xB3\xEB\xFF\xF2\xEE\xF0\xE0 \xE2 \xE4\xF0\xF3\xE3\xEE\xEC\xF3 - \xF8\xEB\xFF\xF5 \xE4\xEE \xF2\xE5\xF1\xF2\xF3 - \xE2 \xF2\xF0\xE5\xF2\xFC\xEE\xEC\xF3 - \xF8\xEB\xFF\xF5 \xE4\xEE \xEF\xE0\xEF\xEA\xE8 \xE2 \xFF\xEA\xB3\xE9 \xE1\xF3\xE4\xF3\xF2\xFC \xE7\xE1\xE5\xF0\xB3\xE3\xE0\xF2\xE8\xF1\xFC \xEF\xF0\xEE\xEC\xB3\xE6\xED\xB3 \xF4\xE0\xE9\xEB\xE8 (\xEE\xE1\xEE\xE2'\xFF\xE7\xEA\xEE\xE2\xEE \xEF\xEE\xE2\xED\xE8\xE9, \xE0 \xED\xE5 \xE2\xB3\xE4\xED\xEE\xF1\xED\xE8\xE9) + \xE2 \xF2\xF0\xE5\xF2\xFC\xEE\xEC\xF3 - \xF8\xEB\xFF\xF5 \xE4\xEE \xEF\xE0\xEF\xEA\xE8 \xE2 \xFF\xEA\xB3\xE9 \xE1\xF3\xE4\xF3\xF2\xFC \xE7\xE1\xE5\xF0\xB3\xE3\xE0\xF2\xE8\xF1\xFC \xEF\xF0\xEE\xEC\xB3\xE6\xED\xB3 \xF4\xE0\xE9\xEB\xE8 \xE2 \xF7\xE5\xF2\xE2\xE5\xF0\xF2\xEE\xEC\xF3 - \xF8\xEB\xFF\xF5 \xE4\xEE \xF4\xE0\xE9\xEB\xF3, \xF9\xEE \xEC\xB3\xF1\xF2\xE8\xF2\xFC \xEA\xEE\xE4 \xEF\xF0\xEE\xE3\xF0\xE0\xEC\xE8 3. \xCA\xEE\xE6\xE5\xED \xF2\xE5\xF1\xF2 - \xF6\xE5 \xEF\xE0\xEF\xEA\xE0, \xF9\xEE \xEC\xB3\xF1\xF2\xE8\xF2\xFC \xF4\xE0\xE9\xEB Limits.txt \xB3 \xEF\xB3\xE4\xEF\xE0\xEF\xEA\xE8 \xE7 \xED\xE0\xE7\xE2\xE0\xEC\xE8 test1,test2, ... \xCA\xEE\xE6\xED\xE0 \xE7 \xF6\xE8\xF5 \xEF\xE0\xEF\xEE\xEA \xEC\xB3\xF1\xF2\xE8\xF2\xFC \xF4\xE0\xE9\xEB\xE8 in.txt,out.txt,points.txt. @@ -78,6 +79,7 @@ \xF2\xEE \xE7\xED\xE0\xF7\xE8\xF2\xFC \xE2 \xF1\xEE\xF0\xF1\xB3 \xE2\xE8\xE4\xB3\xEB\xFF\xBA\xF2\xFC\xF1\xFF \xE4\xF3\xE6\xE5 \xE2\xE5\xEB\xE8\xEA\xE8\xE9 \xEC\xE0\xF1\xE8\xE2. \xCF\xF0\xE8 \xF1\xF2\xE2\xEE\xF0\xE5\xED\xED\xB3 TSource \xEF\xF0\xEE\xE1\xF3\xBA \xE7\xED\xE0\xE9\xF2\xE8 \xFE\xE7\xE5\xF0\xE0 \xE7 \xB3\xEC'\xFF\xEC TestingUser, \xFF\xEA\xF9\xEE \xF2\xE0\xEA\xE8\xE9 \xED\xE5 \xB3\xF1\xED\xF3\xBA, \xF2\xEE \xF1\xF2\xE2\xEE\xF0\xFE\xBA \xE9\xEE\xE3\xEE \xB3 \xE7\xE0\xE1\xEE\xF0\xEE\xED\xFF\xBA \xE9\xEE\xEC\xF3 \xE4\xEE\xF1\xF2\xF3\xEF \xE4\xEE \xEB\xEE\xEA\xE0\xEB\xFC\xED\xE8\xF5 \xE4\xE8\xF1\xEA\xB3\xE2. \xD6\xE5 \xEC\xEE\xE6\xE5 \xE7\xE0\xE9\xED\xFF\xF2\xE8 \xEA\xB3\xEB\xFC\xEA\xE0 \xF5\xE2\xE8\xEB\xE8\xED. +\xC2 \xFE\xE7\xE5\xF0\xE0 TestingUser \xEF\xE0\xF0\xEE\xEB\xFC USER12345. \xDF\xEA\xF9\xEE \xEF\xF0\xEE\xE3\xF0\xE0\xEC\xB3 \xED\xE5 \xE2\xE4\xE0\xBA\xF2\xFC\xF1\xFF \xF1\xF2\xE2\xEE\xF0\xE8\xF2\xE8 \xEF\xF0\xEE\xF6\xE5\xF1 \xE2\xB3\xE4 \xB3\xEC\xE5\xED\xB3 TestingUSer, \xF2\xEE \xE2\xEE\xED\xE0 \xE9\xEE\xE3\xEE \xF1\xF2\xE2\xEE\xF0\xFE\xBA \xE2\xB3\xE4 \xB3\xEC\xE5\xED\xB3 \xFE\xE7\xE5\xF0\xE0 \xEF\xB3\xE4 \xFF\xEA\xE8\xEC \xE7\xE0\xEF\xF3\xF1\xEA\xE0\xBA\xF2\xFC\xF1\xFF \xF1\xE0\xEC\xE0. \xD2\xEE\xE4\xB3 \xEF\xF0\xEE\xF6\xE5\xF1 \xF1\xF2\xE0\xBA Unsecured \xB3 \xEC\xEE\xE6\xE5 \xE4\xEE\xF1\xF2\xF3\xEF\xE0\xF2\xE8\xF1\xFC \xE4\xEE \xF4\xE0\xE9\xEB\xEE\xE2\xEE\xBF \xF1\xE8\xF1\xF2\xE5\xEC\xE8. \ No newline at end of file Modified: ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp =================================================================== --- ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp 2008-06-07 19:51:51 UTC (rev 227) +++ ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp 2008-06-08 16:05:03 UTC (rev 228) @@ -63,10 +63,18 @@ FCompPath=gcnew String(""); FRunAll=true; lib=LoadLibraryA("TestLibrary.dll"); -FSecurity=new TSecure(); +FSecurity=NULL; +InitSecure(false); init(); //initializing of critical section } +void TSource::InitSecure(bool SetPrivAnyway) +{ + if (FSecurity!=NULL) + delete FSecurity; + FSecurity=new TSecure(SetPrivAnyway); +} + TSource::~TSource() { if (lib!=NULL) @@ -777,7 +785,7 @@ fi->SetAccessControl(fs); } -TSecure::TSecure() +TSecure::TSecure(bool SetPrivAnyway) //if SetPrivAnyway==true, then all destrictions are set to the user even if it already exists { SetUserObjectFullAccess( GetThreadDesktop(GetCurrentThreadId())); //needed for accessing from CreateProcessAsUser SetUserObjectFullAccess( GetProcessWindowStation()); //needed for accessing from CreateProcessAsUser @@ -792,29 +800,35 @@ ui.usri1_priv=USER_PRIV_USER; ui.usri1_script_path=NULL; st=NetUserAdd(NULL,1,(LPBYTE)&ui,NULL); //trying to create new user + bool userex=false; if (st!=NERR_Success) { if (st==NERR_UserExists) - return; //if user exists just do nothing - MessageBox(NULL,L"Can not create testing user - only unsecured mode",L"Warning",MB_ICONWARNING|MB_OK); - return; + userex=true; else + { + MessageBox(NULL,L"Can not create testing user - only unsecured mode",L"Warning",MB_ICONWARNING|MB_OK); + return; + } } - array<DriveInfo^>^ drv=DriveInfo::GetDrives(); - for (int i=0;i<drv->Length;i++) //for all drives set limitation - if (drv[i]->DriveType==DriveType::Fixed) - DenyAccessFolder(drv[i]->Name); - wchar_t buf[MAX_PATH+1]; - GetEnvironmentVariableW(L"ProgramFiles",buf,MAX_PATH); - DenyAccessFolder(gcnew String(buf)); - GetEnvironmentVariable(L"ALLUSERSPROFILE",buf,MAX_PATH); - DenyAccessFolder(gcnew String(buf)); - GetWindowsDirectory(buf,MAX_PATH); - DenyAccessFolder(gcnew String(buf)); - GetSystemDirectory(buf,MAX_PATH); - DenyAccessFolder(gcnew String(buf)); - DWORD size=MAX_PATH; - GetProfilesDirectory(buf,&size); - DenyAccessFolder(gcnew String(buf)); + if ((!userex)||(SetPrivAnyway)) + { + array<DriveInfo^>^ drv=DriveInfo::GetDrives(); + for (int i=0;i<drv->Length;i++) //for all drives set limitation + if (drv[i]->DriveType==DriveType::Fixed) + DenyAccessFolder(drv[i]->Name); + wchar_t buf[MAX_PATH+1]; + GetEnvironmentVariableW(L"ProgramFiles",buf,MAX_PATH); + DenyAccessFolder(gcnew String(buf)); + GetEnvironmentVariable(L"ALLUSERSPROFILE",buf,MAX_PATH); + DenyAccessFolder(gcnew String(buf)); + GetWindowsDirectory(buf,MAX_PATH); + DenyAccessFolder(gcnew String(buf)); + GetSystemDirectory(buf,MAX_PATH); + DenyAccessFolder(gcnew String(buf)); + DWORD size=MAX_PATH; + GetProfilesDirectory(buf,&size); + DenyAccessFolder(gcnew String(buf)); + } } TSecure::~TSecure() @@ -826,6 +840,9 @@ { HANDLE token=NULL,Token=NULL; wchar_t* env=NULL; + wchar_t buflpCommandLine[MAX_PATH+1]; + if (!GetFullPathName(lpCommandLine,MAX_PATH,buflpCommandLine,NULL)) + wcscpy(buflpCommandLine,lpCommandLine); if (LogonUser((LPWSTR)USER_NAME,(LPWSTR)".",(LPWSTR)USER_PASSW,LOGON32_LOGON_NETWORK,LOGON32_PROVIDER_DEFAULT,&Token)) { FileInfo^ fi=gcnew FileInfo(gcnew String(lpCommandLine)); @@ -838,7 +855,7 @@ { if (CreateEnvironmentBlock((LPVOID*)&env,token,FALSE)) { - if (CreateProcessAsUser(token,NULL,lpCommandLine,NULL,NULL,bInheritHandles,dwCreationFlags|CREATE_UNICODE_ENVIRONMENT,env,NULL,lpStartupInfo,lpProcessInformation)) + if (CreateProcessAsUser(token,NULL,buflpCommandLine,NULL,NULL,bInheritHandles,dwCreationFlags|CREATE_UNICODE_ENVIRONMENT,env,NULL,lpStartupInfo,lpProcessInformation)) { DestroyEnvironmentBlock(env); RevertToSelf(); @@ -858,7 +875,7 @@ if (Token!=NULL) CloseHandle(Token); Details="Unsecured process. Result details: "; - if (CreateProcess(NULL,lpCommandLine,NULL,NULL,bInheritHandles,dwCreationFlags,NULL,NULL,lpStartupInfo,lpProcessInformation)) + if (CreateProcess(NULL,buflpCommandLine,NULL,NULL,bInheritHandles,dwCreationFlags,NULL,NULL,lpStartupInfo,lpProcessInformation)) return true; return false; } Modified: ACMServer/branches/sharp tester/SourceTest/SourceTest.h =================================================================== --- ACMServer/branches/sharp tester/SourceTest/SourceTest.h 2008-06-07 19:51:51 UTC (rev 227) +++ ACMServer/branches/sharp tester/SourceTest/SourceTest.h 2008-06-08 16:05:03 UTC (rev 228) @@ -249,7 +249,7 @@ { private: public: - TSecure(); + TSecure(bool SetPrivAnyway); ~TSecure(); bool RunProcess(LPWSTR lpCommandLine,BOOL bInheritHandles,DWORD dwCreationFlags,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation,String^% Details); }; @@ -308,6 +308,7 @@ public: TSource(); ~TSource(); + void InitSecure(bool SetPrivAnyway); void CheckCL(); void CheckDF(); void Compile(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-07 19:52:46
|
Revision: 227 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=227&view=rev Author: Oracle_ Date: 2008-06-07 12:51:51 -0700 (Sat, 07 Jun 2008) Log Message: ----------- Added Details to CheckAnswer procedure from DLL. Modified Paths: -------------- ACMServer/branches/sharp tester/ReadMe.txt ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp ACMServer/branches/sharp tester/SourceTest/SourceTest.h ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp ACMServer/branches/sharp tester/TestLibrary/TestLibrary.h Modified: ACMServer/branches/sharp tester/ReadMe.txt =================================================================== --- ACMServer/branches/sharp tester/ReadMe.txt 2008-06-07 14:14:12 UTC (rev 226) +++ ACMServer/branches/sharp tester/ReadMe.txt 2008-06-07 19:51:51 UTC (rev 227) @@ -26,13 +26,13 @@ \xF6\xE5 \xF8\xEB\xFF\xF5 \xE4\xEE \xF1\xEE\xF0\xF1\xE0, \xE0 \xE4\xF0\xF3\xE3\xE8\xE9 - \xF6\xE5 \xF8\xEB\xFF\xF5, \xE4\xE5 \xEF\xEE\xE2\xE8\xED\xED\xE8\xE9 \xF1\xF2\xE2\xEE\xF0\xE8\xF2\xE8\xF1\xFC EXE \xF4\xE0\xE9\xEB. \xC2\xF1\xB3 \xB3\xED\xF8\xB3 \xEE\xEF\xF6\xB3\xBF \xE2\xE8 \xEF\xEE\xE2\xE8\xED\xED\xB3 \xE2\xF1\xF2\xE0\xED\xEE\xE2\xE8\xF2\xE8 \xF1\xE0\xEC\xEE\xF1\xF2\xB3\xE9\xED\xEE (\xED\xE0\xEF\xF0\xE8\xEA\xEB\xE0\xE4 \xE7\xE0 \xE4\xEE\xEF\xEE\xEC\xEE\xE3\xEE\xFE *.bat \xF4\xE0\xE9\xEB\xF3). 4. TestLibrary \xCE\xC1\xCE\xC2'\xDF\xC7\xCA\xCE\xC2\xCE \xEF\xEE\xE2\xE8\xED\xED\xE0 \xE5\xEA\xF1\xEF\xEE\xF0\xF2\xF3\xE2\xE0\xF2\xE8 \xF2\xE0\xEA\xB3 \xF4\xF3\xED\xEA\xF6\xB3\xBF (\xB3\xED\xE0\xEA\xF8\xE5 \xF2\xE5\xF1\xF2\xF3\xE2\xE0\xEB\xEA\xE0 \xEF\xF0\xEE\xF1\xF2\xEE \xE2\xEF\xE0\xE4\xE5): - bool CheckCL(char* src, int cl, char* details) - bool CheckDF(char* src, int lang, char* details) - bool CheckRTL(int usedrealtime, int realtimelimit) - bool CheckTL(int usedtime, int timelimit) - int CheckAnswer(char* input, char* output, char* rightoutput) - void FreeChar(char* buf); - \xE4\xE5\xF2\xE0\xEB\xB3 \xF0\xE5\xE0\xEB\xB3\xE7\xE0\xF6\xB3\xBF \xF6\xE8\xF5 \xF4\xF3\xED\xEA\xF6\xB3\xE9 \xE2 SourceTest.h + bool CheckCL(char* src, int cl, char*& details) - must check codelimit + bool CheckDF(char* src, int lang, char*& details) - must check DF + bool CheckRTL(int usedrealtime, int realtimelimit) - must check RTL + bool CheckTL(int usedtime, int timelimit) - must check TL + int CheckAnswer(char* input, char* output, char* rightoutput, char*& Details) - checks WA,OE,PE + void FreeChar(char* buf); - must free memory used by buf + \xE4\xE5\xF2\xE0\xEB\xB3 \xF0\xE5\xE0\xEB\xB3\xE7\xE0\xF6\xB3\xBF \xF6\xE8\xF5 \xF4\xF3\xED\xEA\xF6\xB3\xE9 \xE2 SourceTest.h //////////////////////////////////////////////////////////////////////// ///////////////////////\xD1\xD2\xD0\xD3\xCA\xD2\xD3\xD0\xC0 \xD4\xC0\xC9˲\xC2///////////////////////////////// //////////////////////////////////////////////////////////////////////// Modified: ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp =================================================================== --- ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp 2008-06-07 14:14:12 UTC (rev 226) +++ ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp 2008-06-07 19:51:51 UTC (rev 227) @@ -292,7 +292,7 @@ } } -TCheckAnsRes TSource::CheckAnswer(int index,String^ output) //checks answer for test +TCheckAnsRes TSource::CheckAnswer(int index,String^ output, String^% Details) //checks answer for test { try { @@ -306,10 +306,12 @@ return carAC; } else { - char* buf1,*buf2,*buf3; + char* buf1,*buf2,*buf3,*buf4=NULL; TCheckAnswer prc=(TCheckAnswer)GetProcAddress(lib,"CheckAnswer"); - TCheckAnsRes res=(TCheckAnsRes)prc(buf1=StrToArr(t.input),buf2=StrToArr(output),buf3=StrToArr(t.output)); - FreeArr(buf1);FreeArr(buf2);FreeArr(buf3); + TCheckAnsRes res=(TCheckAnsRes)prc(buf1=StrToArr(t.input),buf2=StrToArr(output),buf3=StrToArr(t.output),buf4); + Details+=gcnew String(buf4); + TFreeFunc prc2=(TFreeFunc)GetProcAddress(lib,"FreeChar"); + FreeArr(buf1);FreeArr(buf2);FreeArr(buf3);prc2(buf4); return res; } }__finally @@ -621,7 +623,7 @@ ReadFile(ouf,buf,size,&len,NULL); CloseHandle(ouf); - TCheckAnsRes r=CheckAnswer(index,gcnew String(buf)); + TCheckAnsRes r=CheckAnswer(index,gcnew String(buf),it->Details); delete[] buf; if (r==carAC) { Modified: ACMServer/branches/sharp tester/SourceTest/SourceTest.h =================================================================== --- ACMServer/branches/sharp tester/SourceTest/SourceTest.h 2008-06-07 14:14:12 UTC (rev 226) +++ ACMServer/branches/sharp tester/SourceTest/SourceTest.h 2008-06-07 19:51:51 UTC (rev 227) @@ -236,7 +236,7 @@ typedef bool (*TCheckSrc)(char* src,int,char*& details); typedef bool (*TCheckLim)(int,int); - typedef int (*TCheckAnswer)(char* input, char* output, char* rightoutput); + typedef int (*TCheckAnswer)(char* input, char* output, char* rightoutput, char*& Details); typedef void (*TFreeFunc)(char* buf); public delegate void TTestHandler(int index, TResult^ res); @@ -275,11 +275,11 @@ TLang FLang; //language of source TSecure *FSecurity; //security class HMODULE lib; //library that must export: - //bool CheckCL(char* src, int cl, char* details) - must check codelimit - //bool CheckDF(char* src, int lang, char* details) - must check DF + //bool CheckCL(char* src, int cl, char*& details) - must check codelimit + //bool CheckDF(char* src, int lang, char*& details) - must check DF //bool CheckRTL(int usedrealtime, int realtimelimit) - must check RTL //bool CheckTL(int usedtime, int timelimit) - must check TL - //int CheckAnswer(char* input, char* output, char* rightoutput) - checks WA,OE,PE + //int CheckAnswer(char* input, char* output, char* rightoutput, char*& Details) - checks WA,OE,PE //void FreeChar(char* buf); - must free memory used by buf //if there is no library called TestLibrary.dll then standart check is performed @@ -313,7 +313,7 @@ void Compile(); void RunTests(); //all tests void RunTest(int index); //only one test - TCheckAnsRes CheckAnswer(int index,String^ output); + TCheckAnsRes CheckAnswer(int index,String^ output, String^% Details); void ProcessAll(); //gets result for all tests void ProcessTest(int index); //gets result for only 1 test void LoadTest(int index,TTest% test); //load test from file Modified: ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp =================================================================== --- ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp 2008-06-07 14:14:12 UTC (rev 226) +++ ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp 2008-06-07 19:51:51 UTC (rev 227) @@ -33,8 +33,10 @@ return (usedtime*1.0>(timelimit*TLk+TLx)); } -TESTLIBRARY_API int CheckAnswer(char* input, char* output, char* rightoutput) +TESTLIBRARY_API int CheckAnswer(char* input, char* output, char* rightoutput, char*& Details) { + Details=new char[30]; + strcpy(Details,"CheckAnswer from DLL\n"); if (strcmp(output,rightoutput)==0) return 0; int curo=0; Modified: ACMServer/branches/sharp tester/TestLibrary/TestLibrary.h =================================================================== --- ACMServer/branches/sharp tester/TestLibrary/TestLibrary.h 2008-06-07 14:14:12 UTC (rev 226) +++ ACMServer/branches/sharp tester/TestLibrary/TestLibrary.h 2008-06-07 19:51:51 UTC (rev 227) @@ -12,5 +12,5 @@ TESTLIBRARY_API void FreeChar(char* buf); TESTLIBRARY_API bool CheckRTL(int usedrealtime, int realtimelimit); TESTLIBRARY_API bool CheckTL(int usedtime, int timelimit); -TESTLIBRARY_API int CheckAnswer(char* input, char* output, char* rightoutput); +TESTLIBRARY_API int CheckAnswer(char* input, char* output, char* rightoutput, char*& Details); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-07 14:14:04
|
Revision: 226 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=226&view=rev Author: Oracle_ Date: 2008-06-07 07:14:12 -0700 (Sat, 07 Jun 2008) Log Message: ----------- Updated - one more restriction added. Modified Paths: -------------- ACMServer/branches/sharp tester/ReadMe.txt Modified: ACMServer/branches/sharp tester/ReadMe.txt =================================================================== --- ACMServer/branches/sharp tester/ReadMe.txt 2008-06-07 14:12:18 UTC (rev 225) +++ ACMServer/branches/sharp tester/ReadMe.txt 2008-06-07 14:14:12 UTC (rev 226) @@ -41,7 +41,7 @@ 2. InData.txt - \xEC\xB3\xF1\xF2\xE8\xF2\xFC 4 \xF0\xFF\xE4\xEA\xE8: \xE2 \xEF\xE5\xF0\xF8\xEE\xEC\xF3 - \xF8\xEB\xFF\xF5 \xE4\xEE \xEA\xEE\xEC\xEF\xB3\xEB\xFF\xF2\xEE\xF0\xE0 \xE2 \xE4\xF0\xF3\xE3\xEE\xEC\xF3 - \xF8\xEB\xFF\xF5 \xE4\xEE \xF2\xE5\xF1\xF2\xF3 - \xE2 \xF2\xF0\xE5\xF2\xFC\xEE\xEC\xF3 - \xF8\xEB\xFF\xF5 \xE4\xEE \xEF\xE0\xEF\xEA\xE8 \xE2 \xFF\xEA\xB3\xE9 \xE1\xF3\xE4\xF3\xF2\xFC \xE7\xE1\xE5\xF0\xB3\xE3\xE0\xF2\xE8\xF1\xFC \xEF\xF0\xEE\xEC\xB3\xE6\xED\xB3 \xF4\xE0\xE9\xEB\xE8 + \xE2 \xF2\xF0\xE5\xF2\xFC\xEE\xEC\xF3 - \xF8\xEB\xFF\xF5 \xE4\xEE \xEF\xE0\xEF\xEA\xE8 \xE2 \xFF\xEA\xB3\xE9 \xE1\xF3\xE4\xF3\xF2\xFC \xE7\xE1\xE5\xF0\xB3\xE3\xE0\xF2\xE8\xF1\xFC \xEF\xF0\xEE\xEC\xB3\xE6\xED\xB3 \xF4\xE0\xE9\xEB\xE8 (\xEE\xE1\xEE\xE2'\xFF\xE7\xEA\xEE\xE2\xEE \xEF\xEE\xE2\xED\xE8\xE9, \xE0 \xED\xE5 \xE2\xB3\xE4\xED\xEE\xF1\xED\xE8\xE9) \xE2 \xF7\xE5\xF2\xE2\xE5\xF0\xF2\xEE\xEC\xF3 - \xF8\xEB\xFF\xF5 \xE4\xEE \xF4\xE0\xE9\xEB\xF3, \xF9\xEE \xEC\xB3\xF1\xF2\xE8\xF2\xFC \xEA\xEE\xE4 \xEF\xF0\xEE\xE3\xF0\xE0\xEC\xE8 3. \xCA\xEE\xE6\xE5\xED \xF2\xE5\xF1\xF2 - \xF6\xE5 \xEF\xE0\xEF\xEA\xE0, \xF9\xEE \xEC\xB3\xF1\xF2\xE8\xF2\xFC \xF4\xE0\xE9\xEB Limits.txt \xB3 \xEF\xB3\xE4\xEF\xE0\xEF\xEA\xE8 \xE7 \xED\xE0\xE7\xE2\xE0\xEC\xE8 test1,test2, ... \xCA\xEE\xE6\xED\xE0 \xE7 \xF6\xE8\xF5 \xEF\xE0\xEF\xEE\xEA \xEC\xB3\xF1\xF2\xE8\xF2\xFC \xF4\xE0\xE9\xEB\xE8 in.txt,out.txt,points.txt. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-07 14:12:15
|
Revision: 225 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=225&view=rev Author: Oracle_ Date: 2008-06-07 07:12:18 -0700 (Sat, 07 Jun 2008) Log Message: ----------- More secured version. Modified Paths: -------------- ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp Modified: ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp =================================================================== --- ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp 2008-06-06 21:44:44 UTC (rev 224) +++ ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp 2008-06-07 14:12:18 UTC (rev 225) @@ -8,8 +8,8 @@ #include <Userenv.h> using namespace System::IO; -const wchar_t USER_NAME[]={'T','e','s','t','i','n','g','U','s','e','r'}; //username for testing -const wchar_t USER_PASSW[]={'U','S','E','R','1','2','3','4','5'}; //password of user for testing +const wchar_t USER_NAME[]={L"TestingUser"}; //username for testing +const wchar_t USER_PASSW[]={L"USER12345"}; //password of user for testing namespace SourceTest { @@ -764,6 +764,17 @@ return Result; } +void DenyAccessFolder(String^ folder) +{ + DirectoryInfo^ fi = gcnew DirectoryInfo(folder); + DirectorySecurity^ fs = gcnew DirectorySecurity(folder, AccessControlSections::All); + fs->SetAccessRule(gcnew FileSystemAccessRule(gcnew String(USER_NAME),FileSystemRights::FullControl, + InheritanceFlags::ObjectInherit|InheritanceFlags::ContainerInherit, + PropagationFlags::None, + AccessControlType::Deny)); + fi->SetAccessControl(fs); +} + TSecure::TSecure() { SetUserObjectFullAccess( GetThreadDesktop(GetCurrentThreadId())); //needed for accessing from CreateProcessAsUser @@ -783,22 +794,25 @@ { if (st==NERR_UserExists) return; //if user exists just do nothing - MessageBox(NULL,(LPCTSTR)"Can not create testing user - only unsecured mode",(LPCTSTR)"Warning",MB_ICONWARNING|MB_OK); + MessageBox(NULL,L"Can not create testing user - only unsecured mode",L"Warning",MB_ICONWARNING|MB_OK); return; } array<DriveInfo^>^ drv=DriveInfo::GetDrives(); for (int i=0;i<drv->Length;i++) //for all drives set limitation if (drv[i]->DriveType==DriveType::Fixed) - { - DirectoryInfo^ fi = gcnew DirectoryInfo(drv[i]->Name); - DirectorySecurity^ fs = gcnew DirectorySecurity(drv[i]->Name, AccessControlSections::All); - fs->SetAccessRule(gcnew FileSystemAccessRule(gcnew String(USER_NAME),FileSystemRights::FullControl, - InheritanceFlags::ObjectInherit|InheritanceFlags::ContainerInherit, - PropagationFlags::None, - AccessControlType::Deny)); - fi->SetAccessControl(fs); - } - + DenyAccessFolder(drv[i]->Name); + wchar_t buf[MAX_PATH+1]; + GetEnvironmentVariableW(L"ProgramFiles",buf,MAX_PATH); + DenyAccessFolder(gcnew String(buf)); + GetEnvironmentVariable(L"ALLUSERSPROFILE",buf,MAX_PATH); + DenyAccessFolder(gcnew String(buf)); + GetWindowsDirectory(buf,MAX_PATH); + DenyAccessFolder(gcnew String(buf)); + GetSystemDirectory(buf,MAX_PATH); + DenyAccessFolder(gcnew String(buf)); + DWORD size=MAX_PATH; + GetProfilesDirectory(buf,&size); + DenyAccessFolder(gcnew String(buf)); } TSecure::~TSecure() @@ -817,8 +831,11 @@ fs->SetAccessRule(gcnew FileSystemAccessRule(gcnew String(USER_NAME),FileSystemRights::ExecuteFile,AccessControlType::Allow)); fi->SetAccessControl(fs); if (DuplicateTokenEx(Token,TOKEN_ALL_ACCESS,NULL,SecurityImpersonation,TokenPrimary,&token)) + { if (ImpersonateLoggedOnUser(token)) + { if (CreateEnvironmentBlock((LPVOID*)&env,token,FALSE)) + { if (CreateProcessAsUser(token,NULL,lpCommandLine,NULL,NULL,bInheritHandles,dwCreationFlags|CREATE_UNICODE_ENVIRONMENT,env,NULL,lpStartupInfo,lpProcessInformation)) { DestroyEnvironmentBlock(env); @@ -828,6 +845,9 @@ return true; } } + } + } + } if (env!=NULL) DestroyEnvironmentBlock(env); RevertToSelf(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-06 21:44:36
|
Revision: 224 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=224&view=rev Author: brus07 Date: 2008-06-06 14:44:44 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Logging testing process Modified Paths: -------------- ACMServer/trunk/TesterSolution/Checker/Checker.csproj ACMServer/trunk/TesterSolution/Checker/Class1.cs ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs ACMServer/trunk/TesterSolution/Tester/Form1.cs ACMServer/trunk/TesterSolution/Tester/Tester.csproj Modified: ACMServer/trunk/TesterSolution/Checker/Checker.csproj =================================================================== --- ACMServer/trunk/TesterSolution/Checker/Checker.csproj 2008-06-06 21:38:47 UTC (rev 223) +++ ACMServer/trunk/TesterSolution/Checker/Checker.csproj 2008-06-06 21:44:44 UTC (rev 224) @@ -45,6 +45,12 @@ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\Library\LibraryExtention\LibraryExtention.csproj"> + <Project>{A8135069-F8BA-4E5D-835F-3FF3F350AA5D}</Project> + <Name>LibraryExtention</Name> + </ProjectReference> + </ItemGroup> <Import Project="$(MSBuildBinPath)\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. Modified: ACMServer/trunk/TesterSolution/Checker/Class1.cs =================================================================== --- ACMServer/trunk/TesterSolution/Checker/Class1.cs 2008-06-06 21:38:47 UTC (rev 223) +++ ACMServer/trunk/TesterSolution/Checker/Class1.cs 2008-06-06 21:44:44 UTC (rev 224) @@ -3,6 +3,7 @@ using System.Text; using SourceTest; using System.IO; +using AcmContester.Library.LibraryExtention; namespace Checker { @@ -13,8 +14,20 @@ Console.WriteLine("test number {0}, result: {1}, details: {2}", x, TSource.TestResultToString(res.res), res.Details); } + static void funcWithLog(int x, TResult res) + { + Log log = Log.GetLog(); + log.Loging(" Test #" + x + " Details " + res.Details + "\xA0\n", Log.Priority.INFO); + //Console.WriteLine("test number {0}, result: {1}, details: {2}", x, TSource.TestResultToString(res.res), res.Details); + } + public static string GetResult(string message) { + Log log = Log.GetLog(); + log.Loging(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(), Log.Priority.INFO); + log.Loging(message, Log.Priority.INFO); + log.Loging("", Log.Priority.INFO); + string code = message.Substring(message.IndexOf('$')+1); string id = message.Substring(0, message.IndexOf('$')); TSource c = new TSource(); @@ -32,17 +45,26 @@ //c.Src = s.ReadToEnd(); //s.Close(); c.TempPath = temp; - c.TestHandler += new TTestHandler(func); + c.TestHandler += new TTestHandler(funcWithLog); c.Language = (TLang)1; c.ProcessAll(); c.State = (TSourceState)6; + log.Loging("Compile result: " + TSource.CompileResultToString(c.Summary.compres.res) + "\nCompilation details: " + c.Summary.compres.Details + "\nUsed Time for compile: " + c.Summary.compres.UsedTime, Log.Priority.INFO); //Console.WriteLine("Compile result: {0}\nCompilation details: {1}\nUsed Time for compile: {2}", TSource.CompileResultToString(c.Summary.compres.res), c.Summary.compres.Details, c.Summary.compres.UsedTime); + log.Loging("Test result: " + TSource.TestResultToString(c.Summary.res.res), Log.Priority.INFO); //Console.WriteLine("Test result: {0}", TSource.TestResultToString(c.Summary.res.res)); + log.Loging("Points: " + c.Summary.res.points, Log.Priority.INFO); //Console.WriteLine("Points: {0}", c.Summary.res.points); + log.Loging("Used Time: " + c.Summary.res.UsedTime, Log.Priority.INFO); //Console.WriteLine("Used Time: {0}", c.Summary.res.UsedTime); + log.Loging("Used Memory: " + c.Summary.res.UsedMemory, Log.Priority.INFO); //Console.WriteLine("Used Memory: {0}", c.Summary.res.UsedMemory); + log.Loging("Used Real Time: " + c.Summary.res.UsedRealTime, Log.Priority.INFO); //Console.WriteLine("Used Real Time: {0}", c.Summary.res.UsedRealTime); //Console.ReadKey(); + log.Loging("----------------------------------------------------", Log.Priority.INFO); + log.Loging("", Log.Priority.INFO); + if (c.Summary.compres.res != (TCompRes)0 ) { return TSource.CompileResultToString(c.Summary.compres.res); Modified: ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs 2008-06-06 21:38:47 UTC (rev 223) +++ ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs 2008-06-06 21:44:44 UTC (rev 224) @@ -135,6 +135,7 @@ this.Controls.Add(this.textBox1); this.Name = "Form1"; this.Text = "Tester"; + this.Load += new System.EventHandler(this.Form1_Load); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); Modified: ACMServer/trunk/TesterSolution/Tester/Form1.cs =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-06-06 21:38:47 UTC (rev 223) +++ ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-06-06 21:44:44 UTC (rev 224) @@ -6,6 +6,8 @@ using System.Text; using System.Windows.Forms; using AcmContester.Library.Connector; +using System.IO; +using AcmContester.Library.LibraryExtention; namespace Tester { @@ -73,5 +75,11 @@ else toolStripStatusLabel1.Text = "null"; } + + private void Form1_Load(object sender, EventArgs e) + { + StreamWriter sw = File.AppendText("testerlog.txt"); + Log log = Log.GetLog(sw, Log.Priority.EMPTY); + } } } \ No newline at end of file Modified: ACMServer/trunk/TesterSolution/Tester/Tester.csproj =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Tester.csproj 2008-06-06 21:38:47 UTC (rev 223) +++ ACMServer/trunk/TesterSolution/Tester/Tester.csproj 2008-06-06 21:44:44 UTC (rev 224) @@ -76,6 +76,10 @@ <Project>{211DD6A5-2D73-439E-8722-ED2C89ED1DDB}</Project> <Name>Connector</Name> </ProjectReference> + <ProjectReference Include="..\Library\LibraryExtention\LibraryExtention.csproj"> + <Project>{A8135069-F8BA-4E5D-835F-3FF3F350AA5D}</Project> + <Name>LibraryExtention</Name> + </ProjectReference> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-06 21:38:39
|
Revision: 223 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=223&view=rev Author: brus07 Date: 2008-06-06 14:38:47 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Added destructor for close stream. Modified Paths: -------------- ACMServer/trunk/TesterSolution/Library/LibraryExtention/Log.cs Modified: ACMServer/trunk/TesterSolution/Library/LibraryExtention/Log.cs =================================================================== --- ACMServer/trunk/TesterSolution/Library/LibraryExtention/Log.cs 2008-06-06 08:50:12 UTC (rev 222) +++ ACMServer/trunk/TesterSolution/Library/LibraryExtention/Log.cs 2008-06-06 21:38:47 UTC (rev 223) @@ -96,8 +96,19 @@ //TODO: throw new Exception("WriterNullException"); } - writer.WriteLine(message); + lock (writer) + { + writer.WriteLine(message); + writer.Flush(); + } } } + ~Log() + { + if (writer != null) + { + writer.Close(); + } + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-06 08:50:06
|
Revision: 222 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=222&view=rev Author: Oracle_ Date: 2008-06-06 01:50:12 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Added ReadMe.txt. Added Paths: ----------- ACMServer/branches/sharp tester/ReadMe.txt Added: ACMServer/branches/sharp tester/ReadMe.txt =================================================================== --- ACMServer/branches/sharp tester/ReadMe.txt (rev 0) +++ ACMServer/branches/sharp tester/ReadMe.txt 2008-06-06 08:50:12 UTC (rev 222) @@ -0,0 +1,83 @@ +//////////////////////////////////////////////////////////////////////// +//////////////////////////\xCA\xCE\xCCϲ\xCB\xDFֲ\xDF//////////////////////////////////// +//////////////////////////////////////////////////////////////////////// +\xC4\xEB\xFF \xEA\xEE\xEC\xEF\xB3\xEB\xFF\xF6\xB3\xBF \xEF\xF0\xEE\xE5\xEA\xF2\xF3 \xEF\xEE\xF2\xF0\xB3\xE1\xED\xEE: +1. \xC4\xEE \xEF\xE0\xEF\xEA\xE8 SourceTest \xE4\xEE\xE4\xE0\xF2\xE8 \xF4\xE0\xE9\xEB\xE8 + - AdvAPI32.lib + - NetAPI32.lib + - User32.lib + - UserEnv.lib +2. \xC4\xEE \xEF\xE0\xEF\xEA\xE8 \xE7 \xF4\xE0\xE9\xEB\xEE\xEC tester.exe \xE4\xEE\xE4\xE0\xF2\xE8 \xF4\xE0\xE9\xEB\xE8 InData.txt \xB3 Times.txt (\xEF\xF0\xEE + \xBF\xF5\xED\xB3\xE9 \xE2\xEC\xB3\xF1\xF2 \xE9\xE4\xE5\xF2\xFC\xF1\xFF \xE2 \xF0\xEE\xE7\xE4\xB3\xEB\xB3 \xF1\xF2\xF0\xF3\xEA\xF2\xF3\xF0\xE0 \xF4\xE0\xE9\xEB\xB3\xE2). +3. \xD3 \xEF\xE0\xEF\xEA\xF3 SAMPLE \xE4\xEE\xE4\xE0\xF2\xE8 \xEA\xEE\xEC\xEF\xB3\xEB\xFF\xF2\xEE\xF0 Delphi, \xE0 \xF3 \xEF\xE0\xEF\xEA\xF3 includeD7 \xE4\xEE\xE4\xE0\xF2\xE8 + \xED\xE5\xEE\xE1\xF5\xB3\xE4\xED\xB3 \xE4\xEB\xFF \xF0\xEE\xE1\xEE\xF2\xE8 \xEC\xEE\xE4\xF3\xEB\xB3. +4. \xC4\xEB\xFF \xEA\xEE\xEC\xEF\xB3\xEB\xFF\xF6\xB3\xBF \xEF\xEE\xF2\xF0\xB3\xE1\xE5\xED .NET Framework 2.0 \xE0\xE1\xEE \xE2\xE8\xF9\xE5. +5. ϳ\xF1\xEB\xFF \xEA\xEE\xEC\xEF\xB3\xEB\xFF\xF6\xB3\xBF \xEF\xEE\xEC\xB3\xF1\xF2\xB3\xF2\xFC \xE4\xEE \xF4\xE0\xE9\xEB\xF3 tester.exe \xF4\xE0\xE9\xEB TestLibrary.dll i + SourceTest.dll +//////////////////////////////////////////////////////////////////////// +///////////////////////\xC7\xC0\xCF\xD3\xD1\xCA \xB2 \xC2\xC8\xCA\xCE\xCD\xC0\xCD\xCD\xDF/////////////////////////////// +//////////////////////////////////////////////////////////////////////// +\xC4\xEB\xFF \xF3\xF1\xEF\xB3\xF8\xED\xEE\xBF \xF0\xEE\xE1\xEE\xF2\xE8 \xEF\xEE\xF2\xF0\xB3\xE1\xED\xEE: +1. \xCD\xE0\xE4\xE0\xF2\xE8 \xEA\xEE\xF0\xE8\xF1\xF2\xF3\xE2\xE0\xF7\xF3 \xE7 \xFF\xEA\xEE\xE3\xEE \xE1\xF3\xE4\xE5 \xE7\xE0\xEF\xF3\xF1\xEA\xE0\xF2\xE8\xF1\xFC \xEF\xF0\xEE\xE3\xF0\xE0\xEC\xE0 \xEF\xF0\xE0\xE2 \xE0\xE4\xEC\xB3\xED\xB3\xF1\xF2\xF0\xE0\xF2\xEE\xF0\xE0 + \xB3 2 \xE4\xEE\xE4\xE0\xF2\xEA\xEE\xE2\xB3 \xEF\xF0\xE8\xE2\xB3\xEB\xE5㳿 (SE_ASSIGNPRIMARYTOKEN_NAME \xB3 + SE_INCREASE_QUOTA_NAME). +2. \xC2\xF1\xF2\xE0\xED\xEE\xE2\xE8\xF2\xE8 \xED\xE0 \xE2\xF1\xB3\xF5 \xEB\xEE\xEA\xE0\xEB\xFC\xED\xE8\xF5 \xE4\xE8\xF1\xEA\xE0\xF5 \xF4\xE0\xE9\xEB\xEE\xE2\xF3 \xF1\xE8\xF1\xF2\xE5\xEC\xF3 NTFS. +3. \xD2\xE5\xF1\xF2\xF3\xE2\xE0\xEB\xEA\xE0 \xE7\xE0\xEF\xF3\xF1\xEA\xE0\xBA \xEA\xEE\xEC\xEF\xB3\xEB\xFF\xF2\xEE\xF0 \xE7 \xE4\xE2\xEE\xEC\xE0 \xE0\xF0\xE3\xF3\xEC\xE5\xED\xF2\xE0\xEC\xE8 \xEA\xEE\xEC\xE0\xED\xE4\xED\xEE\xBF \xF1\xF2\xF0\xB3\xF7\xEA\xE8, \xE4\xE5 \xEF\xE5\xF0\xF8\xE8\xE9 \xE0\xF0\xE3\xF3\xEC\xE5\xED\xF2 - + \xF6\xE5 \xF8\xEB\xFF\xF5 \xE4\xEE \xF1\xEE\xF0\xF1\xE0, \xE0 \xE4\xF0\xF3\xE3\xE8\xE9 - \xF6\xE5 \xF8\xEB\xFF\xF5, \xE4\xE5 \xEF\xEE\xE2\xE8\xED\xED\xE8\xE9 \xF1\xF2\xE2\xEE\xF0\xE8\xF2\xE8\xF1\xFC EXE \xF4\xE0\xE9\xEB. \xC2\xF1\xB3 \xB3\xED\xF8\xB3 \xEE\xEF\xF6\xB3\xBF + \xE2\xE8 \xEF\xEE\xE2\xE8\xED\xED\xB3 \xE2\xF1\xF2\xE0\xED\xEE\xE2\xE8\xF2\xE8 \xF1\xE0\xEC\xEE\xF1\xF2\xB3\xE9\xED\xEE (\xED\xE0\xEF\xF0\xE8\xEA\xEB\xE0\xE4 \xE7\xE0 \xE4\xEE\xEF\xEE\xEC\xEE\xE3\xEE\xFE *.bat \xF4\xE0\xE9\xEB\xF3). +4. TestLibrary \xCE\xC1\xCE\xC2'\xDF\xC7\xCA\xCE\xC2\xCE \xEF\xEE\xE2\xE8\xED\xED\xE0 \xE5\xEA\xF1\xEF\xEE\xF0\xF2\xF3\xE2\xE0\xF2\xE8 \xF2\xE0\xEA\xB3 \xF4\xF3\xED\xEA\xF6\xB3\xBF (\xB3\xED\xE0\xEA\xF8\xE5 \xF2\xE5\xF1\xF2\xF3\xE2\xE0\xEB\xEA\xE0 \xEF\xF0\xEE\xF1\xF2\xEE \xE2\xEF\xE0\xE4\xE5): + bool CheckCL(char* src, int cl, char* details) + bool CheckDF(char* src, int lang, char* details) + bool CheckRTL(int usedrealtime, int realtimelimit) + bool CheckTL(int usedtime, int timelimit) + int CheckAnswer(char* input, char* output, char* rightoutput) + void FreeChar(char* buf); + \xE4\xE5\xF2\xE0\xEB\xB3 \xF0\xE5\xE0\xEB\xB3\xE7\xE0\xF6\xB3\xBF \xF6\xE8\xF5 \xF4\xF3\xED\xEA\xF6\xB3\xE9 \xE2 SourceTest.h +//////////////////////////////////////////////////////////////////////// +///////////////////////\xD1\xD2\xD0\xD3\xCA\xD2\xD3\xD0\xC0 \xD4\xC0\xC9˲\xC2///////////////////////////////// +//////////////////////////////////////////////////////////////////////// +\xC4\xEB\xFF \xF0\xEE\xE1\xEE\xF2\xE8 \xEF\xF0\xEE\xE3\xF0\xE0\xEC\xE8 \xEF\xEE\xF2\xF0\xB3\xE1\xED\xEE \xF9\xEE\xE1 \xF4\xE0\xE9\xEB\xE8 \xEC\xE0\xEB\xE8 \xF2\xE0\xEA\xF3 \xF1\xF2\xF0\xF3\xEA\xF2\xF3\xF0\xF3: +1. Times.txt - \xBA\xE4\xE8\xED\xE8\xE9 \xF0\xFF\xE4\xEE\xEA \xEC\xB3\xF1\xF2\xE8\xF2\xFC \xE4\xE2\xE0 \xE4\xF0\xEE\xE1\xEE\xE2\xE8\xF5 \xF7\xE8\xF1\xEB\xE0 TL=1-\xE5 \xF7\xE8\xF1\xEB\xEE*OLDTL+2-\xE5 \xF7\xE8\xF1\xEB\xEE +2. InData.txt - \xEC\xB3\xF1\xF2\xE8\xF2\xFC 4 \xF0\xFF\xE4\xEA\xE8: + \xE2 \xEF\xE5\xF0\xF8\xEE\xEC\xF3 - \xF8\xEB\xFF\xF5 \xE4\xEE \xEA\xEE\xEC\xEF\xB3\xEB\xFF\xF2\xEE\xF0\xE0 + \xE2 \xE4\xF0\xF3\xE3\xEE\xEC\xF3 - \xF8\xEB\xFF\xF5 \xE4\xEE \xF2\xE5\xF1\xF2\xF3 + \xE2 \xF2\xF0\xE5\xF2\xFC\xEE\xEC\xF3 - \xF8\xEB\xFF\xF5 \xE4\xEE \xEF\xE0\xEF\xEA\xE8 \xE2 \xFF\xEA\xB3\xE9 \xE1\xF3\xE4\xF3\xF2\xFC \xE7\xE1\xE5\xF0\xB3\xE3\xE0\xF2\xE8\xF1\xFC \xEF\xF0\xEE\xEC\xB3\xE6\xED\xB3 \xF4\xE0\xE9\xEB\xE8 + \xE2 \xF7\xE5\xF2\xE2\xE5\xF0\xF2\xEE\xEC\xF3 - \xF8\xEB\xFF\xF5 \xE4\xEE \xF4\xE0\xE9\xEB\xF3, \xF9\xEE \xEC\xB3\xF1\xF2\xE8\xF2\xFC \xEA\xEE\xE4 \xEF\xF0\xEE\xE3\xF0\xE0\xEC\xE8 +3. \xCA\xEE\xE6\xE5\xED \xF2\xE5\xF1\xF2 - \xF6\xE5 \xEF\xE0\xEF\xEA\xE0, \xF9\xEE \xEC\xB3\xF1\xF2\xE8\xF2\xFC \xF4\xE0\xE9\xEB Limits.txt \xB3 \xEF\xB3\xE4\xEF\xE0\xEF\xEA\xE8 \xE7 \xED\xE0\xE7\xE2\xE0\xEC\xE8 + test1,test2, ... \xCA\xEE\xE6\xED\xE0 \xE7 \xF6\xE8\xF5 \xEF\xE0\xEF\xEE\xEA \xEC\xB3\xF1\xF2\xE8\xF2\xFC \xF4\xE0\xE9\xEB\xE8 in.txt,out.txt,points.txt. + \xCF\xE0\xEF\xEA\xE8 \xEF\xEE\xE2\xE8\xED\xED\xB3 \xEC\xE0\xF2\xE8 \xEF\xEE\xF1\xEB\xB3\xE4\xEE\xE2\xED\xB3 \xED\xEE\xEC\xE5\xF0\xE8, \xFF\xEA\xB3 \xEF\xEE\xF7\xE8\xED\xE0\xFE\xF2\xFC\xF1\xFF \xE7 \xEE\xE4\xE8\xED\xE8\xF6\xB3. \xC4\xE5\xFF\xEA\xB3 + \xF4\xE0\xE9\xEB\xE8 \xEC\xEE\xE6\xF3\xF2\xFC \xE1\xF3\xF2\xE8 \xE2\xB3\xE4\xF1\xF3\xF2\xED\xB3, \xF2\xEE\xE4\xB3 \xE4\xEB\xFF \xF2\xE5\xF1\xF2\xF3\xE2\xE0\xED\xED\xFF \xE1\xF3\xE4\xF3\xF2\xFC \xE2\xE8\xEA\xEE\xF0\xE8\xF1\xF2\xE0\xED\xB3 \xF1\xF2\xE0\xED\xE4\xE0\xF0\xF2\xED\xB3 + \xE2\xE5\xEB\xE8\xF7\xE8\xED\xE8. \xCD\xE0\xEF\xF0\xE8\xEA\xEB\xE0\xE4 \xEF\xF0\xE8 \xE2\xB3\xE4\xF1\xF3\xF2\xED\xEE\xF1\xF2\xB3 points.txt \xEA\xB3\xEB\xFC\xEA\xB3\xF1\xF2\xFC \xEE\xF7\xEE\xEA \xE7\xE0 \xF2\xE5\xF1\xF2 \xE1\xF3\xE4\xE5 \xE2\xE2\xE0\xE6\xE0\xE8\xF1\xFC + \xF0\xB3\xE2\xED\xEE\xFE 1. +4. Limits.txt - \xEC\xE0\xBA \xED\xE0\xF1\xF2\xF3\xEF\xED\xF3 \xF1\xF2\xF0\xF3\xEA\xF2\xF3\xF0\xF3: + CodeLimit: XXXX (\xE2 \xE1\xE0\xE9\xF2\xE0\xF5) + CompilationTimeLimit: XXXX (\xE2 \xEC\xB3\xEB\xB3\xF1\xE5\xEA\xF3\xED\xE4\xE0\xF5) + MemoryLimit: XXXX (\xE2 \xE1\xE0\xE9\xF2\xE0\xF5) + OutputLimit: XXXX (\xE2 \xE1\xE0\xE9\xF2\xE0\xF5) + RealTimeLimit: XXXX (\xE2 \xEC\xB3\xEB\xB3\xF1\xE5\xEA\xF3\xED\xE4\xE0\xF5) + TimeLimit: XXXX (\xE2 \xEC\xB3\xEB\xB3\xF1\xE5\xEA\xF3\xED\xE4\xE0\xF5) + \xE4\xE5 \xD5\xD5\xD5\xD5 - \xF6\xE5 \xF6\xB3\xEB\xB3 \xF7\xE8\xF1\xEB\xE0 +//////////////////////////////////////////////////////////////////////// +///////////////////////\xD0\xC5\xC7\xD3\xCB\xDC\xD2\xC0\xD2 \xC2\xC8\xCA\xCE\xCD\xC0\xCD\xCD\xDF////////////////////////////// +//////////////////////////////////////////////////////////////////////// + \xCF\xF0\xEE\xE3\xF0\xE0\xEC\xE0 \xEF\xEE\xE2\xE5\xF0\xF2\xE0\xBA \xE4\xE5\xF2\xE0\xEB\xB3 \xF1\xE2\xEE\xE3\xEE \xE2\xE8\xEA\xEE\xED\xE0\xED\xED\xFF \xE2 \xEF\xEE\xEB\xFF\xF5 Details \xE2\xB3\xE4\xEF\xEE\xE2\xB3\xE4\xED\xE8\xF5 \xF1\xF2\xF0\xF3\xEA\xF2\xF3\xF0. +\xDF\xEA\xF9\xEE \xEF\xF0\xEE\xF6\xE5\xF1 \xF1\xEE\xF0\xF1\xE0 \xE1\xF3\xEB\xEE \xE2\xE8\xEA\xEE\xED\xE0\xED\xEE \xE7 \xE2\xE8\xEA\xEE\xF0\xE8\xF1\xF2\xE0\xED\xED\xFF\xEC \xE7\xE0\xF5\xE8\xF1\xF2\xF3, \xF2\xEE Details \xEA\xEE\xE6\xED\xEE\xE3\xEE \xF2\xE5\xF1\xF2\xF3 +\xE1\xF3\xE4\xE5 \xEC\xB3\xF1\xF2\xE8\xF2\xE8 \xF0\xFF\xE4\xEE\xEA Secured process, \xE2 \xEF\xF0\xEE\xF2\xE8\xEB\xE5\xE6\xED\xEE\xEC\xF3 \xE2\xE8\xEF\xE0\xE4\xEA\xF3 Details \xF2\xE5\xF1\xF2\xF3 \xE1\xF3\xE4\xE5 +\xEC\xB3\xF1\xF2\xE8\xF2\xE8 Unsecured process. \xD0\xE5\xE7\xF3\xEB\xFC\xF2\xE0\xF2\xE0 \xEA\xEE\xEC\xEF\xB3\xEB\xFF\xF6\xB3\xBF \xE7\xE1\xE5\xF0\xB3\xE3\xE0\xBA\xF2\xFC\xF1\xFF \xE2 \xF1\xF2\xF0\xF3\xEA\xF2\xF3\xF0\xB3 +TSource->Summary->compres, \xE0 \xF0\xE5\xE7\xF3\xEB\xFC\xF2\xE0\xF2 \xEF\xF0\xEE\xF5\xEE\xE4\xE6\xE5\xED\xED\xFF \xF2\xE5\xF1\xF2\xB3\xE2 \xE2 \xF1\xF2\xF0\xF3\xEA\xF2\xF3\xF0\xB3 +TSource->Summary->res. +//////////////////////////////////////////////////////////////////////// +/////////////////////////\xC4\xC5\xD2\xC0˲ \xD0\xCE\xC1\xCE\xD2\xC8////////////////////////////////// +//////////////////////////////////////////////////////////////////////// + \xD7\xE0\xF1 \xEA\xEE\xEC\xEF\xB3\xEB\xFF\xF6\xB3\xBF \xE2\xE8\xEC\xB3\xF0\xFE\xBA\xF2\xFC\xF1\xFF \xEF\xEE \xF0\xE5\xE0\xEB\xFC\xED\xEE\xEC\xF3 \xF7\xE0\xF1\xF3 \xF0\xEE\xE1\xEE\xF2\xE8 (\xF2\xEE\xE1\xF2\xEE \xE2\xB3\xED \xEC\xEE\xE6\xE5 \xE7\xEC\xB3\xED\xFE\xE2\xE0\xF2\xE8\xF1\xFC +\xE7\xE0\xEB\xE5\xE6\xED\xEE \xE2\xB3\xE4 \xE7\xE0\xE3\xF0\xF3\xE6\xE5\xED\xEE\xF1\xF2\xB3 \xD6\xCF). \xD0\xE5\xE0\xEB\xFC\xED\xE8\xE9 \xF7\xE0\xF1 \xF0\xEE\xE1\xEE\xF2\xE8 \xE2\xE8\xEC\xB3\xF0\xFE\xBA\xF2\xFC\xF1\xFF \xE0\xED\xE0\xEB\xEE\xE3\xB3\xF7\xED\xE8\xEC \xF7\xE8\xED\xEE\xEC. + \xCF\xE0\xEC\xFF\xF2\xFC \xEF\xF0\xEE\xF6\xE5\xF1\xE0 \xEE\xE1\xEC\xE5\xE6\xF3\xBA\xF2\xFC\xF1\xFF JobObject'\xEE\xEC, \xF7\xE0\xF1 \xE2\xE8\xEA\xEE\xED\xE0\xED\xED\xFF \xE2\xE8\xEC\xB3\xF0\xFE\xBA\xF2\xFC\xF1\xFF \xE2 \xE1\xE5\xF1\xEA\xB3\xED\xE5\xF7\xED\xEE\xEC\xF3 \xF6\xE8\xEA\xEB\xB3, +\xF2\xE0\xEA \xF1\xE0\xEC\xEE \xFF\xEA \xB3 \xF0\xEE\xE7\xEC\xB3\xF0 \xE2\xE8\xF5\xB3\xE4\xED\xEE\xE3\xEE \xF4\xE0\xE9\xEB\xF3. \xD0\xE0\xED\xF2\xE0\xE9\xEC\xE8 \xEB\xEE\xE2\xE8\xF2\xFC JobObject, \xFF\xEA\xF9\xEE \xF0\xE0\xED\xF2\xE0\xE9\xEC \xEC\xE0\xBA \xED\xEE\xEC\xE5\xF0 +5 (Access is denied), \xF2\xEE \xF1\xF2\xE0\xE2\xE8\xF2\xFC\xF1\xFF \xF0\xE5\xE7\xF3\xEB\xFC\xF2\xE0\xF2 \xE7\xE0\xE1\xEE\xF0\xEE\xED\xE5\xED\xE0 \xF4\xF3\xED\xEA\xF6\xB3\xFF. \xDF\xEA\xF9\xEE \xEF\xF0\xEE\xF6\xE5\xF1 \xED\xE5 \xEC\xEE\xE6\xE5 +\xE7\xE0\xEF\xF3\xF1\xF2\xE8\xF2\xE8\xF1\xFC, \xF2\xEE \xEF\xE5\xF0\xE5\xE2\xB3\xF0\xFF\xBA\xF2\xFC\xF1\xFF \xF0\xE5\xE7\xF3\xEB\xFC\xF2\xE0\xF2 GetLastError - \xFF\xEA\xF9\xEE \xE2\xB3\xED \xF0\xB3\xE2\xED\xE8\xE9 193 \xE0\xE1\xEE 1455, +\xF2\xEE \xE7\xED\xE0\xF7\xE8\xF2\xFC \xE2 \xF1\xEE\xF0\xF1\xB3 \xE2\xE8\xE4\xB3\xEB\xFF\xBA\xF2\xFC\xF1\xFF \xE4\xF3\xE6\xE5 \xE2\xE5\xEB\xE8\xEA\xE8\xE9 \xEC\xE0\xF1\xE8\xE2. + \xCF\xF0\xE8 \xF1\xF2\xE2\xEE\xF0\xE5\xED\xED\xB3 TSource \xEF\xF0\xEE\xE1\xF3\xBA \xE7\xED\xE0\xE9\xF2\xE8 \xFE\xE7\xE5\xF0\xE0 \xE7 \xB3\xEC'\xFF\xEC TestingUser, \xFF\xEA\xF9\xEE \xF2\xE0\xEA\xE8\xE9 \xED\xE5 \xB3\xF1\xED\xF3\xBA, +\xF2\xEE \xF1\xF2\xE2\xEE\xF0\xFE\xBA \xE9\xEE\xE3\xEE \xB3 \xE7\xE0\xE1\xEE\xF0\xEE\xED\xFF\xBA \xE9\xEE\xEC\xF3 \xE4\xEE\xF1\xF2\xF3\xEF \xE4\xEE \xEB\xEE\xEA\xE0\xEB\xFC\xED\xE8\xF5 \xE4\xE8\xF1\xEA\xB3\xE2. \xD6\xE5 \xEC\xEE\xE6\xE5 \xE7\xE0\xE9\xED\xFF\xF2\xE8 \xEA\xB3\xEB\xFC\xEA\xE0 \xF5\xE2\xE8\xEB\xE8\xED. + \xDF\xEA\xF9\xEE \xEF\xF0\xEE\xE3\xF0\xE0\xEC\xB3 \xED\xE5 \xE2\xE4\xE0\xBA\xF2\xFC\xF1\xFF \xF1\xF2\xE2\xEE\xF0\xE8\xF2\xE8 \xEF\xF0\xEE\xF6\xE5\xF1 \xE2\xB3\xE4 \xB3\xEC\xE5\xED\xB3 TestingUSer, \xF2\xEE \xE2\xEE\xED\xE0 \xE9\xEE\xE3\xEE \xF1\xF2\xE2\xEE\xF0\xFE\xBA +\xE2\xB3\xE4 \xB3\xEC\xE5\xED\xB3 \xFE\xE7\xE5\xF0\xE0 \xEF\xB3\xE4 \xFF\xEA\xE8\xEC \xE7\xE0\xEF\xF3\xF1\xEA\xE0\xBA\xF2\xFC\xF1\xFF \xF1\xE0\xEC\xE0. \xD2\xEE\xE4\xB3 \xEF\xF0\xEE\xF6\xE5\xF1 \xF1\xF2\xE0\xBA Unsecured \xB3 \xEC\xEE\xE6\xE5 \xE4\xEE\xF1\xF2\xF3\xEF\xE0\xF2\xE8\xF1\xFC +\xE4\xEE \xF4\xE0\xE9\xEB\xEE\xE2\xEE\xBF \xF1\xE8\xF1\xF2\xE5\xEC\xE8. \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-05 21:28:58
|
Revision: 221 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=221&view=rev Author: brus07 Date: 2008-06-05 14:29:04 -0700 (Thu, 05 Jun 2008) Log Message: ----------- Update checker for work with SourceTest. Fixed bug with return "Compile error". Modified Paths: -------------- ACMServer/trunk/TesterSolution/Checker/Class1.cs Modified: ACMServer/trunk/TesterSolution/Checker/Class1.cs =================================================================== --- ACMServer/trunk/TesterSolution/Checker/Class1.cs 2008-06-05 21:25:44 UTC (rev 220) +++ ACMServer/trunk/TesterSolution/Checker/Class1.cs 2008-06-05 21:29:04 UTC (rev 221) @@ -16,7 +16,7 @@ public static string GetResult(string message) { string code = message.Substring(message.IndexOf('$')+1); - string id = message.Substring(0,message.IndexOf('$')); + string id = message.Substring(0, message.IndexOf('$')); TSource c = new TSource(); StreamReader s = new StreamReader("InData.txt", Encoding.Default); String compiler = s.ReadLine(); @@ -35,12 +35,18 @@ c.TestHandler += new TTestHandler(func); c.Language = (TLang)1; c.ProcessAll(); - Console.WriteLine("Compile result: {0}\nCompilation details: {1}\nUsed Time for compile: {2}", TSource.CompileResultToString(c.Summary.compres.res), c.Summary.compres.Details, c.Summary.compres.UsedTime); - Console.WriteLine("Test result: {0}", TSource.TestResultToString(c.Summary.res.res)); - Console.WriteLine("Points: {0}", c.Summary.res.points); - Console.WriteLine("Used Time: {0}", c.Summary.res.UsedTime); - Console.WriteLine("Used Memory: {0}", c.Summary.res.UsedMemory); - Console.WriteLine("Used Real Time: {0}", c.Summary.res.UsedRealTime); + c.State = (TSourceState)6; + //Console.WriteLine("Compile result: {0}\nCompilation details: {1}\nUsed Time for compile: {2}", TSource.CompileResultToString(c.Summary.compres.res), c.Summary.compres.Details, c.Summary.compres.UsedTime); + //Console.WriteLine("Test result: {0}", TSource.TestResultToString(c.Summary.res.res)); + //Console.WriteLine("Points: {0}", c.Summary.res.points); + //Console.WriteLine("Used Time: {0}", c.Summary.res.UsedTime); + //Console.WriteLine("Used Memory: {0}", c.Summary.res.UsedMemory); + //Console.WriteLine("Used Real Time: {0}", c.Summary.res.UsedRealTime); + //Console.ReadKey(); + if (c.Summary.compres.res != (TCompRes)0 ) + { + return TSource.CompileResultToString(c.Summary.compres.res); + } return TSource.TestResultToString(c.Summary.res.res); } public static int GetResult1(string code) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-05 21:25:39
|
Revision: 220 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=220&view=rev Author: brus07 Date: 2008-06-05 14:25:44 -0700 (Thu, 05 Jun 2008) Log Message: ----------- Bug fixed Modified Paths: -------------- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs Modified: ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs 2008-06-05 20:30:40 UTC (rev 219) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs 2008-06-05 21:25:44 UTC (rev 220) @@ -74,9 +74,9 @@ myRequest.Method = "GET"; WebResponse myResponse = myRequest.GetResponse(); StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8); - myResponse.Close(); string result = sr.ReadToEnd(); sr.Close(); + myResponse.Close(); if (result.Length == 0) return null; return result; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-05 20:30:36
|
Revision: 219 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=219&view=rev Author: brus07 Date: 2008-06-05 13:30:40 -0700 (Thu, 05 Jun 2008) Log Message: ----------- Rename InDataW.txt file. Start all work when start application. Not use GUI element marked as Enabled=false. Fixed bug with send to web result in WebGetter. Modified Paths: -------------- ACMServer/trunk/MediatorSolution/Library/Connector/Connector.csproj ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs ACMServer/trunk/MediatorSolution/Mediator/Form1.Designer.cs ACMServer/trunk/MediatorSolution/Mediator/Form1.cs Added Paths: ----------- ACMServer/trunk/MediatorSolution/Library/Connector/InDataW.txt Removed Paths: ------------- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/InData.txt Modified: ACMServer/trunk/MediatorSolution/Library/Connector/Connector.csproj =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Connector.csproj 2008-06-05 20:27:25 UTC (rev 218) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Connector.csproj 2008-06-05 20:30:40 UTC (rev 219) @@ -47,7 +47,7 @@ <Compile Include="WebConnector.cs" /> </ItemGroup> <ItemGroup> - <Content Include="Getter\InData.txt"> + <Content Include="InDataW.txt"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> </ItemGroup> Deleted: ACMServer/trunk/MediatorSolution/Library/Connector/Getter/InData.txt =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/InData.txt 2008-06-05 20:27:25 UTC (rev 218) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Getter/InData.txt 2008-06-05 20:30:40 UTC (rev 219) @@ -1,2 +0,0 @@ -http://127.0.0.1/d -http://acm.lviv.ua/version3 \ No newline at end of file Modified: ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs 2008-06-05 20:27:25 UTC (rev 218) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs 2008-06-05 20:30:40 UTC (rev 219) @@ -16,7 +16,7 @@ { if (fullPathToWebPages == "") { - StreamReader s = new StreamReader("Getter/InData.txt", Encoding.Default); + StreamReader s = new StreamReader("InDataW.txt", Encoding.Default); fullPathToWebPages = s.ReadLine(); s.Close(); } @@ -65,14 +65,8 @@ string id = (message.Split('$'))[1]; HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(fullPathToWebPages + "/set.php?res=" + res + "&id=" + id); myRequest.Method = "GET"; - myRequest.GetResponse(); - /* WebResponse myResponse = myRequest.GetResponse(); - StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8); - string result = sr.ReadToEnd(); - sr.Close(); myResponse.Close(); - */ } string GetInfoFromSite2() { @@ -80,9 +74,9 @@ myRequest.Method = "GET"; WebResponse myResponse = myRequest.GetResponse(); StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8); + myResponse.Close(); string result = sr.ReadToEnd(); sr.Close(); - myResponse.Close(); if (result.Length == 0) return null; return result; Added: ACMServer/trunk/MediatorSolution/Library/Connector/InDataW.txt =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/InDataW.txt (rev 0) +++ ACMServer/trunk/MediatorSolution/Library/Connector/InDataW.txt 2008-06-05 20:30:40 UTC (rev 219) @@ -0,0 +1,2 @@ +http://acm.lviv.ua/version3 +http://127.0.0.1/d \ No newline at end of file Modified: ACMServer/trunk/MediatorSolution/Mediator/Form1.Designer.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Form1.Designer.cs 2008-06-05 20:27:25 UTC (rev 218) +++ ACMServer/trunk/MediatorSolution/Mediator/Form1.Designer.cs 2008-06-05 20:30:40 UTC (rev 219) @@ -35,11 +35,14 @@ this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.timer1 = new System.Windows.Forms.Timer(this.components); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); // // button2 // + this.button2.Enabled = false; this.button2.Location = new System.Drawing.Point(12, 12); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); @@ -51,7 +54,7 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 76); + this.label1.Location = new System.Drawing.Point(12, 72); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(23, 13); this.label1.TabIndex = 3; @@ -59,6 +62,7 @@ // // button3 // + this.button3.Enabled = false; this.button3.Location = new System.Drawing.Point(12, 41); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(75, 23); @@ -88,17 +92,37 @@ this.timer1.Enabled = true; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(12, 95); + this.textBox1.Name = "textBox1"; + this.textBox1.ReadOnly = true; + this.textBox1.Size = new System.Drawing.Size(236, 20); + this.textBox1.TabIndex = 10; + this.textBox1.Text = "http://acm.lviv.ua/version3/table.php"; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(41, 69); + this.textBox2.Name = "textBox2"; + this.textBox2.ReadOnly = true; + this.textBox2.Size = new System.Drawing.Size(110, 20); + this.textBox2.TabIndex = 11; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(262, 160); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.button3); this.Controls.Add(this.label1); this.Controls.Add(this.button2); this.Name = "Form1"; this.Text = "Gate"; + this.Load += new System.EventHandler(this.Form1_Load); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); @@ -115,6 +139,8 @@ private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox textBox2; } } Modified: ACMServer/trunk/MediatorSolution/Mediator/Form1.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Form1.cs 2008-06-05 20:27:25 UTC (rev 218) +++ ACMServer/trunk/MediatorSolution/Mediator/Form1.cs 2008-06-05 20:30:40 UTC (rev 219) @@ -19,7 +19,7 @@ { InitializeComponent(); string s = System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName())[0].ToString(); - label1.Text += s; + textBox2.Text = s; } private void button2_Click(object sender, EventArgs e) @@ -57,5 +57,10 @@ mes += "0"; toolStripStatusLabel1.Text = mes; } + + private void Form1_Load(object sender, EventArgs e) + { + button2_Click(this, null); + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-05 20:27:21
|
Revision: 218 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=218&view=rev Author: brus07 Date: 2008-06-05 13:27:25 -0700 (Thu, 05 Jun 2008) Log Message: ----------- Not use GUI element marked as Enabled=false Modified Paths: -------------- ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs Modified: ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs 2008-06-05 20:07:26 UTC (rev 217) +++ ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs 2008-06-05 20:27:25 UTC (rev 218) @@ -75,6 +75,7 @@ // // textBox2 // + this.textBox2.Enabled = false; this.textBox2.Location = new System.Drawing.Point(149, 35); this.textBox2.Name = "textBox2"; this.textBox2.Size = new System.Drawing.Size(100, 20); @@ -82,6 +83,7 @@ // // button3 // + this.button3.Enabled = false; this.button3.Location = new System.Drawing.Point(174, 61); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(75, 23); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-05 20:07:38
|
Revision: 217 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=217&view=rev Author: Oracle_ Date: 2008-06-05 13:07:26 -0700 (Thu, 05 Jun 2008) Log Message: ----------- Fixed some bugs, added some comments. Modified Paths: -------------- ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp ACMServer/branches/sharp tester/SourceTest/SourceTest.h ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp Modified: ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp =================================================================== --- ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp 2008-06-05 14:54:51 UTC (rev 216) +++ ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp 2008-06-05 20:07:26 UTC (rev 217) @@ -8,34 +8,34 @@ #include <Userenv.h> using namespace System::IO; -const wchar_t USER_NAME[]={'T','e','s','t','i','n','g','U','s','e','r'}; -const wchar_t USER_PASSW[]={'U','S','E','R','1','2','3','4','5'}; +const wchar_t USER_NAME[]={'T','e','s','t','i','n','g','U','s','e','r'}; //username for testing +const wchar_t USER_PASSW[]={'U','S','E','R','1','2','3','4','5'}; //password of user for testing namespace SourceTest { -char* StrToArr(String^ str) +char* StrToArr(String^ str) //converts Managed String to C++ string to { return (char*)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(str).ToPointer(); } -wchar_t* StrToArrW(String^ str) +wchar_t* StrToArrW(String^ str) //converts Managed String to array of Unicode symbols { return (wchar_t*)System::Runtime::InteropServices::Marshal::StringToHGlobalUni(str).ToPointer(); } -void FreeArr(char* buf) +void FreeArr(char* buf) //destroys C++ string { System::Runtime::InteropServices::Marshal::FreeHGlobal(IntPtr(buf)); } -void FreeArr(wchar_t* buf) +void FreeArr(wchar_t* buf) //destroys array of Unicode symbols { System::Runtime::InteropServices::Marshal::FreeHGlobal(IntPtr(buf)); } -String^ ToStr(int x) +String^ ToStr(int x) //fast convert integer to Managed String { char intg[15]; _itoa_s(x,intg,10); @@ -43,7 +43,7 @@ } -bool FileExists(String^ path) +bool FileExists(String^ path) //checks whether file exists or not { char* buf=StrToArr(path); OFSTRUCT of; @@ -64,7 +64,7 @@ FRunAll=true; lib=LoadLibraryA("TestLibrary.dll"); FSecurity=new TSecure(); -init(); +init(); //initializing of critical section } TSource::~TSource() @@ -72,15 +72,15 @@ if (lib!=NULL) FreeLibrary(lib); delete FSecurity; -final(); +final(); } -void TSource::CheckCL() +void TSource::CheckCL() //checking size of source { try { lock(); - if (lib==NULL) + if (lib==NULL) //no library was found { if (FSrc->Length>FLim.CodeLimit) FCompResult.res=crCL; @@ -102,12 +102,12 @@ } } -void TSource::CheckDF() +void TSource::CheckDF() //checking for DF in source { try { lock(); - if (lib==NULL) + if (lib==NULL) //no library was found { FCompResult.Details+="No checker for DF\n"; } else @@ -127,7 +127,7 @@ } } -void TSource::Compile() +void TSource::Compile() //compiles the source { PROCESS_INFORMATION pi;ZeroMemory(&pi,sizeof(pi)); STARTUPINFO si; ZeroMemory(&si,sizeof(si)); @@ -144,7 +144,7 @@ String^ outpath=gcnew String(FTempPath+"compoutput.txt"); FExePath=FTempPath+"source.exe"; - if (FileExists(FExePath)) + if (FileExists(FExePath)) //delete previsious source { DeleteFile((LPCTSTR)(bufW=StrToArrW(FExePath))); FreeArr(bufW); @@ -194,7 +194,7 @@ ReadFile(oup,compres,size,&len,NULL); CloseHandle(oup); - if (!FileExists(FExePath)) + if (!FileExists(FExePath)) //compilation error { FCompResult.res=crCE; FCompResult.Details+=gcnew String("EXE file not found\n")+gcnew String(compres); @@ -214,7 +214,7 @@ } } -void TSource::RunTests() +void TSource::RunTests() //runs all tests of problem { try { @@ -230,7 +230,7 @@ if (((TResult^)FRes[n-1])->res!=trAC) { FSummary.res->res=((TResult^)FRes[n-1])->res; - if (!FRunAll) break; + if (!FRunAll) break; } n++; } @@ -241,7 +241,7 @@ } } -void TSource::LoadTest(int index,TTest% test) +void TSource::LoadTest(int index,TTest% test) //loads test from file { FILE* inp,*oup,*points; char *bufA; @@ -292,14 +292,14 @@ } } -TCheckAnsRes TSource::CheckAnswer(int index,String^ output) +TCheckAnsRes TSource::CheckAnswer(int index,String^ output) //checks answer for test { try { lock(); TTest t; LoadTest(index,t); - if (lib==NULL) + if (lib==NULL) //lib was not found { if (output!=t.output) return carWA; @@ -318,22 +318,27 @@ } } -void TSource::ProcessAll() +void TSource::ProcessAll() //executes all actions needed to get Summary result for all tests { -CheckCL(); -if (FCompResult.res==crOK) - CheckDF(); else - return ; -if (FCompResult.res==crOK) - Compile(); else - return ; -(*FSummary.compres)=FCompResult; -if (FCompResult.res==crOK) - RunTests(); else - return ; +try +{ + CheckCL(); + if (FCompResult.res==crOK) + CheckDF(); else + return ; + if (FCompResult.res==crOK) + Compile(); else + return ; + if (FCompResult.res==crOK) + RunTests(); else + return ; +} __finally +{ + (*FSummary.compres)=FCompResult; } +} -BOOL DelPrivilege(HANDLE hToken,LPCTSTR lpszPrivilege) +BOOL DelPrivilege(HANDLE hToken,LPCTSTR lpszPrivilege) //deletes privilege from process token { TOKEN_PRIVILEGES tp; LUID luid; @@ -344,16 +349,13 @@ tp.Privileges[0].Attributes = SE_PRIVILEGE_REMOVED; if ( !AdjustTokenPrivileges(hToken,FALSE,&tp,sizeof(TOKEN_PRIVILEGES),(PTOKEN_PRIVILEGES) NULL,(PDWORD) NULL) ) -{ - int x=GetLastError(); return FALSE; -} if (GetLastError() == ERROR_NOT_ALL_ASSIGNED) return FALSE; return TRUE; } -BOOL AddPrivilege(HANDLE hToken,LPCTSTR lpszPrivilege) +BOOL AddPrivilege(HANDLE hToken,LPCTSTR lpszPrivilege) //adds privilege to process token (in this version unused) { TOKEN_PRIVILEGES tp; LUID luid; @@ -370,7 +372,7 @@ return TRUE; } -void DeletePrivileges(HANDLE proc) +void DeletePrivileges(HANDLE proc) //deletes all privileges from process token { HANDLE hToken; try @@ -417,7 +419,7 @@ } } -void TSource::RunTest(int index) +void TSource::RunTest(int index) //runs one test { PROCESS_INFORMATION pi;ZeroMemory(&pi,sizeof(pi)); STARTUPINFO si;ZeroMemory(&si,sizeof(si)); @@ -462,7 +464,7 @@ SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOALIGNMENTFAULTEXCEPT|SEM_NOGPFAULTERRORBOX|SEM_NOOPENFILEERRORBOX); - if (!FSecurity->RunProcess(bufW=StrToArrW(FExePath),TRUE,CREATE_SUSPENDED|CREATE_NO_WINDOW,&si,&pi)) + if (!FSecurity->RunProcess(bufW=StrToArrW(FExePath),TRUE,CREATE_SUSPENDED|CREATE_NO_WINDOW,&si,&pi,it->Details)) { FreeArr(bufW); it->points=0; @@ -470,11 +472,11 @@ if ((err==193)||(err==1455)) { it->res=trRE; - it->Details="Too large array"; + it->Details+=gcnew String("Too large array"); } else { it->res=trIE; - it->Details="Can not start process"; + it->Details+=gcnew String("Can not start process"); } return ; } @@ -503,7 +505,7 @@ { TerminateJobObject(job,0); it->res=trOL; - it->Details="Size of output file excided OutputLimit"; + it->Details+=gcnew String("Size of output file excided OutputLimit"); break; } QueryInformationJobObject(job,JobObjectBasicAccountingInformation,&acc,sizeof(acc),NULL); @@ -513,14 +515,14 @@ { TerminateJobObject(job,0); it->res=trRTL; - it->Details="Real time limit"; + it->Details+=gcnew String("Real time limit"); break; } if ((acc.ThisPeriodTotalKernelTime.QuadPart+acc.ThisPeriodTotalUserTime.QuadPart)>FLim.TimeLimit*10000) { TerminateJobObject(job,0); it->res=trTL; - it->Details="Time Limit"; + it->Details+=gcnew String("Time Limit"); break; } } else @@ -530,7 +532,7 @@ { TerminateJobObject(job,0); it->res=trTL; - it->Details="Time Limit"; + it->Details+=gcnew String("Time Limit"); break; } prc=(TCheckLim)GetProcAddress(lib,"CheckRTL"); @@ -538,7 +540,7 @@ { TerminateJobObject(job,0); it->res=trRTL; - it->Details="Real time Limit"; + it->Details+=gcnew String("Real time Limit"); break; } } @@ -556,18 +558,18 @@ if (code==5) { it->res=trDF; - it->Details="Access denied."; + it->Details+=gcnew String("Access denied."); } else if (code!=0) { it->res=trRE; - it->Details="Runtime error #"+ToStr((int)code); + it->Details+=gcnew String("Runtime error #"+ToStr((int)code)); } needbreak=true; break; case JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT: it->res=trML; - it->Details="Memory Limit"; + it->Details+=gcnew String("Memory Limit"); needbreak=true; break; case JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO: @@ -575,12 +577,12 @@ if (code==5) { it->res=trDF; - it->Details="Access denied."; + it->Details+=gcnew String("Access denied."); } else if (code!=0) { it->res=trRE; - it->Details="Runtime error #"+ToStr((int)code); + it->Details+=gcnew String("Runtime error #"+ToStr((int)code)); } needbreak=true; break; @@ -609,7 +611,7 @@ if (!FileExists(oupath)) { it->res=trWA; - it->Details="No output file"; + it->Details+=gcnew String("No output file"); return; } @@ -667,18 +669,23 @@ void TSource::ProcessTest(int index) { -CheckCL(); -if (FCompResult.res==crOK) - CheckDF(); else - return ; -if (FCompResult.res==crOK) - Compile(); else - return ; -(*FSummary.compres)=FCompResult; -if (FCompResult.res==crOK) - RunTest(index); else - return ; +try +{ + CheckCL(); + if (FCompResult.res==crOK) + CheckDF(); else + return ; + if (FCompResult.res==crOK) + Compile(); else + return ; + if (FCompResult.res==crOK) + RunTest(index); else + return ; +} __finally +{ + (*FSummary.compres)=FCompResult; } +} void TSource::LoadLimits() { @@ -759,8 +766,8 @@ TSecure::TSecure() { - SetUserObjectFullAccess( GetThreadDesktop(GetCurrentThreadId())); - SetUserObjectFullAccess( GetProcessWindowStation()); + SetUserObjectFullAccess( GetThreadDesktop(GetCurrentThreadId())); //needed for accessing from CreateProcessAsUser + SetUserObjectFullAccess( GetProcessWindowStation()); //needed for accessing from CreateProcessAsUser USER_INFO_1 ui; NET_API_STATUS st; @@ -771,22 +778,27 @@ ui.usri1_password=(LPWSTR)USER_PASSW; ui.usri1_priv=USER_PRIV_USER; ui.usri1_script_path=NULL; - st=NetUserAdd(NULL,1,(LPBYTE)&ui,NULL); + st=NetUserAdd(NULL,1,(LPBYTE)&ui,NULL); //trying to create new user if (st!=NERR_Success) { if (st==NERR_UserExists) - return; - throw "Can not create user!"; + return; //if user exists just do nothing + MessageBox(NULL,(LPCTSTR)"Can not create testing user - only unsecured mode",(LPCTSTR)"Warning",MB_ICONWARNING|MB_OK); + return; } array<DriveInfo^>^ drv=DriveInfo::GetDrives(); - for (int i=0;i<drv->Length;i++) + for (int i=0;i<drv->Length;i++) //for all drives set limitation if (drv[i]->DriveType==DriveType::Fixed) { - DirectoryInfo^ fi = gcnew DirectoryInfo(drv[i]->Name); - DirectorySecurity^ fs = gcnew DirectorySecurity(drv[i]->Name, AccessControlSections::All); - fs->SetAccessRule(gcnew FileSystemAccessRule("TestingUser",FileSystemRights::FullControl,AccessControlType::Deny)); - fi->SetAccessControl(fs); + DirectoryInfo^ fi = gcnew DirectoryInfo(drv[i]->Name); + DirectorySecurity^ fs = gcnew DirectorySecurity(drv[i]->Name, AccessControlSections::All); + fs->SetAccessRule(gcnew FileSystemAccessRule(gcnew String(USER_NAME),FileSystemRights::FullControl, + InheritanceFlags::ObjectInherit|InheritanceFlags::ContainerInherit, + PropagationFlags::None, + AccessControlType::Deny)); + fi->SetAccessControl(fs); } + } TSecure::~TSecure() @@ -794,11 +806,16 @@ } -bool TSecure::RunProcess(LPWSTR lpCommandLine,BOOL bInheritHandles,DWORD dwCreationFlags,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation) +bool TSecure::RunProcess(LPWSTR lpCommandLine,BOOL bInheritHandles,DWORD dwCreationFlags,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation, String^% Details) { HANDLE token=NULL,Token=NULL; wchar_t* env=NULL; if (LogonUser((LPWSTR)USER_NAME,(LPWSTR)".",(LPWSTR)USER_PASSW,LOGON32_LOGON_NETWORK,LOGON32_PROVIDER_DEFAULT,&Token)) + { + FileInfo^ fi=gcnew FileInfo(gcnew String(lpCommandLine)); + FileSecurity^ fs=gcnew FileSecurity(gcnew String(lpCommandLine),AccessControlSections::All); + fs->SetAccessRule(gcnew FileSystemAccessRule(gcnew String(USER_NAME),FileSystemRights::ExecuteFile,AccessControlType::Allow)); + fi->SetAccessControl(fs); if (DuplicateTokenEx(Token,TOKEN_ALL_ACCESS,NULL,SecurityImpersonation,TokenPrimary,&token)) if (ImpersonateLoggedOnUser(token)) if (CreateEnvironmentBlock((LPVOID*)&env,token,FALSE)) @@ -807,9 +824,10 @@ DestroyEnvironmentBlock(env); RevertToSelf(); CloseHandle(token); + Details="Secured process. Result details: "; return true; } - int x=GetLastError(); + } if (env!=NULL) DestroyEnvironmentBlock(env); RevertToSelf(); @@ -817,6 +835,7 @@ CloseHandle(token); if (Token!=NULL) CloseHandle(Token); + Details="Unsecured process. Result details: "; if (CreateProcess(NULL,lpCommandLine,NULL,NULL,bInheritHandles,dwCreationFlags,NULL,NULL,lpStartupInfo,lpProcessInformation)) return true; return false; Modified: ACMServer/branches/sharp tester/SourceTest/SourceTest.h =================================================================== --- ACMServer/branches/sharp tester/SourceTest/SourceTest.h 2008-06-05 14:54:51 UTC (rev 216) +++ ACMServer/branches/sharp tester/SourceTest/SourceTest.h 2008-06-05 20:07:26 UTC (rev 217) @@ -8,14 +8,25 @@ namespace SourceTest { + /* + To normally execute source you need to: + 1. Have privileges SE_ASSIGNPRIMARYTOKEN_NAME and SE_INCREASE_QUOTA_NAME + 2. Have HTFS file system + 3. Have .NET Framework 2.0 or higher + */ + + + ///<summary> + ///TLimits holds information about limits for process + ///</summary> public ref struct TLimits { - int OutputLimit; - int TimeLimit; - int MemoryLimit; - int RealTimeLimit; - int CompilationTimeLimit; - int CodeLimit; + int OutputLimit; //maximum size of output file + int TimeLimit; //maximum kernel time + int MemoryLimit; //maximum virtual memory usage + int RealTimeLimit; //maximum real time + int CompilationTimeLimit; //maximum time for compilation + int CodeLimit; //maximum source size TLimits() { @@ -48,6 +59,9 @@ return value; } }; + ///<summary> + ///TCompRes is all possible results of compilation + ///</summary> public enum TCompRes //result of compilation { @@ -59,6 +73,10 @@ crIE //internal error }; + ///<summary> + ///TRes is all possible results of running the source + ///</summary> + public enum TRes { trAC, //accepted @@ -74,14 +92,18 @@ trOE //output error }; + ///<summary> + ///TResult holds information about results of running the process + ///</summary> + public ref struct TResult { TRes res; - int points; - int UsedMemory; - int UsedTime; - int UsedRealTime; - String^ Details; + int points; //points earned during testing (each test has some points) points are stored in Points.txt (in test folder) + int UsedMemory; //memory peak during testing + int UsedTime; //kernel time used + int UsedRealTime; //real time used + String^ Details; //details of testing TResult() { @@ -115,11 +137,15 @@ } }; + ///<summary> + ///TCompResult holds information about compilation + ///</summary> + public ref struct TCompResult { - TCompRes res; - int UsedTime; - String^ Details; + TCompRes res; //result of compilation + int UsedTime; //time used for compilation + String^ Details; //details of compilation TCompResult(TCompResult% value) { res=value.res; @@ -142,18 +168,23 @@ return value; } }; + ///<summary> + ///TSourceState is all possible states of source during its testing + ///</summary> public enum TSourceState { - ssNone=0, - ssCheckedCL=1, - ssCheckedDF=2, - ssCompiled=3, - ssIsRunning=4, //for multithreading + ssNone=0, //no actions were taken + ssCheckedCL=1, //CodeLimit checked + ssCheckedDF=2, //source is checked for DF + ssCompiled=3, //source is compiled + ssIsRunning=4, //test is running ssTestComplete=5, //next test is gonna be tested ssFinish=6 //all tests is tested }; - + ///<summary> + ///TSummary holds information about total result of processing all tests + ///</summary> public ref struct TSummary { public: @@ -172,12 +203,17 @@ } }; - + ///<summary> + ///TTest holds information about one test + ///</summary> public ref struct TTest { - String^ input,^output; - int points; + String^ input,^output; //input and output of test + int points; //points for test }; + ///<summary> + ///TCheckAnsRes is all possible values, what can give CheckAnswer function from DLL + ///</summary> public enum TCheckAnsRes { @@ -188,12 +224,16 @@ carOE=4 //output error }; + ///<summary> + ///TLang is all possible languages of source (needed for CheckDF) + ///</summary> + public enum TLang { lCpp=0, lPascal=1 }; - + typedef bool (*TCheckSrc)(char* src,int,char*& details); typedef bool (*TCheckLim)(int,int); typedef int (*TCheckAnswer)(char* input, char* output, char* rightoutput); @@ -201,32 +241,39 @@ public delegate void TTestHandler(int index, TResult^ res); + ///<summary> + ///Class that takes part in security - it has to create a user and execute source in his security context + ///</summary> + private class TSecure { private: public: TSecure(); ~TSecure(); - bool RunProcess(LPWSTR lpCommandLine,BOOL bInheritHandles,DWORD dwCreationFlags,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); + bool RunProcess(LPWSTR lpCommandLine,BOOL bInheritHandles,DWORD dwCreationFlags,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation,String^% Details); }; + ///<summary> + ///TSource is main class that incapsulates all information about source and it's testing + ///</summary> public ref class TSource { private: - String^ FSrc; - String^ FExePath; - String^ FProblemPath; - String^ FCompPath; + String^ FSrc; //text of source + String^ FExePath; //executable file + String^ FProblemPath; //path for problem + String^ FCompPath; //path for compiler String^ FTempPath; //this is the place where temporary files will be created - bool FRunAll; - TSourceState FState; - TCompResult FCompResult; - ArrayList FRes; - TSummary FSummary; - TLimits FLim; - TTestHandler^ FTestHandler; - TLang FLang; - TSecure *FSecurity; + bool FRunAll; //if true then all tests will run (no matter on errors) + TSourceState FState; //state of source + TCompResult FCompResult; //result of compilation + ArrayList FRes; //results of each test + TSummary FSummary; //summary results of all tests + TLimits FLim; //limits for testing + TTestHandler^ FTestHandler; //event, that occures when test is completed + TLang FLang; //language of source + TSecure *FSecurity; //security class HMODULE lib; //library that must export: //bool CheckCL(char* src, int cl, char* details) - must check codelimit //bool CheckDF(char* src, int lang, char* details) - must check DF @@ -265,11 +312,11 @@ void CheckDF(); void Compile(); void RunTests(); //all tests - void RunTest(int index); + void RunTest(int index); //only one test TCheckAnsRes CheckAnswer(int index,String^ output); void ProcessAll(); //gets result for all tests void ProcessTest(int index); //gets result for only 1 test - void LoadTest(int index,TTest% test); + void LoadTest(int index,TTest% test); //load test from file void LoadLimits(); //loads limits from a file Limits.txt static String^ TestResultToString(TRes res); static String^ CompileResultToString(TCompRes res); Modified: ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp =================================================================== --- ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp 2008-06-05 14:54:51 UTC (rev 216) +++ ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp 2008-06-05 20:07:26 UTC (rev 217) @@ -14,7 +14,7 @@ TESTLIBRARY_API bool CheckDF(char* src, int lang, char*& details) { details=new char[20]; - strcpy_s(details,20,"CheckDF from DLL"); + strcpy_s(details,20,"CheckDF from DLL\n"); return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-05 14:54:45
|
Revision: 216 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=216&view=rev Author: Oracle_ Date: 2008-06-05 07:54:51 -0700 (Thu, 05 Jun 2008) Log Message: ----------- Added file access control. Modified Paths: -------------- ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp ACMServer/branches/sharp tester/SourceTest/SourceTest.vcproj Added Paths: ----------- ACMServer/branches/sharp tester/SourceTest/NetAPI32.Lib here.txt ACMServer/branches/sharp tester/SourceTest/User32.Lib here.txt ACMServer/branches/sharp tester/SourceTest/UserEnv.lib here.txt Added: ACMServer/branches/sharp tester/SourceTest/NetAPI32.Lib here.txt =================================================================== Modified: ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp =================================================================== --- ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp 2008-06-04 22:16:56 UTC (rev 215) +++ ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp 2008-06-05 14:54:51 UTC (rev 216) @@ -5,8 +5,8 @@ #include "SourceTest.h" #include <LM.h> #include <Aclapi.h> +#include <Userenv.h> using namespace System::IO; -using namespace System::Diagnostics; const wchar_t USER_NAME[]={'T','e','s','t','i','n','g','U','s','e','r'}; const wchar_t USER_PASSW[]={'U','S','E','R','1','2','3','4','5'}; @@ -553,6 +553,11 @@ { case JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS: GetExitCodeProcess(pi.hProcess,&code); + if (code==5) + { + it->res=trDF; + it->Details="Access denied."; + } else if (code!=0) { it->res=trRE; @@ -567,6 +572,11 @@ break; case JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO: GetExitCodeProcess(pi.hProcess,&code); + if (code==5) + { + it->res=trDF; + it->Details="Access denied."; + } else if (code!=0) { it->res=trRE; @@ -734,9 +744,25 @@ //-------------SECURITY CLASS---------------------------- //------------------------------------------------------- +BOOL SetUserObjectFullAccess(HANDLE hUserObject) +{ + SECURITY_DESCRIPTOR* Sd; + SECURITY_INFORMATION Si; + Sd = (SECURITY_DESCRIPTOR*)LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH); + InitializeSecurityDescriptor(Sd, SECURITY_DESCRIPTOR_REVISION); + SetSecurityDescriptorDacl(Sd, TRUE, NULL, FALSE); + Si = DACL_SECURITY_INFORMATION; + BOOL Result = SetUserObjectSecurity(hUserObject, &Si, Sd); + LocalFree(HLOCAL(Sd)); + return Result; +} + TSecure::TSecure() { - /*USER_INFO_1 ui; + SetUserObjectFullAccess( GetThreadDesktop(GetCurrentThreadId())); + SetUserObjectFullAccess( GetProcessWindowStation()); + + USER_INFO_1 ui; NET_API_STATUS st; ui.usri1_comment=NULL; ui.usri1_flags=UF_SCRIPT|UF_PASSWD_CANT_CHANGE; @@ -751,31 +777,46 @@ if (st==NERR_UserExists) return; throw "Can not create user!"; + } + array<DriveInfo^>^ drv=DriveInfo::GetDrives(); + for (int i=0;i<drv->Length;i++) + if (drv[i]->DriveType==DriveType::Fixed) + { + DirectoryInfo^ fi = gcnew DirectoryInfo(drv[i]->Name); + DirectorySecurity^ fs = gcnew DirectorySecurity(drv[i]->Name, AccessControlSections::All); + fs->SetAccessRule(gcnew FileSystemAccessRule("TestingUser",FileSystemRights::FullControl,AccessControlType::Deny)); + fi->SetAccessControl(fs); } - - DirectoryInfo^ fi = gcnew DirectoryInfo("C:\\"); - DirectorySecurity^ fs = gcnew DirectorySecurity("C:\\", AccessControlSections::All); - fs->SetAccessRule(gcnew FileSystemAccessRule("TestingUser",FileSystemRights::FullControl,AccessControlType::Deny)); - fi->SetAccessControl(fs);*/ } TSecure::~TSecure() { - + } bool TSecure::RunProcess(LPWSTR lpCommandLine,BOOL bInheritHandles,DWORD dwCreationFlags,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation) { - /*HANDLE token; - if (LogonUser((LPWSTR)USER_NAME,(LPWSTR)".",(LPWSTR)USER_PASSW,LOGON32_LOGON_INTERACTIVE,LOGON32_PROVIDER_DEFAULT,&token)) + HANDLE token=NULL,Token=NULL; + wchar_t* env=NULL; + if (LogonUser((LPWSTR)USER_NAME,(LPWSTR)".",(LPWSTR)USER_PASSW,LOGON32_LOGON_NETWORK,LOGON32_PROVIDER_DEFAULT,&Token)) + if (DuplicateTokenEx(Token,TOKEN_ALL_ACCESS,NULL,SecurityImpersonation,TokenPrimary,&token)) + if (ImpersonateLoggedOnUser(token)) + if (CreateEnvironmentBlock((LPVOID*)&env,token,FALSE)) + if (CreateProcessAsUser(token,NULL,lpCommandLine,NULL,NULL,bInheritHandles,dwCreationFlags|CREATE_UNICODE_ENVIRONMENT,env,NULL,lpStartupInfo,lpProcessInformation)) { - if (CreateProcessAsUser(token,NULL,lpCommandLine,NULL,NULL,bInheritHandles,dwCreationFlags,NULL,NULL,lpStartupInfo,lpProcessInformation)) - { - CloseHandle(token); - return true; - } + DestroyEnvironmentBlock(env); + RevertToSelf(); CloseHandle(token); - }*/ + return true; + } + int x=GetLastError(); + if (env!=NULL) + DestroyEnvironmentBlock(env); + RevertToSelf(); + if (token!=NULL) + CloseHandle(token); + if (Token!=NULL) + CloseHandle(Token); if (CreateProcess(NULL,lpCommandLine,NULL,NULL,bInheritHandles,dwCreationFlags,NULL,NULL,lpStartupInfo,lpProcessInformation)) return true; return false; Modified: ACMServer/branches/sharp tester/SourceTest/SourceTest.vcproj =================================================================== --- ACMServer/branches/sharp tester/SourceTest/SourceTest.vcproj 2008-06-04 22:16:56 UTC (rev 215) +++ ACMServer/branches/sharp tester/SourceTest/SourceTest.vcproj 2008-06-05 14:54:51 UTC (rev 216) @@ -250,6 +250,14 @@ RelativePath=".\NetAPI32.Lib" > </File> + <File + RelativePath=".\User32.Lib" + > + </File> + <File + RelativePath=".\UserEnv.Lib" + > + </File> </Files> <Globals> </Globals> Added: ACMServer/branches/sharp tester/SourceTest/User32.Lib here.txt =================================================================== Added: ACMServer/branches/sharp tester/SourceTest/UserEnv.lib here.txt =================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-04 22:17:13
|
Revision: 215 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=215&view=rev Author: brus07 Date: 2008-06-04 15:16:56 -0700 (Wed, 04 Jun 2008) Log Message: ----------- Added InData.txt. In this file save real path to webpages. Read only first line in this file. Modified Paths: -------------- ACMServer/trunk/MediatorSolution/Library/Connector/Connector.csproj ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs Added Paths: ----------- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/InData.txt Modified: ACMServer/trunk/MediatorSolution/Library/Connector/Connector.csproj =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Connector.csproj 2008-06-04 21:24:40 UTC (rev 214) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Connector.csproj 2008-06-04 22:16:56 UTC (rev 215) @@ -46,6 +46,11 @@ <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="WebConnector.cs" /> </ItemGroup> + <ItemGroup> + <Content Include="Getter\InData.txt"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + </ItemGroup> <Import Project="$(MSBuildBinPath)\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. Added: ACMServer/trunk/MediatorSolution/Library/Connector/Getter/InData.txt =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/InData.txt (rev 0) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Getter/InData.txt 2008-06-04 22:16:56 UTC (rev 215) @@ -0,0 +1,2 @@ +http://127.0.0.1/d +http://acm.lviv.ua/version3 \ No newline at end of file Modified: ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs 2008-06-04 21:24:40 UTC (rev 214) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs 2008-06-04 22:16:56 UTC (rev 215) @@ -3,18 +3,34 @@ using System.Windows.Forms; using System.Net; using System.IO; +using System.Text; namespace AcmContester.Library.Connector.Getter { class WebGetter: IGetter { + //"http://127.0.0.1/d"; + string fullPathToWebPages = ""; + + private void checkAddress() + { + if (fullPathToWebPages == "") + { + StreamReader s = new StreamReader("Getter/InData.txt", Encoding.Default); + fullPathToWebPages = s.ReadLine(); + s.Close(); + } + } + public void Send(string message) { + checkAddress(); Send2(message); } public object GetInfoFromSite() { + checkAddress(); return GetInfoFromSite2(); } @@ -22,7 +38,7 @@ { WebBrowser webBrowser = new WebBrowser(); webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted); - webBrowser.Navigate("http://127.0.0.1/d/a.php?p=321"); + webBrowser.Navigate(fullPathToWebPages + "/a.php?p=321"); } @@ -32,7 +48,7 @@ { WebBrowser webBrowser = new WebBrowser(); webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted); - webBrowser.Navigate("http://127.0.0.1/d/a.php?p=321"); + webBrowser.Navigate(fullPathToWebPages + "/a.php?p=321"); mut.WaitOne(); return document; } @@ -47,7 +63,7 @@ { string res = (message.Split('$'))[0]; string id = (message.Split('$'))[1]; - HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://127.0.0.1/d/set.php?res=" + res + "&id=" + id); + HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(fullPathToWebPages + "/set.php?res=" + res + "&id=" + id); myRequest.Method = "GET"; myRequest.GetResponse(); /* @@ -60,7 +76,7 @@ } string GetInfoFromSite2() { - HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://127.0.0.1/d/get.php"); + HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(fullPathToWebPages + "/get.php"); myRequest.Method = "GET"; WebResponse myResponse = myRequest.GetResponse(); StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-04 21:24:37
|
Revision: 214 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=214&view=rev Author: brus07 Date: 2008-06-04 14:24:40 -0700 (Wed, 04 Jun 2008) Log Message: ----------- Work with real Tester. Modification of logging. Modified Paths: -------------- ACMServer/trunk/TesterSolution/Checker/Checker.csproj ACMServer/trunk/TesterSolution/Checker/Class1.cs ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs ACMServer/trunk/TesterSolution/Tester/Form1.cs Added Paths: ----------- ACMServer/trunk/TesterSolution/Checker/InData.txt ACMServer/trunk/TesterSolution/Checker/SourceTest.dll Modified: ACMServer/trunk/TesterSolution/Checker/Checker.csproj =================================================================== --- ACMServer/trunk/TesterSolution/Checker/Checker.csproj 2008-06-04 16:42:41 UTC (rev 213) +++ ACMServer/trunk/TesterSolution/Checker/Checker.csproj 2008-06-04 21:24:40 UTC (rev 214) @@ -28,6 +28,10 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="SourceTest, Version=1.0.3077.22878, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>.\SourceTest.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> @@ -36,6 +40,11 @@ <Compile Include="Class1.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> + <ItemGroup> + <Content Include="InData.txt"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + </ItemGroup> <Import Project="$(MSBuildBinPath)\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. Modified: ACMServer/trunk/TesterSolution/Checker/Class1.cs =================================================================== --- ACMServer/trunk/TesterSolution/Checker/Class1.cs 2008-06-04 16:42:41 UTC (rev 213) +++ ACMServer/trunk/TesterSolution/Checker/Class1.cs 2008-06-04 21:24:40 UTC (rev 214) @@ -1,13 +1,50 @@ using System; using System.Collections.Generic; using System.Text; +using SourceTest; +using System.IO; namespace Checker { public class Checker { - public static int GetResult(string code) + static void func(int x, TResult res) { + Console.WriteLine("test number {0}, result: {1}, details: {2}", x, TSource.TestResultToString(res.res), res.Details); + } + + public static string GetResult(string message) + { + string code = message.Substring(message.IndexOf('$')+1); + string id = message.Substring(0,message.IndexOf('$')); + TSource c = new TSource(); + StreamReader s = new StreamReader("InData.txt", Encoding.Default); + String compiler = s.ReadLine(); + String problem = s.ReadLine(); + String temp = s.ReadLine(); + String source = s.ReadLine(); + s.Close(); + //s = File.OpenText(source); + c.CompPath = compiler; + c.ProblemPath = problem; + c.LoadLimits(); + c.Src = code; + //c.Src = s.ReadToEnd(); + //s.Close(); + c.TempPath = temp; + c.TestHandler += new TTestHandler(func); + c.Language = (TLang)1; + c.ProcessAll(); + Console.WriteLine("Compile result: {0}\nCompilation details: {1}\nUsed Time for compile: {2}", TSource.CompileResultToString(c.Summary.compres.res), c.Summary.compres.Details, c.Summary.compres.UsedTime); + Console.WriteLine("Test result: {0}", TSource.TestResultToString(c.Summary.res.res)); + Console.WriteLine("Points: {0}", c.Summary.res.points); + Console.WriteLine("Used Time: {0}", c.Summary.res.UsedTime); + Console.WriteLine("Used Memory: {0}", c.Summary.res.UsedMemory); + Console.WriteLine("Used Real Time: {0}", c.Summary.res.UsedRealTime); + return TSource.TestResultToString(c.Summary.res.res); + } + public static int GetResult1(string code) + { code = (code.Split(' '))[1]; int res = 0; for (int i = 0; i < code.Length; i++) Added: ACMServer/trunk/TesterSolution/Checker/InData.txt =================================================================== --- ACMServer/trunk/TesterSolution/Checker/InData.txt (rev 0) +++ ACMServer/trunk/TesterSolution/Checker/InData.txt 2008-06-04 21:24:40 UTC (rev 214) @@ -0,0 +1,4 @@ +d:\SAMPLE\D7.bat +d:\SAMPLE\Test\ +d:\SAMPLE\Temp\ +d:\SAMPLE\source.txt Added: ACMServer/trunk/TesterSolution/Checker/SourceTest.dll =================================================================== (Binary files differ) Property changes on: ACMServer/trunk/TesterSolution/Checker/SourceTest.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs 2008-06-04 16:42:41 UTC (rev 213) +++ ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs 2008-06-04 21:24:40 UTC (rev 214) @@ -36,16 +36,20 @@ this.button3 = new System.Windows.Forms.Button(); this.textBox3 = new System.Windows.Forms.TextBox(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.timer1 = new System.Windows.Forms.Timer(this.components); - this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); // // textBox1 // + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.textBox1.Location = new System.Drawing.Point(12, 90); this.textBox1.Multiline = true; this.textBox1.Name = "textBox1"; + this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.textBox1.Size = new System.Drawing.Size(268, 158); this.textBox1.TabIndex = 0; // @@ -104,17 +108,17 @@ this.statusStrip1.TabIndex = 6; this.statusStrip1.Text = "statusStrip1"; // - // timer1 - // - this.timer1.Enabled = true; - this.timer1.Tick += new System.EventHandler(this.timer1_Tick); - // // toolStripStatusLabel1 // this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; this.toolStripStatusLabel1.Size = new System.Drawing.Size(109, 17); this.toolStripStatusLabel1.Text = "toolStripStatusLabel1"; // + // timer1 + // + this.timer1.Enabled = true; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); Modified: ACMServer/trunk/TesterSolution/Tester/Form1.cs =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-06-04 16:42:41 UTC (rev 213) +++ ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-06-04 21:24:40 UTC (rev 214) @@ -51,8 +51,9 @@ private void DataArrived(string message) { textBox1.Text += "\r\n" + message; - int result = Checker.Checker.GetResult(message); - socket.Send(result.ToString() + " " + message); + string result = Checker.Checker.GetResult(message); + textBox1.Text += "\r\n\t-> " + result; + socket.Send(result.ToString() + "$" + message); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-04 16:42:39
|
Revision: 213 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=213&view=rev Author: Oracle_ Date: 2008-06-04 09:42:41 -0700 (Wed, 04 Jun 2008) Log Message: ----------- Fixed CE. Modified Paths: -------------- ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp ACMServer/branches/sharp tester/SourceTest/SourceTest.h ACMServer/branches/sharp tester/SourceTest/SourceTest.vcproj ACMServer/branches/sharp tester/tester/Program.cs Modified: ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp =================================================================== --- ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp 2008-06-04 13:08:31 UTC (rev 212) +++ ACMServer/branches/sharp tester/SourceTest/SourceTest.cpp 2008-06-04 16:42:41 UTC (rev 213) @@ -3,29 +3,36 @@ #include "stdafx.h" #include <stdio.h> #include "SourceTest.h" +#include <LM.h> +#include <Aclapi.h> +using namespace System::IO; +using namespace System::Diagnostics; +const wchar_t USER_NAME[]={'T','e','s','t','i','n','g','U','s','e','r'}; +const wchar_t USER_PASSW[]={'U','S','E','R','1','2','3','4','5'}; + namespace SourceTest { char* StrToArr(String^ str) { - return (char*)Marshal::StringToHGlobalAnsi(str).ToPointer(); + return (char*)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(str).ToPointer(); } wchar_t* StrToArrW(String^ str) { - return (wchar_t*)Marshal::StringToHGlobalUni(str).ToPointer(); + return (wchar_t*)System::Runtime::InteropServices::Marshal::StringToHGlobalUni(str).ToPointer(); } void FreeArr(char* buf) { - Marshal::FreeHGlobal(IntPtr(buf)); + System::Runtime::InteropServices::Marshal::FreeHGlobal(IntPtr(buf)); } void FreeArr(wchar_t* buf) { - Marshal::FreeHGlobal(IntPtr(buf)); + System::Runtime::InteropServices::Marshal::FreeHGlobal(IntPtr(buf)); } String^ ToStr(int x) @@ -337,12 +344,32 @@ tp.Privileges[0].Attributes = SE_PRIVILEGE_REMOVED; if ( !AdjustTokenPrivileges(hToken,FALSE,&tp,sizeof(TOKEN_PRIVILEGES),(PTOKEN_PRIVILEGES) NULL,(PDWORD) NULL) ) +{ + int x=GetLastError(); return FALSE; +} if (GetLastError() == ERROR_NOT_ALL_ASSIGNED) return FALSE; return TRUE; } +BOOL AddPrivilege(HANDLE hToken,LPCTSTR lpszPrivilege) +{ +TOKEN_PRIVILEGES tp; +LUID luid; +if (!LookupPrivilegeValue( NULL,lpszPrivilege,&luid)) + return FALSE; +tp.PrivilegeCount = 1; +tp.Privileges[0].Luid = luid; +tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + +if ( !AdjustTokenPrivileges(hToken,FALSE,&tp,sizeof(TOKEN_PRIVILEGES),(PTOKEN_PRIVILEGES) NULL,(PDWORD) NULL) ) + return FALSE; +if (GetLastError() == ERROR_NOT_ALL_ASSIGNED) + return FALSE; +return TRUE; +} + void DeletePrivileges(HANDLE proc) { HANDLE hToken; @@ -426,7 +453,6 @@ TTest t; LoadTest(index,t); - job=CreateJobObject(NULL,(LPWSTR)""); si.cb=sizeof(si); si.dwFlags=STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW; si.wShowWindow=FALSE; @@ -453,6 +479,7 @@ return ; } FreeArr(bufW); + job=CreateJobObject(NULL,NULL); mem.BasicLimitInformation.LimitFlags=JOB_OBJECT_LIMIT_PROCESS_MEMORY; mem.ProcessMemoryLimit=FLim.MemoryLimit; SetInformationJobObject(job,JobObjectExtendedLimitInformation,&mem,sizeof(mem)); @@ -466,10 +493,8 @@ SetInformationJobObject(job,JobObjectBasicUIRestrictions,&uilim,sizeof(uilim)); DeletePrivileges(pi.hProcess); - AssignProcessToJobObject(job,pi.hProcess); ResumeThread(pi.hThread); - DWORD start=GetTickCount(); while (true) @@ -512,7 +537,7 @@ if (prc((int)(GetTickCount()-start),FLim.RealTimeLimit)) { TerminateJobObject(job,0); - it->res=trTL; + it->res=trRTL; it->Details="Real time Limit"; break; } @@ -711,7 +736,27 @@ TSecure::TSecure() { + /*USER_INFO_1 ui; + NET_API_STATUS st; + ui.usri1_comment=NULL; + ui.usri1_flags=UF_SCRIPT|UF_PASSWD_CANT_CHANGE; + ui.usri1_home_dir=NULL; + ui.usri1_name=(LPWSTR)USER_NAME; + ui.usri1_password=(LPWSTR)USER_PASSW; + ui.usri1_priv=USER_PRIV_USER; + ui.usri1_script_path=NULL; + st=NetUserAdd(NULL,1,(LPBYTE)&ui,NULL); + if (st!=NERR_Success) + { + if (st==NERR_UserExists) + return; + throw "Can not create user!"; + } + DirectoryInfo^ fi = gcnew DirectoryInfo("C:\\"); + DirectorySecurity^ fs = gcnew DirectorySecurity("C:\\", AccessControlSections::All); + fs->SetAccessRule(gcnew FileSystemAccessRule("TestingUser",FileSystemRights::FullControl,AccessControlType::Deny)); + fi->SetAccessControl(fs);*/ } TSecure::~TSecure() @@ -721,9 +766,19 @@ bool TSecure::RunProcess(LPWSTR lpCommandLine,BOOL bInheritHandles,DWORD dwCreationFlags,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation) { - if (CreateProcess(NULL,lpCommandLine,NULL,NULL,bInheritHandles,dwCreationFlags,NULL,NULL,lpStartupInfo,lpProcessInformation)) - return true; - return false; + /*HANDLE token; + if (LogonUser((LPWSTR)USER_NAME,(LPWSTR)".",(LPWSTR)USER_PASSW,LOGON32_LOGON_INTERACTIVE,LOGON32_PROVIDER_DEFAULT,&token)) + { + if (CreateProcessAsUser(token,NULL,lpCommandLine,NULL,NULL,bInheritHandles,dwCreationFlags,NULL,NULL,lpStartupInfo,lpProcessInformation)) + { + CloseHandle(token); + return true; + } + CloseHandle(token); + }*/ + if (CreateProcess(NULL,lpCommandLine,NULL,NULL,bInheritHandles,dwCreationFlags,NULL,NULL,lpStartupInfo,lpProcessInformation)) + return true; + return false; } }; Modified: ACMServer/branches/sharp tester/SourceTest/SourceTest.h =================================================================== --- ACMServer/branches/sharp tester/SourceTest/SourceTest.h 2008-06-04 13:08:31 UTC (rev 212) +++ ACMServer/branches/sharp tester/SourceTest/SourceTest.h 2008-06-04 16:42:41 UTC (rev 213) @@ -4,7 +4,7 @@ #include <windows.h> using namespace System; using namespace System::Collections; -using namespace System::Runtime::InteropServices; +using namespace System::Security::AccessControl; namespace SourceTest { Modified: ACMServer/branches/sharp tester/SourceTest/SourceTest.vcproj =================================================================== --- ACMServer/branches/sharp tester/SourceTest/SourceTest.vcproj 2008-06-04 13:08:31 UTC (rev 212) +++ ACMServer/branches/sharp tester/SourceTest/SourceTest.vcproj 2008-06-04 16:42:41 UTC (rev 213) @@ -246,6 +246,10 @@ RelativePath=".\AdvAPI32.Lib" > </File> + <File + RelativePath=".\NetAPI32.Lib" + > + </File> </Files> <Globals> </Globals> Modified: ACMServer/branches/sharp tester/tester/Program.cs =================================================================== --- ACMServer/branches/sharp tester/tester/Program.cs 2008-06-04 13:08:31 UTC (rev 212) +++ ACMServer/branches/sharp tester/tester/Program.cs 2008-06-04 16:42:41 UTC (rev 213) @@ -32,6 +32,7 @@ c.TestHandler += new TTestHandler(func); c.Language = (TLang)1; c.ProcessAll(); + c.State = (TSourceState)6; Console.WriteLine("Compile result: {0}\nCompilation details: {1}\nUsed Time for compile: {2}", TSource.CompileResultToString(c.Summary.compres.res),c.Summary.compres.Details,c.Summary.compres.UsedTime); Console.WriteLine("Test result: {0}", TSource.TestResultToString(c.Summary.res.res)); Console.WriteLine("Points: {0}", c.Summary.res.points); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-04 13:08:23
|
Revision: 212 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=212&view=rev Author: brus07 Date: 2008-06-04 06:08:31 -0700 (Wed, 04 Jun 2008) Log Message: ----------- made a copy Added Paths: ----------- ACMServer/trunk/TesterSolution/SAMPLE/ Copied: ACMServer/trunk/TesterSolution/SAMPLE (from rev 211, ACMServer/branches/sharp tester/tester/SAMPLE) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-06-04 12:57:33
|
Revision: 211 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=211&view=rev Author: brus07 Date: 2008-06-04 05:57:22 -0700 (Wed, 04 Jun 2008) Log Message: ----------- Update protocol (change separator character to '$'). Fixed bug with empty response. Modified Paths: -------------- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Result.cs ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Submit.cs Modified: ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs 2008-06-04 09:08:29 UTC (rev 210) +++ ACMServer/trunk/MediatorSolution/Library/Connector/Getter/WebGetter.cs 2008-06-04 12:57:22 UTC (rev 211) @@ -45,8 +45,8 @@ void Send2(string message) { - string res = (message.Split(' '))[0]; - string id = (message.Split(' '))[1]; + string res = (message.Split('$'))[0]; + string id = (message.Split('$'))[1]; HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://127.0.0.1/d/set.php?res=" + res + "&id=" + id); myRequest.Method = "GET"; myRequest.GetResponse(); @@ -67,6 +67,8 @@ string result = sr.ReadToEnd(); sr.Close(); myResponse.Close(); + if (result.Length == 0) + return null; return result; } } Modified: ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Result.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Result.cs 2008-06-04 09:08:29 UTC (rev 210) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Result.cs 2008-06-04 12:57:22 UTC (rev 211) @@ -14,11 +14,9 @@ public Result(string message) { //TODO - string[] messages = message.Split(' '); - if (messages.Length != 3) - throw new Exception("Result.Result: \xED\xE5\xEF\xF0\xE0\xE2\xE8\xEB\xFC\xED\xE8\xE9 \xF4\xEE\xF0\xEC\xE0\xF2 \xE2\xF5\xB3\xE4\xED\xEE\xBF \xF1\xF2\xF0\xB3\xF7\xEA\xE8"); - temp = messages[0]; - submit = new Submit(messages[1] + " " + messages[2]); + temp = message.Substring(0, message.IndexOf('$')); + string s = message.Substring(message.IndexOf('$') + 1); + submit = new Submit(s); } public Submit Submit Modified: ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Submit.cs =================================================================== --- ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Submit.cs 2008-06-04 09:08:29 UTC (rev 210) +++ ACMServer/trunk/MediatorSolution/Mediator/Library/Data/Submit.cs 2008-06-04 12:57:22 UTC (rev 211) @@ -13,11 +13,8 @@ public Submit(string message) { //TODO - string[] messages = message.Split(' '); - if (messages.Length != 2) - throw new Exception("Submit.Submit: \xED\xE5\xEF\xF0\xE0\xE2\xE8\xEB\xFC\xED\xE8\xE9 \xF4\xEE\xF0\xEC\xE0\xF2 \xE2\xF5\xB3\xE4\xED\xEE\xBF \xF1\xF2\xF0\xB3\xF7\xEA\xE8"); - id = Convert.ToInt32(messages[0]); - temp = messages[1]; + id = Convert.ToInt32(message.Substring(0,message.IndexOf('$'))); + temp = message.Substring(message.IndexOf('$')+1); } //HACK: \xE4\xEB\xFF \xF2\xE5\xF1\xF2\xF3 \xF5\xE0\xE9 \xE1\xF3\xE4\xE5 \xF2\xE0\xEA, \xE0\xEB\xE5 \xEC\xE0\xBA \xE1\xF3\xF2\xE8 \xF7\xE5\xF0\xE5\xE7 XML This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-04 09:08:45
|
Revision: 210 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=210&view=rev Author: Oracle_ Date: 2008-06-04 02:08:29 -0700 (Wed, 04 Jun 2008) Log Message: ----------- Fixed small bug with TL. Modified Paths: -------------- ACMServer/branches/Version_2/Server/MainUnit.pas Modified: ACMServer/branches/Version_2/Server/MainUnit.pas =================================================================== --- ACMServer/branches/Version_2/Server/MainUnit.pas 2008-06-03 21:41:11 UTC (rev 209) +++ ACMServer/branches/Version_2/Server/MainUnit.pas 2008-06-04 09:08:29 UTC (rev 210) @@ -621,7 +621,7 @@ LLog.Add('End Testing RUN'); - WorkedTime:=WorkedTime*100; + WorkedTime:=Round((WorkedTime-TLx)/TLk)*100; UsedMemory:=UsedMemory div 1024; if Language = L_Pascal then This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-03 21:41:05
|
Revision: 209 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=209&view=rev Author: Oracle_ Date: 2008-06-03 14:41:11 -0700 (Tue, 03 Jun 2008) Log Message: ----------- Added TL coefficients. Modified Paths: -------------- ACMServer/branches/Version_2/Server/IniData.txt ACMServer/branches/Version_2/Server/MainUnit.pas Modified: ACMServer/branches/Version_2/Server/IniData.txt =================================================================== --- ACMServer/branches/Version_2/Server/IniData.txt 2008-06-03 21:17:32 UTC (rev 208) +++ ACMServer/branches/Version_2/Server/IniData.txt 2008-06-03 21:41:11 UTC (rev 209) @@ -7,4 +7,5 @@ 60000 Visualization Info: True -ACM: True \ No newline at end of file +ACM: True +0.5 0 Modified: ACMServer/branches/Version_2/Server/MainUnit.pas =================================================================== --- ACMServer/branches/Version_2/Server/MainUnit.pas 2008-06-03 21:17:32 UTC (rev 208) +++ ACMServer/branches/Version_2/Server/MainUnit.pas 2008-06-03 21:41:11 UTC (rev 209) @@ -82,9 +82,9 @@ NeedVisualization, ACM_Compilating:boolean; TestingSource : RTL_CRITICAL_SECTION; + TLk,TLx:Extended; - implementation uses Math; @@ -192,7 +192,7 @@ while s[1]=' ' do delete(s,1,1); ACM_Compilating:=LowerCase(s)='true'; - +Readln(f,TLk,TLx); closefile(f); if IOResult<>0 then @@ -500,7 +500,7 @@ LLog.add('TestSingleSourceFile'); RLog.Add('Start Test: ID='+inttostr(info.SubmitID)+' ProblemNumber='+inttostr(info.ProblemNumber)+' Login='+Info.Login); -RLog.Add(' TimeLimit='+floattostr(Info.Limits.TimeLimit/1000)+' s. MemoryLimit='+inttostr(info.Limits.MemoryLimit div 1024)+' KB'); +RLog.Add(' TimeLimit='+floattostr((Info.Limits.TimeLimit*TLk+TLx)/1000)+' s. MemoryLimit='+inttostr(info.Limits.MemoryLimit div 1024)+' KB'); Res:=CompileFile(SourcePath,Info.Language,ProgramPath); @@ -617,7 +617,7 @@ LLog.Add('ML='+inttostr(ML)); RunResult:=Run( ExeFile, TestFile, ResultFile, ExtractFilePath(ExeFile), - Limits.TimeLimit, ML, Limits.OutputLimit, WorkedTime, UsedMemory); + Round(Limits.TimeLimit*TLk+TLx), ML, Limits.OutputLimit, WorkedTime, UsedMemory); LLog.Add('End Testing RUN'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-03 21:17:24
|
Revision: 208 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=208&view=rev Author: Oracle_ Date: 2008-06-03 14:17:32 -0700 (Tue, 03 Jun 2008) Log Message: ----------- Added TL coefficient. Modified Paths: -------------- ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp ACMServer/branches/sharp tester/TestLibrary/TestLibrary.h ACMServer/branches/sharp tester/TestLibrary/dllmain.cpp Modified: ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp =================================================================== --- ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp 2008-06-03 16:12:26 UTC (rev 207) +++ ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp 2008-06-03 21:17:32 UTC (rev 208) @@ -1,5 +1,4 @@ -// TestLibrary.cpp : Defines the exported functions for the DLL application. -// +#pragma once #include "stdafx.h" #include "TestLibrary.h" @@ -31,7 +30,7 @@ TESTLIBRARY_API bool CheckTL(int usedtime, int timelimit) { - return (usedtime>timelimit); + return (usedtime*1.0>(timelimit*TLk+TLx)); } TESTLIBRARY_API int CheckAnswer(char* input, char* output, char* rightoutput) Modified: ACMServer/branches/sharp tester/TestLibrary/TestLibrary.h =================================================================== --- ACMServer/branches/sharp tester/TestLibrary/TestLibrary.h 2008-06-03 16:12:26 UTC (rev 207) +++ ACMServer/branches/sharp tester/TestLibrary/TestLibrary.h 2008-06-03 21:17:32 UTC (rev 208) @@ -5,6 +5,8 @@ #define TESTLIBRARY_API __declspec(dllimport) #endif +double TLx,TLk; + TESTLIBRARY_API bool CheckCL(char* src, int cl, char*& details); TESTLIBRARY_API bool CheckDF(char* src, int lang, char*& details); TESTLIBRARY_API void FreeChar(char* buf); Modified: ACMServer/branches/sharp tester/TestLibrary/dllmain.cpp =================================================================== --- ACMServer/branches/sharp tester/TestLibrary/dllmain.cpp 2008-06-03 16:12:26 UTC (rev 207) +++ ACMServer/branches/sharp tester/TestLibrary/dllmain.cpp 2008-06-03 21:17:32 UTC (rev 208) @@ -1,5 +1,8 @@ // dllmain.cpp : Defines the entry point for the DLL application. +#pragma once #include "stdafx.h" +#include <stdio.h> +extern double TLx,TLk; BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, @@ -8,12 +11,19 @@ { switch (ul_reason_for_call) { - case DLL_PROCESS_ATTACH: + case DLL_PROCESS_ATTACH: + FILE* f; + TLx=0;TLk=1; + if (fopen_s(&f,"Times.txt","rt")==0) + { + fscanf_s(f,"%Lf %Lf",&TLk,&TLx); + fclose(f); + } + break; case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; -} - +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Or...@us...> - 2008-06-03 16:12:25
|
Revision: 207 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=207&view=rev Author: Oracle_ Date: 2008-06-03 09:12:26 -0700 (Tue, 03 Jun 2008) Log Message: ----------- Modified Paths: -------------- ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp Modified: ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp =================================================================== --- ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp 2008-06-03 15:59:35 UTC (rev 206) +++ ACMServer/branches/sharp tester/TestLibrary/TestLibrary.cpp 2008-06-03 16:12:26 UTC (rev 207) @@ -4,7 +4,6 @@ #include "stdafx.h" #include "TestLibrary.h" #include <new.h> -#include <stdio.h> TESTLIBRARY_API bool CheckCL(char* src, int cl, char*& details) { @@ -42,16 +41,16 @@ int curo=0; for (int i=0;;i++,curo++) { - if (output[curo]=='\0'&&rightoutput[i]!='\0') + while ((output[curo]==' ')||(output[curo]=='\n')||(output[curo]=='\r')) + ++curo; + while ((rightoutput[i]==' ')||(rightoutput[i]=='\n')||(rightoutput[i]=='\r')) + ++i; + if ((output[curo]=='\0')&&(rightoutput[i]!='\0')) return 1; - if (output[curo]!='\0'&&rightoutput[i]=='\0') + if ((output[curo]!='\0')&&(rightoutput[i]=='\0')) return 1; - if (output[curo]=='\0'&&rightoutput[i]=='\0') + if ((output[curo]=='\0')&&(rightoutput[i]=='\0')) return 3; - while ((output[curo]==' ')&&(output[curo]=='\n')&&(output[curo]=='\r')) - ++curo; - while ((rightoutput[i]==' ')&&(rightoutput[i]=='\n')&&(rightoutput[i]=='\r')) - ++i; if (output[curo]!=rightoutput[i]) return 1; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |