From: <Or...@us...> - 2008-08-18 12:27:07
|
Revision: 334 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=334&view=rev Author: Oracle_ Date: 2008-08-18 12:27:16 +0000 (Mon, 18 Aug 2008) Log Message: ----------- Fixed bugs. Modified Paths: -------------- ACMServer/trunk/sharp tester/SourceTest 2.0/Test/SecureClass.cpp ACMServer/trunk/sharp tester/SourceTest 2.0/Test/Test.cpp ACMServer/trunk/sharp tester/SourceTest 2.0/Test/Test.h Modified: ACMServer/trunk/sharp tester/SourceTest 2.0/Test/SecureClass.cpp =================================================================== --- ACMServer/trunk/sharp tester/SourceTest 2.0/Test/SecureClass.cpp 2008-08-17 23:12:52 UTC (rev 333) +++ ACMServer/trunk/sharp tester/SourceTest 2.0/Test/SecureClass.cpp 2008-08-18 12:27:16 UTC (rev 334) @@ -249,7 +249,7 @@ HasDF=true; Details="Destricted Function. "; FreeLibrary(hmodCaller); - return false; + return true; } } } @@ -334,12 +334,15 @@ bool DoubleSecure::Init(LPWSTR lpApplicationName) { - return (syssec->Init(lpApplicationName)&&usersec->Init(lpApplicationName)); + bool res=(syssec->Init(lpApplicationName)&&usersec->Init(lpApplicationName)); + this->Details=syssec->Details+usersec->Details; + return res; } bool DoubleSecure::CreateProc(LPWSTR lpApplicationName,BOOL bInheritHandles,DWORD dwCreationFlags,LPSTARTUPINFOW lpStartupInfo) { bool res=usersec->CreateProc(lpApplicationName,bInheritHandles,dwCreationFlags,lpStartupInfo); + this->Details=usersec->Details; if (res) { this->process=usersec->process; Modified: ACMServer/trunk/sharp tester/SourceTest 2.0/Test/Test.cpp =================================================================== --- ACMServer/trunk/sharp tester/SourceTest 2.0/Test/Test.cpp 2008-08-17 23:12:52 UTC (rev 333) +++ ACMServer/trunk/sharp tester/SourceTest 2.0/Test/Test.cpp 2008-08-18 12:27:16 UTC (rev 334) @@ -9,6 +9,7 @@ Runner::Runner(SecureType secure, String^ ProblemPath, String^ ExeFile, String^ TempPath, int WaitForFile) { + SetPriorityClass(GetCurrentProcess(),HIGH_PRIORITY_CLASS); //for better testing initlock(); data = gcnew DataLoader(ProblemPath + "ProblemData.txt"); data->Load(); @@ -50,8 +51,10 @@ sec=new SysCallSecure(); else if (SecType==SecureType::Double) sec=new DoubleSecure(); + lock(); String^ oupath=temp+"out"+index.ToString()+".txt"; String^ erpath=temp+"err"+index.ToString()+".txt"; + unlock(); String^ inpath=test->tests[index-1]->InPath; si.cb=sizeof(si); @@ -62,13 +65,23 @@ si.hStdError=CreateFile(bufW=(wchar_t*)Marshal::StringToHGlobalUni(erpath).ToPointer(),GENERIC_WRITE,FILE_SHARE_WRITE,&secdesc,CREATE_ALWAYS,0,NULL); Marshal::FreeHGlobal(IntPtr(bufW)); SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOALIGNMENTFAULTEXCEPT|SEM_NOGPFAULTERRORBOX|SEM_NOOPENFILEERRORBOX); - if (!sec->Init(bufW=(wchar_t*)Marshal::StringToHGlobalUni(exe).ToPointer())) + lock(); + bufW=(wchar_t*)Marshal::StringToHGlobalUni(exe).ToPointer(); + unlock(); + if (!sec->Init(bufW)) { result->res=TestResult::InternalError; result->Details=gcnew String(sec->Details.c_str())+" Can not init secure"; Marshal::FreeHGlobal(IntPtr(bufW)); return false; } + if (sec->CheckSecure()) + { + result->res=TestResult::DestrictedFunction; + result->Details=gcnew String(sec->Details.c_str())+" Destricted function."; + Marshal::FreeHGlobal(IntPtr(bufW)); + return false; + } if (!sec->CreateProc(bufW,TRUE,CREATE_SUSPENDED|CREATE_NO_WINDOW|ABOVE_NORMAL_PRIORITY_CLASS,&si)) { Marshal::FreeHGlobal(IntPtr(bufW)); @@ -263,7 +276,9 @@ return true; }finally { + lock(); results[index-1]=result; + unlock(); sec->Finalize(); if (sec!=NULL) delete sec; @@ -328,6 +343,7 @@ Runner::~Runner() { destroylock(); + SetPriorityClass(GetCurrentProcess(),NORMAL_PRIORITY_CLASS); } void Runner::initlock() Modified: ACMServer/trunk/sharp tester/SourceTest 2.0/Test/Test.h =================================================================== --- ACMServer/trunk/sharp tester/SourceTest 2.0/Test/Test.h 2008-08-17 23:12:52 UTC (rev 333) +++ ACMServer/trunk/sharp tester/SourceTest 2.0/Test/Test.h 2008-08-18 12:27:16 UTC (rev 334) @@ -80,10 +80,11 @@ void lock(); //locks access to other theads void unlock(); //unlocks access to other threads TestLoader^ testfield; + DataLoader^ datafield; + PluginLoader^ plugfield; public: array<TestRes^>^ results; - DataLoader^ data; - PluginLoader^ plug; + bool TestAll; //set false if break testing after ExecuteTest return false (not AC) SecureType SecType; int CONST_SLEEP; @@ -115,6 +116,50 @@ unlock(); } } + + property DataLoader^ data + { + DataLoader^ get() + { + try + { + lock(); + return datafield; + } finally + { + unlock(); + } + } + + void set(DataLoader^ value) + { + lock(); + datafield=value; + unlock(); + } + } + + property PluginLoader^ plug + { + PluginLoader^ get() + { + try + { + lock(); + return plugfield; + } finally + { + unlock(); + } + } + + void set(PluginLoader^ value) + { + lock(); + plugfield=value; + unlock(); + } + } }; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |