Source code of Windows XP (NT5)
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.

203 lines
4.1 KiB

  1. /*************************************************************************
  2. *
  3. * syslib.h
  4. *
  5. * Header file for Terminal Server System Library routines.
  6. *
  7. Copyright Microsoft Corporation, 1998
  8. *
  9. *
  10. *************************************************************************/
  11. #ifndef _INC_CTXSYSLIB
  12. #define _INC_CTXSYSLIB
  13. //
  14. // Routines for dealing with WinStations
  15. //
  16. //
  17. // This function enumerates all WinStations in the system
  18. // calling the supplied function with the supplied argument.
  19. //
  20. typedef BOOLEAN (CALLBACK* WINSTATIONENUMPROC)(ULONG, PLOGONIDW, ULONG_PTR);
  21. BOOLEAN
  22. WinStationEnumeratorW(
  23. ULONG StartIndex,
  24. WINSTATIONENUMPROC pProc,
  25. ULONG_PTR lParam
  26. );
  27. //
  28. // Routines for dealing with users and WinStations
  29. //
  30. //
  31. // Get the WinStations User name
  32. //
  33. BOOL
  34. WinStationGetUserName(
  35. ULONG LogonId,
  36. PWCHAR pBuf,
  37. ULONG BufSize
  38. );
  39. //
  40. // Get the WinStations ICA name
  41. //
  42. #ifdef UNICODE
  43. #define WinStationGetICAName WinStationGetICANameW
  44. #else
  45. #define WinStationGetICAName WinStationGetICANameA
  46. #endif
  47. PWCHAR
  48. WinStationGetICANameW(
  49. ULONG LogonId
  50. );
  51. PCHAR
  52. WinStationGetICANameA(
  53. ULONG LogonId
  54. );
  55. //
  56. // Get the LogonId of the client currently being impersonated.
  57. // Returns 0 if error to default to console.
  58. //
  59. ULONG
  60. GetClientLogonId();
  61. //
  62. // Find which WinStation a given user name is logged into.
  63. //
  64. // NOTE: If a user is logged on multiple times, the FIRST
  65. // occurance is returned.
  66. //
  67. BOOL
  68. FindUsersWinStation(
  69. PWCHAR pName,
  70. PULONG pLogonId
  71. );
  72. //
  73. // Return whether the WinStation is hardwired
  74. //
  75. BOOLEAN
  76. WinStationIsHardWire(
  77. ULONG LogonId
  78. );
  79. //
  80. // Return the user token for the user logged on the WinStation
  81. //
  82. BOOL
  83. GetWinStationUserToken(
  84. ULONG LogonId,
  85. PHANDLE pUserToken
  86. );
  87. //
  88. // Routines to deal with NT Security
  89. //
  90. //
  91. // Return whether the calling thread has admin rights.
  92. //
  93. #if 0
  94. BOOL
  95. TestUserForAdmin( VOID );
  96. #endif
  97. //
  98. // Return whether the calling thread is a member of requested group.
  99. //
  100. BOOL
  101. TestUserForGroup( PWCHAR );
  102. //
  103. // Debugging routines for dumping security descriptors
  104. //
  105. #if DBG
  106. void
  107. DumpSecurityDescriptor(
  108. PSECURITY_DESCRIPTOR pSD
  109. );
  110. #endif
  111. //
  112. // Application compatibility flags
  113. //
  114. #define CITRIX_COMPAT_DOS 0x00000001
  115. #define CITRIX_COMPAT_OS2 0x00000002
  116. #define CITRIX_COMPAT_WIN16 0x00000004
  117. #define CITRIX_COMPAT_WIN32 0x00000008
  118. #define CITRIX_COMPAT_ALL 0x0000000F
  119. #define CITRIX_COMPAT_USERNAME 0x00000010 // return username for computername
  120. #define CITRIX_COMPAT_CTXBLDNUM 0x00000020 // return Citrix build number
  121. #define CITRIX_COMPAT_INISYNC 0x00000040 // sync user ini file to system
  122. #define CITRIX_COMPAT_ININOSUB 0x00000080 // Don't subst. user dir for sys dir
  123. #define CITRIX_COMPAT_NOREGMAP 0x00000100 // Disable registry mapping for app
  124. #define CITRIX_COMPAT_PEROBJMAP 0x00000200 // Per object user/system global mapping
  125. #define CITRIX_COMPAT_SYSWINDIR 0x00000400 // return system windows directory
  126. #define CITRIX_COMPAT_PHYSMEMLIM \
  127. 0x00000800 // Limit the reported physical memory info
  128. #define CITRIX_COMPAT_LOGOBJCREATE \
  129. 0x00001000 // Log object creation to file
  130. #define CITRIX_COMPAT_KBDPOLL_NOSLEEP \
  131. 0x20000000 // Don't put app to sleep on unsuccessful
  132. // keyboard polling (WIN16 only)
  133. //
  134. // Clipboard compatibility flags
  135. //
  136. #define CITRIX_COMPAT_CLIPBRD_METAFILE 0x00000008
  137. BOOL SetCtxAppCompatFlags(ULONG ulAppFlags);
  138. //
  139. // Create and set the user's temp directory
  140. //
  141. typedef struct {
  142. HANDLE UserToken;
  143. PSECURITY_DESCRIPTOR NewThreadTokenSD;
  144. } CTX_USER_DATA;
  145. typedef CTX_USER_DATA *PCTX_USER_DATA;
  146. BOOL
  147. CtxCreateTempDir(
  148. PWSTR pwcEnvVar,
  149. PWSTR pwcLogonID,
  150. PVOID *pEnv,
  151. PWSTR *ppTempName,
  152. PCTX_USER_DATA pUserData
  153. );
  154. //
  155. // Remove the directory and all files and subdirectories it contains
  156. //
  157. BOOL RemoveDir( PWCHAR dirname );
  158. //
  159. // User Impersonation
  160. //
  161. HANDLE
  162. CtxImpersonateUser(
  163. PCTX_USER_DATA UserData,
  164. HANDLE ThreadHandle
  165. );
  166. BOOL
  167. CtxStopImpersonating(
  168. HANDLE ThreadHandle
  169. );
  170. #endif /* !_INC_CTXSYSLIB */