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.

194 lines
4.9 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation
  3. Module Name:
  4. SetX.h
  5. Abstract:
  6. This module is the header file used for setx.cpp
  7. Author:
  8. Gary Milne
  9. Revision History:
  10. Created ????. 1996 - Gary Milne
  11. #54581 Dec. 1996 - Joe Hughes (a-josehu)
  12. Modified on 10-7-2001 (Wipro Technologies) .
  13. --*/
  14. #ifndef __SETX_H
  15. #define __SETX_H
  16. #if !defined( SECURITY_WIN32 ) && !defined( SECURITY_KERNEL ) && !defined( SECURITY_MAC )
  17. #define SECURITY_WIN32
  18. #endif
  19. // include header file only once
  20. #pragma once
  21. #include "pch.h"
  22. #define FAILURE 1
  23. #define SUCCESS 0
  24. #define TOKEN_BACKSLASH L"\\"
  25. #define TOKEN_BACKSLASH2 L"\\\\"
  26. #define HKEYLOCALMACHINE L"HKEY_LOCAL_MACHINE"
  27. #define HKLM L"HKLM"
  28. #define HKEYCURRENTUSER L"HKEY_CURRENT_USER"
  29. #define HKCU L"HKCU"
  30. #define COLON_SYMBOL L":"
  31. //#define MAX_OPTIONS 12
  32. #define NEWLINE L'\n'
  33. #define NULLCHAR L'\0'
  34. #define COMMA L','
  35. #define DOT L"."
  36. #define HYPHEN L'-'
  37. #define PLUS L'+'
  38. #define OPTION_USAGE 0
  39. #define OPTION_SERVER 1
  40. #define OPTION_USER 2
  41. #define OPTION_PASSWORD 3
  42. #define OPTION_MACHINE 4
  43. #define OPTION_REGISTRY 5
  44. #define OPTION_FILE 6
  45. #define OPTION_DEFAULT 7
  46. //#define OPTION_VERBOSE 8
  47. #define OPTION_ABS_OFFSET 8
  48. #define OPTION_REL_OFFSET 9
  49. #define OPTION_DEBUG 10
  50. #define OPTION_DELIMITER 11
  51. #define MAX_OPTIONS 12
  52. #define ERROR_REGISTRY 99
  53. #define BACKSLASH4 L"\\\\"
  54. #define CHAR_TILDE L'~'
  55. #define CHAR_PERCENT L'%'
  56. #define MACHINE_KEY L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"
  57. #define ENVIRONMENT_KEY L"Environment"
  58. #define NULL_U_STRING L"\0"
  59. #define RETVALZERO 0
  60. #define LINE_BUFFER 5000
  61. #define FREE_MEMORY( VARIABLE ) \
  62. FreeMemory(&VARIABLE); \
  63. 1
  64. #define ASSIGN_MEMORY( VARIABLE , TYPE , VALUE ) \
  65. VARIABLE = ( TYPE * ) AllocateMemory( VALUE * sizeof( TYPE ) ); \
  66. 1
  67. #define REALLOC_MEMORY( VARIABLE , TYPE , VALUE ) \
  68. ReallocateMemory( VARIABLE, VALUE * sizeof( TYPE ) ); \
  69. 1
  70. /* Functions definitions here */
  71. LONG Parsekey(WCHAR * ptr,
  72. WCHAR * hive,
  73. WCHAR ** path,
  74. WCHAR * parameter );
  75. LONG GetCoord(WCHAR * rcv_buffer,
  76. LONG * row,
  77. LONG * column
  78. );
  79. WCHAR * ParseLine(WCHAR *szPtr,
  80. LONG* row,
  81. LONG* column,
  82. WCHAR szDelimiters[15],
  83. WCHAR *search_string ,
  84. LONG DEBUG ,
  85. LONG ABS ,
  86. LONG REL ,
  87. LONG *record_counter ,
  88. LONG *iValue ,
  89. DWORD *dwFound,
  90. DWORD* dwColPos,
  91. BOOL bNegCoord,
  92. FILE *fin) ;
  93. VOID DisplayHelp();
  94. DWORD CheckKeyType( DWORD *dwType,
  95. TCHAR ** buffer,
  96. DWORD dwBytesRead,
  97. PBOOL pbLengthExceed);
  98. BOOL DisplayError( LONG value,
  99. LPCTSTR ptr );
  100. DWORD WriteEnv(
  101. LPCTSTR szVariable,
  102. LPTSTR szBuffer,
  103. DWORD dwType ,
  104. LPTSTR szServer,
  105. DWORD MACHINE
  106. );
  107. DWORD CheckPercent( TCHAR * buffer);
  108. DWORD ReadRegValue ( PWCHAR wszHive,
  109. LPCWSTR wszPath,
  110. LPCWSTR wszParameter,
  111. LPWSTR* wszBuffer,
  112. DWORD buffsize ,
  113. LPTSTR szServer,
  114. PDWORD pdwBytesRead,
  115. PBOOL pbLengthExceed);
  116. DWORD ProcessOptions( IN LONG argc ,
  117. IN LPCWSTR argv[] ,
  118. PBOOL pbShowUsage ,
  119. LPTSTR* szServer,
  120. LPTSTR* szUserName,
  121. LPTSTR* szPassword,
  122. PBOOL pbMachine,
  123. LPTSTR* szRegistry,
  124. // PBOOL pbConnFlag ,
  125. LPTSTR* szDefault,
  126. PBOOL pbNeedPwd,
  127. LPTSTR szFile ,
  128. LPTSTR szAbsolute,
  129. LPTSTR szRelative,
  130. PBOOL pbDebug,
  131. LPTSTR* szBuffer,
  132. LPTSTR szDelimiter);
  133. //PDWORD pdwBufferSize);
  134. VOID SafeCloseConnection(BOOL bConnFlag,
  135. LPTSTR szServer);
  136. BOOL ProcessUnlimitedArguments( LPCWSTR pwszOption,
  137. LPCWSTR pwszValue,
  138. LPVOID pData,
  139. DWORD* pdwIncrement );
  140. #define SIZE1 100
  141. #define SIZE2 500
  142. #define SIZE3 5000
  143. #define SIZE4 15
  144. #define SIZE5 5024
  145. #define CHAR_BACKSLASH L'\\'
  146. #define SPACE_CHAR L" "
  147. #define NEW_LINE L"\n"
  148. #define INVALID_LENGTH 999
  149. #endif