Colin
admin
- Posts
- 928
- Threads
- 49
- Location
- Bulgaria
in the post above:
char strArr[10240]; storage for hold all string array each one is 128 byte len
dword cnt;
dword disp;
..........
.........
//later
eax = Ziron_GetNextToken();
ebx = 0;
cnt = 0;
edi = @strArr;
while( eax != zirParenClose)
{
H_strcpy( [edi+ebx],Ziron_GetStringValue());
ebx += 128;
cnt++;
eax = Ziron_GetNextToken();
}
you pass [edi+ebx] as if it points to a pointer, however you defined your array as a string. What you could do is define a new macro:
inline function ptrAt($base) {
lea eax, $base
$return eax;
}
then change
H_strcpy( [edi+ebx],Ziron_GetStringValue());
to
H_strcpy( ptrAt([edi+ebx]),Ziron_GetStringValue());
let me know.
btw you could also make it a general purpose macro
inline function laddr($reg, $base) {
lea $reg, $base
$return $reg;
}
H_strcpy( laddr(eax, [edi+ebx]),Ziron_GetStringValue());
ps: using add is also fine.
while( eax != zirParenClose)
{
H_strcpy( edi,Ziron_GetStringValue());
edi += 128;
cnt++;
eax = Ziron_GetNextToken();
}
best approach:
eax = Ziron_GetNextToken();
esi = 0;
edi = @parArr;
while( eax != zirParenClose)
{
H_strcpy( edi, Ziron_GetStringValue());
edi += 128;
esi++;
eax = Ziron_GetNextToken();
}
cnt = esi;
Emil_halim
member
- Posts
- 639
- Threads
- 104
- Location
- Alex, Egypt
thanks , but there is a strange problem.
using this line crashing the program
cnt = esi;
i changed it like this and every thing is okay.
mov cnt,eas
it seems the '=' handler has sume problem with local variable.
http://www.freewebs.com/ogremagic/index.htm
Colin
admin
- Posts
- 928
- Threads
- 49
- Location
- Bulgaria
thanks for the report, i will take a look at it :)
Colin
admin
- Posts
- 928
- Threads
- 49
- Location
- Bulgaria
btw i tried
DWord cnt = 10;
for (edi = 0 to cnt) {
print('Hello\r\n');
}
and i did not have any crashes.
Emil_halim
member
- Posts
- 639
- Threads
- 104
- Location
- Alex, Egypt
but i
was testing it inside a code and it crashed , when substitute with while it worked well.
i think the problem belong to local variable , because i replaced cnt local variable with a register , and every thing was ok.
http://www.freewebs.com/ogremagic/index.htm
Colin
admin
- Posts
- 928
- Threads
- 49
- Location
- Bulgaria
can you try to make a small test app that re-produces the problem? i can't seem to get it to crash, if you can will be great.
Colin
admin
- Posts
- 928
- Threads
- 49
- Location
- Bulgaria
I have updated the beta which should fix a few bugs here and there :)
Emil_halim
member
- Posts
- 639
- Threads
- 104
- Location
- Alex, Egypt
ok , look this is part of my #define handler , if you replace this part
// adding '$' to param
edi = cnt;
ebx = @parArr;
while(edi>0)
{
if(strCmp(ebx, Ziron_GetStringValue()))
{
H_strcat(@val,' $');
break;
}
ebx += 128;
edi--;
}
with for statement the plugin makes ziron crash with access violation.
http://www.freewebs.com/ogremagic/index.htm