Marker Count identify error

Issues related to VMProtect
Post Reply
luleigreat
Posts: 10
Joined: Mon Jun 27, 2011 1:59 am

Marker Count identify error

Post by luleigreat »

Hello, Administrator, I am a registered VMProtect user. I have sevel questions when using your product,following is my source code:
situation1:

#include <Windows.h>
#include "VMProtectSDK.h"

void func(int param)
{
VMProtectBegin("func");
if(param > 100)
{
_tprintf(TEXT("<100"));
return;
}
else
{
_tprintf(TEXT(">100"));
}
VMProtectEnd();

VMProtectBegin("func2");
switch(param)
{
case 0:
MessageBoxA(0,"Begin",0,0);
return;
case 1:
MessageBoxA(0,"Begin1",0,0);
break;
default:
break;
}
VMProtectEnd();


}
int _tmain(int argc, _TCHAR* argv[])
{
MessageBoxA(0,0,0,0);
IsDebuggerPresent();

func(10);
return 0;
}

When I open my released .exe file, VMProtect identifies only the first Marker "func" in function func,can you tell me why?
The Debuged edition is right.

The second question,source code:
situation 2:

void func(int param)
{
VMProtectBegin("func");
if(param > 100)
{
_tprintf(TEXT("<100"));
return;
}
else
{
_tprintf(TEXT(">100"));
}
switch(param)
{
case 0:
MessageBoxA(0,"Begin",0,0);
return;
case 1:
MessageBoxA(0,"Begin1",0,0);
break;
default:
break;
}
VMProtectEnd();


}
int _tmain(int argc, _TCHAR* argv[])
{
VMProtectBegin("_tmain");

MessageBoxA(0,0,0,0);
IsDebuggerPresent();

VMProtectEnd();

func(10);
return 0;
}

When I open the released .exe file ,VM only identifies the Marker "_tmain" in function _tmain, while the marker "func" in function func() is ignored.
Can you tell me why?
Admin
Site Admin
Posts: 2693
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: Marker Count identify error

Post by Admin »

Please send us a test application with this problem (original exe+map+vmp files).
luleigreat
Posts: 10
Joined: Mon Jun 27, 2011 1:59 am

Re: Marker Count identify error

Post by luleigreat »

Attachment is the file .
By the way ,I used the Macro in previous edition of VMProtect, and it display right!
Attachments
Release.rar
(6.21 KiB) Downloaded 776 times
Admin
Site Admin
Posts: 2693
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: Marker Count identify error

Post by Admin »

The reason of this problem is an optimization:

Code: Select all

00401004 8B35B0204000            mov esi, [004020B0] <- VMProtectMarker "_tmain"
0040100A 57                      push edi 
0040100B 6838214000              push 00402138 -> ANSI "_tmain"
00401010 FFD6                    call esi 
00401012 8B2DA8204000            mov ebp, [004020A8] -> USER32.MessageBoxA
00401018 6A00                    push 00 
0040101A 6A00                    push 00 
0040101C 6A00                    push 00 
0040101E 6A00                    push 00 
00401020 FFD5                    call ebp 
00401022 FF1500204000            call dword ptr [00402000] -> KERNEL32.IsDebuggerPresent
00401028 8B3DB4204000            mov edi, [004020B4] -> VMProtectSDK32.VMProtectEnd
0040102E FFD7                    call edi 
00401030 6824214000              push 00402124 -> ANSI "func3"
00401035 FFD6                    call esi 
00401037 682C214000              push 0040212C -> Unicode ">100"
0040103C FF157C204000            call dword ptr [0040207C] -> MSVCR90.wprintf
00401042 83C404                  add esp, 04 
00401045 FFD7                    call edi 
00401047 6804214000              push 00402104 -> ANSI "checkCheat"
0040104C FFD6                    call esi 
VMProtect did not find the second marker by call esi+call edi. Please try add #pragma optimize( "g", off ) and #pragma optimize( "g", on ) around _tmain or use MAP file for the selection of protection functions.
By the way ,I used the Macro in previous edition of VMProtect, and it display right!
I think that in preious cases you had a different code.
luleigreat
Posts: 10
Joined: Mon Jun 27, 2011 1:59 am

Re: Marker Count identify error

Post by luleigreat »

Thanks for your reply.
I have realized the question due to your reply.
But the code is identical except the mark when it display well.You can try using the code I posted.
Admin
Site Admin
Posts: 2693
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: Marker Count identify error

Post by Admin »

We`ll fix this issue in the next versions.
Post Reply