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.

117 lines
2.8 KiB

  1. /*
  2. * REVISIONS:
  3. */
  4. #ifndef _INC__UTILS_H
  5. #define _INC__UTILS_H
  6. #include "cdefine.h"
  7. #include "apc.h"
  8. extern "C" {
  9. #include <sys/types.h>
  10. }
  11. #define LESS_THAN -1
  12. #define GREATER_THAN 1
  13. #define EQUAL 0
  14. char* getPwrchuteDirectory();
  15. //
  16. // By defining initial values to max values in the opposite
  17. // direction we are guarenteed the first value will reset
  18. // the max/min value
  19. //
  20. #if (C_OS & (C_OS2 | C_NT | C_NLM | C_UNIX))
  21. #ifndef MINFLOAT
  22. #define MINFLOAT ((float)3.4e-34)
  23. #endif
  24. #ifndef MAXFLOAT
  25. #define MAXFLOAT ((float)3.4e+34)
  26. #endif
  27. #endif
  28. #define INITIAL_MAX_VALUE MINFLOAT
  29. #define INITIAL_MIN_VALUE MAXFLOAT
  30. VOID UtilStoreString(PCHAR& destination, const PCHAR source);
  31. INT UtilHexStringToInt(PCHAR aString);
  32. INT UtilHexCharToInt(CHAR ch);
  33. INT UtilTime12to24(PCHAR a12Value, PCHAR a24Value);
  34. INT UtilDayToDayOfWeek(PCHAR aDay);
  35. PCHAR UtilDayOfWeekToDay(INT aDayOfWeek);
  36. INT Remove(PCHAR filename);
  37. PCHAR GetServerByAddress(PCHAR aServer);
  38. PCHAR GetIPByName(PCHAR aServer);
  39. INT IsIPAddress(CHAR *str);
  40. INT UtilCheckIniFilePath(PCHAR aPath, INT aCode, PCHAR aRoot);
  41. // @@@ start
  42. PCHAR GetNewUPSName(PCHAR currentName);
  43. INT APCLoadLibrary(PCHAR libraryName);
  44. INT APCLoadString(UINT rid,LPTSTR buffer, INT buffersize);
  45. CHAR * const GetResourceString(INT rid);
  46. BOOL APCFreeLibrary(void);
  47. INT SetTimeZone(void);
  48. // @@@ end
  49. INT ApcStrIntCmpI(PCHAR aStr1, PCHAR aStr2);
  50. BOOLEAN IsEmpty(PCHAR aString);
  51. #if(C_OS & (C_WIN311 | C_WINDOWS | C_NT | C_SUNOS4 | C_IRIX))
  52. // MAA, added because MSC def's max and min
  53. #ifndef max
  54. float max(float a, float b);
  55. #endif
  56. #ifndef min
  57. float min(float a, float b);
  58. #endif
  59. #endif
  60. #if (C_OS & C_UNIX)
  61. PCHAR itoa(INT, PCHAR, INT);
  62. PCHAR strupr(PCHAR);
  63. PCHAR ltoa(LONG,PCHAR,INT);
  64. PCHAR clip_string(INT,PCHAR,INT);
  65. ULONG MilliToMicro(ULONG);
  66. VOID Wait(ULONG);
  67. INT strcmpi (PCHAR cbuffer,PCHAR target);
  68. INT strnicmp (PCHAR cbuffer,PCHAR target,INT len);
  69. VOID FormatTimeStruct(ULONG milli_sec_timeout, struct timeval *tstruct);
  70. INT GetUnixHostName(PCHAR buffer,INT bufferSize);
  71. PCHAR clip_string(INT,PCHAR,INT);
  72. VOID System(char *exec_string ...);
  73. // The following in English means :-
  74. // if not AIX version 4
  75. // and not SOLARIS 2.x
  76. // and not HP-UX version 10
  77. // then define the abs macro.
  78. // poc25Jun96
  79. //
  80. #if (!((C_OS & C_AIX) && (C_AIX_VERSION & C_AIX4)) && !(C_OS & C_SOLARIS2) && !((C_OS & C_HPUX) && (C_HP_VERSION & C_HPUX10)))
  81. #define abs(x) ((x) >= 0 ? (x) : -(x))
  82. #endif
  83. #if !((C_OS & C_AIX) && (C_AIX_VERSION & C_AIX4))
  84. #ifndef max
  85. #define max(a, b) ((a) < (b) ? (b) : (a))
  86. #define min(a, b) ((a) > (b) ? (b) : (a))
  87. #endif
  88. #endif
  89. #endif
  90. int IsIPString(char *test_string);
  91. #if (C_OS & C_SUNOS4)
  92. #define FD_ZERO(p) memset((char *)(p), 0, sizeof (*(p)))
  93. #endif
  94. #endif