Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.7 KiB

  1. // net_config_get.h : Declaration of the net_config_get class
  2. #ifndef __NET_CONFIG_GET_H_
  3. #define __NET_CONFIG_GET_H_
  4. class net_config_getAccessor
  5. {
  6. public:
  7. TCHAR m_configName[257];
  8. TCHAR m_configValue[8001];
  9. DBSTATUS m_dwconfigNameStatus;
  10. DBSTATUS m_dwconfigValueStatus;
  11. DBLENGTH m_dwconfigNameLength;
  12. DBLENGTH m_dwconfigValueLength;
  13. CComBSTR m_connectionString;
  14. LONG m_RETURN_VALUE;
  15. BEGIN_COLUMN_MAP(net_config_getAccessor)
  16. COLUMN_ENTRY_LENGTH_STATUS(1, m_configName, m_dwconfigNameLength, m_dwconfigNameStatus)
  17. COLUMN_ENTRY_LENGTH_STATUS(2, m_configValue, m_dwconfigValueLength, m_dwconfigValueStatus)
  18. END_COLUMN_MAP()
  19. BEGIN_PARAM_MAP(net_config_getAccessor)
  20. SET_PARAM_TYPE(DBPARAMIO_OUTPUT)
  21. COLUMN_ENTRY(1, m_RETURN_VALUE)
  22. END_PARAM_MAP()
  23. DEFINE_COMMAND(net_config_getAccessor, _T("{ ? = CALL dbo.net_config_get }"))
  24. // You may wish to call this function if you are inserting a record and wish to
  25. // initialize all the fields, if you are not going to explicitly set all of them.
  26. void ClearRecord()
  27. {
  28. memset(this, 0, sizeof(*this));
  29. }
  30. };
  31. class net_config_get : public CCommand<CAccessor<net_config_getAccessor>, CRowset, CMultipleResults >
  32. {
  33. public:
  34. HRESULT Open()
  35. {
  36. HRESULT hr;
  37. m_configName[ 0 ] = 0x00;
  38. m_configValue[ 0 ] = 0x00;
  39. hr = OpenDataSource();
  40. if( FAILED(hr) )
  41. return hr;
  42. return OpenRowset();
  43. }
  44. HRESULT OpenDataSource()
  45. {
  46. HRESULT hr;
  47. CDataSource db;
  48. hr = db.OpenFromInitializationString( m_connectionString );
  49. if( FAILED(hr) )
  50. return hr;
  51. return m_session.Open(db);
  52. }
  53. HRESULT OpenRowset()
  54. {
  55. return __super::Open(m_session, NULL, NULL, 0, DBGUID_DBSQL, false);
  56. }
  57. CSession m_session;
  58. };
  59. #endif // __NET_CONFIG_GET_H_