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.

68 lines
1.5 KiB

  1. // ADM_addServiceAccount.h : Declaration of the CADM_addServiceAccount
  2. #pragma once
  3. // ADM_addServiceAccount.h : Declaration of the ADM_addServiceAccount class
  4. #ifndef __ADM_addServiceAccount_H_
  5. #define __ADM_addServiceAccount_H_
  6. class ADM_addServiceAccountAccessor
  7. {
  8. public:
  9. LONG m_RETURNVALUE;
  10. TCHAR m_accountName[129];
  11. CComBSTR m_connectionString;
  12. BEGIN_PARAM_MAP(ADM_addServiceAccountAccessor)
  13. SET_PARAM_TYPE(DBPARAMIO_OUTPUT)
  14. COLUMN_ENTRY(1, m_RETURNVALUE)
  15. SET_PARAM_TYPE(DBPARAMIO_INPUT)
  16. COLUMN_ENTRY(2, m_accountName)
  17. END_PARAM_MAP()
  18. DEFINE_COMMAND(ADM_addServiceAccountAccessor, _T("{ ? = CALL dbo.ADM_addServiceAccount;1 (?) }"))
  19. // You may wish to call this function if you are inserting a record and wish to
  20. // initialize all the fields, if you are not going to explicitly set all of them.
  21. void ClearRecord()
  22. {
  23. memset(this, 0, sizeof(*this));
  24. }
  25. };
  26. class ADM_addServiceAccount : public CCommand<CAccessor<ADM_addServiceAccountAccessor> >
  27. {
  28. public:
  29. HRESULT Open()
  30. {
  31. HRESULT hr;
  32. hr = OpenDataSource();
  33. if( FAILED(hr) )
  34. return hr;
  35. return OpenRowset();
  36. }
  37. HRESULT OpenDataSource()
  38. {
  39. HRESULT hr;
  40. CDataSource db;
  41. hr = db.OpenFromInitializationString( m_connectionString );
  42. if( FAILED(hr) )
  43. return hr;
  44. return m_session.Open(db);
  45. }
  46. HRESULT OpenRowset()
  47. {
  48. return CCommand<CAccessor<ADM_addServiceAccountAccessor> >::Open(m_session);
  49. }
  50. CSession m_session;
  51. };
  52. #endif // __ADM_addServiceAccount_H_