Static member functions

Post here any topics that related to Enigma Protector, its functionality, your misunderstanding, offers to improvements etc etc etc
Post Reply
avok
Posts: 7
Joined: Thu Feb 12, 2009 2:04 pm

Static member functions

Post by avok »

Hello,

Does the VM know how to read static member functions from the map file? We have a few critical areas in our program that are utilizing these and it would be nice if we could protect these parts with the VM.

Thank you.
Enigma
Site Admin
Posts: 2945
Joined: Wed Aug 20, 2008 2:24 pm

Re: Static member functions

Post by Enigma »

Hi avok,

Why not, static members (natively) are just a functions. Any function of compiled executable are written in map file. Try to open map file in Enigma, if you find this function in the list - so, no problem, VM will work correctly with this fn.

By the way, I'm often getting emails with the question "Why Enigma shows not all the functions from map", please note that Enigma shows only supported functions. If you do not find your function in the list - it is unsupported.

So, if for example your class is looking so (there are 2 kind of static members, 1st - like a function, 2nd - like a variable, Enigma VM can't protect variable, but any var static method could be rewritten to function equivalent and protected without a problem):

Code: Select all

class BufferedOutput
{
public:
   // Return number of bytes written by any object of this class.
   short BytesWritten()
   {
      return bytecount;
   }

   // Reset the counter.
   static void ResetCount()
   {
      bytecount = 0;
   }

   // Static member declaration.
   static long bytecount;
};
You can compile this and find in the map file ResetCount() function. But one note also. Enigma could support the function if it's length will be more than 5 bytes. The member ResetCount() above I do not think has 5 bytes, but we can enlarge it. For example with the null nop assembler instruction that has 1 byte length:

Code: Select all

  static void ResetCount()
   {
      __asm
      {
         nop
         nop
         nop
         nop
         nop
      }
      bytecount = 0;
   }
avok
Posts: 7
Joined: Thu Feb 12, 2009 2:04 pm

Re: Static member functions

Post by avok »

We are sure that the functions are more than 5 bytes(pretty long). What does it mean that a function is unsupported?
Enigma
Site Admin
Posts: 2945
Joined: Wed Aug 20, 2008 2:24 pm

Re: Static member functions

Post by Enigma »

Unsupported functions means:
1. Size of function less than 5 bytes
2. There are unsupported SEH handlers (Enigma VM support well Delphi, C++ and VB seh, but I assume there are a lot of other compilers)
3. There are unsupported assembler instructions in the function, for example, any fpu instruction like
FLD TBYTE PTR SS:[EBP+14]
FLDLN2
FXCH ST(1)
FYL2X
FLD TBYTE PTR SS:[EBP+8]
FMULP ST(1),ST
4. There are switch/case conditions (does not support yet)

If you need, you can send me your non protected exe and map file and I will tell you what is wrong there.
Post Reply