Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Bugs and Fixes

Masm Plugin in c crash

A community discussion post from the original code:zIRON forum.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

Masm Plugin in c crash

hi this code of plugin makes ziron.exe it self crashed.

/****************************************************************************
 *                                                                          *
 *                                                                          *
 ****************************************************************************/

#define WIN32_LEAN_AND_MEAN  /* speed up */
#include <windows.h>

#include "framework.h"
#include "ZIRPLUGIN.h"


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

char* strLoaded = "Masm plugin written with C.";

//////////////////////////////
 
//
// event_Data()
// return false to allow the assembler to process this keyword internally.
// return true to tell the assembler this keyword has been processed.
//
BOOL __stdcall  event_Data(void) 
{
      Ziron_ShowMessage("hellow from plugin written with C.");
      return TRUE;
}

void __stdcall FileEntry(DWORD handle, char* strCode) 
{
     char* addr = strstr(strCode, ".DATA");
     while (*addr != 0)
      {
            *addr = '_';
            addr = strstr(addr, ".DATA");
      }
     
     addr = strstr(strCode, ".CODE");
     while (*addr != 0) 
  	  {
            *addr = '_';
            addr = strstr(addr, ".CODE");
      }
}

char* __stdcall InitPlugin(void* pGetF)
{
	Ziron_LoadAll(pGetF); //use framework utility function to load all
	//register our keyword
	Ziron_RegisterKeyword("_Data", event_Data);
	return strLoaded;
}

BOOL APIENTRY DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
   
    /* Return success */
    return TRUE;
}

when comment Ziron_RegisterKeyword function the crashed take place in the plugin itself.

the test program is

program WIN32CUI 'Masm Syntax test';

#include 'console.zir';


.DATA 
{

var      DB 0x0f 
vv       Db 1 
ar1      DB ?  
ar2      DB 0 

ml       db 0 , 1 , 100
}

wait_key(nil);
ExitProcess(0);

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

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

Unfortunately i won't be able to help debug plug-ins that are written in other languages - since i need to step through the code with ziron assembler to find ziron bugs/errors.