void cleanup_and_start_app(){
	int other_nodes = nodes_discovered();
	printf("%d Nodes  Discovered for Address %d(nodenum=%d) \n",other_nodes,nodeinfo.address, nodeinfo.nodenumber);
	for(int i=0; i<= other_nodes; i++){
		if(i != nodeinfo.nodenumber)
		printf("#%d : Dest address : %d | Via address : %d | MTU : %d | Cost : %ld \n", 
			i, table[i].dest, table[i].via, linkinfo[table[i].link].mtu, table[i].cost);
	}
	printf("Routing successfully completed! Application started.\n");
	RoutingStage = false;
	CNET_enable_application(ALLNODES);
	setup_nl();
	setup_dll();
	
}
Exemple #2
0
static HRESULT install_cab_file(install_ctx_t *ctx)
{
    WCHAR tmp_path[MAX_PATH], tmp_dir[MAX_PATH];
    BOOL res = FALSE, leave_temp = FALSE;
    DWORD i;
    HRESULT hres;

    GetTempPathW(sizeof(tmp_path)/sizeof(WCHAR), tmp_path);

    for(i=0; !res && i < 100; i++) {
        GetTempFileNameW(tmp_path, NULL, GetTickCount() + i*17037, tmp_dir);
        res = CreateDirectoryW(tmp_dir, NULL);
    }
    if(!res)
        return E_FAIL;

    ctx->tmp_dir = tmp_dir;

    TRACE("Using temporary directory %s\n", debugstr_w(tmp_dir));

    hres = extract_cab_file(ctx);
    if(SUCCEEDED(hres)) {
        if(ctx->callback)
            IBindStatusCallback_OnProgress(ctx->callback, 0, 0, BINDSTATUS_INSTALLINGCOMPONENTS, ctx->install_file);

        switch(ctx->install_type) {
        case INSTALL_INF:
            hres = RunSetupCommandW(ctx->hwnd, ctx->install_file, NULL, ctx->tmp_dir, NULL, NULL, RSC_FLAG_INF, NULL);
            if(FAILED(hres))
                WARN("RunSetupCommandW failed: %08x\n", hres);
            break;
        case INSTALL_DLL:
            FIXME("Installing DLL, registering in temporary location\n");
            hres = setup_dll(ctx);
            if(SUCCEEDED(hres))
                leave_temp = TRUE;
            break;
        default:
            assert(0);
        }
    }

    if(!leave_temp)
        RemoveDirectoryW(ctx->tmp_dir);
    return hres;
}