Пример #1
0
/* registers the OCX if do_reg is TRUE, unregisters it otherwise */
HRESULT do_ocx_reg(HMODULE hocx, BOOL do_reg, const WCHAR *flags, const WCHAR *param)
{
    DLLREGISTER reg_func;

    if (do_reg)
        reg_func = (DLLREGISTER)GetProcAddress(hocx, "DllRegisterServer");
    else
        reg_func = (DLLREGISTER)GetProcAddress(hocx, "DllUnregisterServer");

    if (!reg_func)
        return E_FAIL;

    reg_func();
    return S_OK;
}
Пример #2
0
/** Finds the interface, then calls the register function which should
allocate all the data structures. Set our buffer and length and return.
\n\b Arguments:
\n\b Returns: Structure or NULL on error.
****************************************************************************/
struct open_gpib_dev *find_and_register_if(const char *if_name, int type, uint32_t debug,char *buf, int blen)
{
	open_gpib_register reg_func; 
	struct open_gpib_dev *open_gpibp=NULL;
	
	if(NULL == (reg_func=open_gpib_find_interface(if_name, type)))
		return NULL;
	
	if(DBG_TRACE<=debug)fprintf(stderr,"reg %s\n",if_name);
	/**this call allocates the interface's open_gpib_dev  structure
		and allocates the internal structure. It also sets if_name.
		see the macro in _open_gpib.h GPIB_TRANSPORT_FUNCTION
	   */
	if(NULL == (open_gpibp=reg_func()) )
		return NULL; 
	open_gpibp->buf=buf;
	open_gpibp->buf_len=blen;	
	open_gpibp->debug=debug;
	return open_gpibp;
}
Пример #3
0
static HRESULT setup_dll(install_ctx_t *ctx)
{
    HMODULE module;
    HRESULT hres;

    HRESULT (WINAPI *reg_func)(void);

    module = LoadLibraryW(ctx->install_file);
    if(!module)
        return E_FAIL;

    reg_func = (void*)GetProcAddress(module, "DllRegisterServer");
    if(reg_func) {
        hres = reg_func();
    }else {
        WARN("no DllRegisterServer function\n");
        hres = E_FAIL;
    }

    FreeLibrary(module);
    return hres;
}