Register | Login
Forum Index > Plugins > PlugIn Example in C
Author Message
Pages: 1 2 3 4 5 6 7 8 9 10 11
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[945] - posted: 2011-12-02 17:46:49
i think it would be better to create your buffer first and then just copy it all in 1 chunk, it will be faster and you will have less problems.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[946] - posted: 2011-12-02 18:23:45
so you would keep track of your pointer offset... then use another or variable to find the offset of the matching } and then create your buffer to match the size of


how can i achieve that in the event_while function. in this stage you did not have a pointer
to the code buffer so that you can navigate until you found '}'.

http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[951] - posted: 2011-12-02 19:03:25
you would not do it on the event but when you do the strOffset('.while', ... etc

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[952] - posted: 2011-12-02 19:29:17

ok , i am using this to calculate the max buffer size of the while body , need to know your opinion please.
Code:
    // part of FileEntry code that computes max buf  
    buflen = 0; // global variable 
    eax = strOffset(strCode, '_WHILE');
    while (char[eax] <> 0) {
           edx = 0;
           while(char[eax] != "{")
            {
               eax++;
            }
           while(char[eax] != "}")
            {
               edx++;
               eax++;
            } 
           if(edx >  buflen)
            {
              buflen = edx;
            }
           eax = strOffset(eax, '_WHILE');
    } 


http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[953] - posted: 2011-12-02 19:53:30
i don't think that will work because of nested while loops

maybe something like:

Code:
  buflen = 0; // global variable 

  push edi //nest counter
  edi = xor;
  eax = strOffset(strCode, '_WHILE');
  while (char[eax] <> 0) {
    edx = xor;
    
    while(char[eax] != "{") {
      eax++;
    }
    edi++;
    
    while(edi <> 0) {
      edx++;
      eax++;
      
      if (char[eax] == "{") {
        edi++;
      } elseif (char[eax] == "}") {
        edi--;
      }
    } 
    
    if(edx >  buflen) {
      buflen = edx;
    }
    eax = strOffset(eax, '_WHILE');
  } 
  pop edi


note that i have not tested this.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[954] - posted: 2011-12-02 20:52:27

i have access violation in masm.dll , so that i putted this for debug
Code:
  buflen = 0; // global variable 
  push edi //nest counter
  edi = xor;
  eax = strOffset(strCode, '_WHILE');
  while (char[eax] <> 0) {
    edx = xor;
    while(char[eax] != "{") {
      eax++;
    }
    edi++;
    while(edi <> 0) {
      edx++;
      eax++;
      if (char[eax] == "{") {
        edi++;
      } elseif (char[eax] == "}") {
        edi--;
      }
    } 
    if(edx >  buflen) {
      buflen = edx;
    }
    eax = strOffset(eax, '_WHILE');
  } 
  pop edi
    // debug 
    char tmp[1024];
    IntToStr(buflen, @tmp);
    Ziron_ShowMessage(@tmp);    

so i got that

PlugSys: Basic plugin has loaded!
PlugSys: Emit plugin has loaded!
PlugSys: Masm plugin version 0.01 has loaded!
PlugSys: Sleep seconds plugin has loaded
PlugSys: 14
PlugSys: 0
PlugSys: 0
PlugSys: 0
PlugSys: 0
PlugSys: 0
PlugSys: 0
PlugSys: 0
PlugSys: 0
--------------------------------------------


Access violation at address 01493394 in module 'masm.dll'. Read of address 00000000


from that i have found out that buflen is 0 when FileEntry finished but why?

http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[955] - posted: 2011-12-02 21:56:20
not all files contain _while's... check the plugin documentation search for the function to display the filename from handle, then print out the filename along with the size, to check.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[956] - posted: 2011-12-04 17:24:53

ok , i got strange results from Ziron_GetFileName

here is my code of FileEntry
Code:
procedure FileEntry(DWord handle; char* strCode) {
  
     uses edi;
       
     Ziron_ShowMessage(Ziron_GetFileName(handle));
} 
     


i got that

PlugSys: Basic plugin has loaded!
PlugSys: Emit plugin has loaded!
PlugSys: Masm plugin version 0.01 has loaded!
PlugSys: Sleep seconds plugin has loaded
PlugSys:
PlugSys:
PlugSys: macro return
PlugSys: macro return
PlugSys: macro return
PlugSys: macro return
PlugSys: macro return
PlugSys: macro return
PlugSys: macro return
--------------------------------------------


Access violation at address 0023334A in module 'masm.dll'. Read of address 00000000


forget the access violation now , i will check it later , but i think there is a problem with Ziron_GetFileName , am i wright ?

http://www.freewebs.com/ogremagic/index.htm
Pages: 1 2 3 4 5 6 7 8 9 10 11
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 8 user(s) online. 0 member(s) and 8 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd