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.

95 lines
1.3 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. inifile.h
  5. Abstract:
  6. SIS Groveler initialization file interface headers
  7. Authors:
  8. John Douceur, 1998
  9. Environment:
  10. User Mode
  11. Revision History:
  12. --*/
  13. #ifndef _INC_INIFILE
  14. #define _INC_INIFILE
  15. #ifndef _DEF_ENTRY_INFO
  16. #define _DEF_ENTRY_INFO
  17. enum EntryType
  18. {
  19. entry_bool,
  20. entry_char,
  21. entry_int,
  22. entry_int64,
  23. entry_double
  24. };
  25. struct EntrySpec
  26. {
  27. const _TCHAR *identifier;
  28. EntryType type;
  29. const _TCHAR *default_value;
  30. void *pointer;
  31. };
  32. #endif /* _DEF_ENTRY_INFO */
  33. class IniFile
  34. {
  35. public:
  36. static bool read(
  37. const _TCHAR *filename,
  38. const _TCHAR *section,
  39. int num_entries,
  40. EntrySpec *entries);
  41. static bool overwrite(
  42. const _TCHAR *filename,
  43. const _TCHAR *section,
  44. int num_entries,
  45. EntrySpec *entries);
  46. static bool read_string_set(
  47. const _TCHAR *filename,
  48. const _TCHAR *section,
  49. int *num_strings,
  50. _TCHAR ***strings,
  51. _TCHAR **buffer);
  52. private:
  53. enum {id_buffer_length = 256};
  54. static void load_string_into_value(
  55. EntryType type,
  56. const _TCHAR *string,
  57. void *value);
  58. static void store_value_in_string(
  59. EntryType type,
  60. void *value,
  61. _TCHAR *string,
  62. int stringLen); //in bytes
  63. IniFile() {}
  64. ~IniFile() {}
  65. };
  66. #endif /* _INC_INIFILE */