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.7 KiB

  1. /*++
  2. Copyright (c) 97 Microsoft Corporation
  3. All rights reserved.
  4. Module Name:
  5. IniSection.h
  6. Abstract:
  7. Standard TCP/IP Port Monitor class to handle INI file settings
  8. Author:
  9. Muhunthan Sivapragasam (MuhuntS) 19-Nov-1997
  10. Revision History:
  11. --*/
  12. // INI file Key names and values
  13. #define RAW_PROTOCOL_TEXT TEXT("RAW")
  14. #define LPR_PROTOCOL_TEXT TEXT("LPR")
  15. #define YES_TEXT TEXT("YES")
  16. #define NO_TEXT TEXT("NO")
  17. #define PORT_SECTION TEXT("Ports")
  18. #define PORTS_KEY TEXT("PORTS")
  19. #define PORT_NAME_KEY TEXT("NAME")
  20. #define PORT_NAMEI_KEY TEXT("NAME%d")
  21. #define PROTOCOL_KEY TEXT("PROTOCOL%d")
  22. #define PORT_NUMBER_KEY TEXT("PORTNUMBER%d")
  23. #define COMMUNITY_KEY TEXT("COMMUNITYNAME%d")
  24. #define DEVICE_KEY TEXT("DEVICE%d")
  25. #define QUEUE_KEY TEXT("QUEUE%d")
  26. #define DOUBLESPOOL_KEY TEXT("LPRDSPOOL%d")
  27. #define PORT_STATUS_ENABLED_KEY TEXT("SNMP%d")
  28. class IniSection {
  29. public:
  30. IniSection();
  31. ~IniSection();
  32. BOOL GetString(LPTSTR pszKey, TCHAR szBuf[], DWORD cchBuf);
  33. BOOL GetDWord(LPTSTR pszKey, LPDWORD pdwValue);
  34. BOOL GetPortInfo(LPCTSTR pAddress, PPORT_DATA_1 pPortInfo, DWORD dwPortIndex, BOOL bBypassMibProbe);
  35. BOOL GetIniSection(LPTSTR pszPortDesc);
  36. BOOL SetIniSection(LPTSTR pszPortSection);
  37. LPTSTR GetSectionName() { return( (LPTSTR)m_szSectionName ); }
  38. private:
  39. TCHAR m_szSectionName[MAX_SECTION_NAME];
  40. TCHAR m_szIniFileName[MAX_PATH];
  41. BOOL SupportsPrinterMIB( LPCTSTR pAddress, PBOOL bSupported);
  42. BOOL FindINISectionFromPortDescription(LPCTSTR pszAnsiPortDesc);
  43. BOOL Valid() { return m_szSectionName[0] != 0 && m_szIniFileName[0] != 0; }
  44. };