QVariant tNDP2kVirtualDeviceInfoParam::GetValueForNDP2k(const unsigned short paramID, const unsigned char destAddress, const unsigned char paramInstance) 
{ 
    Q_UNUSED(paramID);
    Q_UNUSED(destAddress);
    Q_UNUSED(paramInstance);

    QVariant value;

    switch(m_VirtualDeviceInfoParamType)
    {
        case eVirtualDeviceInfoParamType_ProductId :
            value = GetProductId();
            break;

        case eVirtualDeviceInfoParamType_SerialNumber :
            value = GetSerialNumber();
            break;

        case eVirtualDeviceInfoParamType_DeviceInstance :
            value = GetDeviceInstance();
            break;

        case eVirtualDeviceInfoParamType_SystemInstance :
            value = GetSysInstance();
            break;

        default :
            Assert(0);
            break;

    }

    return value;
}
示例#2
0
文件: coinst.c 项目: pauldu/win-xen
static FORCEINLINE HRESULT
__DifRemovePreProcess(
    IN  HDEVINFO                    DeviceInfoSet,
    IN  PSP_DEVINFO_DATA            DeviceInfoData,
    IN  PCOINSTALLER_CONTEXT_DATA   Context
    )
{
    PTCHAR                          DeviceInstance;
    PTCHAR                          ActiveDeviceInstance;
    BOOLEAN                         Success;
    HRESULT                         Error;

    UNREFERENCED_PARAMETER(Context);

    Log("====>");

    DeviceInstance = GetDeviceInstance(DeviceInfoSet, DeviceInfoData);
    if (DeviceInstance == NULL)
        goto fail1;

    Success = GetActiveDeviceInstance(&ActiveDeviceInstance);
    if (!Success)
        goto fail2;

    if (ActiveDeviceInstance != NULL) {
        if (strcmp(DeviceInstance, ActiveDeviceInstance) == 0)
            (VOID) ClearActiveDeviceInstance();

        free(ActiveDeviceInstance);
    }

    free(DeviceInstance);

    Log("<====");

    return ERROR_DI_POSTPROCESSING_REQUIRED; 

fail2:
    Log("fail2");

    free(DeviceInstance);

fail1:
    Error = GetLastError();

    {
        PTCHAR  Message;

        Message = GetErrorMessage(Error);
        Log("fail1 (%s)", Message);
        LocalFree(Message);
    }

    return Error;
}
示例#3
0
文件: coinst.c 项目: pauldu/win-xen
static FORCEINLINE HRESULT
__DifInstallPostProcess(
    IN  HDEVINFO                    DeviceInfoSet,
    IN  PSP_DEVINFO_DATA            DeviceInfoData,
    IN  PCOINSTALLER_CONTEXT_DATA   Context
    )
{
    HRESULT                         Error;
    PTCHAR                          DeviceInstance;
    PTCHAR                          ActiveDeviceInstance;
    DWORD                           DeviceId;
    BOOLEAN                         Active;
    BOOLEAN                         Success;

    Log("====>");

    Error = Context->InstallResult;
    if (Error != NO_ERROR) {
        SetLastError(Error);
        goto fail1;
    }

    DeviceInstance = GetDeviceInstance(DeviceInfoSet, DeviceInfoData);
    if (DeviceInstance == NULL)
        goto fail2;

    ActiveDeviceInstance = NULL;

    Success = GetActiveDeviceInstance(&ActiveDeviceInstance);
    if (!Success)
        goto fail3;

    if (sscanf_s(DeviceInstance,
                 "PCI\\VEN_5853&DEV_%x",
                 &DeviceId) != 1) {
        SetLastError(ERROR_BAD_FORMAT);
        goto fail4;
    }

    Active = (ActiveDeviceInstance != NULL &&
              strcmp(DeviceInstance, ActiveDeviceInstance) == 0) ?
             TRUE :
             FALSE;

    Success = SetFriendlyName(DeviceInfoSet,
                              DeviceInfoData,
                              (WORD)DeviceId,
                              Active);
    if (!Success)
        goto fail5;

    if (ActiveDeviceInstance != NULL)
        free(ActiveDeviceInstance);

    free(DeviceInstance);

    Log("<====");

    return NO_ERROR;

fail5:
    Log("fail5");

fail4:
    Log("fail4");

    if (ActiveDeviceInstance != NULL)
        free(ActiveDeviceInstance);

fail3:
    Log("fail3");

    free(DeviceInstance);

fail2:
    Log("fail2");

fail1:
    Error = GetLastError();

    {
        PTCHAR  Message;

        Message = GetErrorMessage(Error);
        Log("fail1 (%s)", Message);
        LocalFree(Message);
    }

    return Error;
}
示例#4
0
文件: coinst.c 项目: pauldu/win-xen
static FORCEINLINE HRESULT
__DifInstallPreProcess(
    IN  HDEVINFO                    DeviceInfoSet,
    IN  PSP_DEVINFO_DATA            DeviceInfoData,
    IN  PCOINSTALLER_CONTEXT_DATA   Context
    )
{
    BOOLEAN                         Success;
    PTCHAR                          DeviceInstance;
    PTCHAR                          ActiveDeviceInstance;
    HRESULT                         Error;

    UNREFERENCED_PARAMETER(Context);

    Log("====>");

    Success = AllowInstall();
    if (!Success)
        goto fail1;

    DeviceInstance = GetDeviceInstance(DeviceInfoSet, DeviceInfoData);
    if (DeviceInstance == NULL)
        goto fail2;

    ActiveDeviceInstance = NULL;

    Success = GetActiveDeviceInstance(&ActiveDeviceInstance);
    if (!Success)
        goto fail3;

    if (ActiveDeviceInstance == NULL) {
        Success = SetActiveDeviceInstance(DeviceInstance);
        if (!Success)
            goto fail4;
    } else {
        free(ActiveDeviceInstance);
    }

    free(DeviceInstance);

    Log("<====");
    
    return ERROR_DI_POSTPROCESSING_REQUIRED;

fail4:
    Log("fail4");

    free(ActiveDeviceInstance);

fail3:
    Log("fail3");

    free(DeviceInstance);

fail2:
    Log("fail2");

fail1:
    Error = GetLastError();

    {
        PTCHAR  Message;

        Message = GetErrorMessage(Error);
        Log("fail1 (%s)", Message);
        LocalFree(Message);
    }

    return Error;
}