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.

248 lines
8.8 KiB

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