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.

158 lines
2.9 KiB

  1. /*++
  2. Copyright (c) 1998-2000 Microsoft Corporation
  3. Module Name :
  4. irtlmisc.h
  5. Abstract:
  6. Declares miscellaneous functions and classes in IisUtil.DLL
  7. Author:
  8. George V. Reilly (GeorgeRe) 06-Jan-1998
  9. Environment:
  10. Win32 - User Mode
  11. Project:
  12. Internet Information Server RunTime Library
  13. Revision History:
  14. --*/
  15. #ifndef __IRTLMISC_H__
  16. #define __IRTLMISC_H__
  17. #include <windows.h>
  18. //--------------------------------------------------------------------
  19. // These declarations are needed to export the template classes from
  20. // IisUtil.DLL and import them into other modules.
  21. #ifndef IRTL_DLLEXP
  22. # ifdef DLL_IMPLEMENTATION
  23. # define IRTL_DLLEXP __declspec(dllexport)
  24. # ifdef IMPLEMENTATION_EXPORT
  25. # define IRTL_EXPIMP
  26. # else
  27. # undef IRTL_EXPIMP
  28. # endif
  29. # elif defined LIB_IMPLEMENTATION
  30. # define IRTL_DLLEXP
  31. # define IRTL_EXPIMP extern
  32. # else
  33. # define IRTL_DLLEXP __declspec(dllimport)
  34. # define IRTL_EXPIMP extern
  35. # endif // !DLL_IMPLEMENTATION
  36. #endif // !IRTL_DLLEXP
  37. //--------------------------------------------------------------------
  38. // Miscellaneous functions
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif // __cplusplus
  42. // Heap routines
  43. // Private IIS heap
  44. HANDLE
  45. WINAPI
  46. IisHeap();
  47. // Allocate dwBytes
  48. LPVOID
  49. WINAPI
  50. IisMalloc(
  51. IN SIZE_T dwBytes);
  52. // Allocate dwBytes. Memory is zeroed
  53. LPVOID
  54. WINAPI
  55. IisCalloc(
  56. IN SIZE_T dwBytes);
  57. // Reallocate lpMem to dwBytes
  58. LPVOID
  59. WINAPI
  60. IisReAlloc(
  61. IN LPVOID lpMem,
  62. IN SIZE_T dwBytes);
  63. // Free lpMem
  64. BOOL
  65. WINAPI
  66. IisFree(
  67. IN LPVOID lpMem);
  68. // additional IISUtil initialization
  69. BOOL
  70. WINAPI
  71. InitializeIISUtil();
  72. // call before unloading IISUtil
  73. VOID
  74. WINAPI
  75. TerminateIISUtil();
  76. //
  77. // call only if using static library version of IISUtil
  78. // must be called in DllMain under PROCESS_ATTACH
  79. //
  80. BOOL
  81. WINAPI
  82. InitializeIISUtilProcessAttach();
  83. //
  84. // call only if using static library version of IISUtil
  85. // must be called in DllMain under PROCESS_DETACH
  86. //
  87. VOID
  88. WINAPI
  89. TerminateIISUtilProcessDetach();
  90. // case-insensitive strstr
  91. IRTL_DLLEXP const char* stristr(const char* pszString, const char* pszSubString);
  92. // how many CPUs on this machine?
  93. inline int NumProcessors()
  94. {
  95. static int s_nCPUs = 0;
  96. if (s_nCPUs == 0)
  97. {
  98. SYSTEM_INFO si;
  99. GetSystemInfo(&si);
  100. s_nCPUs = si.dwNumberOfProcessors;
  101. }
  102. return s_nCPUs;
  103. }
  104. // Type of processor, 386, 486, etc
  105. inline int ProcessorType()
  106. {
  107. static int s_nProcessorType = 0;
  108. if (s_nProcessorType == 0)
  109. {
  110. SYSTEM_INFO si;
  111. GetSystemInfo(&si);
  112. s_nProcessorType = si.dwProcessorType;
  113. }
  114. return s_nProcessorType;
  115. }
  116. #ifdef __cplusplus
  117. }
  118. #endif // __cplusplus
  119. #endif // __IRTLMISC_H__