Exemple #1
0
BOOL ReadImageGlobalFlagsFromRegistry( _In_z_ PCWSTR ImageName, _Out_ ULONG* Flag )
{
    HKEY hKey;
    WCHAR FullKey[260];
    if(!ImageName || !ImageName[0])
    {
        *Flag = 0;
        return TRUE;
    }
    StringCchPrintfW(FullKey, 260, IMAGE_FILE_OPTIONS, ImageName);
    if(EnableDebug())
    {
        LONG lRet = RegOpenKeyExW( HKEY_LOCAL_MACHINE, FullKey, 0, KEY_READ, &hKey );
        if( ERROR_SUCCESS == lRet )
        {
            AutoCloseReg raii(hKey);
            DWORD Type = 0, cbData = sizeof(*Flag);
            if( ERROR_SUCCESS == RegQueryValueExW( hKey, GLOBALFLAG_VALUENAME, NULL, &Type, (LPBYTE)Flag, &cbData ) && Type == REG_DWORD )
            {
                return TRUE;
            }
        }
        else if(ERROR_FILE_NOT_FOUND == lRet)
        {
            *Flag = 0;
            return TRUE;
        }
    }
    return FALSE;
}
Exemple #2
0
BOOL WriteGlobalFlagsToRegistry( _In_ DWORD Flag )
{
    HKEY hKey;
    if(EnableDebug() && ERROR_SUCCESS == RegOpenKeyExW( HKEY_LOCAL_MACHINE, GLOBALFLAG_REGKEY, 0, KEY_WRITE, &hKey ) )
    {
        AutoCloseReg raii(hKey);
        if( ERROR_SUCCESS == RegSetValueExW( hKey, GLOBALFLAG_VALUENAME, NULL, REG_DWORD, (LPBYTE)&Flag, sizeof(Flag) ) )
        {
            return TRUE;
        }
    }
    return FALSE;
}
Exemple #3
0
BOOL ReadGlobalFlagsFromRegistry( _Out_ DWORD* Flag )
{
    HKEY hKey;
    if(EnableDebug() && ERROR_SUCCESS == RegOpenKeyExW( HKEY_LOCAL_MACHINE, GLOBALFLAG_REGKEY, 0, KEY_READ, &hKey ) )
    {
        AutoCloseReg raii(hKey);
        DWORD Type = 0, cbData = sizeof(*Flag);
        if( ERROR_SUCCESS == RegQueryValueExW( hKey, GLOBALFLAG_VALUENAME, NULL, &Type, (LPBYTE)Flag, &cbData ) && Type == REG_DWORD )
        {
            return TRUE;
        }
    }
    return FALSE;
}
Exemple #4
0
BOOL WriteImageGlobalFlagsToRegistry( _In_z_ PCWSTR ImageName,_In_ ULONG Flag )
{
    HKEY hKey;
    WCHAR FullKey[260];
    StringCchPrintfW(FullKey, 260, IMAGE_FILE_OPTIONS, ImageName);
    DWORD dwDisposition = 0;
    if(EnableDebug() && ERROR_SUCCESS == RegCreateKeyExW( HKEY_LOCAL_MACHINE, FullKey, 0, 0, 0, KEY_WRITE, NULL, &hKey, &dwDisposition ))
    {
        AutoCloseReg raii(hKey);
        //dwDisposition == REG_CREATED_NEW_KEY || REG_OPENED_EXISTING_KEY;
        if( ERROR_SUCCESS == RegSetValueExW( hKey, GLOBALFLAG_VALUENAME, NULL, REG_DWORD, (LPBYTE)&Flag, sizeof(Flag) ) )
        {
            return TRUE;
        }
    }
    return FALSE;

}
Exemple #5
0
/****************************************************************************************
**  Constructors /  Destructor
****************************************************************************************/
LinxArduinoUno::LinxArduinoUno()
{
    //Arduino Family Code Set At Family Level, Device ID set to 0x00 for Uno
    DeviceID = 0x00;	//Uno
    DeviceNameLen = DEVICE_NAME_LEN;
    DeviceName =  m_DeviceName;

    //LINX API Version
    LinxApiMajor = 1;
    LinxApiMinor = 2;
    LinxApiSubminor = 0;

    //DIGITAL
    NumDigitalChans = NUM_DIGITAL_CHANS;
    DigitalChans = m_DigitalChans;

    //AI
    NumAiChans = NUM_AI_CHANS;
    AiChans = m_AiChans;
    AiResolution = AI_RES_BITS;
    AiRefSet = AI_REFV;

    AiRefDefault = AI_REFV;
    AiRefSet = AI_REFV;
    AiRefCodes = m_AiRefCodes;

    NumAiRefIntVals = NUM_AI_INT_REFS;
    AiRefIntVals = m_AiRefIntVals;

    AiRefExtMin = 0;
    AiRefExtMax = 5000000;

    //AO
    NumAoChans = 0;
    AoChans = 0;

    //PWM
    NumPwmChans = NUM_PWM_CHANS;
    PwmChans = m_PwmChans;

    //QE
    NumQeChans = 0;
    QeChans = 0;


    //UART
    NumUartChans = NUM_UART_CHANS;
    UartChans = m_UartChans;
    UartMaxBaud = m_UartSupportedSpeeds[NUM_UART_SPEEDS - 1];
    NumUartSpeeds = NUM_UART_SPEEDS;
    UartSupportedSpeeds = m_UartSupportedSpeeds;

    //I2C
    NumI2cChans = NUM_I2C_CHANS;
    I2cChans = m_I2cChans;
    I2cRefCount = m_I2cRefCount;

    //SPI
    NumSpiChans = NUM_SPI_CHANS;
    SpiChans = m_SpiChans;
    NumSpiSpeeds = NUM_SPI_SPEEDS;
    SpiSupportedSpeeds = m_SpiSupportedSpeeds;
    SpiSpeedCodes = m_SpiSpeedCodes;

    //CAN
    NumCanChans = 0;
    CanChans = 0;

    //SERVO
    NumServoChans = NUM_SERVO_CHANS;
    ServoChans = m_DigitalChans;
    Servos = m_Servos;

    //If Debuging Is Enabled Call EnableDebug()
#if DEBUG_ENABLED > 0
    EnableDebug(DEBUG_ENABLED);
#endif
}