Пример #1
0
bool cinstall(const char* x) {
    typedef void(*Ptr)();
    void* m = cload(x);
    if (!m)
        return false;
    void* ptr = csym(m, "mUInstall");
    if (ptr)
        reinterpret_cast<Ptr>(ptr)();
    return true;
}
Пример #2
0
int LoadCoff(CKMotionDLL *KMotionDLLtoUse, const char *Name, unsigned int *EntryPoint, int PackToFlash)
{
	int  files   = 0;
	int  nostart = 0;
	
	need_symbols = 0;

	KMotionDLL = KMotionDLLtoUse;  // save globally so memwrite can use it

	/*----------------------------------------------------------------------*/
	/* PROCESS COMMAND LINE ARGUMENTS                                       */
	/*----------------------------------------------------------------------*/
	
    clear_bss = 1;  
    quiet     = 1;  
    nostart   = 1;  
    sflag     = 1;  
    iflag     = 1;  
    pflag     = 1;  
    ++verbose;      
    reloc   = 0x00000000;
    pageloc = 0x00000000;
	
	packtoflash = PackToFlash;
    firstdata= 1;              /* flag so we can clear flash image*/

	
	fin = fopen(Name, "rb");

	if (!fin)
	{ 
		char s2[300]="can't open file : ";
		strcat(s2,Name);
		AfxMessageBox(s2,MB_OK|MB_SYSTEMMODAL);
		return 1;
	}
	
	if (!cload()) 
	{ 
		AfxMessageBox("error loading file",MB_OK|MB_SYSTEMMODAL); 
		fclose(fin);
		return 1;
	}

	fclose(fin);

	*EntryPoint = entry_point;

	return 0;
}