Source code of Windows XP (NT5)
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.

112 lines
2.5 KiB

  1. /****************************************************************************/
  2. // Directory Integrity Service, header file
  3. //
  4. // Copyright (C) 2000, Microsoft Corporation
  5. /****************************************************************************/
  6. #include <windows.h>
  7. #include <shellapi.h>
  8. #include <stdio.h>
  9. #include <process.h>
  10. #include <sddl.h>
  11. #include <initguid.h>
  12. #include <ole2.h>
  13. #include <objbase.h>
  14. #include <comdef.h>
  15. #include <adoid.h>
  16. #include <adoint.h>
  17. #include <winsta.h>
  18. #include "trace.h"
  19. typedef enum _SERVER_STATUS {
  20. NotResponding,
  21. Responding
  22. } SERVER_STATUS;
  23. // Shortcut VARIANT class to handle cleanup on destruction and common code
  24. // inlining.
  25. class CVar : public VARIANT
  26. {
  27. public:
  28. CVar() { VariantInit(this); }
  29. CVar(VARTYPE vt, SCODE scode = 0) {
  30. VariantInit(this);
  31. this->vt = vt;
  32. this->scode = scode;
  33. }
  34. CVar(VARIANT var) { *this = var; }
  35. ~CVar() { VariantClear(this); }
  36. void InitNull() { this->vt = VT_NULL; }
  37. void InitFromLong(long L) { this->vt = VT_I4; this->lVal = L; }
  38. void InitNoParam() {
  39. this->vt = VT_ERROR;
  40. this->lVal = DISP_E_PARAMNOTFOUND;
  41. }
  42. HRESULT InitFromWSTR(PCWSTR WStr) {
  43. this->bstrVal = SysAllocString(WStr);
  44. if (this->bstrVal != NULL) {
  45. this->vt = VT_BSTR;
  46. return S_OK;
  47. }
  48. else {
  49. return E_OUTOFMEMORY;
  50. }
  51. }
  52. // Inits from a non-NULL-terminated set of WCHARs.
  53. HRESULT InitFromWChars(WCHAR *WChars, unsigned Len) {
  54. this->bstrVal = SysAllocStringLen(WChars, Len);
  55. if (this->bstrVal != NULL) {
  56. this->vt = VT_BSTR;
  57. return S_OK;
  58. }
  59. else {
  60. return E_OUTOFMEMORY;
  61. }
  62. }
  63. HRESULT InitEmptyBSTR(unsigned Size) {
  64. this->bstrVal = SysAllocStringLen(L"", Size);
  65. if (this->bstrVal != NULL) {
  66. this->vt = VT_BSTR;
  67. return S_OK;
  68. }
  69. else {
  70. return E_OUTOFMEMORY;
  71. }
  72. }
  73. HRESULT Clear() { return VariantClear(this); }
  74. };
  75. HRESULT CreateADOStoredProcCommand(
  76. PWSTR CmdName,
  77. ADOCommand **ppCommand,
  78. ADOParameters **ppParameters);
  79. HRESULT AddADOInputStringParam(
  80. PWSTR Param,
  81. PWSTR ParamName,
  82. ADOCommand *pCommand,
  83. ADOParameters *pParameters,
  84. BOOL bNullOnNull);
  85. HRESULT GetRowArrayStringField(
  86. SAFEARRAY *pSA,
  87. unsigned RowIndex,
  88. unsigned FieldIndex,
  89. WCHAR *OutStr,
  90. unsigned MaxOutStr);