Esempio n. 1
0
/****************************************************************************
*    Name        : InitUSBDriver                                            *
*                                                                           *
*    Inputs      : Channel Parameters                                       *
*    Outputs     : None                                                     *
*    Returns     : None                                                     *
*                                                                           *
*    Description : This routine initialises USB driver.It performs following* 
*                 actions.                                                  * 
*                 1. Initialses the USB Transmit and Receive Tasks          *
*                 2. Initialises teh Idle timer                             *
*                 3. Inidicates the Channel idle condition.                 *
*                                                                           *
*****************************************************************************
*/
void InitUSBDriver(GF_UINT8 p_setup_param)
{
  /* Create and Start USB Transmit Task */
  OS_CREATETASK(&USBTxTaskHandle, "USB TX Task", USBInterfaceTransmitTask,  USBTX_TASK_PRIORITY, USBTxStack);

  /* Create and Start USB Recive Task */
  OS_CREATETASK(&USBRxTaskHandle, "USB RX Task", USBInterfaceReceiveTask,  USBRX_TASK_PRIORITY, USBRxStack);

  /* Signal that the channel is NOT busy */
  UsbChannelBusy(FALSE);

  /* Initialise port and timer for timer idle */
#if(USB_IDLE_TYPE == TIMER_IDLE)
  InitIdleTimer();                                          
#endif
}
Esempio n. 2
0
int MirandaLoaded(WPARAM,LPARAM)
{
	g_wMask = db_get_w(NULL,MOD_NAME,"optsmask",DEFAULTSETTING);

	RegisterCoreHotKeys();

	g_hWinHook = SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_SHOW, NULL, WinEventProc, GetCurrentProcessId(), 0, 0);

	HookEvent(ME_TTB_MODULELOADED, TopToolbarInit);
	HookEvent(ME_OPT_INITIALISE, OptsDlgInit);
	HookEvent(ME_MSG_WINDOWEVENT, MsgWinOpening);
	HookEvent(ME_PROTO_ACCLISTCHANGED, EnumProtos);
	HookEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonsInit);
	HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed);

	GetWindowThreadProcessId(pcli->hwndContactList, &g_dwMirandaPID);

	WNDCLASS winclass = {0};
	winclass.lpfnWndProc = ListenWndProc;
	winclass.hInstance = g_hInstance;
	winclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
	winclass.lpszClassName = BOSSKEY_LISTEN_INFO;

	if (RegisterClass(&winclass))
	{
		g_hListenWindow = CreateWindow(BOSSKEY_LISTEN_INFO,BOSSKEY_LISTEN_INFO,WS_POPUP,0,0,5,5,pcli->hwndContactList,NULL,g_hInstance,NULL);
		WTSRegisterSessionNotification(g_hListenWindow, 0);
	}

	if (IsWinVerVistaPlus())
	{
		hDwmApi = LoadLibrary(_T("dwmapi.dll"));
		if (hDwmApi)
			dwmIsCompositionEnabled = (PFNDwmIsCompositionEnabled)GetProcAddress(hDwmApi,"DwmIsCompositionEnabled");
	}
	if (g_wMaskAdv & OPT_MENUITEM)
		BossKeyMenuItemInit();

	// Register token for variables plugin
	if (ServiceExists(MS_VARS_REGISTERTOKEN))
	{
		TOKENREGISTER tr = {0};
		tr.cbSize = sizeof(TOKENREGISTER);
		tr.memType = TR_MEM_OWNER;
		tr.flags = TRF_FIELD | TRF_TCHAR | TRF_PARSEFUNC;

		tr.tszTokenString = _T("bosskeyname");
		tr.parseFunctionT = VariablesBossKey;
		tr.szHelpText = LPGEN("BossKey")"\t"LPGEN("get the BossKey name");
		CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM) &tr);
	}

	EnumProtos(0, 0);
	InitIdleTimer();

	if (g_bOldSetting && !(g_wMaskAdv & OPT_RESTORE)) // Restore settings if Miranda was crushed or killed in hidden mode and "Restore hiding on startup after failure" option is disabled
		RestoreOldSettings();

	if ((g_wMaskAdv & OPT_HIDEONSTART) || (g_wMaskAdv & OPT_RESTORE && g_bOldSetting))
		BossKeyHideMiranda(0, 0);

	return 0;
}