Защита информации в системах дистанционного обучения с монопольным доступом

Реферат - Компьютеры, программирование

Другие рефераты по предмету Компьютеры, программирование

.

Private Sub ViewResult_Click()

Dim handle As Integer

Dim file As IProtectFile

Set file = obj

handle = file.Open("c:\temp\result.dat", "c:\temp\decryptres.upt", "c:\temp\cryptres.upt")

Dim readSize As Long

Dim v As Variant

readSize = file.Read(handle, v)

Dim str As String

result = v

file.Close (handle)

End Sub

 

. .

Dim obj As New protect

Private Sub SaveResult(a)

Dim handle As Integer

Dim file As IProtectFile

Set file = obj

handle = file.Create("c:\temp\result.dat", Default, "c:\temp\cryptres.upt")

Dim writeSize As Long

Dim v As Variant

Dim str As String

str = Form1.ole_doc.DataText

v = a

writeSize = file.Write(handle, v)

file.Close (handle)

End

End Sub

 

Private Sub Command1_Click(Index As Integer)

SaveResult (2)

End Sub

 

Private Sub Command2_Click()

SaveResult (2)

End Sub

 

Private Sub Command3_Click()

SaveResult (5)

End Sub

 

Private Sub Command4_Click()

SaveResult (2)

End Sub

 

Private Sub Form_Load()

Form1.ole_doc.Format = "Rich Text Format"

Dim handle As Integer

Dim file As IProtectFile

Set file = obj

 

handle = file.Open("c:\temp\temp.dat", "c:\temp\decrypt.upt", "c:\temp\crypt.upt")

Dim readSize As Long

Dim v As Variant

readSize = file.Read(handle, v)

Dim str As String

str = v

 

Form1.ole_doc.DoVerb vbOLEDiscardUndoState

Form1.ole_doc.DataText = str

Form1.ole_doc.Update

 

file.Close (handle)

End Sub

 

12 . , , .

12.

 

4.4.4. ProtectEXE.exe

Visual ++, , , . exe. ProtectEXE.

void CreateEncryptedModule(const CString &FileName)

{

CString Line(_T("ProtectExe.exe "));

Line += FileName;

STARTUPINFO StartupInfo;

memset(&StartupInfo, 0, sizeof(StartupInfo));

StartupInfo.cb = sizeof(StartupInfo);

PROCESS_INFORMATION ProcessInformation;

if (!CreateProcess(Line, NULL, NULL, NULL, FALSE, 0,

FALSE, NULL, &StartupInfo,

&ProcessInformation))

throw _T("Error run ProtectExe.exe");

WaitForInputIdle(ProcessInformation.hProcess,

INFINITE);

WaitForSingleObject(ProcessInformation.hProcess,

INFINITE);

CloseHandle(ProcessInformation.hProcess);

DeleteFile(FileName);

}

 

void RunEncryptedModule(const CString &FileName)

{

CString EncryptedFileName(FileName);

EncryptedFileName = EncryptedFileName.Mid(0, FileName.GetLength() - 3);

EncryptedFileName +=_T("upb");

CString Line(_T("ProtectExe.exe"));

Line += EncryptedFileName;

STARTUPINFO StartupInfo;

memset(&StartupInfo, 0, sizeof(StartupInfo));

StartupInfo.cb = sizeof(StartupInfo);

PROCESS_INFORMATION ProcessInformation;

if (!CreateProcess(Line, NULL, NULL, NULL, FALSE, 0,

FALSE, NULL, &StartupInfo, &ProcessInformation))

throw _T("Error run ProtectExe.exe");

WaitForInputIdle(ProcessInformation.hProcess, INFINITE);

WaitForSingleObject(ProcessInformation.hProcess, INFINITE);

CloseHandle(ProcessInformation.hProcess);

}

4.5.

 

, . , .

1.