Beispiel #1
0
/* send notification about a change to a given drive */
static void send_notify( int drive, int code )
{
    DEV_BROADCAST_VOLUME info;

    info.dbcv_size       = sizeof(info);
    info.dbcv_devicetype = DBT_DEVTYP_VOLUME;
    info.dbcv_reserved   = 0;
    info.dbcv_unitmask   = 1 << drive;
    info.dbcv_flags      = DBTF_MEDIA;
    BroadcastSystemMessageW( BSF_FORCEIFHUNG|BSF_QUERY, NULL,
                             WM_DEVICECHANGE, code, (LPARAM)&info );
}
Beispiel #2
0
/*
 * Writes any changes in input methods to the registry
 */
VOID
InputList_Process(VOID)
{
    INPUT_LIST_NODE *pCurrent;
    DWORD dwIndex;

    /* Process deleted and edited input methods */
    for (pCurrent = _InputList; pCurrent != NULL; pCurrent = pCurrent->pNext)
    {
        if ((pCurrent->wFlags & INPUT_LIST_NODE_FLAG_DELETED) ||
            (pCurrent->wFlags & INPUT_LIST_NODE_FLAG_EDITED))
        {
            if (UnloadKeyboardLayout(pCurrent->hkl))
            {
                /* Only unload the edited input method, but does not delete it from the list */
                if (!(pCurrent->wFlags & INPUT_LIST_NODE_FLAG_EDITED))
                {
                    InputList_RemoveNode(pCurrent);
                }
            }
        }
    }

    InputList_PrepareUserRegistry();

    /* Find default input method */
    for (pCurrent = _InputList; pCurrent != NULL; pCurrent = pCurrent->pNext)
    {
        if (pCurrent->wFlags & INPUT_LIST_NODE_FLAG_DEFAULT)
        {
            InputList_AddInputMethodToUserRegistry(1, pCurrent);
            break;
        }
    }

    if (SystemParametersInfoW(SPI_SETDEFAULTINPUTLANG,
                              0,
                              (LPVOID)((LPDWORD)&pCurrent->hkl),
                              0))
    {
        DWORD dwRecipients;

        dwRecipients = BSM_ALLCOMPONENTS;

        BroadcastSystemMessageW(BSF_POSTMESSAGE,
                                &dwRecipients,
                                WM_INPUTLANGCHANGEREQUEST,
                                0,
                                (LPARAM)pCurrent->hkl);
    }

    /* Add methods to registry */
    dwIndex = 2;

    for (pCurrent = _InputList; pCurrent != NULL; pCurrent = pCurrent->pNext)
    {
        if (pCurrent->wFlags & INPUT_LIST_NODE_FLAG_DEFAULT)
            continue;

        InputList_AddInputMethodToUserRegistry(dwIndex, pCurrent);

        dwIndex++;
    }
}