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
[961] - posted: 2011-12-05 18:04:24
actually this is correct, but when i think about it, there is no need for each of them to be re-sent to the plugins, i will correct 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
[969] - posted: 2011-12-05 19:34:40

also i was playing with Ziron_SetFileBuffer ,so i made this
Code:
    int32 len = H_strlen(strCode);
    if(len > 0)
     {
       pointer mem = H_GetTmpMem(len); //allocate memory
       char tmp[1024];
       edi = strGetLine(strCode, @tmp);
       while(edi > 0)
        {    
           H_strcat(mem,@tmp);          
           edi = strGetLine(edi, @tmp);
        }
       if(Ziron_SetFileBuffer(handle, mem ,H_strlen(mem)) == false)
        {
          Ziron_FatalError('error when set File Buffer');
       }  
     }


it always faild , is there something wrong here?

http://www.freewebs.com/ogremagic/index.htm
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[973] - posted: 2011-12-07 17:45:14


ok has no answer , i will ask it in deferent way.

does Ziron_SetFileBuffer function works okay with windows7 system , or it has a problem?

and if it works well , why my test did not work , all my test made is that takes a line from
buffer code then it adds that line to a new buffer , then it sets the new buffer by Ziron_SetFileBuffer function.

any help please ?

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[974] - posted: 2011-12-07 17:53:44
please but a test plugin together that reproduces the issue - that i can assemble, as soon as i get the time i will compile it and test to see what is the problem.

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
[975] - posted: 2011-12-07 18:11:10

actually you can test it with any program , here is simple one.
Code:
program WIN32CUI 'ssleep test';

Eax = 10;

ExitProcess(0);


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[976] - posted: 2011-12-07 18:19:23
i do not see any call to setbuffer in that code.... i require a plugin code not a test code.

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
[977] - posted: 2011-12-07 18:28:05

ok , here it is
Code:
plugins off;

program WIN32DLL 'test PLUGIN';

#include 'zirplug/framework.zir';
#include 'zirutils.zir';
#include 'strings.zir';
//////////////////////////////

const strLoaded = 'test plugin has loaded!';

//////////////////////////////

function H_strlen(char* str) {
  Eax = str;
  while(char[eax] != 0) {
    Eax++;
  }
  sub Eax, str
}

function H_strcat(Dword dst,src) 
{ 
  uses edx ebx;
  Eax = dst; 
  Edx = src;
  push Eax;
  while (byte[Eax] != 0) { Eax++; } 
  while (byte[Edx] != 0)  
   { 
      BL =  char[Edx]; 
      char[Eax] = BL;  
      Edx++; Eax++; 
   } 
  char[Eax] = 0;
  pop Eax;
} 

inline procedure  H_strjoin(;)
{
  $temp = 1;
  $to = $argc - 1;  
  $repeat $to:  
     H_strcat($arg[0],$arg[$temp]);  
  $temp++;
  $end
}

function H_GetTmpMem(DWord sizeInByte)
{
   uses Ebx Ecx;   
   const  len = 1024;
   global int32   StrCnt;
   global char*   StrFunc[len];
   if(sizeInByte == nil)
    {
       for (Ecx = 0 to StrCnt) 
       {
          Ebx=@StrFunc;
          lea Ebx,[Ebx+Ecx]
          Eax=Dword[Ebx];
          if( Eax> 0)
           {
              freemem( Eax);
           }
       }
       return nil; 
    }
   Eax = StrCnt;
   Eax++;
   and Eax,len
   StrCnt = Eax;
   Ebx = @StrFunc;
   lea Ebx,[Ebx+Eax]
   Eax=Dword[Ebx];
   if( Eax> 0)
    {
       freemem( Eax);
    }
   Dword[Ebx]= malloc(sizeInByte);
   char[Eax]=0; // make sure string is nil
}

procedure FileEntry(DWord handle; char* strCode) 
{
    int32 len = H_strlen(strCode);
    if(len > 0)
     {
       pointer mem = H_GetTmpMem(len); //allocate memory
       char tmp[1024];
       edi = strGetLine(strCode, @tmp);
       while(edi > 0)
        {    
           H_strcat(mem,@tmp);          
           edi = strGetLine(edi, @tmp);
        }
       if(Ziron_SetFileBuffer(handle, mem ,H_strlen(mem)) == false)
        {
          Ziron_FatalError('error when set File Buffer');
       }  
     }
}


function InitPlugin(pointer pGetF) {
  Ziron_LoadAll(pGetF); //use framework utility function to load all

  return strLoaded;
}

entry function DLLMain(DWord iDLL; DWord iReason; Pointer iResult) {
  if (iReason == DLL_PROCESS_ATTACH) {
    return true;
  }

  return false;
}

exports InitPlugin,FileEntry;



http://www.freewebs.com/ogremagic/index.htm
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[982] - posted: 2011-12-09 11:56:21

any progress here?

l hope you get the solution , i know you will be busy next 2 months , as soon as possible.

this function will help me a lot if it works correctly.

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 7 user(s) online. 0 member(s) and 7 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