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.

175 lines
8.3 KiB

  1. /**INC+**********************************************************************/
  2. /* Header: nutint.h */
  3. /* */
  4. /* Purpose: Utilities internal defintions - Windows NT specific */
  5. /* */
  6. /* Copyright(C) Microsoft Corporation 1997 */
  7. /* */
  8. /****************************************************************************/
  9. /** Changes:
  10. * $Log: Y:/logs/client/nutint.h_v $
  11. *
  12. * Rev 1.8 22 Sep 1997 14:47:04 KH
  13. * SFR1368: Keep the Win16 INI file in Windows, not Ducati, directory
  14. *
  15. * Rev 1.7 22 Aug 1997 10:22:34 SJ
  16. * SFR1316: Trace options in wrong place in the registry.
  17. *
  18. * Rev 1.6 01 Aug 1997 17:33:02 KH
  19. * SFR1137: Dynamically allocate the bitmap cache
  20. *
  21. * Rev 1.5 09 Jul 1997 17:35:08 AK
  22. * SFR1016: Initial changes to support Unicode
  23. *
  24. * Rev 1.4 04 Jul 1997 10:59:02 AK
  25. * SFR0000: Initial development completed
  26. *
  27. * Rev 1.3 04 Jul 1997 10:50:42 KH
  28. * SFR1022: Fix 16-bit compiler warnings
  29. *
  30. * Rev 1.1 25 Jun 1997 13:35:54 KH
  31. * Win16Port: 32-bit utilities header
  32. **/
  33. /**INC-**********************************************************************/
  34. #ifndef _H_NUTINT
  35. #define _H_NUTINT
  36. /****************************************************************************/
  37. /* */
  38. /* FUNCTION PROTOTYPES */
  39. /* */
  40. /****************************************************************************/
  41. DCVOID DCINTERNAL UTGetCurrentDate(PDC_DATE pDate);
  42. DCBOOL DCINTERNAL UTStartThread(UTTHREAD_PROC entryFunction,
  43. PUT_THREAD_DATA pThreadID,
  44. PDCVOID threadParam);
  45. //
  46. // static member needs access so make threadentry public
  47. //
  48. static DCUINT WINAPI UTStaticThreadEntry(UT_THREAD_INFO * pInfo);
  49. DCBOOL DCINTERNAL UTStopThread(UT_THREAD_DATA threadID, BOOL fPumpMessages);
  50. /****************************************************************************/
  51. /* */
  52. /* CONSTANTS */
  53. /* */
  54. /****************************************************************************/
  55. /****************************************************************************/
  56. /* Timeout in milliseconds when waiting for thread to terminate. */
  57. /****************************************************************************/
  58. #define UT_THREAD_TIMEOUT (30*60000) //thirty minutes
  59. /****************************************************************************/
  60. /* */
  61. /* MACROS */
  62. /* */
  63. /****************************************************************************/
  64. /****************************************************************************/
  65. /* */
  66. /* INLINE FUNCTIONS */
  67. /* */
  68. /****************************************************************************/
  69. #if !defined(OS_WINCE)
  70. __inline DCVOID DCINTERNAL UtMakeSubKey(PDCTCHAR pBuffer,
  71. UINT cchBuffer,
  72. PDCTCHAR pSubkey)
  73. {
  74. DWORD i;
  75. HRESULT hr;
  76. hr = StringCchPrintf(pBuffer,
  77. cchBuffer,
  78. DUCATI_REG_PREFIX_FMT,
  79. pSubkey);
  80. i = DC_TSTRLEN(pBuffer);
  81. if (i > 0 && pBuffer[i-1] == _T('\\')) {
  82. pBuffer[i-1] = _T('\0');
  83. }
  84. }
  85. #endif // !defined(OS_WINCE)
  86. /**PROC+*********************************************************************/
  87. /* Name: UTMalloc */
  88. /* */
  89. /* Purpose: Attempts to dynamically allocate memory of a given size. */
  90. /* */
  91. /* Returns: pointer to allocated memory, or NULL if the function fails. */
  92. /* */
  93. /* Params: length - length in bytes of the memory to allocate. */
  94. /* */
  95. /**PROC-*********************************************************************/
  96. __inline PDCVOID DCINTERNAL UTMalloc(DCUINT length)
  97. {
  98. return((PDCVOID)LocalAlloc(LMEM_FIXED, length));
  99. }
  100. /**PROC+*********************************************************************/
  101. /* Name: UTMallocHuge */
  102. /* */
  103. /* Purpose: Same as UTMalloc for Win32. */
  104. /* */
  105. /* Returns: pointer to allocated memory, or NULL if the function fails. */
  106. /* */
  107. /* Params: length - length in bytes of the memory to allocate. */
  108. /* */
  109. /**PROC-*********************************************************************/
  110. __inline HPDCVOID DCINTERNAL UTMallocHuge(DCUINT32 length)
  111. {
  112. return(UTMalloc(length));
  113. }
  114. /**PROC+*********************************************************************/
  115. /* Name: UTFree */
  116. /* */
  117. /* Purpose: Frees dynamically allocated memory obtained using UT_Malloc */
  118. /* */
  119. /* Returns: Nothing */
  120. /* */
  121. /* Params: pMemory - pointer to memory to free */
  122. /* */
  123. /**PROC-*********************************************************************/
  124. __inline DCVOID DCAPI UTFree(PDCVOID pMemory)
  125. {
  126. LocalFree((HLOCAL)pMemory);
  127. return;
  128. }
  129. #if defined(OS_WINCE)
  130. /**PROC+*********************************************************************/
  131. /* Name: UT_MAKE_SUBKEY */
  132. /* */
  133. /* Purpose: Make registry subkey for WinCE. */
  134. /* WinCE doesn't handle '\\' at end of key string. */
  135. /* */
  136. /* Returns: Nothing */
  137. /* */
  138. /* Params: pBuffer - pointer to output buffer */
  139. /* pSubkey - pointer to subkey buffer */
  140. /* */
  141. /**PROC-*********************************************************************/
  142. __inline DCVOID DCINTERNAL UT_MAKE_SUBKEY(PDCTCHAR pBuffer, PDCTCHAR pSubkey)
  143. {
  144. DWORD i;
  145. DC_TSTRCPY(pBuffer, DUCATI_REG_PREFIX);
  146. DC_TSTRCAT(pBuffer, pSubkey);
  147. i = DC_TSTRLEN(pBuffer);
  148. if (i > 0 && pBuffer[i-1] == _T('\\')) {
  149. pBuffer[i-1] = _T('\0');
  150. }
  151. }
  152. #endif // !defined(OS_WINCE)
  153. #endif /* _H_NUTINT */