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.

297 lines
10 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. tsappcmp.h
  5. Abstract:
  6. Terminal server application compatibility support
  7. Author:
  8. Revision History:
  9. --*/
  10. #ifndef _INC_TSAPPCMP
  11. #define _INC_TSAPPCMP
  12. // @@BEGIN_DDKSPLIT
  13. #define TERMSRV_VALUE \
  14. L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Terminal Server\\Compatibility\\Registry Values"
  15. #define TERMSRV_INSTALL \
  16. L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Terminal Server\\Install"
  17. #define TERMSRV_USERREGISTRY \
  18. L"\\Registry\\User"
  19. #define TERMSRV_MACHINEREGISTRY \
  20. L"\\Registry\\Machine"
  21. #define TERMSRV_CLASSES \
  22. L"\\Registry\\Machine\\Software\\Classes"
  23. #define TERMSRV_INSTALLCLASSES \
  24. L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Terminal Server\\Install\\Software\\Classes"
  25. #define TERMSRV_CLASSES_SIZE sizeof(WCHAR)*(sizeof(TERMSRV_INSTALLCLASSES)+1)
  26. #define TERMSRV_SOFTWARECLASSES \
  27. L"\\Software\\Classes"
  28. #define TERMSRV_COPYONCEFLAG \
  29. L"TermSrvCopyKeyOnce"
  30. //
  31. // Compat flags for the register command, used for import table patching at run time.
  32. //
  33. #define TERMSRV_COMPAT_DONT_PATCH_IN_LOAD_LIBS 0x00000001 // turn off the new Whistler defaul behavior which patches all
  34. // load libs to go thru our redirected load lib first.
  35. //
  36. // The images marked as GLOBAL would still patch in the loadlibs
  37. // regardless of this flag
  38. #define TERMSRV_COMPAT_IAT_FLAGS L"IAT" // flags used by the register module which patches
  39. // the import-address-table
  40. // So far, the following flags are defines/used:
  41. // TERMSRV_COMPAT_DONT_PATCH_IN_LOAD_LIBS
  42. //
  43. //
  44. // Application compatibility flags
  45. //
  46. #define TERMSRV_COMPAT_DOS 0x00000001
  47. #define TERMSRV_COMPAT_OS2 0x00000002
  48. #define TERMSRV_COMPAT_WIN16 0x00000004
  49. #define TERMSRV_COMPAT_WIN32 0x00000008
  50. #define TERMSRV_COMPAT_ALL 0x0000000F
  51. #define TERMSRV_COMPAT_USERNAME 0x00000010 // return username for computername
  52. #define TERMSRV_COMPAT_CTXBLDNUM 0x00000020 // return Terminal Server build number
  53. #define TERMSRV_COMPAT_INISYNC 0x00000040 // sync user ini file to system
  54. #define TERMSRV_COMPAT_ININOSUB 0x00000080 // Don't subst. user dir for sys dir
  55. #define TERMSRV_COMPAT_NOREGMAP 0x00000100 // Disable registry mapping for app
  56. #define TERMSRV_COMPAT_PEROBJMAP 0x00000200 // Per object user/system global mapping
  57. #define TERMSRV_COMPAT_SYSWINDIR 0x00000400 // return system windows directory
  58. #define TERMSRV_COMPAT_PHYSMEMLIM \
  59. 0x00000800 // Limit the reported physical memory info
  60. #define TERMSRV_COMPAT_LOGOBJCREATE \
  61. 0x00001000 // Log object creation to file
  62. #define TERMSRV_COMPAT_SYSREGMAP 0x00002000 // Let system processes take advantage of
  63. // registry mapping.
  64. #define TERMSRV_COMPAT_PERUSERWINDIR \
  65. 0x00004000 // Log object creation to file
  66. #define TERMSRV_COMPAT_WAIT_USING_JOB_OBJECTS \
  67. 0x00008000 // Use kernelJobObject for tracking
  68. // execution completion, since some apps,
  69. // such as VS60WIX.EXE self spawn and
  70. // parent dies immediately.
  71. #define TERMSRV_COMPAT_NO_ENABLE_ACCESS_FLAG_MODIFICATION 0x00010000
  72. #define TERMSRV_COMPAT_NO_PER_USER_CLASSES_REDIRECTION 0x00020000
  73. #define TERMSRV_COMPAT_KBDPOLL_NOSLEEP \
  74. 0x20000000 // Don't put app to sleep on unsuccessful
  75. // keyboard polling (WIN16 only)
  76. #define TERMSRV_COMPAT_APP NTAPI_COMPAT_APPS_REG_PREFIX
  77. //Registry extension flags
  78. #define TERMSRV_SOFTWARE \
  79. L"\\Registry\\Machine\\Software"
  80. #define TERMSRV_BASE \
  81. L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Terminal Server"
  82. #define TERMSRV_ENABLE_ACCESS_FLAG_MODIFICATION 0x00000001
  83. #define TERMSRV_ENABLE_PER_USER_CLASSES_REDIRECTION 0x00000002
  84. void GetRegistryExtensionFlags();
  85. extern DWORD gdwRegistryExtensionFlags;
  86. //
  87. // Clipboard compatibility flags
  88. //
  89. #define TERMSRV_COMPAT_CLIPBRD_METAFILE 0x00000008
  90. typedef enum _TERMSRV_COMPATIBILITY_CLASS {
  91. CompatibilityApp = 1,
  92. CompatibilityIniFile,
  93. CompatibilityRegEntry
  94. } TERMSRV_COMPATIBILITY_CLASS, *PTERMSRV_COMPATIBILITY_CLASS;
  95. #define IsTerminalServer() (BOOLEAN)(USER_SHARED_DATA->SuiteMask & (1 << TerminalServer))
  96. void InitializeTermsrvFpns(void);
  97. //Kernel32 API's
  98. typedef PWCHAR (*PTERMSRVFORMATOBJECTNAME) (
  99. IN LPCWSTR SrcObjectName
  100. );
  101. extern PTERMSRVFORMATOBJECTNAME gpTermsrvFormatObjectName;
  102. typedef DWORD (*PTERMSRVGETCOMPUTERNAME) (
  103. OUT LPWSTR lpBuffer,
  104. OUT LPDWORD nSize
  105. );
  106. extern PTERMSRVGETCOMPUTERNAME gpTermsrvGetComputerName;
  107. typedef void (*PTERMSRVADJUSTPHYMEMLIMITS) (
  108. IN OUT PULONG_PTR TotalPhys,
  109. IN OUT PULONG_PTR AvailPhys,
  110. IN DWORD SysPageSize
  111. );
  112. extern PTERMSRVADJUSTPHYMEMLIMITS gpTermsrvAdjustPhyMemLimits;
  113. typedef UINT (*PTERMSRVGETWINDOWSDIRECTORYA) (
  114. OUT LPSTR lpBuffer,
  115. OUT UINT uSize
  116. );
  117. extern PTERMSRVGETWINDOWSDIRECTORYA gpTermsrvGetWindowsDirectoryA;
  118. typedef UINT (*PTERMSRVGETWINDOWSDIRECTORYW) (
  119. OUT LPWSTR lpBuffer,
  120. OUT UINT uSize
  121. );
  122. extern PTERMSRVGETWINDOWSDIRECTORYW gpTermsrvGetWindowsDirectoryW;
  123. typedef NTSTATUS (* PTERMSRVCONVERTSYSROOTTOUSERDIR)(
  124. OUT PUNICODE_STRING pFQPath,
  125. IN PUNICODE_STRING BaseWindowsDirectory
  126. );
  127. extern PTERMSRVCONVERTSYSROOTTOUSERDIR gpTermsrvConvertSysRootToUserDir;
  128. typedef NTSTATUS (*PTERMSRVBUILDINIFILENAME)(
  129. OUT PUNICODE_STRING pFQName,
  130. IN PUNICODE_STRING pBaseFileName
  131. );
  132. extern PTERMSRVBUILDINIFILENAME gpTermsrvBuildIniFileName;
  133. typedef VOID (*PTERMSRVCORINIFILE)(
  134. PUNICODE_STRING pUserFullPath
  135. );
  136. extern PTERMSRVCORINIFILE gpTermsrvCORIniFile;
  137. typedef BOOL (* PTERMSRVCREATEREGENTRY)(IN HANDLE hKey,
  138. IN POBJECT_ATTRIBUTES pObjAttr,
  139. IN ULONG TitleIndex,
  140. IN PUNICODE_STRING pUniClass OPTIONAL,
  141. IN ULONG ulCreateOpt);
  142. extern PTERMSRVCREATEREGENTRY gpfnTermsrvCreateRegEntry;
  143. typedef BOOL (*PTERMSRVOPENREGENTRY)(OUT PHANDLE pUserhKey,
  144. IN ACCESS_MASK DesiredAccess,
  145. IN POBJECT_ATTRIBUTES pUserObjectAttr);
  146. extern PTERMSRVOPENREGENTRY gpfnTermsrvOpenRegEntry;
  147. typedef BOOL (*PTERMSRVSETVALUEKEY)(HANDLE hKey,
  148. PUNICODE_STRING ValueName,
  149. ULONG TitleIndex,
  150. ULONG Type,
  151. PVOID Data,
  152. ULONG DataSize);
  153. extern PTERMSRVSETVALUEKEY gpfnTermsrvSetValueKey;
  154. typedef BOOL (* PTERMSRVDELETEKEY)(HANDLE hKey);
  155. extern PTERMSRVDELETEKEY gpfnTermsrvDeleteKey;
  156. typedef BOOL (*PTERMSRVDELETEVALUE)(HANDLE hKey,
  157. PUNICODE_STRING pUniValue);
  158. extern PTERMSRVDELETEVALUE gpfnTermsrvDeleteValue;
  159. typedef BOOL (* PTERMSRVRESTOREKEY)(IN HANDLE hKey,
  160. IN HANDLE hFile,
  161. IN ULONG Flags);
  162. extern PTERMSRVRESTOREKEY gpfnTermsrvRestoreKey;
  163. typedef BOOL (* PTERMSRVSETKEYSECURITY)(IN HANDLE hKey,
  164. IN SECURITY_INFORMATION SecInfo,
  165. IN PSECURITY_DESCRIPTOR pSecDesc);
  166. extern PTERMSRVSETKEYSECURITY gpfnTermsrvSetKeySecurity;
  167. typedef BOOL (* PTERMSRVOPENUSERCLASSES)(IN ACCESS_MASK DesiredAccess,
  168. OUT PHANDLE pUserhKey);
  169. extern PTERMSRVOPENUSERCLASSES gpfnTermsrvOpenUserClasses;
  170. typedef NTSTATUS ( * PTERMSRVGETPRESETVALUE)( IN HANDLE hKey,
  171. IN PUNICODE_STRING pValueName,
  172. IN ULONG Type,
  173. OUT PVOID *Data
  174. );
  175. extern PTERMSRVGETPRESETVALUE gpfnTermsrvGetPreSetValue;
  176. typedef int (*PTERMSRVUPDATEALLUSERMENU)(int RunMode);
  177. extern PTERMSRVUPDATEALLUSERMENU gpTermsrvUpdateAllUserMenu;
  178. typedef ULONG ( *PGETTERMSRCOMPATFLAGS)(LPWSTR, LPDWORD, TERMSRV_COMPATIBILITY_CLASS);
  179. extern PGETTERMSRCOMPATFLAGS gpGetTermsrCompatFlags;
  180. typedef BOOL (*PTERMSRVBUILDSYSINIPATH) (
  181. PUNICODE_STRING pIniPath,
  182. PUNICODE_STRING pSysPath,
  183. PUNICODE_STRING pUserPath
  184. );
  185. extern PTERMSRVBUILDSYSINIPATH gpTermsrvBuildSysIniPath;
  186. typedef BOOL (* PTERMSRVCOPYINIFILE)(
  187. PUNICODE_STRING pSysFullPath,
  188. PUNICODE_STRING pUserBasePath,
  189. PUNICODE_STRING pUserFullPath
  190. );
  191. extern PTERMSRVCOPYINIFILE gpTermsrvCopyIniFile;
  192. typedef NTSTATUS (* PTERMSRVGETSTRING)(
  193. HANDLE SrcHandle,
  194. PCHAR *ppStringPtr,
  195. PULONG pStringSize,
  196. PCHAR pIOBuf,
  197. ULONG IOBufSize,
  198. PULONG pIOBufIndex,
  199. PULONG pIOBufFillSize
  200. );
  201. extern PTERMSRVGETSTRING gpTermsrvGetString;
  202. typedef BOOL (*PTERMSRVLOGINSTALLINIFILE)(PUNICODE_STRING NtFileName);
  203. extern PTERMSRVLOGINSTALLINIFILE gpTermsrvLogInstallIniFile;
  204. // @@END_DDKSPLIT
  205. #ifdef __cplusplus
  206. extern "C" {
  207. #endif
  208. WINBASEAPI
  209. BOOL
  210. WINAPI
  211. TermsrvAppInstallMode( VOID );
  212. WINBASEAPI
  213. BOOL
  214. WINAPI
  215. SetTermsrvAppInstallMode( BOOL bState );
  216. #ifdef __cplusplus
  217. }
  218. #endif
  219. #endif