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.

459 lines
13 KiB

  1. #define DUMP // leave enabled...
  2. #include "globals.h"
  3. #include "switches.h"
  4. #include <windows.h>
  5. #include <windowsx.h>
  6. #include <io.h>
  7. #include <malloc.h>
  8. #include <string.h>
  9. #if DBG
  10. void __cdecl dprintf(LPTSTR szFormat, ...) {
  11. static TCHAR tmpStr[1024];
  12. va_list marker;
  13. va_start(marker, szFormat);
  14. wvsprintf(tmpStr, szFormat, marker);
  15. OutputDebugString(tmpStr);
  16. va_end(marker);
  17. } // dprintf
  18. BOOL fDoEntireList = FALSE;
  19. void DumpConvertList(CONVERT_LIST *pConvertList)
  20. {
  21. if (pConvertList)
  22. {
  23. dprintf(
  24. TEXT("+++CONVERT_LIST(0x%08lx)"),
  25. pConvertList
  26. );
  27. dprintf(
  28. TEXT("\r\n\tnext = 0x%08lx")
  29. TEXT("\r\n\tprev = 0x%08lx")
  30. TEXT("\r\n\tSourceServ = 0x%08lx")
  31. TEXT("\r\n\tFileServ = 0x%08lx")
  32. TEXT("\r\n\tConvertOptions = 0x%08lx")
  33. TEXT("\r\n\tFileOptions = 0x%08lx\r\n"),
  34. pConvertList->next,
  35. pConvertList->prev,
  36. pConvertList->SourceServ,
  37. pConvertList->FileServ,
  38. pConvertList->ConvertOptions,
  39. pConvertList->FileOptions
  40. );
  41. if (pConvertList->SourceServ)
  42. DumpSourceServerBuffer(pConvertList->SourceServ);
  43. if (pConvertList->FileServ)
  44. DumpDestServerBuffer(pConvertList->FileServ);
  45. if (fDoEntireList && pConvertList->next)
  46. DumpConvertList(pConvertList->next);
  47. dprintf(
  48. TEXT("---CONVERT_LIST(0x%08lx)\r\n"),
  49. pConvertList
  50. );
  51. }
  52. else
  53. dprintf(TEXT("Null pConvertList\r\n"));
  54. } // DumpConvertList
  55. void DumpDestServerBuffer(DEST_SERVER_BUFFER *pDestServerBuffer)
  56. {
  57. if (pDestServerBuffer)
  58. {
  59. dprintf(
  60. TEXT("+++DEST_SERVER_BUFFER(0x%08lx)"),
  61. pDestServerBuffer
  62. );
  63. dprintf(
  64. TEXT("\r\n\tnext = 0x%08lx")
  65. TEXT("\r\n\tprev = 0x%08lx")
  66. TEXT("\r\n\tIndex = 0x%08lx")
  67. TEXT("\r\n\tType = 0x%08lx")
  68. TEXT("\r\n\tVerMaj = 0x%08lx")
  69. TEXT("\r\n\tVerMin = 0x%08lx")
  70. TEXT("\r\n\tLName = %s")
  71. TEXT("\r\n\tName = %s")
  72. TEXT("\r\n\tShareList = 0x%08lx")
  73. TEXT("\r\n\tNumVShares = 0x%08lx")
  74. TEXT("\r\n\tVShareStart = 0x%08lx")
  75. TEXT("\r\n\tVShareEnd = 0x%08lx")
  76. TEXT("\r\n\tUseCount = 0x%08lx")
  77. TEXT("\r\n\tIsNTAS = 0x%08lx")
  78. TEXT("\r\n\tIsFPNW = 0x%08lx")
  79. TEXT("\r\n\tInDomain = 0x%08lx")
  80. TEXT("\r\n\tDomain = 0x%08lx")
  81. TEXT("\r\n\tDriveList = 0x%08lx\r\n"),
  82. pDestServerBuffer->next,
  83. pDestServerBuffer->prev,
  84. pDestServerBuffer->Index,
  85. pDestServerBuffer->Type,
  86. pDestServerBuffer->VerMaj,
  87. pDestServerBuffer->VerMin,
  88. pDestServerBuffer->LName,
  89. pDestServerBuffer->Name,
  90. pDestServerBuffer->ShareList,
  91. pDestServerBuffer->NumVShares,
  92. pDestServerBuffer->VShareStart,
  93. pDestServerBuffer->VShareEnd,
  94. pDestServerBuffer->UseCount,
  95. pDestServerBuffer->IsNTAS,
  96. pDestServerBuffer->IsFPNW,
  97. pDestServerBuffer->InDomain,
  98. pDestServerBuffer->Domain,
  99. pDestServerBuffer->DriveList
  100. );
  101. if (pDestServerBuffer->DriveList)
  102. DumpDriveList(pDestServerBuffer->DriveList);
  103. if (pDestServerBuffer->ShareList)
  104. DumpShareList(pDestServerBuffer->ShareList);
  105. if (pDestServerBuffer->VShareStart)
  106. DumpVirtualShareBuffer(pDestServerBuffer->VShareStart);
  107. if (pDestServerBuffer->Domain)
  108. DumpDomainBuffer(pDestServerBuffer->Domain);
  109. if (fDoEntireList && pDestServerBuffer->next)
  110. DumpDestServerBuffer(pDestServerBuffer->next);
  111. dprintf(
  112. TEXT("---DEST_SERVER_BUFFER(0x%08lx)\r\n"),
  113. pDestServerBuffer
  114. );
  115. }
  116. else
  117. dprintf(TEXT("Null pDestServerBuffer\r\n"));
  118. } // DumpDestServerBuffer
  119. void DumpSourceServerBuffer(SOURCE_SERVER_BUFFER *pSourceServerBuffer)
  120. {
  121. if (pSourceServerBuffer)
  122. {
  123. dprintf(
  124. TEXT("+++SOURCE_SERVER_BUFFER(0x%08lx)"),
  125. pSourceServerBuffer
  126. );
  127. dprintf(
  128. TEXT("\r\n\tnext = 0x%08lx")
  129. TEXT("\r\n\tprev = 0x%08lx")
  130. TEXT("\r\n\tIndex = 0x%08lx")
  131. TEXT("\r\n\tType = 0x%08lx")
  132. TEXT("\r\n\tVerMaj = 0x%08lx")
  133. TEXT("\r\n\tVerMin = 0x%08lx")
  134. TEXT("\r\n\tLName = %s")
  135. TEXT("\r\n\tName = %s")
  136. TEXT("\r\n\tShareList = 0x%08lx\r\n"),
  137. pSourceServerBuffer->next,
  138. pSourceServerBuffer->prev,
  139. pSourceServerBuffer->Index,
  140. pSourceServerBuffer->Type,
  141. pSourceServerBuffer->VerMaj,
  142. pSourceServerBuffer->VerMin,
  143. pSourceServerBuffer->LName,
  144. pSourceServerBuffer->Name,
  145. pSourceServerBuffer->ShareList
  146. );
  147. if (pSourceServerBuffer->ShareList)
  148. DumpShareList(pSourceServerBuffer->ShareList);
  149. if (fDoEntireList && pSourceServerBuffer->next)
  150. DumpSourceServerBuffer(pSourceServerBuffer->next);
  151. dprintf(
  152. TEXT("---SOURCE_SERVER_BUFFER(0x%08lx)\r\n"),
  153. pSourceServerBuffer
  154. );
  155. }
  156. else
  157. dprintf(TEXT("Null pSourceServerBuffer\r\n"));
  158. } // DumpSourceServerBuffer
  159. void DumpDomainBuffer(DOMAIN_BUFFER *pDomainBuffer)
  160. {
  161. if (pDomainBuffer)
  162. {
  163. dprintf(
  164. TEXT("+++DOMAIN_BUFFER(0x%08lx)"),
  165. pDomainBuffer
  166. );
  167. dprintf(
  168. TEXT("\r\n\tnext = 0x%08lx")
  169. TEXT("\r\n\tprev = 0x%08lx")
  170. TEXT("\r\n\tIndex = 0x%08lx")
  171. TEXT("\r\n\tName = %s")
  172. TEXT("\r\n\tPDCName = %s")
  173. TEXT("\r\n\tType = 0x%08lx")
  174. TEXT("\r\n\tVerMaj = 0x%08lx")
  175. TEXT("\r\n\tVerMin = 0x%08lx")
  176. TEXT("\r\n\tUseCount = 0x%08lx\r\n"),
  177. pDomainBuffer->next,
  178. pDomainBuffer->prev,
  179. pDomainBuffer->Index,
  180. pDomainBuffer->Name,
  181. pDomainBuffer->PDCName,
  182. pDomainBuffer->Type,
  183. pDomainBuffer->VerMaj,
  184. pDomainBuffer->VerMin,
  185. pDomainBuffer->UseCount
  186. );
  187. if (fDoEntireList && pDomainBuffer->next)
  188. DumpDomainBuffer(pDomainBuffer->next);
  189. dprintf(
  190. TEXT("---DOMAIN_BUFFER(0x%08lx)\r\n"),
  191. pDomainBuffer
  192. );
  193. }
  194. else
  195. dprintf(TEXT("Null pDomainBuffer\r\n"));
  196. } // DumpDomainBuffer
  197. void DumpVirtualShareBuffer(VIRTUAL_SHARE_BUFFER *pVirtualShareBuffer)
  198. {
  199. if (pVirtualShareBuffer)
  200. {
  201. dprintf(
  202. TEXT("+++VIRTUAL_SHARE_BUFFER(0x%08lx)"),
  203. pVirtualShareBuffer
  204. );
  205. dprintf(
  206. TEXT("\r\n\tVFlag = 0x%08lx")
  207. TEXT("\r\n\tnext = 0x%08lx")
  208. TEXT("\r\n\tprev = 0x%08lx")
  209. TEXT("\r\n\tIndex = 0x%08lx")
  210. TEXT("\r\n\tName = %s")
  211. TEXT("\r\n\tUseCount = 0x%08lx")
  212. TEXT("\r\n\tPath = %s")
  213. TEXT("\r\n\tDrive = 0x%08lx\r\n"),
  214. pVirtualShareBuffer->VFlag,
  215. pVirtualShareBuffer->next,
  216. pVirtualShareBuffer->prev,
  217. pVirtualShareBuffer->Index,
  218. pVirtualShareBuffer->Name,
  219. pVirtualShareBuffer->UseCount,
  220. pVirtualShareBuffer->Path,
  221. pVirtualShareBuffer->Drive
  222. );
  223. if (pVirtualShareBuffer->Drive)
  224. DumpDriveBuffer(pVirtualShareBuffer->Drive);
  225. if (fDoEntireList && pVirtualShareBuffer->next)
  226. DumpVirtualShareBuffer(pVirtualShareBuffer->next);
  227. dprintf(
  228. TEXT("---VIRTUAL_SHARE_BUFFER(0x%08lx)\r\n"),
  229. pVirtualShareBuffer
  230. );
  231. }
  232. else
  233. dprintf(TEXT("Null pVirtualShareBuffer\r\n"));
  234. } // DumpVirtualShareBuffer
  235. void DumpShareList(SHARE_LIST *pShareList)
  236. {
  237. ULONG index;
  238. if (pShareList)
  239. {
  240. dprintf(
  241. TEXT(">>>SHARE_LIST(0x%08lx)(%d entries, %d converting, %s)\r\n"),
  242. pShareList,
  243. pShareList->Count,
  244. pShareList->ConvertCount,
  245. pShareList->Fixup ? TEXT("FIXUP") : TEXT("NO FIXUP")
  246. );
  247. for (index = 0; index < pShareList->Count; index++ )
  248. DumpShareBuffer(&pShareList->SList[index]);
  249. }
  250. else
  251. dprintf(TEXT("Null pShareList\r\n"));
  252. } // DumpShareList
  253. void DumpShareBuffer(SHARE_BUFFER *pShareBuffer)
  254. {
  255. if (pShareBuffer)
  256. {
  257. dprintf(
  258. TEXT("+++SHARE_BUFFER(0x%08lx)"),
  259. pShareBuffer
  260. );
  261. dprintf(
  262. TEXT("\r\n\tVFlag = 0x%08lx")
  263. TEXT("\r\n\tIndex = 0x%08lx")
  264. TEXT("\r\n\tName = %s")
  265. TEXT("\r\n\tConvert = 0x%08lx")
  266. TEXT("\r\n\tHiddenFiles = 0x%08lx")
  267. TEXT("\r\n\tSystemFiles = 0x%08lx")
  268. TEXT("\r\n\tToFat = 0x%08lx")
  269. TEXT("\r\n\tRoot = 0x%08lx")
  270. TEXT("\r\n\tDrive = 0x%08lx")
  271. TEXT("\r\n\tSize = 0x%08lx")
  272. TEXT("\r\n\tPath = %s")
  273. TEXT("\r\n\tSubDir = %s")
  274. TEXT("\r\n\tVirtual = 0x%08lx")
  275. TEXT("\r\n\tDestShare = 0x%08lx\r\n"),
  276. pShareBuffer->VFlag,
  277. pShareBuffer->Index,
  278. pShareBuffer->Name,
  279. pShareBuffer->Convert,
  280. pShareBuffer->HiddenFiles,
  281. pShareBuffer->SystemFiles,
  282. pShareBuffer->ToFat,
  283. pShareBuffer->Root,
  284. pShareBuffer->Drive,
  285. pShareBuffer->Size,
  286. pShareBuffer->Path,
  287. pShareBuffer->SubDir,
  288. pShareBuffer->Virtual,
  289. pShareBuffer->DestShare
  290. );
  291. if (pShareBuffer->Root)
  292. DumpDirBuffer(pShareBuffer->Root);
  293. if (pShareBuffer->Drive)
  294. DumpDriveBuffer(pShareBuffer->Drive);
  295. if (pShareBuffer->DestShare)
  296. if (!pShareBuffer->Virtual)
  297. DumpShareBuffer(pShareBuffer->DestShare);
  298. else
  299. DumpVirtualShareBuffer((VIRTUAL_SHARE_BUFFER *)pShareBuffer->DestShare);
  300. dprintf(
  301. TEXT("---SHARE_BUFFER(0x%08lx)\r\n"),
  302. pShareBuffer
  303. );
  304. }
  305. else
  306. dprintf(TEXT("Null pShareBuffer\r\n"));
  307. } // DumpShareBuffer
  308. void DumpDriveList(DRIVE_LIST *pDriveList)
  309. {
  310. ULONG index;
  311. if (pDriveList)
  312. {
  313. dprintf(TEXT(">>>DRIVE_LIST(0x%08lx)(%d entries)\r\n"), pDriveList, pDriveList->Count);
  314. for (index = 0; index < pDriveList->Count; index++ )
  315. DumpDriveBuffer(&pDriveList->DList[index]);
  316. }
  317. else
  318. dprintf(TEXT("Null pDriveList\r\n"));
  319. } // DumpDriveList
  320. void DumpDriveBuffer(DRIVE_BUFFER *pDriveBuffer)
  321. {
  322. if (pDriveBuffer)
  323. {
  324. dprintf(
  325. TEXT("+++DRIVE_BUFFER(0x%08lx)"),
  326. pDriveBuffer
  327. );
  328. dprintf(
  329. TEXT("\r\n\tType = 0x%08lx")
  330. TEXT("\r\n\tDrive = %s")
  331. TEXT("\r\n\tDriveType = %s")
  332. TEXT("\r\n\tName = %s")
  333. TEXT("\r\n\tTotalSpace = 0x%08lx")
  334. TEXT("\r\n\tFreeSpace = 0x%08lx")
  335. TEXT("\r\n\tAllocSpace = 0x%08lx\r\n"),
  336. pDriveBuffer->Type,
  337. pDriveBuffer->Drive,
  338. pDriveBuffer->DriveType,
  339. pDriveBuffer->Name,
  340. pDriveBuffer->TotalSpace,
  341. pDriveBuffer->FreeSpace,
  342. pDriveBuffer->AllocSpace
  343. );
  344. dprintf(
  345. TEXT("---DRIVE_BUFFER(0x%08lx)\r\n"),
  346. pDriveBuffer
  347. );
  348. }
  349. else
  350. dprintf(TEXT("Null pDriveBuffer)\r\n"));
  351. } // DumpDriveBuffer
  352. void DumpDirBuffer(DIR_BUFFER *pDirBuffer)
  353. {
  354. if (pDirBuffer)
  355. {
  356. dprintf(
  357. TEXT("+++DIR_BUFFER(0x%08lx)"),
  358. pDirBuffer
  359. );
  360. dprintf(
  361. TEXT("\r\n\tName = %s")
  362. TEXT("\r\n\tparent = 0x%08lx")
  363. TEXT("\r\n\tLast = 0x%08lx")
  364. TEXT("\r\n\tAttributes = 0x%08lx")
  365. TEXT("\r\n\tConvert = 0x%08lx")
  366. TEXT("\r\n\tSpecial = 0x%08lx")
  367. TEXT("\r\n\tDirList = 0x%08lx")
  368. TEXT("\r\n\tFileList = 0x%08lx\r\n"),
  369. pDirBuffer->Name,
  370. pDirBuffer->parent,
  371. pDirBuffer->Last,
  372. pDirBuffer->Attributes,
  373. pDirBuffer->Convert,
  374. pDirBuffer->Special,
  375. pDirBuffer->DirList,
  376. pDirBuffer->FileList
  377. );
  378. // if (pDirBuffer->DirList)
  379. // DumpDirList(pDirBuffer->DirList);
  380. // if (pDirBuffer->FileList)
  381. // DumpFileList(pDirBuffer->FileList);
  382. dprintf(
  383. TEXT("---DIR_BUFFER(0x%08lx)\r\n"),
  384. pDirBuffer
  385. );
  386. }
  387. else
  388. dprintf(TEXT("Null pDirBuffer\r\n"));
  389. } // DumpDirBuffer
  390. #endif