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.

1560 lines
43 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1990 - 2000
  3. All rights reserved.
  4. Module Name:
  5. dbgmain.c
  6. Abstract:
  7. This module provides all the Spooler Subsystem Debugger extensions.
  8. Author:
  9. Krishna Ganugapati (KrishnaG) 1-July-1993
  10. Revision History:
  11. Matthew Felton (MattFe) July 1994 Added flag decode and cleanup
  12. --*/
  13. #include "precomp.h"
  14. #pragma hdrstop
  15. #include "dbglocal.h"
  16. #define VERBOSE_ON 1
  17. #define VERBOSE_OFF 0
  18. DWORD dwGlobalAddress = 32;
  19. DWORD dwGlobalCount = 48;
  20. BOOL help(
  21. HANDLE hCurrentProcess,
  22. HANDLE hCurrentThread,
  23. DWORD dwCurrentPc,
  24. PNTSD_EXTENSION_APIS lpExtensionApis,
  25. LPSTR lpArgumentString)
  26. {
  27. PNTSD_OUTPUT_ROUTINE Print;
  28. PNTSD_GET_EXPRESSION EvalExpression;
  29. PNTSD_GET_SYMBOL GetSymbol;
  30. Print = lpExtensionApis->lpOutputRoutine;
  31. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  32. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  33. while (*lpArgumentString == ' ')
  34. lpArgumentString++;
  35. Print("Windows NT Spooler Subsystem - debugging extensions\n");
  36. Print("help - prints this list of debugging commands\n");
  37. Print("d [addr] - dumps a spooler structure at [addr]\n");
  38. Print("dc [addr] - dumps a change structure at [addr]\n");
  39. Print("dci [addr] - dumps a change info structure at [addr]\n");
  40. Print("ds - dumps all INISPOOLER structures\n");
  41. Print("dp - dumps all INIPRINTER structures pointed to by IniSpooler\n");
  42. Print("dmo - dumps all INIMONITOR structures pointed to by IniSpooler\n");
  43. Print("de - dumps all INIENVIRONMENT structures pointed to by IniSpooler\n");
  44. Print("dpo - dumps all INIPORT structures pointed to by IniSpooler\n");
  45. Print("df - dumps all INIFORM structures pointed to by IniSpooler\n");
  46. Print("dnp - dumps all ININETPRINT structures pointed to by IniSpooler\n");
  47. Print("dd - dumps all INIDRIVER structures pointed to by IniSpooler\n");
  48. Print("dpv - dumps all PROVIDOR structures in the router\n");
  49. Print("dtp [c#] - dumps all or first [c#] WIN32THREAD structures in the threadpool\n");
  50. Print("w32 - dumps all Win32Spl handles WSPOOL\n");
  51. Print("dll [c#] [addr] - dumps all or [c#] structures (based on sig) at [addr]\n");
  52. Print("dsd [addr] - dumps a security descriptor starting from [addr]\n");
  53. Print("ddev [addr] - dumps a devmode structure starting from [addr]\n");
  54. Print("dam [addr] - dumps a security access mask starting at [addr]\n");
  55. Print("ct [addr] [arg0] - creates a thread at addr with 1 parm: [argv0]\n");
  56. Print("dpi2 [c#] addr - dumps 1 or [c#] PRINTER_INFO_2 structures\n");
  57. Print("dpi0 [c#] addr - dumps 1 or [c#] PRINTER_INFO_STRESS structures\n");
  58. Print("dfi1 [c#] addr - dumps 1 or [c#] FORMS_INFO_1 structures\n");
  59. Print("dpdef addr - dumps PRINTER_DEFAULTS structure\n");
  60. Print("handle - dumps ClientHandleCount\n");
  61. return(TRUE);
  62. DBG_UNREFERENCED_PARAMETER(hCurrentProcess);
  63. DBG_UNREFERENCED_PARAMETER(hCurrentThread);
  64. DBG_UNREFERENCED_PARAMETER(dwCurrentPc);
  65. }
  66. BOOL d(
  67. HANDLE hCurrentProcess,
  68. HANDLE hCurrentThread,
  69. DWORD dwCurrentPc,
  70. PNTSD_EXTENSION_APIS lpExtensionApis,
  71. LPSTR lpArgumentString)
  72. {
  73. PNTSD_OUTPUT_ROUTINE Print;
  74. PNTSD_GET_EXPRESSION EvalExpression;
  75. PNTSD_GET_SYMBOL GetSymbol;
  76. UNREFERENCED_PARAMETER(hCurrentProcess);
  77. UNREFERENCED_PARAMETER(hCurrentThread);
  78. UNREFERENCED_PARAMETER(dwCurrentPc);
  79. Print = lpExtensionApis->lpOutputRoutine;
  80. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  81. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  82. while (*lpArgumentString == ' ')
  83. lpArgumentString++;
  84. if (*lpArgumentString == '\0') {
  85. Print("Usage: d [address] - Dumps internal Spooler structure based on signature\n");
  86. } else {
  87. UINT_PTR address;
  88. address = EvalExpression(lpArgumentString);
  89. Print("%x ", address);
  90. if (!DbgDumpStructure(hCurrentProcess, Print, (UINT_PTR)address))
  91. return(0);
  92. }
  93. return 0;
  94. DBG_UNREFERENCED_PARAMETER(hCurrentProcess);
  95. DBG_UNREFERENCED_PARAMETER(hCurrentThread);
  96. DBG_UNREFERENCED_PARAMETER(dwCurrentPc);
  97. }
  98. BOOL dc(
  99. HANDLE hCurrentProcess,
  100. HANDLE hCurrentThread,
  101. DWORD dwCurrentPc,
  102. PNTSD_EXTENSION_APIS lpExtensionApis,
  103. LPSTR lpArgumentString)
  104. {
  105. PNTSD_OUTPUT_ROUTINE Print;
  106. PNTSD_GET_EXPRESSION EvalExpression;
  107. PNTSD_GET_SYMBOL GetSymbol;
  108. UINT_PTR Address = 0;
  109. BOOL bThereAreOptions = TRUE;
  110. UNREFERENCED_PARAMETER(hCurrentProcess);
  111. UNREFERENCED_PARAMETER(hCurrentThread);
  112. UNREFERENCED_PARAMETER(dwCurrentPc);
  113. Print = lpExtensionApis->lpOutputRoutine;
  114. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  115. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  116. while (bThereAreOptions) {
  117. while (*lpArgumentString == ' ') {
  118. lpArgumentString++;
  119. }
  120. switch (*lpArgumentString) {
  121. default: // go get the address because there's nothing else
  122. bThereAreOptions = FALSE;
  123. break;
  124. }
  125. }
  126. Address = EvalExpression(lpArgumentString);
  127. DbgDumpChange(hCurrentProcess, Print, (PCHANGE)Address);
  128. //
  129. // Add Command to the Command Queue
  130. //
  131. return TRUE;
  132. DBG_UNREFERENCED_PARAMETER(hCurrentProcess);
  133. DBG_UNREFERENCED_PARAMETER(hCurrentThread);
  134. DBG_UNREFERENCED_PARAMETER(dwCurrentPc);
  135. }
  136. BOOL dci(
  137. HANDLE hCurrentProcess,
  138. HANDLE hCurrentThread,
  139. DWORD dwCurrentPc,
  140. PNTSD_EXTENSION_APIS lpExtensionApis,
  141. LPSTR lpArgumentString)
  142. {
  143. PNTSD_OUTPUT_ROUTINE Print;
  144. PNTSD_GET_EXPRESSION EvalExpression;
  145. PNTSD_GET_SYMBOL GetSymbol;
  146. CHANGEINFO ChangeInfo;
  147. UINT_PTR Address = 0;
  148. BOOL bThereAreOptions = TRUE;
  149. UNREFERENCED_PARAMETER(hCurrentProcess);
  150. UNREFERENCED_PARAMETER(hCurrentThread);
  151. UNREFERENCED_PARAMETER(dwCurrentPc);
  152. Print = lpExtensionApis->lpOutputRoutine;
  153. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  154. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  155. while (bThereAreOptions) {
  156. while (*lpArgumentString == ' ') {
  157. lpArgumentString++;
  158. }
  159. switch (*lpArgumentString) {
  160. default: // go get the address because there's nothing else
  161. bThereAreOptions = FALSE;
  162. break;
  163. }
  164. }
  165. Address = EvalExpression(lpArgumentString);
  166. // if we've got no address, then quit now - nothing we can do
  167. if (Address == 0) {
  168. return(0);
  169. }
  170. movestruct(Address, &ChangeInfo, CHANGEINFO);
  171. DbgDumpChangeInfo(hCurrentProcess, Print, &ChangeInfo);
  172. // Add Command to the Command Queue
  173. return TRUE;
  174. DBG_UNREFERENCED_PARAMETER(hCurrentProcess);
  175. DBG_UNREFERENCED_PARAMETER(hCurrentThread);
  176. DBG_UNREFERENCED_PARAMETER(dwCurrentPc);
  177. }
  178. PWSPOOL
  179. GetpFirstWSpool(
  180. HANDLE hCurrentProcess,
  181. PNTSD_EXTENSION_APIS lpExtensionApis,
  182. LPSTR lpArgumentString)
  183. {
  184. PNTSD_OUTPUT_ROUTINE Print;
  185. PNTSD_GET_SYMBOL GetSymbol;
  186. PNTSD_GET_EXPRESSION EvalExpression;
  187. ULONG_PTR dwAddrGlobal;
  188. PWSPOOL pWSpool;
  189. Print = lpExtensionApis->lpOutputRoutine;
  190. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  191. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  192. GetAddress(dwAddrGlobal, "win32spl!pFirstWSpool");
  193. movestruct((PVOID)dwAddrGlobal,&pWSpool, PWSPOOL);
  194. return pWSpool;
  195. }
  196. BOOL w32(
  197. HANDLE hCurrentProcess,
  198. HANDLE hCurrentThread,
  199. DWORD dwCurrentPc,
  200. PNTSD_EXTENSION_APIS lpExtensionApis,
  201. LPSTR lpArgumentString)
  202. {
  203. PNTSD_OUTPUT_ROUTINE Print;
  204. PNTSD_GET_EXPRESSION EvalExpression;
  205. PNTSD_GET_SYMBOL GetSymbol;
  206. BOOL bThereAreOptions = TRUE;
  207. DWORD dwCount = 0;
  208. UINT_PTR Address = 0;
  209. PWSPOOL pWSpool = NULL;
  210. UNREFERENCED_PARAMETER(hCurrentProcess);
  211. UNREFERENCED_PARAMETER(hCurrentThread);
  212. UNREFERENCED_PARAMETER(dwCurrentPc);
  213. Print = lpExtensionApis->lpOutputRoutine;
  214. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  215. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  216. while (bThereAreOptions) {
  217. while (isspace(*lpArgumentString)) {
  218. lpArgumentString++;
  219. }
  220. switch (*lpArgumentString) {
  221. case 'c':
  222. lpArgumentString++;
  223. dwCount = EvalValue(&lpArgumentString, EvalExpression, Print);
  224. break;
  225. default: // go get the address because there's nothing else
  226. bThereAreOptions = FALSE;
  227. break;
  228. }
  229. }
  230. if (*lpArgumentString != 0) {
  231. Address = EvalValue(&lpArgumentString, EvalExpression, Print);
  232. }
  233. // if we've got no address, then quit now - nothing we can do
  234. if (Address == 0) {
  235. pWSpool = GetpFirstWSpool( hCurrentProcess, lpExtensionApis, lpArgumentString );
  236. Address = (UINT_PTR)pWSpool;
  237. }
  238. dwGlobalCount = dwCount;
  239. if ( Address != 0 ) {
  240. if (!DbgDumpLL(hCurrentProcess, Print, (UINT_PTR)Address, dwCount? TRUE:FALSE, dwCount, &dwGlobalAddress))
  241. return(0);
  242. } else {
  243. Print("There are NO Win32spl Handles\n");
  244. }
  245. // Add Command to the Command Queue
  246. return TRUE;
  247. DBG_UNREFERENCED_PARAMETER(hCurrentProcess);
  248. DBG_UNREFERENCED_PARAMETER(hCurrentThread);
  249. DBG_UNREFERENCED_PARAMETER(dwCurrentPc);
  250. }
  251. PINISPOOLER
  252. GetLocalIniSpooler(
  253. HANDLE hCurrentProcess,
  254. PNTSD_EXTENSION_APIS lpExtensionApis,
  255. LPSTR lpArgumentString)
  256. {
  257. PINISPOOLER pIniSpooler;
  258. PNTSD_OUTPUT_ROUTINE Print;
  259. PNTSD_GET_SYMBOL GetSymbol;
  260. PNTSD_GET_EXPRESSION EvalExpression;
  261. ULONG_PTR dwAddrGlobal;
  262. Print = lpExtensionApis->lpOutputRoutine;
  263. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  264. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  265. GetAddress(dwAddrGlobal, "localspl!pLocalIniSpooler");
  266. movestruct((PVOID)dwAddrGlobal,&pIniSpooler, PINISPOOLER);
  267. return pIniSpooler;
  268. }
  269. BOOL ds(
  270. HANDLE hCurrentProcess,
  271. HANDLE hCurrentThread,
  272. DWORD dwCurrentPc,
  273. PNTSD_EXTENSION_APIS lpExtensionApis,
  274. LPSTR lpArgumentString)
  275. {
  276. PNTSD_OUTPUT_ROUTINE Print;
  277. PNTSD_GET_EXPRESSION EvalExpression;
  278. PNTSD_GET_SYMBOL GetSymbol;
  279. INISPOOLER IniSpooler;
  280. PINISPOOLER pIniSpooler;
  281. BOOL bThereAreOptions = TRUE;
  282. DWORD dwCount = 0;
  283. UINT_PTR Address = 0;
  284. UNREFERENCED_PARAMETER(hCurrentProcess);
  285. UNREFERENCED_PARAMETER(hCurrentThread);
  286. UNREFERENCED_PARAMETER(dwCurrentPc);
  287. Print = lpExtensionApis->lpOutputRoutine;
  288. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  289. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  290. while (bThereAreOptions) {
  291. while (isspace(*lpArgumentString)) {
  292. lpArgumentString++;
  293. }
  294. switch (*lpArgumentString) {
  295. case 'c':
  296. lpArgumentString++;
  297. dwCount = EvalValue(&lpArgumentString, EvalExpression, Print);
  298. break;
  299. default: // go get the address because there's nothing else
  300. bThereAreOptions = FALSE;
  301. break;
  302. }
  303. }
  304. if (*lpArgumentString != 0) {
  305. Address = EvalValue(&lpArgumentString, EvalExpression, Print);
  306. }
  307. // if we've got no address, then quit now - nothing we can do
  308. if (Address == 0) {
  309. // Print("We have a Null address\n");
  310. pIniSpooler = GetLocalIniSpooler( hCurrentProcess, lpExtensionApis, lpArgumentString );
  311. Address = (UINT_PTR)pIniSpooler;
  312. }
  313. dwGlobalCount = dwCount;
  314. if (!DbgDumpLL(hCurrentProcess, Print, (UINT_PTR)Address, dwCount? TRUE:FALSE, dwCount, &dwGlobalAddress))
  315. return(0);
  316. // Add Command to the Command Queue
  317. return TRUE;
  318. DBG_UNREFERENCED_PARAMETER(hCurrentProcess);
  319. DBG_UNREFERENCED_PARAMETER(hCurrentThread);
  320. DBG_UNREFERENCED_PARAMETER(dwCurrentPc);
  321. }
  322. PWIN32THREAD
  323. GetThreadPoolHead(
  324. HANDLE hCurrentProcess,
  325. PNTSD_EXTENSION_APIS lpExtensionApis,
  326. LPSTR lpArgumentString)
  327. {
  328. PVOID pThreadPool = NULL;
  329. PWIN32THREAD pHead = NULL;
  330. PNTSD_OUTPUT_ROUTINE Print;
  331. PNTSD_GET_SYMBOL GetSymbol;
  332. PNTSD_GET_EXPRESSION EvalExpression;
  333. ULONG_PTR dwAddrGlobal;
  334. Print = lpExtensionApis->lpOutputRoutine;
  335. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  336. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  337. GetAddress(dwAddrGlobal, "win32spl!g_pThreadPool");
  338. movemem((PVOID)dwAddrGlobal, &pThreadPool, sizeof(PVOID));
  339. movemem(pThreadPool, &pHead, sizeof(PWIN32THREAD));
  340. return pHead;
  341. }
  342. BOOL dtp(
  343. HANDLE hCurrentProcess,
  344. HANDLE hCurrentThread,
  345. DWORD dwCurrentPc,
  346. PNTSD_EXTENSION_APIS lpExtensionApis,
  347. LPSTR lpArgumentString)
  348. {
  349. PNTSD_OUTPUT_ROUTINE Print;
  350. PNTSD_GET_EXPRESSION EvalExpression;
  351. PNTSD_GET_SYMBOL GetSymbol;
  352. PWIN32THREAD pWin32Thread;
  353. BOOL bThereAreOptions = TRUE;
  354. DWORD dwCount = 0;
  355. UINT_PTR Address = 0;
  356. UNREFERENCED_PARAMETER(hCurrentProcess);
  357. UNREFERENCED_PARAMETER(hCurrentThread);
  358. UNREFERENCED_PARAMETER(dwCurrentPc);
  359. Print = lpExtensionApis->lpOutputRoutine;
  360. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  361. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  362. while (bThereAreOptions) {
  363. while (isspace(*lpArgumentString)) {
  364. lpArgumentString++;
  365. }
  366. switch (*lpArgumentString) {
  367. case 'c':
  368. lpArgumentString++;
  369. dwCount = EvalValue(&lpArgumentString, EvalExpression, Print);
  370. break;
  371. default: // go get the address because there's nothing else
  372. bThereAreOptions = FALSE;
  373. break;
  374. }
  375. }
  376. pWin32Thread = GetThreadPoolHead( hCurrentProcess, lpExtensionApis, lpArgumentString );
  377. Address = (UINT_PTR)pWin32Thread;
  378. dwGlobalCount = dwCount;
  379. if (!DbgDumpLL(hCurrentProcess, Print, (UINT_PTR)Address, dwCount? TRUE:FALSE, dwCount, &dwGlobalAddress))
  380. return(0);
  381. // Add Command to the Command Queue
  382. return TRUE;
  383. DBG_UNREFERENCED_PARAMETER(hCurrentProcess);
  384. DBG_UNREFERENCED_PARAMETER(hCurrentThread);
  385. DBG_UNREFERENCED_PARAMETER(dwCurrentPc);
  386. }
  387. BOOL dll(
  388. HANDLE hCurrentProcess,
  389. HANDLE hCurrentThread,
  390. DWORD dwCurrentPc,
  391. PNTSD_EXTENSION_APIS lpExtensionApis,
  392. LPSTR lpArgumentString)
  393. {
  394. PNTSD_OUTPUT_ROUTINE Print;
  395. PNTSD_GET_EXPRESSION EvalExpression;
  396. PNTSD_GET_SYMBOL GetSymbol;
  397. UINT_PTR Address = 0;
  398. DWORD dwCount = 0;
  399. BOOL bThereAreOptions = TRUE;
  400. UNREFERENCED_PARAMETER(hCurrentProcess);
  401. UNREFERENCED_PARAMETER(hCurrentThread);
  402. UNREFERENCED_PARAMETER(dwCurrentPc);
  403. Print = lpExtensionApis->lpOutputRoutine;
  404. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  405. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  406. while (bThereAreOptions) {
  407. while (*lpArgumentString == ' ') {
  408. lpArgumentString++;
  409. }
  410. switch (*lpArgumentString) {
  411. case 'c':
  412. lpArgumentString++;
  413. dwCount = EvalValue(&lpArgumentString, EvalExpression, Print);
  414. break;
  415. default: // go get the address because there's nothing else
  416. bThereAreOptions = FALSE;
  417. break;
  418. }
  419. }
  420. Address = EvalExpression(lpArgumentString);
  421. // if we've got no address, then quit now - nothing we can do
  422. if (Address == 0) {
  423. return(0);
  424. }
  425. // if we do have a count which is valid and > 0, call the incremental dump
  426. // otherwise call the dump all function.
  427. dwGlobalCount = dwCount;
  428. if (!DbgDumpLL(hCurrentProcess, Print, (UINT_PTR)Address, dwCount? TRUE: FALSE, dwCount, &dwGlobalAddress)) {
  429. return(0);
  430. }
  431. // Add Command to the Command Queue
  432. return TRUE;
  433. DBG_UNREFERENCED_PARAMETER(hCurrentProcess);
  434. DBG_UNREFERENCED_PARAMETER(hCurrentThread);
  435. DBG_UNREFERENCED_PARAMETER(dwCurrentPc);
  436. }
  437. BOOL dp(
  438. HANDLE hCurrentProcess,
  439. HANDLE hCurrentThread,
  440. DWORD dwCurrentPc,
  441. PNTSD_EXTENSION_APIS lpExtensionApis,
  442. LPSTR lpArgumentString)
  443. {
  444. PNTSD_OUTPUT_ROUTINE Print;
  445. PNTSD_GET_EXPRESSION EvalExpression;
  446. PNTSD_GET_SYMBOL GetSymbol;
  447. INISPOOLER IniSpooler;
  448. PINISPOOLER pIniSpooler;
  449. UINT_PTR Address = 0;
  450. BOOL bThereAreOptions = TRUE;
  451. DWORD dwCount;
  452. Print = lpExtensionApis->lpOutputRoutine;
  453. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  454. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  455. while (bThereAreOptions) {
  456. while (isspace(*lpArgumentString)) {
  457. lpArgumentString++;
  458. }
  459. switch (*lpArgumentString) {
  460. case 'c':
  461. lpArgumentString++;
  462. dwCount = EvalValue(&lpArgumentString, EvalExpression, Print);
  463. break;
  464. default: // go get the address because there's nothing else
  465. bThereAreOptions = FALSE;
  466. break;
  467. }
  468. }
  469. if (*lpArgumentString != 0) {
  470. Address = EvalValue(&lpArgumentString, EvalExpression, Print);
  471. }
  472. // if we've got no address, then quit now - nothing we can do
  473. if (Address == 0) {
  474. // Print("We have a Null address\n");
  475. pIniSpooler = GetLocalIniSpooler( hCurrentProcess, lpExtensionApis, lpArgumentString );
  476. movestruct((PVOID)pIniSpooler,&IniSpooler, INISPOOLER);
  477. Address = (UINT_PTR)IniSpooler.pIniPrinter;
  478. }
  479. dwGlobalCount = dwCount;
  480. if (!DbgDumpLL(hCurrentProcess, Print, (UINT_PTR)Address, dwCount? TRUE:FALSE, dwCount, &dwGlobalAddress))
  481. return(0);
  482. Print("dwGlobalAddress %.8x dwGlobalCount %d\n", dwGlobalAddress, dwGlobalCount);
  483. // Add Command to the Command Queue
  484. return TRUE;
  485. }
  486. BOOL de(
  487. HANDLE hCurrentProcess,
  488. HANDLE hCurrentThread,
  489. DWORD dwCurrentPc,
  490. PNTSD_EXTENSION_APIS lpExtensionApis,
  491. LPSTR lpArgumentString)
  492. {
  493. PNTSD_OUTPUT_ROUTINE Print;
  494. PNTSD_GET_EXPRESSION EvalExpression;
  495. PNTSD_GET_SYMBOL GetSymbol;
  496. INISPOOLER IniSpooler;
  497. PINISPOOLER pIniSpooler;
  498. UINT_PTR Address = 0;
  499. DWORD dwCount = 0;
  500. BOOL bThereAreOptions = TRUE;
  501. UNREFERENCED_PARAMETER(hCurrentProcess);
  502. UNREFERENCED_PARAMETER(hCurrentThread);
  503. UNREFERENCED_PARAMETER(dwCurrentPc);
  504. Print = lpExtensionApis->lpOutputRoutine;
  505. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  506. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  507. while (bThereAreOptions) {
  508. while (isspace(*lpArgumentString)) {
  509. lpArgumentString++;
  510. }
  511. switch (*lpArgumentString) {
  512. case 'c':
  513. lpArgumentString++;
  514. dwCount = EvalValue(&lpArgumentString, EvalExpression, Print);
  515. break;
  516. default: // go get the address because there's nothing else
  517. bThereAreOptions = FALSE;
  518. break;
  519. }
  520. }
  521. if (*lpArgumentString != 0) {
  522. Address = EvalValue(&lpArgumentString, EvalExpression, Print);
  523. }
  524. // if we've got no address, then quit now - nothing we can do
  525. if (Address == 0) {
  526. // Print("We have a Null address\n");
  527. pIniSpooler = GetLocalIniSpooler( hCurrentProcess, lpExtensionApis, lpArgumentString );
  528. movestruct((PVOID)pIniSpooler,&IniSpooler, INISPOOLER);
  529. Address = (UINT_PTR)IniSpooler.pIniEnvironment;
  530. }
  531. dwGlobalCount = dwCount;
  532. if (!DbgDumpLL(hCurrentProcess, Print, (UINT_PTR)Address, dwCount? TRUE:FALSE, dwCount, &dwGlobalAddress))
  533. return(0);
  534. // Add Command to the Command Queue
  535. return 0;
  536. DBG_UNREFERENCED_PARAMETER(hCurrentProcess);
  537. DBG_UNREFERENCED_PARAMETER(hCurrentThread);
  538. DBG_UNREFERENCED_PARAMETER(dwCurrentPc);
  539. }
  540. BOOL dd(
  541. HANDLE hCurrentProcess,
  542. HANDLE hCurrentThread,
  543. DWORD dwCurrentPc,
  544. PNTSD_EXTENSION_APIS lpExtensionApis,
  545. LPSTR lpArgumentString)
  546. {
  547. PNTSD_OUTPUT_ROUTINE Print;
  548. PNTSD_GET_EXPRESSION EvalExpression;
  549. PNTSD_GET_SYMBOL GetSymbol;
  550. INISPOOLER IniSpooler;
  551. PINISPOOLER pIniSpooler;
  552. INIENVIRONMENT IniEnvironment;
  553. PINIENVIRONMENT pIniEnvironment;
  554. INIVERSION IniVersion;
  555. PINIVERSION pIniVersion;
  556. UINT_PTR Address = 0;
  557. WCHAR Buffer[MAX_PATH+1];
  558. UNREFERENCED_PARAMETER(hCurrentProcess);
  559. UNREFERENCED_PARAMETER(hCurrentThread);
  560. UNREFERENCED_PARAMETER(dwCurrentPc);
  561. Print = lpExtensionApis->lpOutputRoutine;
  562. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  563. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  564. pIniSpooler = GetLocalIniSpooler( hCurrentProcess, lpExtensionApis, lpArgumentString );
  565. movestruct((PVOID)pIniSpooler,&IniSpooler, INISPOOLER);
  566. for (pIniEnvironment = IniSpooler.pIniEnvironment;
  567. pIniEnvironment;
  568. pIniEnvironment = IniEnvironment.pNext) {
  569. movestruct((PVOID)pIniEnvironment,&IniEnvironment, INIENVIRONMENT);
  570. movemem(IniEnvironment.pName, Buffer, sizeof(WCHAR)*MAX_PATH);
  571. (*Print)("\nEnvironment %ws\n", Buffer);
  572. for (pIniVersion = IniEnvironment.pIniVersion;
  573. pIniVersion;
  574. pIniVersion = IniVersion.pNext) {
  575. movestruct((PVOID)pIniVersion,&IniVersion, INIVERSION);
  576. movemem(IniVersion.pName, Buffer, sizeof(WCHAR)*MAX_PATH);
  577. (*Print)("\nVersion %ws\n", Buffer);
  578. Address = (UINT_PTR)IniVersion.pIniDriver;
  579. if (!DbgDumpLL(hCurrentProcess, Print, (UINT_PTR)Address, FALSE, 0, &dwGlobalAddress))
  580. return(0);
  581. }
  582. }
  583. // Add Command to the Command Queue
  584. return 0;
  585. DBG_UNREFERENCED_PARAMETER(hCurrentProcess);
  586. DBG_UNREFERENCED_PARAMETER(hCurrentThread);
  587. DBG_UNREFERENCED_PARAMETER(dwCurrentPc);
  588. }
  589. BOOL dpo(
  590. HANDLE hCurrentProcess,
  591. HANDLE hCurrentThread,
  592. DWORD dwCurrentPc,
  593. PNTSD_EXTENSION_APIS lpExtensionApis,
  594. LPSTR lpArgumentString)
  595. {
  596. PNTSD_OUTPUT_ROUTINE Print;
  597. PNTSD_GET_EXPRESSION EvalExpression;
  598. PNTSD_GET_SYMBOL GetSymbol;
  599. INISPOOLER IniSpooler;
  600. PINISPOOLER pIniSpooler;
  601. UINT_PTR Address = 0;
  602. DWORD dwCount = 0;
  603. BOOL bThereAreOptions = TRUE;
  604. UNREFERENCED_PARAMETER(hCurrentProcess);
  605. UNREFERENCED_PARAMETER(hCurrentThread);
  606. UNREFERENCED_PARAMETER(dwCurrentPc);
  607. Print = lpExtensionApis->lpOutputRoutine;
  608. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  609. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  610. while (bThereAreOptions) {
  611. while (isspace(*lpArgumentString)) {
  612. lpArgumentString++;
  613. }
  614. switch (*lpArgumentString) {
  615. case 'c':
  616. lpArgumentString++;
  617. dwCount = EvalValue(&lpArgumentString, EvalExpression, Print);
  618. break;
  619. default: // go get the address because there's nothing else
  620. bThereAreOptions = FALSE;
  621. break;
  622. }
  623. }
  624. if (*lpArgumentString != 0) {
  625. Address = EvalValue(&lpArgumentString, EvalExpression, Print);
  626. }
  627. // if we've got no address, then quit now - nothing we can do
  628. if (Address == 0) {
  629. PSHARED pShared;
  630. SHARED Shared;
  631. // Print("We have a Null address\n");
  632. pIniSpooler = GetLocalIniSpooler( hCurrentProcess, lpExtensionApis, lpArgumentString );
  633. movestruct((PVOID)pIniSpooler,&IniSpooler, INISPOOLER);
  634. Address = (UINT_PTR)IniSpooler.pIniPort;
  635. }
  636. dwGlobalCount = dwCount;
  637. if (!DbgDumpLL(hCurrentProcess, Print, (UINT_PTR)Address, dwCount? TRUE:FALSE, dwCount, &dwGlobalAddress))
  638. return(0);
  639. // Add Command to the Command Queue
  640. return TRUE;
  641. DBG_UNREFERENCED_PARAMETER(hCurrentProcess);
  642. DBG_UNREFERENCED_PARAMETER(hCurrentThread);
  643. DBG_UNREFERENCED_PARAMETER(dwCurrentPc);
  644. }
  645. BOOL dmo(
  646. HANDLE hCurrentProcess,
  647. HANDLE hCurrentThread,
  648. DWORD dwCurrentPc,
  649. PNTSD_EXTENSION_APIS lpExtensionApis,
  650. LPSTR lpArgumentString)
  651. {
  652. PNTSD_OUTPUT_ROUTINE Print;
  653. PNTSD_GET_EXPRESSION EvalExpression;
  654. PNTSD_GET_SYMBOL GetSymbol;
  655. INISPOOLER IniSpooler;
  656. PINISPOOLER pIniSpooler;
  657. UINT_PTR Address = 0;
  658. DWORD dwCount = 0;
  659. BOOL bThereAreOptions = TRUE;
  660. UNREFERENCED_PARAMETER(hCurrentProcess);
  661. UNREFERENCED_PARAMETER(hCurrentThread);
  662. UNREFERENCED_PARAMETER(dwCurrentPc);
  663. Print = lpExtensionApis->lpOutputRoutine;
  664. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  665. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  666. while (bThereAreOptions) {
  667. while (isspace(*lpArgumentString)) {
  668. lpArgumentString++;
  669. }
  670. switch (*lpArgumentString) {
  671. case 'c':
  672. lpArgumentString++;
  673. dwCount = EvalValue(&lpArgumentString, EvalExpression, Print);
  674. break;
  675. default: // go get the address because there's nothing else
  676. bThereAreOptions = FALSE;
  677. break;
  678. }
  679. }
  680. if (*lpArgumentString != 0) {
  681. Address = EvalValue(&lpArgumentString, EvalExpression, Print);
  682. }
  683. // if we've got no address, then quit now - nothing we can do
  684. if (Address == 0) {
  685. PSHARED pShared;
  686. SHARED Shared;
  687. // Print("We have a Null address\n");
  688. pIniSpooler = GetLocalIniSpooler( hCurrentProcess, lpExtensionApis, lpArgumentString );
  689. movestruct((PVOID)pIniSpooler,&IniSpooler, INISPOOLER);
  690. Address = (UINT_PTR)IniSpooler.pIniMonitor;
  691. }
  692. dwGlobalCount = dwCount;
  693. if (!DbgDumpLL(hCurrentProcess, Print, (UINT_PTR)Address, dwCount? TRUE:FALSE, dwCount, &dwGlobalAddress))
  694. return(0);
  695. // Add Command to the Command Queue
  696. return TRUE;
  697. DBG_UNREFERENCED_PARAMETER(hCurrentProcess);
  698. DBG_UNREFERENCED_PARAMETER(hCurrentThread);
  699. DBG_UNREFERENCED_PARAMETER(dwCurrentPc);
  700. }
  701. BOOL dnp(
  702. HANDLE hCurrentProcess,
  703. HANDLE hCurrentThread,
  704. DWORD dwCurrentPc,
  705. PNTSD_EXTENSION_APIS lpExtensionApis,
  706. LPSTR lpArgumentString)
  707. {
  708. PNTSD_OUTPUT_ROUTINE Print;
  709. PNTSD_GET_EXPRESSION EvalExpression;
  710. PNTSD_GET_SYMBOL GetSymbol;
  711. INISPOOLER IniSpooler;
  712. PINISPOOLER pIniSpooler;
  713. UINT_PTR Address = 0;
  714. DWORD dwCount = 0;
  715. BOOL bThereAreOptions = TRUE;
  716. UNREFERENCED_PARAMETER(hCurrentProcess);
  717. UNREFERENCED_PARAMETER(hCurrentThread);
  718. UNREFERENCED_PARAMETER(dwCurrentPc);
  719. Print = lpExtensionApis->lpOutputRoutine;
  720. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  721. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  722. while (bThereAreOptions) {
  723. while (isspace(*lpArgumentString)) {
  724. lpArgumentString++;
  725. }
  726. switch (*lpArgumentString) {
  727. case 'c':
  728. lpArgumentString++;
  729. dwCount = EvalValue(&lpArgumentString, EvalExpression, Print);
  730. break;
  731. default: // go get the address because there's nothing else
  732. bThereAreOptions = FALSE;
  733. break;
  734. }
  735. }
  736. if (*lpArgumentString != 0) {
  737. Address = EvalValue(&lpArgumentString, EvalExpression, Print);
  738. }
  739. // if we've got no address, then quit now - nothing we can do
  740. if (Address == 0) {
  741. // Print("We have a Null address\n");
  742. pIniSpooler = GetLocalIniSpooler( hCurrentProcess, lpExtensionApis, lpArgumentString );
  743. movestruct((PVOID)pIniSpooler,&IniSpooler, INISPOOLER);
  744. Address = (UINT_PTR)IniSpooler.pIniNetPrint;
  745. }
  746. dwGlobalCount = dwCount;
  747. if (!DbgDumpLL(hCurrentProcess, Print, (UINT_PTR)Address, dwCount? TRUE:FALSE, dwCount, &dwGlobalAddress))
  748. return(0);
  749. // Add Command to the Command Queue
  750. return 0;
  751. DBG_UNREFERENCED_PARAMETER(hCurrentProcess);
  752. DBG_UNREFERENCED_PARAMETER(hCurrentThread);
  753. DBG_UNREFERENCED_PARAMETER(dwCurrentPc);
  754. }
  755. BOOL df(
  756. HANDLE hCurrentProcess,
  757. HANDLE hCurrentThread,
  758. DWORD dwCurrentPc,
  759. PNTSD_EXTENSION_APIS lpExtensionApis,
  760. LPSTR lpArgumentString)
  761. {
  762. PNTSD_OUTPUT_ROUTINE Print;
  763. PNTSD_GET_EXPRESSION EvalExpression;
  764. PNTSD_GET_SYMBOL GetSymbol;
  765. INISPOOLER IniSpooler;
  766. PINISPOOLER pIniSpooler;
  767. UINT_PTR Address = 0;
  768. DWORD dwCount = 0;
  769. BOOL bThereAreOptions = TRUE;
  770. UNREFERENCED_PARAMETER(hCurrentProcess);
  771. UNREFERENCED_PARAMETER(hCurrentThread);
  772. UNREFERENCED_PARAMETER(dwCurrentPc);
  773. Print = lpExtensionApis->lpOutputRoutine;
  774. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  775. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  776. while (bThereAreOptions) {
  777. while (isspace(*lpArgumentString)) {
  778. lpArgumentString++;
  779. }
  780. switch (*lpArgumentString) {
  781. case 'c':
  782. lpArgumentString++;
  783. dwCount = EvalValue(&lpArgumentString, EvalExpression, Print);
  784. break;
  785. default: // go get the address because there's nothing else
  786. bThereAreOptions = FALSE;
  787. break;
  788. }
  789. }
  790. if (*lpArgumentString != 0) {
  791. Address = EvalValue(&lpArgumentString, EvalExpression, Print);
  792. }
  793. // if we've got no address, then quit now - nothing we can do
  794. if (Address == 0) {
  795. // Print("We have a Null address\n");
  796. PSHARED pShared;
  797. SHARED Shared;
  798. pIniSpooler = GetLocalIniSpooler( hCurrentProcess, lpExtensionApis, lpArgumentString );
  799. movestruct((PVOID)pIniSpooler,&IniSpooler, INISPOOLER);
  800. movestruct( (PVOID)IniSpooler.pShared, &Shared, SHARED );
  801. Address = (UINT_PTR)Shared.pIniForm;
  802. }
  803. dwGlobalCount = dwCount;
  804. if (!DbgDumpLL(hCurrentProcess, Print, (UINT_PTR)Address, dwCount? TRUE:FALSE, dwCount, &dwGlobalAddress))
  805. return(0);
  806. // Add Command to the Command Queue
  807. return 0;
  808. DBG_UNREFERENCED_PARAMETER(hCurrentProcess);
  809. DBG_UNREFERENCED_PARAMETER(hCurrentThread);
  810. DBG_UNREFERENCED_PARAMETER(dwCurrentPc);
  811. }
  812. BOOL dsp(
  813. HANDLE hCurrentProcess,
  814. HANDLE hCurrentThread,
  815. DWORD dwCurrentPc,
  816. PNTSD_EXTENSION_APIS lpExtensionApis,
  817. LPSTR lpArgumentString)
  818. {
  819. PNTSD_OUTPUT_ROUTINE Print;
  820. PNTSD_GET_EXPRESSION EvalExpression;
  821. PNTSD_GET_SYMBOL GetSymbol;
  822. INISPOOLER IniSpooler;
  823. PINISPOOLER pIniSpooler;
  824. UINT_PTR Address = (UINT_PTR)NULL;
  825. DWORD dwCount = 0;
  826. BOOL bThereAreOptions = TRUE;
  827. UNREFERENCED_PARAMETER(hCurrentProcess);
  828. UNREFERENCED_PARAMETER(hCurrentThread);
  829. UNREFERENCED_PARAMETER(dwCurrentPc);
  830. Print = lpExtensionApis->lpOutputRoutine;
  831. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  832. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  833. while (bThereAreOptions) {
  834. while (isspace(*lpArgumentString)) {
  835. lpArgumentString++;
  836. }
  837. switch (*lpArgumentString) {
  838. case 'c':
  839. lpArgumentString++;
  840. dwCount = EvalValue(&lpArgumentString, EvalExpression, Print);
  841. break;
  842. default: // go get the address because there's nothing else
  843. bThereAreOptions = FALSE;
  844. break;
  845. }
  846. }
  847. if (*lpArgumentString != 0) {
  848. Address = EvalValue(&lpArgumentString, EvalExpression, Print);
  849. }
  850. // if we've got no address, then quit now - nothing we can do
  851. if (Address == 0) {
  852. // Print("We have a Null address\n");
  853. pIniSpooler = GetLocalIniSpooler( hCurrentProcess, lpExtensionApis, lpArgumentString );
  854. movestruct((PVOID)pIniSpooler,&IniSpooler, INISPOOLER);
  855. Address = (UINT_PTR)IniSpooler.pSpool;
  856. }
  857. dwGlobalCount = dwCount;
  858. if (!DbgDumpLL(hCurrentProcess, Print, (UINT_PTR)Address, dwCount? TRUE:FALSE, dwCount, &dwGlobalAddress))
  859. return(0);
  860. // Add Command to the Command Queue
  861. return 0;
  862. DBG_UNREFERENCED_PARAMETER(hCurrentProcess);
  863. DBG_UNREFERENCED_PARAMETER(hCurrentThread);
  864. DBG_UNREFERENCED_PARAMETER(dwCurrentPc);
  865. }
  866. BOOL next(
  867. HANDLE hCurrentProcess,
  868. HANDLE hCurrentThread,
  869. DWORD dwCurrentPc,
  870. PNTSD_EXTENSION_APIS lpExtensionApis,
  871. LPSTR lpArgumentString)
  872. {
  873. PNTSD_OUTPUT_ROUTINE Print;
  874. PNTSD_GET_EXPRESSION EvalExpression;
  875. PNTSD_GET_SYMBOL GetSymbol;
  876. UINT_PTR Address = 0;
  877. DWORD dwCount = 0;
  878. Print = lpExtensionApis->lpOutputRoutine;
  879. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  880. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  881. Address = dwGlobalAddress; // Let's get the address to dump at
  882. dwCount = dwGlobalCount; // and while we're at it, get the count
  883. Print("Next address: %.8x Count: %d\n", Address, dwCount);
  884. if (Address == 0) {
  885. Print("dump address = <null>; no more data to dump\n");
  886. return(FALSE);
  887. }
  888. if (!DbgDumpLL(hCurrentProcess, Print, (UINT_PTR)Address, dwCount? TRUE:FALSE, dwCount, &dwGlobalAddress))
  889. return(0);
  890. // Add Command to the Command Queue
  891. return (TRUE);
  892. }
  893. BOOL ct(
  894. HANDLE hCurrentProcess,
  895. HANDLE hCurrentThread,
  896. DWORD dwCurrentPc,
  897. PNTSD_EXTENSION_APIS lpExtensionApis,
  898. LPSTR lpArgumentString)
  899. {
  900. PNTSD_OUTPUT_ROUTINE Print;
  901. PNTSD_GET_EXPRESSION EvalExpression;
  902. PNTSD_GET_SYMBOL GetSymbol;
  903. INISPOOLER IniSpooler;
  904. PINISPOOLER pIniSpooler;
  905. UINT_PTR Address = 0;
  906. DWORD dwArg = 0;
  907. BOOL bThereAreOptions = TRUE;
  908. UINT i = 0;
  909. HANDLE hThread;
  910. DWORD dwThreadId;
  911. UNREFERENCED_PARAMETER(hCurrentProcess);
  912. UNREFERENCED_PARAMETER(hCurrentThread);
  913. UNREFERENCED_PARAMETER(dwCurrentPc);
  914. Print = lpExtensionApis->lpOutputRoutine;
  915. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  916. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  917. while (*lpArgumentString) {
  918. while (isspace(*lpArgumentString)) {
  919. lpArgumentString++;
  920. }
  921. switch (i) {
  922. case 0:
  923. Address = EvalValue(&lpArgumentString, EvalExpression, Print);
  924. break;
  925. case 1:
  926. dwArg = EvalValue(&lpArgumentString, EvalExpression, Print);
  927. break;
  928. default:
  929. (*Print)("Usage: ct addr arg0");
  930. return FALSE;
  931. }
  932. i++;
  933. }
  934. hThread = CreateRemoteThread(hCurrentProcess,
  935. NULL,
  936. 0,
  937. (LPTHREAD_START_ROUTINE)Address,
  938. (LPVOID)UIntToPtr(dwArg),
  939. 0,
  940. &dwThreadId);
  941. if (hThread) {
  942. (*Print)("Thread id 0x%x at %x, arg0 %x created.\n",
  943. dwThreadId, Address, dwArg);
  944. CloseHandle(hThread);
  945. return TRUE;
  946. }
  947. return FALSE;
  948. DBG_UNREFERENCED_PARAMETER(hCurrentProcess);
  949. DBG_UNREFERENCED_PARAMETER(hCurrentThread);
  950. DBG_UNREFERENCED_PARAMETER(dwCurrentPc);
  951. }
  952. BOOL dpi2(
  953. HANDLE hCurrentProcess,
  954. HANDLE hCurrentThread,
  955. DWORD dwCurrentPc,
  956. PNTSD_EXTENSION_APIS lpExtensionApis,
  957. LPSTR lpArgumentString)
  958. {
  959. PNTSD_OUTPUT_ROUTINE Print;
  960. PNTSD_GET_EXPRESSION EvalExpression;
  961. PNTSD_GET_SYMBOL GetSymbol;
  962. INISPOOLER IniSpooler;
  963. PINISPOOLER pIniSpooler;
  964. UINT_PTR Address = 0;
  965. BOOL bThereAreOptions = TRUE;
  966. DWORD dwCount = 1;
  967. Print = lpExtensionApis->lpOutputRoutine;
  968. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  969. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  970. while (bThereAreOptions) {
  971. while (isspace(*lpArgumentString)) {
  972. lpArgumentString++;
  973. }
  974. switch (*lpArgumentString) {
  975. case 'c':
  976. lpArgumentString++;
  977. dwCount = EvalValue(&lpArgumentString, EvalExpression, Print);
  978. break;
  979. default: // go get the address because there's nothing else
  980. bThereAreOptions = FALSE;
  981. break;
  982. }
  983. }
  984. if (*lpArgumentString != 0) {
  985. Address = EvalValue(&lpArgumentString, EvalExpression, Print);
  986. }
  987. // if we've got no address, then quit now - nothing we can do
  988. if (Address == 0) {
  989. Print("dpi2 you need to supply an address\n");
  990. return TRUE;
  991. }
  992. if ( !DbgDumpPI2(hCurrentProcess, Print, (UINT_PTR)Address, dwCount ))
  993. return(0);
  994. // Add Command to the Command Queue
  995. return TRUE;
  996. }
  997. BOOL dpi0(
  998. HANDLE hCurrentProcess,
  999. HANDLE hCurrentThread,
  1000. DWORD dwCurrentPc,
  1001. PNTSD_EXTENSION_APIS lpExtensionApis,
  1002. LPSTR lpArgumentString)
  1003. {
  1004. PNTSD_OUTPUT_ROUTINE Print;
  1005. PNTSD_GET_EXPRESSION EvalExpression;
  1006. PNTSD_GET_SYMBOL GetSymbol;
  1007. INISPOOLER IniSpooler;
  1008. PINISPOOLER pIniSpooler;
  1009. UINT_PTR Address = 0;
  1010. BOOL bThereAreOptions = TRUE;
  1011. DWORD dwCount = 1;
  1012. Print = lpExtensionApis->lpOutputRoutine;
  1013. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  1014. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  1015. while (bThereAreOptions) {
  1016. while (isspace(*lpArgumentString)) {
  1017. lpArgumentString++;
  1018. }
  1019. switch (*lpArgumentString) {
  1020. case 'c':
  1021. lpArgumentString++;
  1022. dwCount = EvalValue(&lpArgumentString, EvalExpression, Print);
  1023. break;
  1024. default: // go get the address because there's nothing else
  1025. bThereAreOptions = FALSE;
  1026. break;
  1027. }
  1028. }
  1029. if (*lpArgumentString != 0) {
  1030. Address = EvalValue(&lpArgumentString, EvalExpression, Print);
  1031. }
  1032. // if we've got no address, then quit now - nothing we can do
  1033. if (Address == 0) {
  1034. Print("dpi0 you need to supply an address\n");
  1035. return TRUE;
  1036. }
  1037. if ( !DbgDumpPI0(hCurrentProcess, Print, (UINT_PTR)Address, dwCount ))
  1038. return(0);
  1039. // Add Command to the Command Queue
  1040. return TRUE;
  1041. }
  1042. BOOL dfi1(
  1043. HANDLE hCurrentProcess,
  1044. HANDLE hCurrentThread,
  1045. DWORD dwCurrentPc,
  1046. PNTSD_EXTENSION_APIS lpExtensionApis,
  1047. LPSTR lpArgumentString)
  1048. {
  1049. PNTSD_OUTPUT_ROUTINE Print;
  1050. PNTSD_GET_EXPRESSION EvalExpression;
  1051. PNTSD_GET_SYMBOL GetSymbol;
  1052. INISPOOLER IniSpooler;
  1053. PINISPOOLER pIniSpooler;
  1054. UINT_PTR Address = 0;
  1055. BOOL bThereAreOptions = TRUE;
  1056. DWORD dwCount = 1;
  1057. Print = lpExtensionApis->lpOutputRoutine;
  1058. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  1059. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  1060. while (bThereAreOptions) {
  1061. while (isspace(*lpArgumentString)) {
  1062. lpArgumentString++;
  1063. }
  1064. switch (*lpArgumentString) {
  1065. case 'c':
  1066. lpArgumentString++;
  1067. dwCount = EvalValue(&lpArgumentString, EvalExpression, Print);
  1068. break;
  1069. default: // go get the address because there's nothing else
  1070. bThereAreOptions = FALSE;
  1071. break;
  1072. }
  1073. }
  1074. if (*lpArgumentString != 0) {
  1075. Address = EvalValue(&lpArgumentString, EvalExpression, Print);
  1076. }
  1077. // if we've got no address, then quit now - nothing we can do
  1078. if (Address == 0) {
  1079. Print("dfi1 you need to supply an address\n");
  1080. return TRUE;
  1081. }
  1082. if ( !DbgDumpFI1(hCurrentProcess, Print, (UINT_PTR)Address, dwCount ))
  1083. return(0);
  1084. // Add Command to the Command Queue
  1085. return TRUE;
  1086. }
  1087. BOOL dpdef(
  1088. HANDLE hCurrentProcess,
  1089. HANDLE hCurrentThread,
  1090. DWORD dwCurrentPc,
  1091. PNTSD_EXTENSION_APIS lpExtensionApis,
  1092. LPSTR lpArgumentString)
  1093. {
  1094. PNTSD_OUTPUT_ROUTINE Print;
  1095. PNTSD_GET_EXPRESSION EvalExpression;
  1096. PNTSD_GET_SYMBOL GetSymbol;
  1097. INISPOOLER IniSpooler;
  1098. PINISPOOLER pIniSpooler;
  1099. UINT_PTR Address = 0;
  1100. BOOL bThereAreOptions = TRUE;
  1101. DWORD dwCount = 1;
  1102. Print = lpExtensionApis->lpOutputRoutine;
  1103. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  1104. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  1105. if (*lpArgumentString != 0) {
  1106. Address = EvalValue(&lpArgumentString, EvalExpression, Print);
  1107. }
  1108. // if we've got no address, then quit now - nothing we can do
  1109. if (Address == 0) {
  1110. Print("dpi0 you need to supply an address\n");
  1111. return TRUE;
  1112. }
  1113. if ( !DbgDumpPDEF(hCurrentProcess, Print, (UINT_PTR)Address, dwCount ))
  1114. return(0);
  1115. // Add Command to the Command Queue
  1116. return TRUE;
  1117. }
  1118. BOOL handle(
  1119. HANDLE hCurrentProcess,
  1120. HANDLE hCurrentThread,
  1121. DWORD dwCurrentPc,
  1122. PNTSD_EXTENSION_APIS lpExtensionApis,
  1123. LPSTR lpArgumentString)
  1124. {
  1125. PNTSD_OUTPUT_ROUTINE Print;
  1126. PNTSD_GET_EXPRESSION EvalExpression;
  1127. PNTSD_GET_SYMBOL GetSymbol;
  1128. ULONG_PTR dwAddrGlobal = 0;
  1129. DWORD HandleCount;
  1130. Print = lpExtensionApis->lpOutputRoutine;
  1131. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  1132. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  1133. GetAddress(dwAddrGlobal, "winspool!ClientHandleCount");
  1134. if ( dwAddrGlobal != 0 ) {
  1135. movestruct((PVOID)dwAddrGlobal, &HandleCount, DWORD);
  1136. Print("ClientHandleCount %d\n", HandleCount);
  1137. }
  1138. GetAddress(dwAddrGlobal, "spoolss!ServerHandleCount");
  1139. if ( dwAddrGlobal != 0 ) {
  1140. movestruct((PVOID)dwAddrGlobal, &HandleCount, DWORD);
  1141. Print("ServerHandleCount %d\n", HandleCount);
  1142. }
  1143. return TRUE;
  1144. }
  1145. BOOL dpv(
  1146. HANDLE hCurrentProcess,
  1147. HANDLE hCurrentThread,
  1148. DWORD dwCurrentPc,
  1149. PNTSD_EXTENSION_APIS lpExtensionApis,
  1150. LPSTR lpArgumentString)
  1151. {
  1152. PNTSD_OUTPUT_ROUTINE Print;
  1153. PNTSD_GET_EXPRESSION EvalExpression;
  1154. PNTSD_GET_SYMBOL GetSymbol;
  1155. ULONG_PTR dwGlobalAddress = 0;
  1156. WCHAR Buffer[MAX_PATH+1];
  1157. LPPROVIDOR pLocalProvidor, pProvidor;
  1158. PROVIDOR Providor;
  1159. UNREFERENCED_PARAMETER(hCurrentProcess);
  1160. UNREFERENCED_PARAMETER(hCurrentThread);
  1161. UNREFERENCED_PARAMETER(dwCurrentPc);
  1162. Print = lpExtensionApis->lpOutputRoutine;
  1163. EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
  1164. GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
  1165. GetAddress(dwGlobalAddress, "spoolss!pLocalProvidor");
  1166. movestruct((PVOID)dwGlobalAddress, &pLocalProvidor, LPPROVIDOR);
  1167. for (pProvidor = pLocalProvidor;
  1168. pProvidor;
  1169. pProvidor = Providor.pNext)
  1170. {
  1171. (*Print) ("Providor %x\n", pProvidor);
  1172. movestruct((PVOID) pProvidor, &Providor, PROVIDOR);
  1173. DbgDumpProvidor(hCurrentProcess, Print, &Providor);
  1174. }
  1175. // Add Command to the Command Queue
  1176. return 0;
  1177. DBG_UNREFERENCED_PARAMETER(hCurrentProcess);
  1178. DBG_UNREFERENCED_PARAMETER(hCurrentThread);
  1179. DBG_UNREFERENCED_PARAMETER(dwCurrentPc);
  1180. }