Decrypt_On_Execute markers in multi-threaded applications

Post here messages if you have any problems with working of Enigma Protector
Post Reply
Enigma
Site Admin
Posts: 2555
Joined: Wed Aug 20, 2008 2:24 pm

Decrypt_On_Execute markers in multi-threaded applications

Post by Enigma » Thu Oct 16, 2008 10:26 am

We have noticed that Decrypt_On_Execute marker does not work in mutli-threaded applications.
The condition when it does not work is when marker is placed in the thread and this marker is being executed my few thread simultaneously.
If you are sure that some code inside your application does not execute by few threads, you may place marker without any risk and worries!

The following code shows how occur a problem with Decrypt_On_Execute marker.

Code: Select all

            // Threads call back function
	UINT WINAPI Worker()
	{
		while (WaitForSingleObject(m_hExitEvent, 0) == WAIT_TIMEOUT) {			
			#include "decrypt_on_execute_begin.inc"
			Sleep(rand() / 100);
			#include "decrypt_on_execute_end.inc"
		}
		return 0;
	}

            // This function creates few threads that simultaneously execute same threads call back function
	LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
	{
		m_hExitEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
		for (UINT tid, x = 0; x < THREAD_COUNT; x++) {
			m_hTreads[x] = (HANDLE) _beginthreadex(NULL, 0, _Worker, this, 0, &tid);
		}
		return 0;
	}


Enigma
Site Admin
Posts: 2555
Joined: Wed Aug 20, 2008 2:24 pm

Re: Decrypt_On_Execute markers in multi-threaded applications

Post by Enigma » Thu Jan 15, 2009 12:47 pm

This problem is solved in Enigma Protector 1.62

Post Reply