// -------------------------------------------------------------------------- // ========================================================================== // File: TDDDeviceIdentifier.CPP // Authors: BCB_Code_Generator v2.00, // Darren Dwyer (source code, documentation, demos, website), // Hugh Edwards (documentation, icons) // Description: This file contains the code for the TDDDeviceIdentifier // Component // // "TDx_Draw_Library v1.80" // (c) 2006 BCB-Tools.com Pty. Ltd., Sydney, Australia. // All Rights Reserved. // // Refer to the 'Licence.Txt' file for licencing & copyright information. // ========================================================================== // -------------------------------------------------------------------------- // #includes ... // -------------------------------------------------------------------------- #include #pragma hdrstop // -------------------------------------------------------------------------- #include "TDDDeviceIdentifier.H" // -------------------------------------------------------------------------- #pragma link "TDx_Library_Defns" #pragma link "TDx_Library_Functions" #pragma link "TDx_Draw_Library_Defns" #pragma link "TDx_Draw_Library_Functions" // -------------------------------------------------------------------------- // Object Registration... // -------------------------------------------------------------------------- #if (__BORLANDC__ >= 0x0530) // BCB Version 3+ #pragma package(smart_init) #endif // -------------------------------------------------------------------------- static inline void ValidCtrCheck(TDDDeviceIdentifier*) { new TDDDeviceIdentifier(NULL); } // -------------------------------------------------------------------------- namespace Tdddeviceidentifier { #if (__BORLANDC__ >= 0x0530) // BCB Version 3+ void __fastcall PACKAGE Register() #else void __fastcall Register() #endif { TComponentClass classes[1] = {__classid(TDDDeviceIdentifier)}; RegisterComponents("TDx_Draw", classes, 0); } } // -------------------------------------------------------------------------- // Constructor: TDDDeviceIdentifier::TDDDeviceIdentifier() // Description: The default constructor for the TDDDeviceIdentifier (Wrapper) object. // -------------------------------------------------------------------------- __fastcall TDDDeviceIdentifier::TDDDeviceIdentifier(TComponent* Owner) : TComponent(Owner) { Clear(); } // -------------------------------------------------------------------------- // Destructor: TDDDeviceIdentifier::~TDDDeviceIdentifier() // Description: The destructor for the TDDDeviceIdentifier(Wrapper) object. // -------------------------------------------------------------------------- __fastcall TDDDeviceIdentifier::~TDDDeviceIdentifier() { } // -------------------------------------------------------------------------- // Property: Description // Description: The Driver property defines the manufacturers driver // description. // This description should not be used to uniquely identify a // particular driver. // -------------------------------------------------------------------------- AnsiString __fastcall TDDDeviceIdentifier::FGetDescription() { AnsiString tempDescription = fDDDEVICEIDENTIFIER2.szDescription; return tempDescription; } // -------------------------------------------------------------------------- void __fastcall TDDDeviceIdentifier::FSetDescription( AnsiString pDescription ) { int max = pDescription.Length(); if (max>MAX_DDDEVICEID_STRING) max = MAX_DDDEVICEID_STRING; CopyMemory( &fDDDEVICEIDENTIFIER2.szDescription[0], pDescription.c_str(), max ); } // -------------------------------------------------------------------------- // Property: DeviceId // Description: The DeviceId property defines the chipset type identifier. // This property may be 0 if the chipset type's ID is unknown. // -------------------------------------------------------------------------- dword __fastcall TDDDeviceIdentifier::FGetDeviceId() { return fDDDEVICEIDENTIFIER2.dwDeviceId; } // -------------------------------------------------------------------------- void __fastcall TDDDeviceIdentifier::FSetDeviceId( dword pDeviceId ) { fDDDEVICEIDENTIFIER2.dwDeviceId = pDeviceId; } // -------------------------------------------------------------------------- // Property: DeviceIdentifier // Description: The DeviceIdentifier property defines the GUID of the driver // chipset pair. // This GUID is the most reliable way of identifying a // problematic driver. // This GUID can also be used to track driver/chipset changes // for the purpose of reprofiling the graphics subsystem. // -------------------------------------------------------------------------- GUID __fastcall TDDDeviceIdentifier::FGetDeviceIdentifier() { return fDDDEVICEIDENTIFIER2.guidDeviceIdentifier; } // -------------------------------------------------------------------------- void __fastcall TDDDeviceIdentifier::FSetDeviceIdentifier( GUID pDeviceIdentifier ) { fDDDEVICEIDENTIFIER2.guidDeviceIdentifier = pDeviceIdentifier; } // -------------------------------------------------------------------------- // Property: Driver // Description: The Driver property defines the name given to the driver by // the manufacturer. // This name should not be used to uniquely identify a // particular driver. // -------------------------------------------------------------------------- AnsiString __fastcall TDDDeviceIdentifier::FGetDriver() { AnsiString tempDriver = fDDDEVICEIDENTIFIER2.szDriver; return tempDriver; } // -------------------------------------------------------------------------- void __fastcall TDDDeviceIdentifier::FSetDriver( AnsiString pDriver ) { int max = pDriver.Length(); if (max>MAX_DDDEVICEID_STRING) max = MAX_DDDEVICEID_STRING; CopyMemory( &fDDDEVICEIDENTIFIER2.szDriver[0], pDriver.c_str(), max ); } // -------------------------------------------------------------------------- // Property: DriverVersion // Description: The DriverVersion property defines the driver's version // numbers. // Less than or greater than comparisons can legally be made on // the whole 64 bits, but care should be taken when trying to // use this property to identify problematic drivers. // TDDDeviceIdentifier::DeviceGUID is much better suited to this // purpose. // The version numbers contained by this property are in the // following format : // Product = HIWORD(liDriverVersion.HighPart) // Version = LOWORD(liDriverVersion.HighPart) // SubVersion = HIWORD(liDriverVersion.LowPart) // Build = LOWORD(liDriverVersion.LowPart) // -------------------------------------------------------------------------- large_int __fastcall TDDDeviceIdentifier::FGetDriverVersion() { return fDDDEVICEIDENTIFIER2.liDriverVersion; } // -------------------------------------------------------------------------- void __fastcall TDDDeviceIdentifier::FSetDriverVersion( large_int pDriverVersion ) { fDDDEVICEIDENTIFIER2.liDriverVersion = pDriverVersion; } // -------------------------------------------------------------------------- // Property: ErrorValue // Description: The ErrorValue property contains the last error value // returned from a call to a TDDDeviceIdentifier method or // fget/fset. eg. DD_OK or DDERR_SURFACELOST or TDX_ERROR // -------------------------------------------------------------------------- HRESULT __fastcall TDDDeviceIdentifier::FGetErrorValue() { return fErrorValue; } // -------------------------------------------------------------------------- void __fastcall TDDDeviceIdentifier::FSetErrorValue( HRESULT pErrorValue ) { fErrorValue = pErrorValue; } // -------------------------------------------------------------------------- // Property: Revision // Description: The Revision property defines the revision identifier of the // device's chipset. // This property may be 0 if the revision ID is unknown. // -------------------------------------------------------------------------- dword __fastcall TDDDeviceIdentifier::FGetRevision() { return fDDDEVICEIDENTIFIER2.dwRevision; } // -------------------------------------------------------------------------- void __fastcall TDDDeviceIdentifier::FSetRevision( dword pRevision ) { fDDDEVICEIDENTIFIER2.dwRevision = pRevision; } // -------------------------------------------------------------------------- // Property: Size // Description: The Size property contains the size in bytes of the internal // DDDEVICEIDENTIFIER2 structure. // -------------------------------------------------------------------------- dword __fastcall TDDDeviceIdentifier::FGetSize() { return fSize; } // -------------------------------------------------------------------------- void __fastcall TDDDeviceIdentifier::FSetSize( dword pSize ) { fSize = pSize; } // -------------------------------------------------------------------------- // Property: SubSysId // Description: The SubSysId property defines the subsystem identifier, often // the identifier for the particuar board. // This property may be 0 if the subsystem ID is unknown. // -------------------------------------------------------------------------- dword __fastcall TDDDeviceIdentifier::FGetSubSysId() { return fDDDEVICEIDENTIFIER2.dwSubSysId; } // -------------------------------------------------------------------------- void __fastcall TDDDeviceIdentifier::FSetSubSysId( dword pSubSysId ) { fDDDEVICEIDENTIFIER2.dwSubSysId = pSubSysId; } // -------------------------------------------------------------------------- // Property: VendorId // Description: The VendorId property defines the device manufacturer's // identifier. // This property may be 0 if the manufacturer's ID is unknown. // -------------------------------------------------------------------------- dword __fastcall TDDDeviceIdentifier::FGetVendorId() { return fDDDEVICEIDENTIFIER2.dwVendorId; } // -------------------------------------------------------------------------- void __fastcall TDDDeviceIdentifier::FSetVendorId( dword pVendorId ) { fDDDEVICEIDENTIFIER2.dwVendorId = pVendorId; } // -------------------------------------------------------------------------- // Property: WHQLLevel // Description: The WHQLLevel property defines the Windows Hardware Quality // Lab (WHQL) certification level that applies for the // particular device driver pair. // -------------------------------------------------------------------------- dword __fastcall TDDDeviceIdentifier::FGetWHQLLevel() { return fDDDEVICEIDENTIFIER2.dwWHQLLevel; } // -------------------------------------------------------------------------- void __fastcall TDDDeviceIdentifier::FSetWHQLLevel( dword pWHQLLevel ) { fDDDEVICEIDENTIFIER2.dwWHQLLevel = pWHQLLevel; } // -------------------------------------------------------------------------- // Method: Clear() // Description: The Clear() method can be used to clear the contents of the // TDDDeviceIdentifier's internal DDDEVICEIDENTIFIER2 structure. // Note: if you have manually linked a structure member to a // chunk of memory, make sure you release this memory before // calling Clear(). // -------------------------------------------------------------------------- void __fastcall TDDDeviceIdentifier::Clear() { fDDDEVICEIDENTIFIER2.dwDeviceId = 0; ZeroMemory(&fDeviceIdentifier,sizeof(_GUID)); fErrorValue = DD_OK; fDDDEVICEIDENTIFIER2.dwRevision = 0; fSize = sizeof(DDDEVICEIDENTIFIER2); fDDDEVICEIDENTIFIER2.dwSubSysId = 0; fDDDEVICEIDENTIFIER2.dwVendorId = 0; fDDDEVICEIDENTIFIER2.dwWHQLLevel = 0; } // -------------------------------------------------------------------------- // Internal Structure Access // -------------------------------------------------------------------------- DDDEVICEIDENTIFIER2* __fastcall TDDDeviceIdentifier::FGetInternal_DDDEVICEIDENTIFIER2_Ptr() { return &fDDDEVICEIDENTIFIER2; } // -------------------------------------------------------------------------- void __fastcall TDDDeviceIdentifier::FSetInternal_DDDEVICEIDENTIFIER2( DDDEVICEIDENTIFIER2* pDDDEVICEIDENTIFIER2 ) { if (pDDDEVICEIDENTIFIER2==NULL) { fErrorValue = TDX_ERROR; if (FOnError) FOnError(this, "TDDDeviceIdentifier::FSetInternal_DDDEVICEIDENTIFIER2()", "TDX_ERROR", "The supplied DDDEVICEIDENTIFIER2* was NULL" ); return; } CopyMemory( &fDDDEVICEIDENTIFIER2, pDDDEVICEIDENTIFIER2, sizeof(DDDEVICEIDENTIFIER2) ); Internal_DDDEVICEIDENTIFIER2_Update(); } // -------------------------------------------------------------------------- void __fastcall TDDDeviceIdentifier::Internal_DDDEVICEIDENTIFIER2_Update() { } // --------------------------------------------------------------------------