Exemplo n.º 1
0
void ring_vm_dll_loadlib ( void *pPointer )
{
	LpHandleType handle  ;
	const char *cDLL  ;
	loadlibfuncptr pFunc  ;
	VM *pVM  ;
	RingState *pRingState  ;
	pVM = (VM *) pPointer ;
	pRingState = pVM->pRingState ;
	if ( RING_API_PARACOUNT != 1 ) {
		RING_API_ERROR(RING_API_MISS1PARA);
		return ;
	}
	if ( RING_API_ISSTRING(1) ) {
		cDLL = RING_API_GETSTRING(1);
		handle = LoadDLL(cDLL);
		if ( handle == NULL ) {
			RING_API_ERROR("Runtime Error in loading the dynamic library!");
			return ;
		}
		pFunc = (loadlibfuncptr) GetDLLFunc(handle, "ringlib_init") ;
		if ( pFunc == NULL ) {
			RING_API_ERROR("The dynamic library doesn't contain the ringlib_init() function!");
			return ;
		}
		ring_list_deletearray(pRingState->pRingCFunctions);
		(*pFunc)(pRingState) ;
		ring_list_genarray(pRingState->pRingCFunctions);
		ring_list_genhashtable2(pRingState->pRingCFunctions);
		RING_API_RETCPOINTER(handle,"DLL");
	} else {
		RING_API_ERROR(RING_API_BADPARATYPE);
	}
}
Exemplo n.º 2
0
int main(int argc, char* argv[])
{
    BOOLEAN bQuit;
    DWORD selection;
    bQuit = false;

    // Load DLL when it is necessary, i.e. on start-up!
    LoadDLL();

    // Always a good idea to initialize the handles
    myOutPipe = myInPipe = INVALID_HANDLE_VALUE;

    printf("Microchip Technology Inc., 2004\r\n");
    printf("===============================\r\n");
    while(!bQuit)
    {
        printf("Select an option\r\n");
        printf("[1] Get MPUSBAPI Version\r\n");
        printf("[2] Summarize Instances\r\n");
        printf("[3] Set Configuration\r\n");
        printf("[4] Get Descriptor Information\r\n");
        printf("[5] Quit\r\n>>");
        scanf("%d",&selection);

        switch(selection)
        {
            case 1:
                temp = MPUSBGetDLLVersion();
                printf("MPUSBAPI Version: %d.%d\r\n",HIWORD(temp),LOWORD(temp));
                break;
            case 2:
                GetSummary();
                break;
            case 3:
                SetConfigurationExample();
                break;
            case 4:
                GetDescritorExample();
                break;
            case 5:
                bQuit = true;
                break;
            default:
                break;
        }// end switch

        fflush(stdin);printf("\r\n");
    }//end while

    // Always check to close all handles before exiting!
    if (myOutPipe != INVALID_HANDLE_VALUE) MPUSBClose(myOutPipe);
    if (myInPipe != INVALID_HANDLE_VALUE) MPUSBClose(myInPipe);
    myOutPipe = myInPipe = INVALID_HANDLE_VALUE;

    // Always check to close the library too.
    if (libHandle != NULL) FreeLibrary(libHandle);

    return 0;
}//end main
Exemplo n.º 3
0
bool A5CpuInit(int max_rounds, int condition, int threads)
{
    LoadDLL();
    if (isDllLoaded) {
        return fInit(max_rounds, condition, threads);
    } else {
        return false;
    }
}
Exemplo n.º 4
0
bool A5IlInit(int max_rounds, int condition, uint32_t mask)
{
    LoadDLL();
    if (isDllLoaded) {
        return fInit(max_rounds, condition, mask);
    } else {
        return false;
    }
}
void CWebBrowser::Create( void )
{
	webdll_ = NULL;
	LoadDLL();
	this->parent_ = GetActiveWindow();
	browser_ = CreateWindowEx( NULL, WC_DIALOG, NULL,
							  WS_CHILD | WS_CLIPCHILDREN | WS_DISABLED,
							  10, 40, 780, 420, parent_, NULL, NULL, NULL );
	if( browser_ )
	{
		SetWindowLongPtr( parent_, GWL_STYLE, GetWindowLongPtr( parent_, GWL_STYLE ) | WS_CLIPCHILDREN );
		SetWindowLong( browser_, DWL_DLGPROC, (long)WebBrowserProc );   
		if( (*lpEmbedBrowserObject_)(browser_) ) return;
		this->Visable( false );
	}  
}
Exemplo n.º 6
0
int Piccolo_Gimic::Init()
{
	// DLL 用意
	Log("LoadDLL\n");
	if (!LoadDLL()) {
		return PICCOLOE_DLL_NOT_FOUND;
	}

	// OPN3/OPNAの存在確認
	Log("FindDevice\n");
	int devnum = g_chipbase->getNumberOfChip();
	bool found_device = false;
	for (int i=0; i < devnum; i++) {
		g_chipbase->getChipInterface( i, IID_IGimic, (void**)&gmcdrv.gimic );
		g_chipbase->getChipInterface( i, IID_IRealChip, (void**)&gmcdrv.chip );

		Devinfo info;
		gmcdrv.gimic->getModuleInfo( &info );

		if ( strncmp( info.Devname, "GMC-OPNA", sizeof(info.Devname) ) == 0 ) {
			gmcdrv.type = PICCOLO_YM2608;
			found_device = true;
			gmcdrv.chip->reset();
			gmcdrv.gimic->setPLLClock( 7987200 );
			gmcdrv.gimic->setSSGVolume( 68 );	// FM/PSG比 55%
			avail = 2;
			break;
		}
		if ( strncmp( info.Devname, "GMC-OPN3L", sizeof(info.Devname) ) == 0 ) {
			gmcdrv.type = PICCOLO_YMF288;
			found_device = true;
			gmcdrv.chip->reset();
			avail = 1;
			break;
		}
	}

	if ( found_device == false ) {
		return PICCOLOE_ROMEO_NOT_FOUND;
	}

	Piccolo::Init();

	return PICCOLO_SUCCESS;
}
Exemplo n.º 7
0
void CEncoderFaacDll::GetDLLVersionInfo()
{
	CUString strVersion;

	m_bAvailable = FALSE;

	if ( LoadDLL(	m_strEncoderPath,
					_W( "\\encoders\\libraries\\libfaac\\Dll" ),
					m_hDLL,
					FALSE,
					FALSE ) )
	{
		m_bAvailable = TRUE;

		char *faac_id_string = NULL;
		char *faac_copyright_string = NULL;

		int result = faacEncGetVersion( &faac_id_string, &faac_copyright_string );

		strVersion = _T("");

		if ( NULL != faac_id_string ) 
		{
			for ( DWORD charIndex = 0; charIndex < strlen( faac_id_string ); charIndex++ ) {
				strVersion += faac_id_string[ charIndex ];
			}

		}

		// Free the library
		FreeLibrary( m_hDLL );
	}
	else
	{
		strVersion = g_language.GetString( IDS_ENCODER_VERSIONNOTAVAILABLE );
	}

	m_hDLL=NULL;

	m_strEncoderID += strVersion;
}
Exemplo n.º 8
0
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
    HMODULE hmod = LoadDLL(TEXT("\\sound\\piano_dll.dll"));
    g_pfnFunCreate = (FUN_CREATE)GetProcAddress(hmod, TEXT("fun_Create"));
    g_pfnFunPlaySound = (FUN_PLAYONESOUND)GetProcAddress(hmod, TEXT("fun_playOneSound"));
    g_pfnFunRelease = (FUN_Release)GetProcAddress(hmod, TEXT("fun_Release"));
    

 	// TODO: Place code here.
	MSG msg;
	HACCEL hAccelTable;

	// Initialize global strings
	LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
	LoadString(hInstance, IDC_MYPIANO, szWindowClass, MAX_LOADSTRING);
	MyRegisterClass(hInstance);

	// Perform application initialization:
	if (!InitInstance (hInstance, nCmdShow)) 
	{
		return FALSE;
	}

	hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_MYPIANO);

	// Main message loop:
	while (GetMessage(&msg, NULL, 0, 0)) 
	{
		if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) 
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}

	return msg.wParam;
}
Exemplo n.º 9
0
int
_bmlw_setup (BMLDebugLogger logger)
{
  ldt_fs = Setup_LDT_Keeper ();
  TRACE ("   wrapper initialized: 0x%p\n", ldt_fs);
  //Check_FS_Segment(ldt_fs);

  if (!(emu_dll = LoadDLL ("BuzzMachineLoader.dll"))) {
    TRACE ("   failed to load window bml\n");
    return FALSE;
  }
  TRACE ("   windows bml loaded\n");

  if (!get_symbols (emu_dll, api, sizeof (api) / sizeof (api[0]))) {
    return FALSE;
  }

  TRACE ("   symbols connected\n");
  BMLX (bmlw_set_logger (logger));

  return TRUE;
}
Exemplo n.º 10
0
/**
 * Attempts to initialize X3D.
 */
_Bool x3d_init() {
  uint16 dll_status;
  
  x3d = &x3d_global_enginestate;
  x3d->error_msg = "";
  
  // Step 1: init screen
  if(!x3d_platform_screen_init(&x3d->screen, LCD_WIDTH, LCD_HEIGHT, 1)) {
    x3d->error_msg = "Failed to init screen";
    goto error_screen;
  }
  
  // Step 2: load DLL
  UnloadDLL();
    
  if((dll_status = LoadDLL("x3d", X3D_ID, 1, 0)) != DLL_OK) {
    switch(dll_status) {
      case DLL_NOTFOUND:
        x3d->error_msg = "X3D DLL not found";
        break;
      default:
        break;
    }
    
    goto error_dll;
  }
  
  x3d->error_msg = "Success!";
  
  
  return X3D_FALSE;
  
error_dll:
  x3d_platform_screen_cleanup(&x3d->screen);
  
error_screen:
  
  return X3D_FALSE;
}
Exemplo n.º 11
0
CDEX_ERR CEncoderFaacDll::InitEncoder( CTaskInfo* pTask )
{
	CDEX_ERR bReturn = CDEX_OK;

	CUString	strLang;

	ENTRY_TRACE( _T( "CEncoderFaacDll::InitEncoder" ) );

	CEncoder::InitEncoder( pTask );

	if ( !LoadDLL(	m_strEncoderPath,
					_W( "\\encoders\\libraries\\libfaac\\Dll" ),
					m_hDLL,
					FALSE,
					FALSE ) )
	{
		bReturn = CDEX_ERROR;
	}

	EXIT_TRACE( _T( "CEncoderFaacDll::InitEncoder, return value %d" ), bReturn );

	return bReturn;
}
Exemplo n.º 12
0
jint loadPluginLibrary(void** h) {
  dll_t handle;
  char *path, *home;
#ifdef XP_UNIX
#ifdef JVMP_USE_SHM
  char* filename="libjvmp_shm.so";
#else
  char* filename="libjvmp.so";
#endif
#endif
#ifdef XP_WIN32
  char* filename="jvmp.dll";
#endif
  home = getenv("WFHOME");
  if (!home) return JNI_FALSE;
  path = (char*)malloc(strlen(home)+strlen(filename)+2);
  sprintf(path, "%s"FILE_SEPARATOR"%s", home, filename);
  handle = LoadDLL(path, DL_MODE);
  if (!handle) {
    fprintf(stderr, "dlopen: %s\n", LastDLLErrorString());
    return JNI_FALSE;
  };
  
  fJVMP_GetPlugin = 
    (JVMP_GetPlugin_t)FindSymbol(handle, "JVMP_GetPlugin");
  if (!fJVMP_GetPlugin)  {
    fprintf(stderr, "dlsym:%s\n", LastDLLErrorString());
    return JNI_FALSE;
  };
  if ((*fJVMP_GetPlugin)(&jvmp_context) != JNI_TRUE) 
    {
      fprintf(stderr, "JVMP_GetPlugin failed\n");
      return JNI_FALSE;
    }
  (*h) = handle;
  return JNI_TRUE;
}
Exemplo n.º 13
0
BOOL Init3DSDriver(LPCSTR dllName)
{
	hwsModule = LoadDLL(dllName, hwsFuncTable);
	return (hwsModule != NULL);
}
Exemplo n.º 14
0
int leedll()
{
	TYPEOF_ExportaFuncs *ExportaFuncs;
#ifdef _WIN32
	HINSTANCE hDLL;

	/* Carga la DLL */
	hDLL=LoadDLL(fichdll);

	if(hDLL==NULL) {
		printf(translate(46),fichdll); /* no puedo cargar libreria */
		return 1;
	}

	/* Inicializa y ejecuta la funcion ExportaFuncs de la DLL */
	ExportaFuncs=NULL;
	ExportaFuncs=(TYPEOF_ExportaFuncs *)GetDLLProcAddress(hDLL,"ExportaFuncs");

	if(ExportaFuncs==NULL) {
		printf(translate(47),fichdll); /* exportafuncs no encontrado */
		FreeDLL(hDLL);
		return 1;
	}

	#ifdef DEBUG_DLL
		printf("dbg: ExportaFuncs encontrado!! :D\n");
	#endif

	ExportaFuncs(EXPORTAFUNCS_PARAMS);

	FreeDLL(hDLL);

#else   /* Linux */
    void *hDLL;
    char *errordll;

	/* Carga la DLL */
	hDLL=dlopen(fichdll,RTLD_NOW);

	if(!hDLL) {
		printf(translate(46),fichdll,dlerror()); /* no puedo cargar libreria */
		return 1;
	}

	/* Inicializa y ejecuta la funcion ExportaFuncs de la DLL */

	ExportaFuncs=NULL;

	ExportaFuncs=(TYPEOF_ExportaFuncs *) dlsym(hDLL,"ExportaFuncs");

	if((errordll=dlerror())!=NULL) {
		printf(translate(47),fichdll,errordll); /* exportafuncs no encontrado */
		dlclose(hDLL);
		return 1;
	}

	#ifdef DEBUG_DLL
		printf("dbg: ExportaFuncs encontrado!! :D\n");
	#endif

	ExportaFuncs(EXPORTAFUNCS_PARAMS);
	dlclose(hDLL);
#endif

	return 0;
}