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.

227 lines
6.4 KiB

  1. #include <nt.h>
  2. #include <ntrtl.h>
  3. #include <nturtl.h>
  4. #include <windows.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #include <tchar.h>
  9. #include <assert.h>
  10. #include "symsrv.h"
  11. #define IGNORE_IF_SPLIT 130
  12. #define ERROR_IF_SPLIT 131
  13. #define ERROR_IF_NOT_SPLIT 132
  14. #define TRANSACTION_ADD 201
  15. #define TRANSACTION_DEL 202
  16. #define DONT_STORE_FILES 203
  17. #define STORE_FILE 204
  18. #define STORE_PTR 205
  19. #define DEL 210
  20. #define ADD_STORE 206
  21. #define ADD_DONT_STORE 207
  22. #define ADD_STORE_FROM_FILE 208
  23. #define MAX_VERSION 20
  24. #define MAX_PRODUCT 120
  25. #define MAX_COMMENT 120
  26. #define MAX_ID 10
  27. #define MAX_DATE 8
  28. #define MAX_TIME 8
  29. #define MAX_UNUSED 0
  30. // Define some constants for lengths in the transaction record
  31. // in order to define the maximum length of the record that will
  32. // be written to the master file.
  33. #define TRANS_NUM_COMMAS 8
  34. #define TRANS_EOL 1
  35. #define TRANS_ADD_DEL 3
  36. #define TRANS_FILE_PTR 4
  37. // Define some constants for determining what happened when an NT
  38. // file was stored
  39. #define FILE_STORED 1
  40. #define FILE_SKIPPED 2
  41. #define FILE_ERRORED 3
  42. typedef struct _TRANSACTION {
  43. LPTSTR szId; // Id for this transaction
  44. // This always refers to the transaction file that
  45. // is being deleted or added
  46. LPTSTR szDelId; // Id for a delete transaction
  47. // This is just appended to the master file, there is
  48. // no file created for it.
  49. DWORD TransState; // State of this transaction
  50. DWORD FileOrPtr; // Are we storing files or pointers?
  51. LPTSTR szProduct; // Name of the product being added
  52. LPTSTR szVersion; // Version of the product
  53. LPTSTR szComment; // Description
  54. LPTSTR szTransFileName; // Full Path and name of the Transaction file
  55. LPTSTR szTime;
  56. LPTSTR szDate;
  57. LPTSTR szUnused;
  58. } TRANSACTION, *PTRANSACTION;
  59. /* ++
  60. Description of the fields in COM_ARGS
  61. szSrcDir Directory where source files exist
  62. szFileName File name(s) to store in the symbols server.
  63. This may contain wild card characters
  64. Recurse Recurse into subdirectories
  65. szRootDir Root Directory of the symbols server
  66. szSymbolsDir Symbols Directory under the root of the symbols server
  67. szSrcPath Path to the files. If this is not NULL,
  68. then store a pointer to the files instead of
  69. the files. Typically, this is the same as szSrcDir.
  70. The difference is that szSrcPath is the path that
  71. the debugger will use to find the symbol file.
  72. Thus, it needs to be a network share, whereas szSrcDir
  73. can be a local path.
  74. szId Reference string for this transaction. This must be
  75. unique for each transaction.
  76. szAdminDir Admin directory under the root of the symbols server
  77. szProduct Name of the product
  78. szVersion Version of the product
  79. szComment Text description ... optional
  80. szMasterFileName The full path and name of the master file. This contains
  81. the master transaction record for each transaction.
  82. szServerFileName The full path and name of the file that contains a list of
  83. all the transactions that are currently stored in the server.
  84. szTransFileName The full path and name of the file that contains a list of
  85. all the files added by this transaction. This only gets
  86. initialized during GetCommandLineArgs if symstore is only
  87. supposed to store the transaction file and not store any
  88. files on the symbol server.
  89. szShareName This is used with the /x option. It is a prefix of
  90. szFileName. It is the part of szFileName that may
  91. change later when the files are added to the server.
  92. TransState Is this TRANSACTION_ADD or TRANSACTION_DEL
  93. StoreFlags Possible values: STORE or DONT_STORE
  94. AppendStoreFile When storing to a file instead of adding the files to the
  95. symbol server, open the file with append.
  96. -- */
  97. typedef struct _COMMAND_ARGS {
  98. LPTSTR szSrcDir;
  99. LPTSTR szFileName;
  100. BOOL Recurse;
  101. LPTSTR szRootDir;
  102. LPTSTR szSymbolsDir;
  103. LPTSTR szSrcPath;
  104. LPTSTR szId;
  105. LPTSTR szAdminDir;
  106. LPTSTR szProduct;
  107. LPTSTR szVersion;
  108. LPTSTR szComment;
  109. LPTSTR szUnused;
  110. LPTSTR szMasterFileName;
  111. LPTSTR szServerFileName;
  112. LPTSTR szTransFileName;
  113. LPTSTR szShareName;
  114. DWORD ShareNameLength;
  115. DWORD TransState;
  116. DWORD StoreFlags;
  117. BOOL AppendStoreFile;
  118. FILE *pStoreFromFile;
  119. BOOL VerboseOutput;
  120. } COM_ARGS, *PCOM_ARGS;
  121. typedef struct _FILE_COUNTS {
  122. DWORD NumPassedFiles;
  123. DWORD NumIgnoredFiles;
  124. DWORD NumFailedFiles;
  125. } FILE_COUNTS, *PFILE_COUNTS;
  126. BOOL
  127. StoreDbg(
  128. LPTSTR szDestDir,
  129. LPTSTR szFileName,
  130. LPTSTR szPtrFileName
  131. );
  132. BOOL
  133. StorePdb(
  134. LPTSTR szDestDir,
  135. LPTSTR szFileName,
  136. LPTSTR szPtrFileName // If this is NULL, then the file is stored.
  137. // If this is not NULL, then a pointer to
  138. // the file is stored.
  139. );
  140. BOOL
  141. DeleteAllFilesInDirectory(
  142. LPTSTR szDir
  143. );
  144. DECLSPEC_NORETURN
  145. VOID
  146. MallocFailed(
  147. VOID
  148. );
  149. typedef struct _LIST_ELEM {
  150. CHAR FName[_MAX_PATH];
  151. CHAR Path[_MAX_PATH];
  152. } LIST_ELEM, *P_LIST_ELEM;
  153. typedef struct _LIST {
  154. LIST_ELEM *List; // Pointers to the file names
  155. DWORD dNumFiles;
  156. } LIST, *P_LIST;
  157. P_LIST
  158. GetList(
  159. LPTSTR szFileName
  160. );
  161. BOOL
  162. InList(
  163. LPTSTR szFileName,
  164. P_LIST pExcludeList
  165. );
  166. BOOL
  167. StoreNtFile(
  168. LPTSTR szDestDir,
  169. LPTSTR szFileName,
  170. LPTSTR szPtrFileName,
  171. USHORT *rc
  172. );
  173. DWORD
  174. StoreFromFile(
  175. FILE *pStoreFromFile,
  176. LPTSTR szDestDir,
  177. PFILE_COUNTS pFileCounts
  178. );
  179. BOOL
  180. MyCopyFile(
  181. LPCTSTR lpExistingFileName,
  182. LPCTSTR lpNewFileName
  183. );
  184. extern HANDLE hTransFile;
  185. extern DWORD StoreFlags;
  186. extern PCOM_ARGS pArgs;
  187. extern PTRANSACTION pTrans;
  188. extern LONG lMaxTrans; // Maximum number of characters in a transaction record