Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Requests and Feedback

data section.

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

Replies

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt
as i said before, the main file handle might not be 0

is that makes Ziron_ShowMessage does not show any thind at all?

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

well since your showmessage is inside the if block, if there is no string to show, then nothing will be shown.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

ok , this also does not change any thing

function FileEntry(DWord handle; char* strCode)
{   
   //preprocess the main file
   if (handle == 0)
    {       
      esi = strCode;
      esi = strOffset(esi, '.DATA');
      while (char[esi] != 0)
       {
           char[esi] = "_";
           esi = strOffset(esi, '.DATA');
       }
    }
}

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

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

ok , ok , if i remember well , you said that if (handle == 0) return main file?

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

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

this is post #[283]

http://http://www.codeziron.com/forum.php?page=topic&id=60

function FileEntry(DWord handle; char* strCode) {
  const maxLen = 512;
  
  //create a buffer
  char myBuffer[maxLen];
  
  if (handle == 0) {
    strlcpy(@myBuffer, 'program WIN32CUI \'test\'; #include \'console.zir\'; print(\'hello world!\r\n\'); wait_key(nil); ExitProcess(0);', 104);
  
    //set the buffer
    Ziron_SetFileBuffer(handle, @myBuffer, 104);
  }  
}

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

in that post, it was sample, that i knew would work, but 0 may not always be the main file, however it is best not to just process the main file, but all since some people may split their projects into many files, anyways i've just found another bug relating to this that is causing a problem... i will fix upload then post sample.

Colin admin
Posts
928
Threads
49
Location
Bulgaria

ok i've updated the beta package with the fix, and here is test code for you:

procedure FileEntry(DWord handle; char* strCode) {
	eax = strOffset(strCode, '.DATA');
	while (char[eax] <> 0) {
		char[eax] = "_";
		eax = strOffset(eax, '.DATA');
	}
}

this code will definitely work.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

oh , no i got access violation with testprog

//******************************************************//
//                                                      //
//                                                      //
//                 Masm plugin                          //
//               By  Emil Halim                         //
//                 11/11/2011                           //
//                                                      //
//******************************************************//

plugins off;

program WIN32DLL 'Masm PLUGIN';

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

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

const strLoaded = 'Masm plugin has loaded!';

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


//
// event_Data()
// return false to allow the assembler to process this keyword internally.
// return true to tell the assembler this keyword has been processed.
//
function event_Data() {
  uses edi;
  char buf[2048];
  char var[255];
  char str1[255];
  boolean Flg = true;  
  
  if(Flg)
   {
            
      return true;
   }
  else
   {   
      return false;                           // let Ziron handle the line  
   }  
}

function FileEntry(DWord handle; char* strCode)
{   
   eax = strOffset(strCode, '.DATA');
   while (char[eax] <> 0) {
      char[eax] = "_";
      eax = strOffset(eax, '.DATA');
   }
}

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

  //register our keyword
  Ziron_RegisterKeyword('_Data', @event_Data);
  
  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