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.

65 lines
1.1 KiB

  1. #ifndef __CMD_INFO__
  2. #define __CMD_INFO__
  3. // defines the argument list for a command
  4. class CCmdInfo
  5. {
  6. public:
  7. // defines a "TAG = value" pair
  8. struct CArgList
  9. {
  10. char szTag[64];
  11. char *szVal;
  12. CArgList *pNext;
  13. CArgList()
  14. {
  15. pNext = NULL;
  16. szVal = NULL;
  17. //ZeroMemory(szVal, sizeof(szVal));
  18. ZeroMemory(szTag, sizeof(szTag));
  19. };
  20. LPSTR SetVal(LPSTR pszSrc, unsigned nSize)
  21. {
  22. if(NULL != szVal)
  23. delete [] szVal;
  24. szVal = new char[nSize + 1];
  25. if(NULL != szVal)
  26. {
  27. CopyMemory(szVal, pszSrc, nSize);
  28. szVal[nSize] = 0;
  29. }
  30. return szVal;
  31. }
  32. ~CArgList()
  33. {
  34. if(NULL != szVal)
  35. delete [] szVal;
  36. }
  37. };
  38. int nArgNo;
  39. CArgList *pArgs;
  40. char szCmdKey[64];
  41. char szDefTag[64];
  42. CArgList *pSearchPos;
  43. char szSearchTag[64];
  44. CCmdInfo(LPSTR szCmd);
  45. ~CCmdInfo();
  46. public:
  47. void SetDefTag(LPSTR szTag);
  48. HRESULT GetValue(LPSTR szTag, LPSTR szVal);
  49. HRESULT AllocValue(LPSTR szTag, LPSTR* szVal);
  50. private:
  51. HRESULT ParseLine(LPSTR szCmd, CCmdInfo *pCmd);
  52. HRESULT StringToHRES(LPSTR szVal, HRESULT *phrRes);
  53. };
  54. #endif