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.

215 lines
8.3 KiB

  1. /*****************************************************************************
  2. * UTILSUB.H
  3. * This file contains the structure definitions and equtates for
  4. * communication between calling programs and functions in utilsub.lib.
  5. *
  6. * Copyright Citrix Systems Inc. 1990-1995
  7. * Copyright (C) 1997-1999 Microsoft Corp.
  8. *
  9. * $Author: butchd $
  10. ****************************************************************************/
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. /*-----------------------------------------------------------------------------
  15. -- type-defs for File List Structure.
  16. ----------------------------------------------------------------------------*/
  17. typedef struct _FILELIST {
  18. int argc;
  19. WCHAR **argv;
  20. } FILELIST, *PFILELIST;
  21. /*-----------------------------------------------------------------------------
  22. -- type-defs for Token Map Structure.
  23. ----------------------------------------------------------------------------*/
  24. // UNICODE version
  25. typedef struct _TOKMAPW {
  26. PWCHAR tmToken; /* token; null pointer terminates list */
  27. USHORT tmFlag; /* flags for control communication */
  28. USHORT tmForm; /* format control string */
  29. USHORT tmDLen; /* length of data fields */
  30. PVOID tmAddr; /* pointer to interpreted data */
  31. } TOKMAPW, *PTOKMAPW;
  32. // ANSI version
  33. typedef struct _TOKMAPA {
  34. PCHAR tmToken; /* token; null pointer terminates list */
  35. USHORT tmFlag; /* flags for control communication */
  36. USHORT tmForm; /* format control string */
  37. USHORT tmDLen; /* length of data fields */
  38. PVOID tmAddr; /* pointer to interpreted data */
  39. } TOKMAPA, *PTOKMAPA;
  40. /*-----------------------------------------------------------------------------
  41. -- type-defs for Token Map Structure USE FOR CALLING SDM.DLL FUNCIONS
  42. ----------------------------------------------------------------------------*/
  43. typedef struct _FILETOKMAP {
  44. PWCHAR tmToken; /* token; null pointer terminates list */
  45. USHORT tmFlag; /* flags for control communication */
  46. USHORT tmForm; /* format control string */
  47. USHORT tmDLen; /* length of data fields */
  48. PVOID tmAddr; /* pointer to interpreted data */
  49. USHORT tmLast; /* pointer for FindFirst FindNext junk */
  50. } FILETOKMAP, FAR * PFILETOKMAP, NEAR * NPFILETOKMAP, * DPFILETOKMAP;
  51. /*-----------------------------------------------------------------------------
  52. -- equates for _TOKMAP->tmFlag
  53. ----------------------------------------------------------------------------*/
  54. #define TMFLAG_OPTIONAL 0x0000
  55. #define TMFLAG_REQUIRED 0x0001
  56. #define TMFLAG_PRESENT 0x0002 /* was present in command line */
  57. #define TMFLAG_MODIFIED 0x0004 /* was modified by app, request write */
  58. #define TMFLAG_DELETE 0x0008 /* request delete */
  59. /*-----------------------------------------------------------------------------
  60. -- equates for _TOKMAP->tmForm
  61. ----------------------------------------------------------------------------*/
  62. #define TMFORM_VOID 0x0000
  63. #define TMFORM_BOOLEAN 0x0001
  64. #define TMFORM_BYTE 0x0002
  65. #define TMFORM_CHAR 0x0003
  66. #define TMFORM_STRING 0x0004
  67. #define TMFORM_SHORT 0x0005
  68. #define TMFORM_USHORT 0x0006
  69. #define TMFORM_LONG 0x0007
  70. #define TMFORM_ULONG 0x0008
  71. #define TMFORM_HEX 0x0009
  72. #define TMFORM_LONGHEX 0x000A
  73. #define TMFORM_SERIAL 0x000B
  74. #define TMFORM_DATE 0x000C
  75. #define TMFORM_PHONE 0x000D
  76. #define TMFORM_X_STRING 0x000E
  77. #define TMFORM_FILES 0x000F
  78. #define TMFORM_S_STRING 0x0010
  79. /*-----------------------------------------------------------------------------
  80. -- equates for _TOKMAP->tmDLen
  81. ----------------------------------------------------------------------------*/
  82. #define TMDLEN_VOID 0x0000
  83. /*-----------------------------------------------------------------------------
  84. -- prototype for Parse and setargv functions
  85. ----------------------------------------------------------------------------*/
  86. // UNICODE prototypes
  87. int WINAPI setargvW( LPWSTR szModuleName, LPWSTR szCmdLine, int *, WCHAR *** );
  88. void WINAPI freeargvW( WCHAR ** );
  89. USHORT WINAPI ParseCommandLineW(INT, WCHAR **, PTOKMAPW, USHORT);
  90. BOOLEAN WINAPI IsTokenPresentW( PTOKMAPW, PWCHAR );
  91. BOOLEAN WINAPI SetTokenPresentW( PTOKMAPW, PWCHAR );
  92. BOOLEAN WINAPI SetTokenNotPresentW( PTOKMAPW, PWCHAR );
  93. // ANSI prototypes
  94. int WINAPI setargvA( LPSTR szModuleName, LPSTR szCmdLine, int *, char *** );
  95. void WINAPI freeargvA( char ** );
  96. USHORT WINAPI ParseCommandLineA(INT, CHAR **, PTOKMAPA, USHORT);
  97. BOOLEAN WINAPI IsTokenPresentA( PTOKMAPA, PCHAR );
  98. BOOLEAN WINAPI SetTokenPresentA( PTOKMAPA, PCHAR );
  99. BOOLEAN WINAPI SetTokenNotPresentA( PTOKMAPA, PCHAR );
  100. #ifdef UNICODE
  101. #define setargv setargvW
  102. #define freeargv freeargvW
  103. #define ParseCommandLine ParseCommandLineW
  104. #define IsTokenPresent IsTokenPresentW
  105. #define SetTokenPresent SetTokenPresentW
  106. #define SetTokenNotPresent SetTokenNotPresentW
  107. #define TOKMAP TOKMAPW
  108. #define PTOKMAP PTOKMAPW
  109. #else
  110. #define setargv setargvA
  111. #define freeargv freeargvA
  112. #define ParseCommandLine ParseCommandLineA
  113. #define IsTokenPresent IsTokenPresentA
  114. #define SetTokenPresent SetTokenPresentA
  115. #define SetTokenNotPresent SetTokenNotPresentA
  116. #define TOKMAP TOKMAPA
  117. #define PTOKMAP PTOKMAPA
  118. #endif /* UNICODE */
  119. /*-----------------------------------------------------------------------------
  120. -- flags for ParseCommandLine().
  121. ----------------------------------------------------------------------------*/
  122. #define PCL_FLAG_CONTINUE_ON_ERROR 0x0001
  123. #define PCL_FLAG_RET_ON_FIRST_SUCCESS 0x0002
  124. #define PCL_FLAG_IGNORE_INVALID 0x0004
  125. #define PCL_FLAG_NO_CLEAR_MEMORY 0x0008
  126. #define PCL_FLAG_NO_VERSION_CHECK 0x0010
  127. #define PCL_FLAG_VERSION_CHK_UPWARD 0x0020
  128. /*-----------------------------------------------------------------------------
  129. -- flags for rc=ParseCommandLine(), PARSE_FLAG_* (BIT FLAGS)
  130. ----------------------------------------------------------------------------*/
  131. #define PARSE_FLAG_NO_ERROR 0x0000
  132. #define PARSE_FLAG_MISSING_REQ_FIELD 0x0001
  133. #define PARSE_FLAG_INVALID_PARM 0x0002
  134. #define PARSE_FLAG_DUPLICATE_FIELD 0x0004
  135. #define PARSE_FLAG_NO_PARMS 0x0008
  136. #define PARSE_FLAG_TOO_MANY_PARMS 0x0010
  137. #define PARSE_FLAG_NOT_ENOUGH_MEMORY 0x0020
  138. /*-----------------------------------------------------------------------------
  139. -- prototypes for WinStation utility functions
  140. ----------------------------------------------------------------------------*/
  141. VOID WINAPI RefreshAllCaches();
  142. VOID WINAPI RefreshWinStationCaches();
  143. VOID WINAPI RefreshWinStationObjectCache();
  144. VOID WINAPI RefreshWinStationNameCache();
  145. ULONG WINAPI GetCurrentLogonId( );
  146. VOID WINAPI GetCurrentWinStationName( PWCHAR, int );
  147. BOOLEAN WINAPI GetWinStationNameFromId( ULONG, PWCHAR, int );
  148. BOOLEAN WINAPI GetWinStationUserName( ULONG, PWCHAR, int );
  149. VOID WINAPI GetCurrentUserName( PWCHAR, int );
  150. BOOLEAN WINAPI WinStationObjectMatch( VOID *, PWCHAR );
  151. /*-----------------------------------------------------------------------------
  152. -- prototypes for process/user utility functions
  153. ----------------------------------------------------------------------------*/
  154. VOID WINAPI RefreshProcessObjectCaches();
  155. VOID WINAPI RefreshUserSidCrcCache();
  156. BOOLEAN WINAPI ProcessObjectMatch( ULONG, ULONG, int, PWCHAR, PWCHAR, PWCHAR, PWCHAR );
  157. VOID WINAPI GetUserNameFromSid( VOID *, PWCHAR, PULONG );
  158. /*-----------------------------------------------------------------------------
  159. -- prototypes for helper functions
  160. ----------------------------------------------------------------------------*/
  161. USHORT WINAPI CalculateCrc16( PBYTE, USHORT );
  162. INT WINAPI ExecProgram( PPROGRAMCALL, INT, WCHAR ** );
  163. VOID WINAPI ProgramUsage( LPCWSTR, PPROGRAMCALL, BOOLEAN );
  164. VOID WINAPI Message( int nResourceID, ... );
  165. VOID WINAPI ErrorPrintf( int nErrorResourceID, ... );
  166. VOID WINAPI TruncateString( PWCHAR pString, int MaxLength );
  167. PPDPARAMS WINAPI EnumerateDevices(PDLLNAME pDllName, PULONG pEntries);
  168. FILE * WINAPI wfopen( LPCWSTR filename, LPCWSTR mode );
  169. PWCHAR WINAPI wfgets( PWCHAR Buffer, int Len, FILE *Stream);
  170. int WINAPI PutStdErr(unsigned int MsgNum, unsigned int NumOfArgs, ...);
  171. #ifdef __cplusplus
  172. }
  173. #endif