From: <br...@us...> - 2008-05-04 16:30:45
|
Revision: 81 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=81&view=rev Author: brus07 Date: 2008-05-04 09:30:48 -0700 (Sun, 04 May 2008) Log Message: ----------- Deleted *.dcu files Removed Paths: ------------- ACMServer/branches/Version_2/Poserednyk/AcmLib.dcu ACMServer/branches/Version_2/Poserednyk/AcmLibForHome.dcu ACMServer/branches/Version_2/Poserednyk/AdditionalUnit.dcu ACMServer/branches/Version_2/Poserednyk/MainUnit.dcu ACMServer/branches/Version_2/Server/CompilationUnit.dcu ACMServer/branches/Version_2/Server/MainUnit.dcu ACMServer/branches/Version_2/Server/TestingUnit.dcu Deleted: ACMServer/branches/Version_2/Poserednyk/AcmLib.dcu =================================================================== (Binary files differ) Deleted: ACMServer/branches/Version_2/Poserednyk/AcmLibForHome.dcu =================================================================== (Binary files differ) Deleted: ACMServer/branches/Version_2/Poserednyk/AdditionalUnit.dcu =================================================================== (Binary files differ) Deleted: ACMServer/branches/Version_2/Poserednyk/MainUnit.dcu =================================================================== (Binary files differ) Deleted: ACMServer/branches/Version_2/Server/CompilationUnit.dcu =================================================================== (Binary files differ) Deleted: ACMServer/branches/Version_2/Server/MainUnit.dcu =================================================================== (Binary files differ) Deleted: ACMServer/branches/Version_2/Server/TestingUnit.dcu =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <br...@us...> - 2008-05-04 16:35:08
|
Revision: 82 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=82&view=rev Author: brus07 Date: 2008-05-04 09:35:14 -0700 (Sun, 04 May 2008) Log Message: ----------- Added resources files Added Paths: ----------- ACMServer/branches/Version_2/Poserednyk/ACMPoserednyk.res ACMServer/branches/Version_2/Server/ACMServer.res Added: ACMServer/branches/Version_2/Poserednyk/ACMPoserednyk.res =================================================================== (Binary files differ) Property changes on: ACMServer/branches/Version_2/Poserednyk/ACMPoserednyk.res ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: ACMServer/branches/Version_2/Server/ACMServer.res =================================================================== (Binary files differ) Property changes on: ACMServer/branches/Version_2/Server/ACMServer.res ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <or...@us...> - 2008-05-08 17:25:29
|
Revision: 103 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=103&view=rev Author: oracle_ Date: 2008-05-08 10:25:04 -0700 (Thu, 08 May 2008) Log Message: ----------- Little bug fixed Modified Paths: -------------- ACMServer/branches/Version_2/Server/TestingUnit.pas Added Paths: ----------- ACMServer/branches/Version_2/changelog.txt Modified: ACMServer/branches/Version_2/Server/TestingUnit.pas =================================================================== --- ACMServer/branches/Version_2/Server/TestingUnit.pas 2008-05-07 22:19:10 UTC (rev 102) +++ ACMServer/branches/Version_2/Server/TestingUnit.pas 2008-05-08 17:25:04 UTC (rev 103) @@ -9,6 +9,7 @@ SleepConst = 200; WaitConst = 10; TerProcTimeOut = 10000; + RealTimeConst = 25; R_CompilationError = 1; R_RuntimeError = 2; @@ -168,8 +169,15 @@ if not WasOK then begin - Res.ResInt:=R_InTimeError; - Res.ResStr:='Cant create process with exe file="'+ExeFile+'"'; + if ((GetLastError()=193) or (GetLastError()=1455)) then + begin + Res.ResInt:=R_RuntimeError; + Res.ResStr:='Extra large array error'; + end else + begin + Res.ResInt:=R_InTimeError; + Res.ResStr:='Cant create process with exe file="'+ExeFile+'"'; + end; end else begin starttime:=GetTickCount(); @@ -215,7 +223,7 @@ break; end; - if GetTickCount-starttime>TimeLimit*100 then + if GetTickCount-starttime>TimeLimit*RealTimeConst then begin Res.ResInt:=R_TimeLimit; Res.ResStr:='Time Limit (due to realtime limit)'; Added: ACMServer/branches/Version_2/changelog.txt =================================================================== --- ACMServer/branches/Version_2/changelog.txt (rev 0) +++ ACMServer/branches/Version_2/changelog.txt 2008-05-08 17:25:04 UTC (rev 103) @@ -0,0 +1,2 @@ +20:20 08.05.2008 Oracle + - \xD2\xE5\xEF\xE5\xF0 \xEF\xF0\xEE\xE3\xF0\xE0\xEC\xE8 \xE7 \xE2\xE5\xEB\xE8\xF7\xE5\xE7\xED\xE8\xEC\xE8 \xEC\xE0\xF1\xE8\xE2\xE0\xEC\xE8 \xEA\xEE\xF0\xE5\xEA\xF2\xED\xEE \xF2\xE5\xF1\xF2\xF3\xFE\xF2\xFC\xF1\xFF - \xE2\xE8\xE2\xEE\xE4\xE8\xF2\xFC\xF1\xFF Runtime error. \xCA\xEE\xED\xF1\xF2\xE0\xED\xF2\xF3 \xE4\xEB\xFF \xF0\xE5\xE0\xEB\xFC\xED\xEE\xE3\xEE \xF7\xE0\xF1\xF3 \xF0\xEE\xE1\xEE\xF2\xE8 \xE7\xEC\xE5\xED\xF8\xE5\xED\xEE \xE4\xEE 25. \ 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-05-27 18:21:47
|
Revision: 172 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=172&view=rev Author: Oracle_ Date: 2008-05-27 11:21:33 -0700 (Tue, 27 May 2008) Log Message: ----------- Added Paths: ----------- ACMServer/branches/Version_2/sharp tester/ ACMServer/branches/Version_2/sharp tester/SourceTest/ ACMServer/branches/Version_2/sharp tester/SourceTest/AdvAPI32.Lib ACMServer/branches/Version_2/sharp tester/SourceTest/AssemblyInfo.cpp ACMServer/branches/Version_2/sharp tester/SourceTest/SourceTest.cpp ACMServer/branches/Version_2/sharp tester/SourceTest/SourceTest.h ACMServer/branches/Version_2/sharp tester/SourceTest/SourceTest.vcproj ACMServer/branches/Version_2/sharp tester/SourceTest/Stdafx.cpp ACMServer/branches/Version_2/sharp tester/SourceTest/Stdafx.h ACMServer/branches/Version_2/sharp tester/SourceTest/app.ico ACMServer/branches/Version_2/sharp tester/SourceTest/app.rc ACMServer/branches/Version_2/sharp tester/SourceTest/resource.h ACMServer/branches/Version_2/sharp tester/SourceTest.sln ACMServer/branches/Version_2/sharp tester/tester/ ACMServer/branches/Version_2/sharp tester/tester/Program.cs ACMServer/branches/Version_2/sharp tester/tester/Properties/ ACMServer/branches/Version_2/sharp tester/tester/Properties/AssemblyInfo.cs ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/ ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/D7.bat ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Delphi compiler here.txt ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Temp/ ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/ ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/limits.txt ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/test1/ ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/test1/in.txt ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/test1/out.txt ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/test2/ ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/test2/in.txt ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/test2/out.txt ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/dcc32.cfg ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/includeD7/ ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/includeD7/units for delphi here.txt ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/source.txt ACMServer/branches/Version_2/sharp tester/tester/bin/ ACMServer/branches/Version_2/sharp tester/tester/bin/Debug/ ACMServer/branches/Version_2/sharp tester/tester/bin/Debug/InData.txt ACMServer/branches/Version_2/sharp tester/tester/obj/ ACMServer/branches/Version_2/sharp tester/tester/obj/Debug/ ACMServer/branches/Version_2/sharp tester/tester/obj/Debug/ResolveAssemblyReference.cache ACMServer/branches/Version_2/sharp tester/tester/obj/Debug/TempPE/ ACMServer/branches/Version_2/sharp tester/tester/obj/Debug/tester.csproj.FileListAbsolute.txt ACMServer/branches/Version_2/sharp tester/tester/obj/Debug/tester.exe ACMServer/branches/Version_2/sharp tester/tester/obj/Debug/tester.pdb ACMServer/branches/Version_2/sharp tester/tester/tester.csproj Added: ACMServer/branches/Version_2/sharp tester/SourceTest/AdvAPI32.Lib =================================================================== (Binary files differ) Property changes on: ACMServer/branches/Version_2/sharp tester/SourceTest/AdvAPI32.Lib ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: ACMServer/branches/Version_2/sharp tester/SourceTest/AssemblyInfo.cpp =================================================================== --- ACMServer/branches/Version_2/sharp tester/SourceTest/AssemblyInfo.cpp (rev 0) +++ ACMServer/branches/Version_2/sharp tester/SourceTest/AssemblyInfo.cpp 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1,40 @@ +#include "stdafx.h" + +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::CompilerServices; +using namespace System::Runtime::InteropServices; +using namespace System::Security::Permissions; + +// +// 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:AssemblyTitleAttribute("SourceTest")]; +[assembly:AssemblyDescriptionAttribute("")]; +[assembly:AssemblyConfigurationAttribute("")]; +[assembly:AssemblyCompanyAttribute("Home")]; +[assembly:AssemblyProductAttribute("SourceTest")]; +[assembly:AssemblyCopyrightAttribute("Copyright (c) Home 2008")]; +[assembly:AssemblyTrademarkAttribute("")]; +[assembly:AssemblyCultureAttribute("")]; + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the value or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly:AssemblyVersionAttribute("1.0.*")]; + +[assembly:ComVisible(false)]; + +[assembly:CLSCompliantAttribute(true)]; + +[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)]; Added: ACMServer/branches/Version_2/sharp tester/SourceTest/SourceTest.cpp =================================================================== --- ACMServer/branches/Version_2/sharp tester/SourceTest/SourceTest.cpp (rev 0) +++ ACMServer/branches/Version_2/sharp tester/SourceTest/SourceTest.cpp 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1,678 @@ +// This is the main DLL file. + +#include "stdafx.h" +#include <stdio.h> +#include "SourceTest.h" + +namespace SourceTest +{ + +char* StrToArr(String^ str) +{ + return (char*)Marshal::StringToHGlobalAnsi(str).ToPointer(); +} + +wchar_t* StrToArrW(String^ str) +{ + return (wchar_t*)Marshal::StringToHGlobalUni(str).ToPointer(); +} + + +void FreeArr(char* buf) +{ + Marshal::FreeHGlobal(IntPtr(buf)); +} + +void FreeArr(wchar_t* buf) +{ + Marshal::FreeHGlobal(IntPtr(buf)); +} + +String^ ToStr(int x) +{ + char intg[15]; + _itoa_s(x,intg,10); + return %String(intg); +} + + +bool FileExists(String^ path) +{ + char* buf=StrToArr(path); + OFSTRUCT of; + ZeroMemory(&of,sizeof(of)); + of.cBytes=sizeof(of); + bool res=(OpenFile(buf,&of,OF_EXIST)!=HFILE_ERROR); + FreeArr(buf); + return res; +} + +TSource::TSource() +{ +FSrc=gcnew String(""); +FExePath=gcnew String(""); +FProblemPath=gcnew String(""); +FState=ssNone; +FCompPath=gcnew String(""); +FRunAll=true; +init(); +} + +TSource::~TSource() +{ +final(); +} + +void TSource::CheckCL() +{ + HMODULE lib=NULL; + try + { + lock(); + lib=LoadLibrary((LPCWSTR)"CheckCodeLimitDLL"); + if (lib==NULL) + { + if (FSrc->Length>FLim.CodeLimit) + { + FCompResult.res=crCL; + FCompResult.Details+="Used std checker for Code Limit\n"; + } + } else + { + TCheckCL prc=(TCheckCL)GetProcAddress(lib,"CheckCL"); + String^ buf; + if (prc(FSrc,buf)) FCompResult.res=crCL; + FCompResult.Details+=buf; + } + FState=ssCheckedCL; + }__finally + { + if (lib!=NULL) + FreeLibrary(lib); + unlock(); + } +} + +void TSource::CheckDF() +{ + try + { + lock(); + //MAIN SOURCE + FState=ssCheckedDF; + }__finally + { + unlock(); + } +} + +void TSource::Compile() +{ + PROCESS_INFORMATION pi;ZeroMemory(&pi,sizeof(pi)); + STARTUPINFO si; ZeroMemory(&si,sizeof(si)); + SECURITY_ATTRIBUTES sec; + sec.bInheritHandle=true; + sec.lpSecurityDescriptor=NULL; + sec.nLength=sizeof(sec); + char* bufA; + wchar_t* bufW; + try + { + lock(); + String^ srcpath=gcnew String(FTempPath+"source.txt"); + String^ outpath=gcnew String(FTempPath+"compoutput.txt"); + FExePath=FTempPath+"source.exe"; + + if (FileExists(FExePath)) + { + DeleteFile((LPCTSTR)(bufW=StrToArrW(FExePath))); + FreeArr(bufW); + } + + si.cb=sizeof(si); + si.dwFlags=STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW; + si.wShowWindow=FALSE; + si.hStdOutput=CreateFile(bufW=StrToArrW(outpath),GENERIC_WRITE,0,&sec,CREATE_ALWAYS,0,NULL); + FreeArr(bufW); + HANDLE src=CreateFile(bufW=StrToArrW(srcpath),GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL); + FreeArr(bufW); + DWORD len; + WriteFile(src,bufA=StrToArr(FSrc),FSrc->Length,&len,NULL); + FreeArr(bufA); + CloseHandle(src); + + Sleep(100); //waiting for file to flush on hard + + DWORD start=GetTickCount(); + bufW=StrToArrW("\""+FCompPath+"\" \""+srcpath+"\" \""+FTempPath); + if (!CreateProcess(NULL,bufW,&sec,&sec,true,CREATE_NEW_CONSOLE|CREATE_NO_WINDOW,NULL,NULL,&si,&pi)) + { + FreeArr(bufW); + FCompResult.res=crIE; + FCompResult.Details+="Can not run the compiler\n"; + return; + } + FreeArr(bufW); + if (WaitForSingleObject(pi.hProcess,FLim.CompilationTimeLimit)==WAIT_TIMEOUT) + { + TerminateProcess(pi.hProcess,0); + FCompResult.res=crCTL; + FCompResult.UsedTime=FLim.CompilationTimeLimit; + FCompResult.Details+="Time out during compilation\n"; + return; + } + FCompResult.UsedTime=GetTickCount()-start; + + Sleep(100); //waiting for creating the file + CloseHandle(si.hStdOutput); + + HANDLE oup=CreateFile(bufW=StrToArrW(outpath),GENERIC_READ,0,&sec,OPEN_EXISTING,0,NULL); + FreeArr(bufW); + DWORD size=GetFileSize(oup,NULL); + char* compres=new char[size+2]; compres[size+1]='\0'; + ReadFile(oup,compres,size,&len,NULL); + CloseHandle(oup); + + if (!FileExists(FExePath)) + { + FCompResult.res=crCE; + FCompResult.Details+=gcnew String("EXE file not found\n")+gcnew String(compres); + delete[] compres; + return; + } + + FCompResult.Details+=gcnew String(compres); + delete[] compres; + + }__finally + { + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + FState=ssCompiled; + unlock(); + } +} + +void TSource::RunTests() +{ +try +{ + lock(); + int n=1; + while (FileExists(FProblemPath+"test"+ToStr(n)+"\\in.txt")||FileExists(FProblemPath+"test"+ToStr(n)+"\\out.txt")||FileExists(FProblemPath+"test"+ToStr(n)+"\\points.txt")) + { + RunTest(n); + FSummary.res->points+=((TResult^)FRes[n-1])->points; + FSummary.res->UsedMemory=max(((TResult^)FRes[n-1])->UsedMemory,FSummary.res->UsedMemory); + FSummary.res->UsedTime=max(((TResult^)FRes[n-1])->UsedTime,FSummary.res->UsedTime); + FSummary.res->UsedRealTime=max(((TResult^)FRes[n-1])->UsedRealTime,FSummary.res->UsedRealTime); + if (((TResult^)FRes[n-1])->res!=trAC) + { + FSummary.res->res=((TResult^)FRes[n-1])->res; + if (!FRunAll) break; + } + n++; + } +}__finally +{ + FState=ssFinish; + unlock(); +} +} + +void TSource::LoadTest(int index,TTest% test) +{ +FILE* inp,*oup,*points; +char *bufA; +try +{ + lock(); + test.input=""; + test.output=""; + test.points=1; + + if (fopen_s(&inp,bufA=StrToArr(FProblemPath+"test"+ToStr(index)+"\\in.txt"),"rt")==0) + { + fseek(inp,0,SEEK_END); + int size=ftell(inp); + fseek(inp,0,SEEK_SET); + char* buf=new char[size+1];ZeroMemory(buf,(size+1)*sizeof(char)); + fread(buf,sizeof(char),size,inp); + test.input=gcnew String(buf); + } + FreeArr(bufA); + + if (fopen_s(&oup,bufA=StrToArr(FProblemPath+"\\test"+ToStr(index)+"\\out.txt"),"rt")==0) + { + fseek(oup,0,SEEK_END); + int size=ftell(inp); + fseek(oup,0,SEEK_SET); + char* buf=new char[size+1];ZeroMemory(buf,(size+1)*sizeof(char)); + fread(buf,sizeof(char),size,oup); + test.output=gcnew String(buf); + } + FreeArr(bufA); + + if (fopen_s(&points,bufA=StrToArr(FProblemPath+"\\test"+ToStr(index)+"\\points.txt"),"rt")==0) + { + fscanf_s(points,"%d",&test.points); + } + FreeArr(bufA); + +}__finally +{ + if (inp!=NULL) + fclose(inp); + if (oup!=NULL) + fclose(oup); + if (points!=NULL) + fclose(points); + unlock(); +} +} + +TCheckAnsRes TSource::CheckAnswer(int index,String^ output) +{ + HMODULE lib=NULL; + try + { + lock(); + TTest t; + LoadTest(index,t); + lib=LoadLibrary((LPCWSTR)"CheckAnswerDLL"); + if (lib==NULL) + { + if (output!=t.output) + return carWA; + return carAC; + } else + { + TCheckAnswer prc=(TCheckAnswer)GetProcAddress(lib,"CheckAnswer"); + return prc(t.input,output,t.output); + } + }__finally + { + if (lib!=NULL) + FreeLibrary(lib); + unlock(); + } +} + +void TSource::ProcessAll() +{ +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 ; +} + +BOOL DelPrivilege(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_REMOVED; + +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; + try + { + OpenProcessToken(proc,TOKEN_ALL_ACCESS,&hToken); + DelPrivilege(hToken,SE_ASSIGNPRIMARYTOKEN_NAME); + DelPrivilege(hToken,SE_AUDIT_NAME); + DelPrivilege(hToken,SE_BACKUP_NAME); + DelPrivilege(hToken,SE_CHANGE_NOTIFY_NAME); + DelPrivilege(hToken,SE_CREATE_GLOBAL_NAME); + DelPrivilege(hToken,SE_CREATE_PAGEFILE_NAME); + DelPrivilege(hToken,SE_CREATE_PERMANENT_NAME); + DelPrivilege(hToken,SE_CREATE_SYMBOLIC_LINK_NAME); + DelPrivilege(hToken,SE_CREATE_TOKEN_NAME); + DelPrivilege(hToken,SE_DEBUG_NAME); + DelPrivilege(hToken,SE_ENABLE_DELEGATION_NAME); + DelPrivilege(hToken,SE_IMPERSONATE_NAME); + DelPrivilege(hToken,SE_INC_BASE_PRIORITY_NAME); + DelPrivilege(hToken,SE_INCREASE_QUOTA_NAME); + DelPrivilege(hToken,SE_INC_WORKING_SET_NAME); + DelPrivilege(hToken,SE_LOAD_DRIVER_NAME); + DelPrivilege(hToken,SE_LOCK_MEMORY_NAME); + DelPrivilege(hToken,SE_MACHINE_ACCOUNT_NAME); + DelPrivilege(hToken,SE_MANAGE_VOLUME_NAME); + DelPrivilege(hToken,SE_PROF_SINGLE_PROCESS_NAME); + DelPrivilege(hToken,SE_RELABEL_NAME); + DelPrivilege(hToken,SE_REMOTE_SHUTDOWN_NAME); + DelPrivilege(hToken,SE_RESTORE_NAME); + DelPrivilege(hToken,SE_SECURITY_NAME); + DelPrivilege(hToken,SE_SHUTDOWN_NAME); + DelPrivilege(hToken,SE_SYNC_AGENT_NAME); + DelPrivilege(hToken,SE_SYSTEM_ENVIRONMENT_NAME); + DelPrivilege(hToken,SE_SYSTEM_PROFILE_NAME); + DelPrivilege(hToken,SE_SYSTEMTIME_NAME); + DelPrivilege(hToken,SE_TAKE_OWNERSHIP_NAME); + DelPrivilege(hToken,SE_TCB_NAME); + DelPrivilege(hToken,SE_TIME_ZONE_NAME); + DelPrivilege(hToken,SE_TRUSTED_CREDMAN_ACCESS_NAME); + DelPrivilege(hToken,SE_UNDOCK_NAME); + DelPrivilege(hToken,SE_UNSOLICITED_INPUT_NAME); + }__finally + { + CloseHandle(hToken); + } +} + +void TSource::RunTest(int index) +{ +PROCESS_INFORMATION pi;ZeroMemory(&pi,sizeof(pi)); +STARTUPINFO si;ZeroMemory(&si,sizeof(si)); +SECURITY_ATTRIBUTES sec; +sec.bInheritHandle=TRUE; +sec.nLength=sizeof(sec); +sec.lpSecurityDescriptor=NULL; +JOBOBJECT_BASIC_ACCOUNTING_INFORMATION acc; +JOBOBJECT_EXTENDED_LIMIT_INFORMATION mem; +HANDLE job; +JOBOBJECT_ASSOCIATE_COMPLETION_PORT port; +JOBOBJECT_BASIC_UI_RESTRICTIONS uilim; +DWORD len=0; +wchar_t* bufW; +char* bufA; +try +{ + lock(); + FRes.Add(%TResult()); + TResult^ it=(TResult^)FRes[FRes.Count-1]; + it->res=trAC; + it->points=0; + it->Details=""; + it->UsedMemory=-1; + it->UsedRealTime=-1; + it->UsedTime=-1; + String^ inpath=FProblemPath+"test"+ToStr(index)+"\\in.txt"; + String^ oupath=FTempPath+"out.txt"; + String^ erpath=FTempPath+"err.txt"; + String^ pointpath=FProblemPath+"test"+ToStr(index)+"\\points.txt"; + + FState=ssIsRunning; + + TTest t; + LoadTest(index,t); + job=CreateJobObject(NULL,(LPWSTR)""); + si.cb=sizeof(si); + si.dwFlags=STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW; + si.wShowWindow=FALSE; + si.hStdInput=CreateFile(bufW=StrToArrW(inpath),GENERIC_READ,0,&sec,OPEN_EXISTING,0,NULL); FreeArr(bufW); + si.hStdOutput=CreateFile(bufW=StrToArrW(oupath),GENERIC_WRITE,0,&sec,CREATE_ALWAYS,0,NULL); FreeArr(bufW); + si.hStdError=CreateFile(bufW=StrToArrW(erpath),GENERIC_WRITE,0,&sec,CREATE_ALWAYS,0,NULL); FreeArr(bufW); + + SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOALIGNMENTFAULTEXCEPT|SEM_NOGPFAULTERRORBOX|SEM_NOOPENFILEERRORBOX); + + if (!CreateProcess(NULL,bufW=StrToArrW(FExePath),NULL,NULL,TRUE,CREATE_SUSPENDED|CREATE_NO_WINDOW,NULL,NULL,&si,&pi)) + { + FreeArr(bufW); + it->points=0; + int err=GetLastError(); + if ((err==193)||(err==1455)) + { + it->res=trRE; + it->Details="Too large array"; + } else + { + it->res=trIE; + it->Details="Can not start process"; + } + return ; + } + FreeArr(bufW); + mem.BasicLimitInformation.LimitFlags=JOB_OBJECT_LIMIT_PROCESS_MEMORY; + mem.ProcessMemoryLimit=FLim.MemoryLimit; + SetInformationJobObject(job,JobObjectExtendedLimitInformation,&mem,sizeof(mem)); + + port.CompletionKey=(void*)123; + port.CompletionPort=CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0); + + SetInformationJobObject(job,JobObjectAssociateCompletionPortInformation,&port,sizeof(port)); + + uilim.UIRestrictionsClass=JOB_OBJECT_UILIMIT_ALL; + SetInformationJobObject(job,JobObjectBasicUIRestrictions,&uilim,sizeof(uilim)); + + DeletePrivileges(pi.hProcess); + + AssignProcessToJobObject(job,pi.hProcess); + ResumeThread(pi.hThread); + + DWORD start=GetTickCount(); + + while (true) + { + if ((int)GetFileSize(si.hStdOutput,NULL)>FLim.OutputLimit) + { + TerminateJobObject(job,0); + it->res=trOL; + it->Details="Size of output file excided OutputLimit"; + break; + } + if ((int)(GetTickCount()-start)>FLim.RealTimeLimit) + { + TerminateJobObject(job,0); + it->res=trRTL; + it->Details="Real time limit"; + break; + } + QueryInformationJobObject(job,JobObjectBasicAccountingInformation,&acc,sizeof(acc),NULL); + if ((acc.ThisPeriodTotalKernelTime.QuadPart+acc.ThisPeriodTotalUserTime.QuadPart)>FLim.TimeLimit*10000) + { + TerminateJobObject(job,0); + it->res=trTL; + it->Details="Time Limit"; + break; + } + + unsigned long len,key; + HANDLE proc; + if (GetQueuedCompletionStatus(port.CompletionPort, &len, &key, (LPOVERLAPPED*)&proc, 1)&&key == 123) + { + DWORD code=0; + bool needbreak=false; + switch(len) + { + case JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS: + GetExitCodeProcess(pi.hProcess,&code); + if (code!=0) + { + it->res=trRE; + it->Details="Runtime error #"+ToStr((int)code); + } + needbreak=true; + break; + case JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT: + it->res=trML; + it->Details="Memory Limit"; + needbreak=true; + break; + case JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO: + GetExitCodeProcess(pi.hProcess,&code); + if (code!=0) + { + it->res=trRE; + it->Details="Runtime error #"+ToStr((int)code); + } + needbreak=true; + break; + } + if (needbreak) + { + TerminateJobObject(job,0); + break; + } + } + + Sleep(1); + } + CloseHandle(si.hStdOutput); + CloseHandle(si.hStdInput); + + Sleep(100); //waiting for file + + QueryInformationJobObject(job,JobObjectExtendedLimitInformation,&mem,sizeof(mem),NULL); + QueryInformationJobObject(job,JobObjectBasicAccountingInformation,&acc,sizeof(acc),NULL); + it->UsedMemory=mem.PeakProcessMemoryUsed; + it->UsedTime=(int)((acc.ThisPeriodTotalKernelTime.QuadPart+acc.ThisPeriodTotalUserTime.QuadPart)/10000); + it->UsedRealTime=GetTickCount()-start; + if (it->res!=trAC) return; + + if (!FileExists(oupath)) + { + it->res=trWA; + it->Details="No output file"; + return; + } + + HANDLE ouf=CreateFile(bufW=StrToArrW(oupath),GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL); FreeArr(bufW); + DWORD size=GetFileSize(ouf,NULL); + char* buf=new char[size+1]; ZeroMemory(buf,(size+1)*sizeof(char)); + ReadFile(ouf,buf,size,&len,NULL); + CloseHandle(ouf); + + TCheckAnsRes r=CheckAnswer(index,gcnew String(buf)); + delete[] buf; + if (r==carAC) + { + if (FileExists(pointpath)) + { + FILE* point; + fopen_s(&point,bufA=StrToArr(pointpath),"rt"); FreeArr(bufA); + fscanf_s(point,"%d",&it->points); + fclose(point); + } else it->points=1; + return ; + } + + switch (r) + { + case carOE: + it->res=trOE; + break; + case carPE: + it->res=trPE; + break; + case carWA: + it->res=trWA; + break; + case carIE: + it->res=trIE; + break; + }; + +}__finally +{ + CloseHandle(job); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + CloseHandle(si.hStdInput); + CloseHandle(si.hStdOutput); + CloseHandle(si.hStdError); + CloseHandle(port.CompletionPort); + FState=ssTestComplete; + if (FTestHandler) + FTestHandler(index,(TResult^)FRes[index-1]); + unlock(); +} +} + +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 ; +} + +void TSource::LoadLimits() +{ + String^ path=FProblemPath+"Limits.txt"; + if (!FileExists(path)) + return; + char* buf; + FILE* f; + try + { + lock(); + if (FState!=ssNone) + { + throw "Can not load limits if state is higher than ssNone"; + return; + } + fopen_s(&f,buf=StrToArr(path),"rt"); + fscanf_s(f,"CodeLimit: %d\nCompilationTimeLimit: %d\nMemoryLimit: %d\n",&FLim.CodeLimit,&FLim.CompilationTimeLimit,&FLim.MemoryLimit); + fscanf_s(f,"OutputLimit: %d\nRealTimeLimit: %d\nTimeLimit: %d",&FLim.OutputLimit,&FLim.RealTimeLimit,&FLim.TimeLimit); + }__finally + { + fclose(f); + FreeArr(buf); + unlock(); + } + +} + +String^ TSource::TestResultToString(TRes res) +{ + switch (res) + { + case trAC:return "Accepted"; + case trWA:return "Wrong Answer"; + case trTL:return "Time Limit"; + case trML:return "Memory Limit"; + case trRTL:return "Real Time Limit"; + case trRE:return "Runtime Error"; + case trDF:return "Destricted Function"; + case trIE:return "Internal Error"; + case trOL:return "Output Limit"; + case trPE:return "Presentation Error"; + case trOE:return "Output Error"; + default:return "Unknown Error"; + } +} + +String^ TSource::CompileResultToString(TCompRes res) +{ + switch (res) + { + case crOK:return "No Error"; + case crCE:return "Compilation Error"; + case crCL:return "Code Limit"; + case crCTL:return "Compilation Time Limit"; + case crDF:return "Destricted Function"; + case crIE:return "Internal Error"; + default:return "Unknown Error"; + } +} + +}; + Added: ACMServer/branches/Version_2/sharp tester/SourceTest/SourceTest.h =================================================================== --- ACMServer/branches/Version_2/sharp tester/SourceTest/SourceTest.h (rev 0) +++ ACMServer/branches/Version_2/sharp tester/SourceTest/SourceTest.h 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1,552 @@ +// SourceTest.h + +#pragma once +#include <windows.h> +using namespace System; +using namespace System::Collections; +using namespace System::Runtime::InteropServices; + +namespace SourceTest +{ + public ref struct TLimits + { + int OutputLimit; + int TimeLimit; + int MemoryLimit; + int RealTimeLimit; + int CompilationTimeLimit; + int CodeLimit; + + TLimits() + { + OutputLimit=0; + TimeLimit=0; + MemoryLimit=0; + RealTimeLimit=0; + CompilationTimeLimit=0; + CodeLimit=0; + } + + TLimits(TLimits% value) + { + OutputLimit=value.OutputLimit; + TimeLimit=value.TimeLimit; + MemoryLimit=value.MemoryLimit; + RealTimeLimit=value.RealTimeLimit; + CompilationTimeLimit=value.CompilationTimeLimit; + CodeLimit=value.CodeLimit; + } + + TLimits operator=(TLimits value) + { + OutputLimit=value.OutputLimit; + TimeLimit=value.TimeLimit; + MemoryLimit=value.MemoryLimit; + RealTimeLimit=value.RealTimeLimit; + CompilationTimeLimit=value.CompilationTimeLimit; + CodeLimit=value.CodeLimit; + return value; + } + }; + + public enum TCompRes //result of compilation + { + crOK, //all ok + crCE, //compilation error + crCL, //code limit + crCTL, //compilation time limit + crDF, //destricted function + crIE //internal error + }; + + public enum TRes + { + trAC, //accepted + trWA, //wrong answer + trTL, //time limit + trML, //memory limit + trRTL,//real time limit + trRE, //runtime error + trDF, //destricted function + trIE, //internal error + trOL, //output limit + trPE, //presentation error + trOE //output error + }; + + public ref struct TResult + { + TRes res; + int points; + int UsedMemory; + int UsedTime; + int UsedRealTime; + String^ Details; + + TResult() + { + res=trAC; + points=0; + UsedMemory=0; + UsedTime=0; + UsedRealTime=0; + Details=""; + } + + TResult(TResult% value) + { + res=value.res; + points=value.points; + UsedMemory=value.UsedMemory; + UsedTime=value.UsedTime; + UsedRealTime=value.UsedRealTime; + Details=value.Details; + } + + TResult operator=(TResult value) + { + res=value.res; + points=value.points; + UsedMemory=value.UsedMemory; + UsedTime=value.UsedTime; + UsedRealTime=value.UsedRealTime; + Details=value.Details; + return value; + } + }; + + public ref struct TCompResult + { + TCompRes res; + int UsedTime; + String^ Details; + TCompResult(TCompResult% value) + { + res=value.res; + UsedTime=value.UsedTime; + Details=value.Details; + } + + TCompResult() + { + res=crOK; + UsedTime=0; + Details=""; + } + + TCompResult operator=(TCompResult value) + { + res=value.res; + UsedTime=value.UsedTime; + Details=value.Details; + return value; + } + }; + + public enum TSourceState + { + ssNone=0, + ssCheckedCL=1, + ssCheckedDF=2, + ssCompiled=3, + ssIsRunning=4, //for multithreading + ssTestComplete=5, //next test is gonna be tested + ssFinish=6 //all tests is tested + }; + + public ref struct TSummary + { + public: + TResult^ res; //total result of all tests + TCompResult^ compres; //result of compilation + TSummary() + { + res=gcnew TResult(); + compres=gcnew TCompResult(); + } + + TSummary(TSummary% value) + { + (*res)=(*value.res); + (*compres)=(*value.compres); + } + + }; + + public ref struct TTest + { + String^ input,^output; + int points; + }; + + public enum TCheckAnsRes + { + carAC, //accepted + carWA, //wrong answer + carIE, //internal error + carPE, //presentation error + carOE //output error + }; + + typedef bool (*TCheckCL)(String^ src,String^ details); + typedef TCheckAnsRes (*TCheckAnswer)(String^ input, String^ output, String^ rightoutput); + + public delegate void TTestHandler(int index, TResult^ res); + + public ref class TSource + { + private: + String^ FSrc; + String^ FExePath; + String^ FProblemPath; + String^ FCompPath; + String^ FTempPath; //this is the place were temp files will be created + bool FRunAll; + TSourceState FState; + TCompResult FCompResult; + ArrayList FRes; + TSummary FSummary; + TLimits FLim; + TTestHandler^ FTestHandler; + + CRITICAL_SECTION* cs; //for multithreading + void init() + { + cs=new CRITICAL_SECTION; + InitializeCriticalSection(cs); + } + + void lock() + { + EnterCriticalSection(cs); + } + + void unlock() + { + LeaveCriticalSection(cs); + } + + void final() + { + DeleteCriticalSection(cs); + delete cs; + } + public: + TSource(); + ~TSource(); + void CheckCL(); + void CheckDF(); + void Compile(); + void RunTests(); //all tests + void RunTest(int index); + 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 LoadLimits(); //loads limits from a file Limits.txt + static String^ TestResultToString(TRes res); + static String^ CompileResultToString(TCompRes res); + + property TLimits^ Lim + { + void set(TLimits^ value) + { + try + { + lock(); + if (FState>=ssIsRunning) + { + throw "Can not set limits if state is ssIsRunning or higher"; + return ; + } + FLim=(*value); + } + __finally { + unlock(); + } + } + } + + property String^ Src + { + String^ get() + { + try + { + lock(); + return FSrc; + }__finally { + unlock(); + } + } + + void set(String^ value) + { + try + { + lock(); + if (FState!=ssNone) + { + throw "Can not set source unless state is ssNone"; + return; + } + FSrc=value; + } __finally { + unlock(); + } + } + } + + property String^ ExePath + { + String^ get() + { + try + { + lock(); + if (FState<ssCompiled) + { + throw "Can not get exepath unless state is ssCompiled or higher"; + return ""; + } + return FExePath; + }__finally{ + unlock(); + } + } + } + + property String^ ProblemPath + { + String^ get() { + try + { + lock(); + return FProblemPath; + }__finally { + unlock(); + } + } + void set(String^ value) + { + try{ + lock(); + if (FState>ssCompiled) + { + throw "Can not set problempath if state is ssIsRunning or higher"; + return ; + } + FProblemPath=value; + }__finally { + unlock(); + } + } + } + + property TCompResult^ CompResult + { + TCompResult^ get() + { + try + { + lock(); + if (FState==ssNone) + { + throw "Can not get compresult if state is ssNone"; + return %FCompResult; + } + return %FCompResult; + }__finally { + unlock(); + } + } + } + + property TSourceState State + { + TSourceState get() { + try + { + lock(); + return (FState); + }__finally { + unlock(); + } + }; + + void set(TSourceState value) { + try + { + lock(); + FState=(value); + }__finally { + unlock(); + } + }; + } + + property TResult^ Results[int] + { + TResult^ get(int index) + { + try + { + lock(); + if (FState<ssIsRunning) + { + throw "Can not get test results if state is lower than ssIsRunning"; + return (%TResult()); + } + if (index>=FRes.Count) + { + throw "The index is not accesible"; + return (%TResult()); + } + return (TResult^)FRes[index]; + } + __finally + { + unlock(); + } + } + } + + property TSummary^ Summary + { + TSummary^ get() + { + try + { + lock(); + if (FState!=ssFinish) + { + throw "Can not get summary unlest state is ssFinish"; + return (%TSummary()); + } + return (%FSummary); + }__finally + { + unlock(); + } + }; + } + + property TTestHandler^ TestHandler + { + TTestHandler^ get() + { + try + { + lock(); + return FTestHandler; + }__finally + { + unlock(); + } + } + + void set(TTestHandler^ value) + { + try + { + lock(); + FTestHandler=value; + }__finally + { + unlock(); + } + } + } + + property String^ CompPath + { + String^ get() + { + try + { + lock(); + return (FCompPath); + }__finally + { + unlock(); + } + } + + void set(String^ value) + { + try + { + lock(); + if (FState>ssCheckedDF) + { + throw "Can not set compiler path if state is higher than ssCheckedDF"; + return ; + } + FCompPath=value; + }__finally + { + unlock(); + } + } + } + + property String^ TempPath + { + String^ get() + { + try + { + lock(); + return FTempPath; + }__finally + { + unlock(); + } + } + + void set(String^ value) + { + try + { + lock(); + FTempPath=value; + }__finally + { + unlock(); + } + } + } + + property bool RunAll + { + void set(bool value) + { + try + { + lock(); + if (FState>=ssIsRunning) + { + throw "Can not set RunAll if state is higher or equal ssIsRunning"; + return; + } + FRunAll=value; + } __finally + { + unlock(); + } + } + + bool get() + { + try + { + lock(); + return FRunAll; + }__finally + { + unlock(); + } + } + } + }; +} Added: ACMServer/branches/Version_2/sharp tester/SourceTest/SourceTest.vcproj =================================================================== --- ACMServer/branches/Version_2/sharp tester/SourceTest/SourceTest.vcproj (rev 0) +++ ACMServer/branches/Version_2/sharp tester/SourceTest/SourceTest.vcproj 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1,252 @@ +<?xml version="1.0" encoding="windows-1251"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="SourceTest" + ProjectGUID="{FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}" + RootNamespace="SourceTest" + Keyword="ManagedCProj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + ManagedExtensions="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG" + RuntimeLibrary="3" + UsePrecompiledHeader="2" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="$(NoInherit)" + LinkIncremental="2" + GenerateDebugInformation="true" + AssemblyDebug="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + ManagedExtensions="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="WIN32;NDEBUG" + RuntimeLibrary="2" + UsePrecompiledHeader="2" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="$(NoInherit)" + LinkIncremental="1" + GenerateDebugInformation="true" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + <AssemblyReference + RelativePath="System.dll" + AssemblyName="System, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" + MinFrameworkVersion="131072" + /> + <AssemblyReference + RelativePath="System.Data.dll" + AssemblyName="System.Data, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86" + MinFrameworkVersion="131072" + /> + <AssemblyReference + RelativePath="System.XML.dll" + AssemblyName="System.Xml, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" + MinFrameworkVersion="131072" + /> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\AssemblyInfo.cpp" + > + </File> + <File + RelativePath=".\SourceTest.cpp" + > + </File> + <File + RelativePath=".\Stdafx.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\resource.h" + > + </File> + <File + RelativePath=".\SourceTest.h" + > + </File> + <File + RelativePath=".\Stdafx.h" + > + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + <File + RelativePath=".\app.ico" + > + </File> + <File + RelativePath=".\app.rc" + > + </File> + </Filter> + <File + RelativePath=".\AdvAPI32.Lib" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Added: ACMServer/branches/Version_2/sharp tester/SourceTest/Stdafx.cpp =================================================================== --- ACMServer/branches/Version_2/sharp tester/SourceTest/Stdafx.cpp (rev 0) +++ ACMServer/branches/Version_2/sharp tester/SourceTest/Stdafx.cpp 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1,5 @@ +// stdafx.cpp : source file that includes just the standard includes +// SourceTest.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" Added: ACMServer/branches/Version_2/sharp tester/SourceTest/Stdafx.h =================================================================== --- ACMServer/branches/Version_2/sharp tester/SourceTest/Stdafx.h (rev 0) +++ ACMServer/branches/Version_2/sharp tester/SourceTest/Stdafx.h 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1,7 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#pragma once + + Added: ACMServer/branches/Version_2/sharp tester/SourceTest/app.ico =================================================================== (Binary files differ) Property changes on: ACMServer/branches/Version_2/sharp tester/SourceTest/app.ico ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: ACMServer/branches/Version_2/sharp tester/SourceTest/app.rc =================================================================== --- ACMServer/branches/Version_2/sharp tester/SourceTest/app.rc (rev 0) +++ ACMServer/branches/Version_2/sharp tester/SourceTest/app.rc 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1,63 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon placed first or with lowest ID value becomes application icon + +LANGUAGE 25, 1 +#pragma code_page(1251) +1 ICON "app.ico" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" + "\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\0" +END + +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + Added: ACMServer/branches/Version_2/sharp tester/SourceTest/resource.h =================================================================== --- ACMServer/branches/Version_2/sharp tester/SourceTest/resource.h (rev 0) +++ ACMServer/branches/Version_2/sharp tester/SourceTest/resource.h 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1,3 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by app.rc Added: ACMServer/branches/Version_2/sharp tester/SourceTest.sln =================================================================== --- ACMServer/branches/Version_2/sharp tester/SourceTest.sln (rev 0) +++ ACMServer/branches/Version_2/sharp tester/SourceTest.sln 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1,42 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SourceTest", "SourceTest\SourceTest.vcproj", "{FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tester", "tester\tester.csproj", "{2D663DAB-3573-4CB6-95A0-2425635CFEC3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|Win32 = Debug|Win32 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Debug|Win32.ActiveCfg = Debug|Win32 + {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Debug|Win32.Build.0 = Debug|Win32 + {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Release|Any CPU.ActiveCfg = Release|Win32 + {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Release|Mixed Platforms.Build.0 = Release|Win32 + {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Release|Win32.ActiveCfg = Release|Win32 + {FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}.Release|Win32.Build.0 = Release|Win32 + {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Debug|Win32.ActiveCfg = Debug|Any CPU + {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Release|Any CPU.Build.0 = Release|Any CPU + {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {2D663DAB-3573-4CB6-95A0-2425635CFEC3}.Release|Win32.ActiveCfg = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Added: ACMServer/branches/Version_2/sharp tester/tester/Program.cs =================================================================== --- ACMServer/branches/Version_2/sharp tester/tester/Program.cs (rev 0) +++ ACMServer/branches/Version_2/sharp tester/tester/Program.cs 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; +using SourceTest; + +namespace tester +{ + class Program + { + static void func(int x,TResult res) + { + Console.WriteLine("test number {0}, result: {1}, details: {2}",x,TSource.TestResultToString(res.res),res.Details); + } + + static void Main(string[] args) + { + 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 = s.ReadToEnd(); + s.Close(); + c.TempPath = temp; + c.TestHandler += new TTestHandler(func); + 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); + 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(); + } + } +} Added: ACMServer/branches/Version_2/sharp tester/tester/Properties/AssemblyInfo.cs =================================================================== --- ACMServer/branches/Version_2/sharp tester/tester/Properties/AssemblyInfo.cs (rev 0) +++ ACMServer/branches/Version_2/sharp tester/tester/Properties/AssemblyInfo.cs 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1,36 @@ +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("tester")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Home")] +[assembly: AssemblyProduct("tester")] +[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("9fa887d8-5904-4045-ba4d-c33714e900b8")] + +// 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 Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] Added: ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/D7.bat =================================================================== --- ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/D7.bat (rev 0) +++ ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/D7.bat 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1 @@ +DCC32.EXE -CC %1 -E%2 \ No newline at end of file Added: ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Delphi compiler here.txt =================================================================== Added: ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/limits.txt =================================================================== --- ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/limits.txt (rev 0) +++ ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/limits.txt 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1,6 @@ +CodeLimit: 1024 +CompilationTimeLimit: 10000 +MemoryLimit: 10000000 +OutputLimit: 1024 +RealTimeLimit: 10000 +TimeLimit: 1000 Added: ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/test1/in.txt =================================================================== --- ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/test1/in.txt (rev 0) +++ ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/test1/in.txt 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1 @@ +1 1 Added: ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/test1/out.txt =================================================================== --- ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/test1/out.txt (rev 0) +++ ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/test1/out.txt 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1 @@ +2 \ No newline at end of file Added: ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/test2/in.txt =================================================================== --- ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/test2/in.txt (rev 0) +++ ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/test2/in.txt 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1 @@ +1334 15 Added: ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/test2/out.txt =================================================================== --- ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/test2/out.txt (rev 0) +++ ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/Test/test2/out.txt 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1 @@ +1349 \ No newline at end of file Added: ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/dcc32.cfg =================================================================== --- ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/dcc32.cfg (rev 0) +++ ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/dcc32.cfg 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1 @@ +-u"includeD7" Added: ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/includeD7/units for delphi here.txt =================================================================== Added: ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/source.txt =================================================================== --- ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/source.txt (rev 0) +++ ACMServer/branches/Version_2/sharp tester/tester/SAMPLE/source.txt 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1,8 @@ +program hello; +uses windows; +var a,b:integer; +begin +read(a,b); +while true do; +write(a+b); +end. \ No newline at end of file Added: ACMServer/branches/Version_2/sharp tester/tester/bin/Debug/InData.txt =================================================================== --- ACMServer/branches/Version_2/sharp tester/tester/bin/Debug/InData.txt (rev 0) +++ ACMServer/branches/Version_2/sharp tester/tester/bin/Debug/InData.txt 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1,4 @@ +SourceTest\tester\SAMPLE\D7.bat +SourceTest\tester\SAMPLE\Test\ +SourceTest\tester\SAMPLE\Temp\ +SourceTest\tester\SAMPLE\source.txt Added: ACMServer/branches/Version_2/sharp tester/tester/obj/Debug/ResolveAssemblyReference.cache =================================================================== (Binary files differ) Property changes on: ACMServer/branches/Version_2/sharp tester/tester/obj/Debug/ResolveAssemblyReference.cache ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: ACMServer/branches/Version_2/sharp tester/tester/obj/Debug/tester.csproj.FileListAbsolute.txt =================================================================== --- ACMServer/branches/Version_2/sharp tester/tester/obj/Debug/tester.csproj.FileListAbsolute.txt (rev 0) +++ ACMServer/branches/Version_2/sharp tester/tester/obj/Debug/tester.csproj.FileListAbsolute.txt 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1,7 @@ +D:\Пашка\ACM contester\ACM Contester\SourceTest\tester\obj\Debug\ResolveAssemblyReference.cache +D:\Пашка\ACM contester\ACM Contester\SourceTest\tester\bin\Debug\tester.exe +D:\Пашка\ACM contester\ACM Contester\SourceTest\tester\bin\Debug\tester.pdb +D:\Пашка\ACM contester\ACM Contester\SourceTest\tester\bin\Debug\SourceTest.dll +D:\Пашка\ACM contester\ACM Contester\SourceTest\tester\bin\Debug\SourceTest.pdb +D:\Пашка\ACM contester\ACM Contester\SourceTest\tester\obj\Debug\tester.exe +D:\Пашка\ACM contester\ACM Contester\SourceTest\tester\obj\Debug\tester.pdb Added: ACMServer/branches/Version_2/sharp tester/tester/obj/Debug/tester.exe =================================================================== (Binary files differ) Property changes on: ACMServer/branches/Version_2/sharp tester/tester/obj/Debug/tester.exe ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: ACMServer/branches/Version_2/sharp tester/tester/obj/Debug/tester.pdb =================================================================== (Binary files differ) Property changes on: ACMServer/branches/Version_2/sharp tester/tester/obj/Debug/tester.pdb ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: ACMServer/branches/Version_2/sharp tester/tester/tester.csproj =================================================================== --- ACMServer/branches/Version_2/sharp tester/tester/tester.csproj (rev 0) +++ ACMServer/branches/Version_2/sharp tester/tester/tester.csproj 2008-05-27 18:21:33 UTC (rev 172) @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.21022</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{2D663DAB-3573-4CB6-95A0-2425635CFEC3}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>tester</RootNamespace> + <AssemblyName>tester</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </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.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\SourceTest\SourceTest.vcproj"> + <Project>{FD28B5FF-FCE2-417C-998C-DA3B1B9D9315}</Project> + <Name>SourceTest</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |