ReactOS  r76032
parse.c File Reference
#include "remods.h"
#include "precomp.h"
#include "pci_ids.h"
Include dependency graph for parse.c:

Go to the source code of this file.

Macros

#define COMMAND_HAS_NO_PARAMS   (0)
 
#define COMMAND_HAS_PARAMS   (1<<0)
 
#define COMMAND_HAS_SWITCHES   (1<<1)
 
#define PARAM_CAN_BE_SYMBOLIC   (1<<0)
 
#define PARAM_CAN_BE_SEG_OFFSET   (1<<1)
 
#define PARAM_CAN_BE_MODULE   (1<<2)
 
#define PARAM_CAN_BE_PRNAME   (1<<3)
 
#define PARAM_CAN_BE_PID   (1<<4)
 
#define PARAM_CAN_BE_SRC_FILE   (1<<5)
 
#define PARAM_CAN_BE_NUMERIC   (1<<6)
 
#define PARAM_CAN_BE_REG_KEYWORD   (1<<7)
 
#define PARAM_CAN_BE_ONOFF_KEYWORD   (1<<8)
 
#define PARAM_CAN_BE_SPECIAL_KEYWORD   (1<<9)
 
#define PARAM_CAN_BE_ASTERISK   (1<<10)
 
#define PARAM_CAN_BE_ONOFF   (1<<11)
 
#define PARAM_CAN_BE_VIRTUAL_SYMBOLIC   (1<<12)
 
#define PARAM_CAN_BE_SRCLINE   (1<<13)
 
#define PARAM_CAN_BE_PARTIAL_SYM_NAME   (1<<14)
 
#define PARAM_CAN_BE_ANY_STRING   (1<<15)
 
#define PARAM_CAN_BE_DECIMAL   (1<<16)
 
#define PARAM_CAN_BE_SIZE_DESC   (1<<17)
 
#define PARAM_CAN_BE_LETTER   (1<<18)
 
#define COMMAND_GROUP_HELP   (0)
 
#define COMMAND_GROUP_FLOW   (1)
 
#define COMMAND_GROUP_STRUCT   (2)
 
#define COMMAND_GROUP_OS   (3)
 
#define COMMAND_GROUP_MEM   (4)
 
#define COMMAND_GROUP_BREAKPOINT   (5)
 
#define COMMAND_GROUP_WINDOW   (6)
 
#define COMMAND_GROUP_DEBUG   (7)
 
#define COMMAND_GROUP_INFO   (8)
 
#define COMMAND_GROUP_STATE   (9)
 
#define COMMAND_GROUP_HELP_ONLY   (10)
 
#define COMMAND_GROUP_LAST   (11)
 

Functions

void RepaintSource (void)
 
void RepaintDesktop (void)
 
void PutStatusText (LPSTR p)
 
BOOLEAN WaitForKey (void)
 
 COMMAND_PROTOTYPE (SingleStep)
 
 COMMAND_PROTOTYPE (StepOver)
 
 COMMAND_PROTOTYPE (StepInto)
 
 COMMAND_PROTOTYPE (SetBreakpoint)
 
 COMMAND_PROTOTYPE (ListBreakpoints)
 
 COMMAND_PROTOTYPE (ClearBreakpoints)
 
 COMMAND_PROTOTYPE (LeaveIce)
 
 COMMAND_PROTOTYPE (ShowGdt)
 
void OutputIdtEntry (PIDT pIdt, ULONG i)
 
 COMMAND_PROTOTYPE (ShowIdt)
 
 COMMAND_PROTOTYPE (ShowHelp)
 
 COMMAND_PROTOTYPE (ShowPageDirs)
 
 COMMAND_PROTOTYPE (ShowProcesses)
 
 COMMAND_PROTOTYPE (DisplayMemoryDword)
 
 COMMAND_PROTOTYPE (DisplayMemoryByte)
 
 COMMAND_PROTOTYPE (DisplayPhysMemDword)
 
void DisplaySourceFile (LPSTR pSrcLine, LPSTR pSrcEnd, ULONG ulLineNumber, ULONG ulLineNumberToInvert)
 
void UnassembleOneLineDown (void)
 
void UnassembleOnePageDown (ULONG page)
 
void UnassembleOneLineUp (void)
 
void UnassembleOnePageUp (ULONG page)
 
 COMMAND_PROTOTYPE (Unassemble)
 
 COMMAND_PROTOTYPE (ShowModules)
 
LPSTR DecodeVmFlags (ULONG flags)
 
 COMMAND_PROTOTYPE (ShowVirtualMemory)
 
 COMMAND_PROTOTYPE (Ver)
 
 COMMAND_PROTOTYPE (Hboot)
 
 COMMAND_PROTOTYPE (SetSrcDisplay)
 
 COMMAND_PROTOTYPE (I3here)
 
 COMMAND_PROTOTYPE (I1here)
 
 COMMAND_PROTOTYPE (NextInstr)
 
 COMMAND_PROTOTYPE (SetGetRegisters)
 
 COMMAND_PROTOTYPE (SetCodeDisplay)
 
 COMMAND_PROTOTYPE (ShowCPU)
 
 COMMAND_PROTOTYPE (WalkStack)
 
 COMMAND_PROTOTYPE (PokeDword)
 
 COMMAND_PROTOTYPE (PokeMemory)
 
 COMMAND_PROTOTYPE (PeekDword)
 
 COMMAND_PROTOTYPE (PeekWord)
 
 COMMAND_PROTOTYPE (PeekByte)
 
 COMMAND_PROTOTYPE (PeekMemory)
 
 COMMAND_PROTOTYPE (UnassembleAtCurrentEip)
 
 COMMAND_PROTOTYPE (SwitchTables)
 
 COMMAND_PROTOTYPE (SwitchFiles)
 
 COMMAND_PROTOTYPE (ShowLocals)
 
 COMMAND_PROTOTYPE (ShowSymbols)
 
 COMMAND_PROTOTYPE (EvaluateExpression)
 
 COMMAND_PROTOTYPE (SizeCodeWindow)
 
 COMMAND_PROTOTYPE (SizeDataWindow)
 
 COMMAND_PROTOTYPE (ClearScreen)
 
 COMMAND_PROTOTYPE (ShowMappings)
 
 COMMAND_PROTOTYPE (ShowTimers)
 
LPSTR FindPCIVendorName (USHORT vendorid)
 
 COMMAND_PROTOTYPE (ShowPCI)
 
 COMMAND_PROTOTYPE (SetKeyboardLayout)
 
 COMMAND_PROTOTYPE (ShowSysCallTable)
 
 COMMAND_PROTOTYPE (SetAltKey)
 
 COMMAND_PROTOTYPE (ShowContext)
 
LPSTR FindCommand (LPSTR p)
 
void CompactString (LPSTR p)
 
charPICE_strtok (char *szInputString)
 
BOOLEAN ConvertTokenToHex (LPSTR p, PULONG pValue)
 
BOOLEAN ConvertTokenToDec (LPSTR p, PULONG pValue)
 
BOOLEAN ConvertTokenToSymbol (LPSTR pToken, PULONG pValue)
 
BOOLEAN ConvertTokenToModuleAndName (LPSTR pToken, PULONG pulModuleName, PULONG pulFunctionName)
 
BOOLEAN ConvertTokenToModule (LPSTR p, PULONG pValue)
 
BOOLEAN ConvertTokenToProcess (LPSTR p, PULONG pValue)
 
BOOLEAN ReplaceKeywordWithValue (LPSTR p, PULONG pValue, KEYWORDS *pKeyWords)
 
BOOLEAN ConvertTokenToKeyword (LPSTR p, PULONG pValue)
 
BOOLEAN ConvertTokenToSpecialKeyword (LPSTR p, PULONG pValue)
 
BOOLEAN ConvertTokenToOnOff (LPSTR p, PULONG pValue)
 
BOOLEAN ConvertSizeToKeyword (LPSTR p, PULONG pValue)
 
BOOLEAN ConvertTokenToSrcFile (LPSTR p, PULONG pValue)
 
BOOLEAN ConvertTokenToLineNumber (LPSTR p, PULONG pValue)
 
BOOLEAN IsWhiteChar (char c, LPSTR WhiteChars)
 
ULONG StrLenUpToWhiteChar (LPSTR p, LPSTR WhiteChars)
 
void Parse (LPSTR pCmdLine, BOOLEAN bInvokedByFkey)
 

Variables

ULONG ValueTrue =1
 
ULONG ValueFalse =0
 
ULONG ulLastDisassStartAddress =0
 
ULONG ulLastDisassEndAddress =0
 
ULONG ulLastInvertedAddress =0
 
USHORT gCurrentSelector =0
 
ULONG gCurrentOffset =0
 
LONG ulCurrentlyDisplayedLineNumber =0
 
USHORT usOldDisasmSegment = 0
 
ULONG ulOldDisasmOffset = 0
 
static ULONG ulCountForWaitKey = 0
 
PDEBUG_MODULE pdebug_module_head
 
PDEBUG_MODULE pdebug_module_tail
 
BOOLEAN(* DisplayMemory )(PARGS) = DisplayMemoryDword
 
char szCurrentFile [256] =""
 
PDEBUG_MODULE pCurrentMod =NULL
 
PICE_SYMBOLFILE_HEADERpCurrentSymbols =NULL
 
BOOLEAN bStepping = FALSE
 
BOOLEAN bInt3Here = TRUE
 
BOOLEAN bInt1Here = TRUE
 
KEYWORDS RegKeyWords []
 
KEYWORDS SelectorRegKeyWords []
 
KEYWORDS OnOffKeyWords []
 
KEYWORDS SpecialKeyWords []
 
LPSTR LocalVarRegs []
 
LPSTR CommandGroups []
 
CMDTABLE CmdTable []
 
char tempCmd [1024]
 
char HexDigit []
 
CPUINFO CPUInfo []
 
BP Bp [4]
 
BOOLEAN bShowSrc = TRUE
 
BOOLEAN bCodeOn = FALSE
 
BOOLEAN bNeedToFillBuffer = TRUE
 
charNonSystemSegmentTypes []
 
charSystemSegmentTypes []
 

Macro Definition Documentation

#define COMMAND_GROUP_BREAKPOINT   (5)

Definition at line 151 of file parse.c.

#define COMMAND_GROUP_DEBUG   (7)

Definition at line 153 of file parse.c.

#define COMMAND_GROUP_FLOW   (1)

Definition at line 147 of file parse.c.

#define COMMAND_GROUP_HELP   (0)

Definition at line 146 of file parse.c.

#define COMMAND_GROUP_HELP_ONLY   (10)

Definition at line 156 of file parse.c.

Referenced by FindCommand(), and Parse().

#define COMMAND_GROUP_INFO   (8)

Definition at line 154 of file parse.c.

#define COMMAND_GROUP_LAST   (11)

Definition at line 157 of file parse.c.

Referenced by COMMAND_PROTOTYPE().

#define COMMAND_GROUP_MEM   (4)

Definition at line 150 of file parse.c.

#define COMMAND_GROUP_OS   (3)

Definition at line 149 of file parse.c.

#define COMMAND_GROUP_STATE   (9)

Definition at line 155 of file parse.c.

#define COMMAND_GROUP_STRUCT   (2)

Definition at line 148 of file parse.c.

#define COMMAND_GROUP_WINDOW   (6)

Definition at line 152 of file parse.c.

#define COMMAND_HAS_NO_PARAMS   (0)

Definition at line 122 of file parse.c.

#define COMMAND_HAS_PARAMS   (1<<0)

Definition at line 123 of file parse.c.

Referenced by Parse().

#define COMMAND_HAS_SWITCHES   (1<<1)

Definition at line 124 of file parse.c.

Referenced by Parse().

#define PARAM_CAN_BE_ANY_STRING   (1<<15)

Definition at line 141 of file parse.c.

Referenced by Parse().

#define PARAM_CAN_BE_ASTERISK   (1<<10)

Definition at line 136 of file parse.c.

Referenced by Parse().

#define PARAM_CAN_BE_DECIMAL   (1<<16)

Definition at line 142 of file parse.c.

Referenced by Parse().

#define PARAM_CAN_BE_LETTER   (1<<18)

Definition at line 144 of file parse.c.

Referenced by Parse().

#define PARAM_CAN_BE_MODULE   (1<<2)

Definition at line 128 of file parse.c.

Referenced by Parse().

#define PARAM_CAN_BE_NUMERIC   (1<<6)

Definition at line 132 of file parse.c.

Referenced by Parse().

#define PARAM_CAN_BE_ONOFF   (1<<11)

Definition at line 137 of file parse.c.

Referenced by Parse().

#define PARAM_CAN_BE_ONOFF_KEYWORD   (1<<8)

Definition at line 134 of file parse.c.

#define PARAM_CAN_BE_PARTIAL_SYM_NAME   (1<<14)

Definition at line 140 of file parse.c.

Referenced by Parse().

#define PARAM_CAN_BE_PID   (1<<4)

Definition at line 130 of file parse.c.

#define PARAM_CAN_BE_PRNAME   (1<<3)

Definition at line 129 of file parse.c.

Referenced by Parse().

#define PARAM_CAN_BE_REG_KEYWORD   (1<<7)

Definition at line 133 of file parse.c.

Referenced by Parse().

#define PARAM_CAN_BE_SEG_OFFSET   (1<<1)

Definition at line 127 of file parse.c.

#define PARAM_CAN_BE_SIZE_DESC   (1<<17)

Definition at line 143 of file parse.c.

Referenced by Parse().

#define PARAM_CAN_BE_SPECIAL_KEYWORD   (1<<9)

Definition at line 135 of file parse.c.

#define PARAM_CAN_BE_SRC_FILE   (1<<5)

Definition at line 131 of file parse.c.

Referenced by Parse().

#define PARAM_CAN_BE_SRCLINE   (1<<13)

Definition at line 139 of file parse.c.

Referenced by Parse().

#define PARAM_CAN_BE_SYMBOLIC   (1<<0)

Definition at line 126 of file parse.c.

Referenced by Parse().

#define PARAM_CAN_BE_VIRTUAL_SYMBOLIC   (1<<12)

Definition at line 138 of file parse.c.

Referenced by Parse().

Function Documentation

COMMAND_PROTOTYPE ( SingleStep  )

Definition at line 420 of file parse.c.

421 {
422  ULONG ulLineNumber;
423  LPSTR pSrcStart,pSrcEnd,pFilename;
424 
425  ENTER_FUNC();
426 
427  if(FindSourceLineForAddress(GetLinearAddress(CurrentCS,CurrentEIP),&ulLineNumber,&pSrcStart,&pSrcEnd,&pFilename))
428  {
429  DPRINT((0,"SingleStep(): stepping into source\n"));
430  StepInto(NULL);
431  }
432  else
433  {
434  // modify trace flag
435  CurrentEFL|=0x100; // set trace flag (TF)
436 
439  }
440 
441  bStepping = TRUE;
442 
443  LEAVE_FUNC();
444 
445  return TRUE;
446 }
USHORT CurrentCS
Definition: shell.c:116
#define TRUE
Definition: types.h:120
#define LEAVE_FUNC()
Definition: debug.h:43
char * LPSTR
Definition: xmlstorage.h:182
BOOLEAN bStepping
Definition: parse.c:63
volatile BOOLEAN bSingleStep
Definition: shell.c:129
smooth NULL
Definition: ftsmooth.c:557
void DPRINT(...)
Definition: polytest.cpp:61
ULONG GetLinearAddress(USHORT Segment, ULONG Offset)
Definition: utils.c:782
LPSTR FindSourceLineForAddress(ULONG addr, PULONG pulLineNumber, LPSTR *ppSrcStart, LPSTR *ppSrcEnd, LPSTR *ppFilename)
Definition: symbols.c:1476
ULONG CurrentEIP
Definition: shell.c:113
unsigned int ULONG
Definition: retypes.h:1
#define ENTER_FUNC()
Definition: debug.h:42
ULONG CurrentEFL
Definition: shell.c:113
volatile BOOLEAN bNotifyToExit
Definition: shell.c:76
COMMAND_PROTOTYPE ( StepOver  )

Definition at line 454 of file parse.c.

455 {
456  char tempDisasm[256];
457  ULONG dwBreakAddress;
458  ULONG ulLineNumber;
459  LPSTR pSrcStart,pSrcEnd,pFilename;
460 
461  ENTER_FUNC();
462 
463  DPRINT((0,"StepOver():\n"));
464 
465  // only no arguments supplied
466  // when we have source and current disassembly mod is SOURCE
467  // we have to analyse the code block for the source line
468  if(FindSourceLineForAddress(GetLinearAddress(CurrentCS,CurrentEIP),&ulLineNumber,&pSrcStart,&pSrcEnd,&pFilename))
469  {
470  DPRINT((0,"StepOver(): we have source here!\n"));
471  DPRINT((0,"StepOver(): line #%u in file = %s!\n",ulLineNumber,pFilename));
472 
473  g_ulLineNumberStart = ulLineNumber;
475 
476  // deinstall the INT3 in kernel's printk()
478 
479  goto proceed_as_normal;
480  }
481  else
482  {
483  DPRINT((0,"StepOver(): no source here!\n"));
484 
485 proceed_as_normal:
486  // if there is some form of call instruction at EIP we need to find
487  // the return address
488  if(IsCallInstrAtEIP())
489  {
490  // get address of next instruction
491  dwBreakAddress=GetLinearAddress(CurrentCS,CurrentEIP);
492 
493  Disasm(&dwBreakAddress,tempDisasm);
494 
495  DPRINT((0,"address of break = %.4X:%.8X\n",CurrentCS,dwBreakAddress));
496 
497  dwBreakAddress=GetLinearAddress(CurrentCS,dwBreakAddress);
498 
499  DPRINT((0,"linear address of break = %.8X\n",dwBreakAddress));
500 
501  DPRINT((0,"setting DR0=%.8X\n",dwBreakAddress));
502 
503  SetHardwareBreakPoint(dwBreakAddress,0);
504 
505  bSingleStep = FALSE;
507  }
508  else
509  {
510  DPRINT((0,"no call at breakpoint\n"));
511  // modify trace flag
512  CurrentEFL|=0x100; // set trace flag (TF)
513 
516  }
517  }
518 
519  bStepInto = FALSE;
520 
521  bStepping = TRUE;
522 
523  LEAVE_FUNC();
524 
525  return TRUE;
526 }
USHORT CurrentCS
Definition: shell.c:116
#define TRUE
Definition: types.h:120
BOOLEAN bStepInto
Definition: shell.c:65
#define LEAVE_FUNC()
Definition: debug.h:43
char * LPSTR
Definition: xmlstorage.h:182
BOOLEAN bStepping
Definition: parse.c:63
#define FALSE
Definition: types.h:117
volatile BOOLEAN bSingleStep
Definition: shell.c:129
void DeInstallPrintkHook(void)
Definition: output.c:278
void DPRINT(...)
Definition: polytest.cpp:61
ULONG GetLinearAddress(USHORT Segment, ULONG Offset)
Definition: utils.c:782
BOOLEAN Disasm(PULONG pOffset, PUCHAR pchDst)
Definition: disassembler.c:705
void SetHardwareBreakPoint(ULONG ulAddress, ULONG ulReg)
Definition: utils.c:878
LPSTR FindSourceLineForAddress(ULONG addr, PULONG pulLineNumber, LPSTR *ppSrcStart, LPSTR *ppSrcEnd, LPSTR *ppFilename)
Definition: symbols.c:1476
BOOLEAN bStepThroughSource
Definition: shell.c:64
ULONG g_ulLineNumberStart
Definition: shell.c:62
ULONG CurrentEIP
Definition: shell.c:113
unsigned int ULONG
Definition: retypes.h:1
#define ENTER_FUNC()
Definition: debug.h:42
ULONG CurrentEFL
Definition: shell.c:113
BOOLEAN IsCallInstrAtEIP(void)
Definition: utils.c:1008
volatile BOOLEAN bNotifyToExit
Definition: shell.c:76
COMMAND_PROTOTYPE ( StepInto  )

Definition at line 533 of file parse.c.

534 {
535  ULONG ulLineNumber;
536  LPSTR pSrcStart,pSrcEnd,pFilename;
537 
538  ENTER_FUNC();
539 
540  // only no arguments supplied
541  // when we have source and current disassembly mod is SOURCE
542  // we have to analyse the code block for the source line
543  if(FindSourceLineForAddress(GetLinearAddress(CurrentCS,CurrentEIP),&ulLineNumber,&pSrcStart,&pSrcEnd,&pFilename))
544  {
545  DPRINT((0,"StepOver(): we have source here!\n"));
546  DPRINT((0,"StepOver(): line #%u in file = %s!\n",ulLineNumber,pFilename));
547 
548  g_ulLineNumberStart = ulLineNumber;
550 
551  // deinstall the INT3 in kernel's printk()
553 
554  goto proceed_as_normal_into;
555  }
556  else
557  {
558  DPRINT((0,"StepInto(): no source here!\n"));
559 
560 proceed_as_normal_into:
561 
562  // modify trace flag
563  CurrentEFL|=0x100; // set trace flag (TF)
564 
567  }
568 
569  bStepInto = TRUE;
570 
571  bStepping = TRUE;
572 
573  LEAVE_FUNC();
574 
575  return TRUE;
576 }
USHORT CurrentCS
Definition: shell.c:116
#define TRUE
Definition: types.h:120
BOOLEAN bStepInto
Definition: shell.c:65
#define LEAVE_FUNC()
Definition: debug.h:43
char * LPSTR
Definition: xmlstorage.h:182
BOOLEAN bStepping
Definition: parse.c:63
volatile BOOLEAN bSingleStep
Definition: shell.c:129
void DeInstallPrintkHook(void)
Definition: output.c:278
void DPRINT(...)
Definition: polytest.cpp:61
ULONG GetLinearAddress(USHORT Segment, ULONG Offset)
Definition: utils.c:782
LPSTR FindSourceLineForAddress(ULONG addr, PULONG pulLineNumber, LPSTR *ppSrcStart, LPSTR *ppSrcEnd, LPSTR *ppFilename)
Definition: symbols.c:1476
BOOLEAN bStepThroughSource
Definition: shell.c:64
ULONG g_ulLineNumberStart
Definition: shell.c:62
ULONG CurrentEIP
Definition: shell.c:113
unsigned int ULONG
Definition: retypes.h:1
#define ENTER_FUNC()
Definition: debug.h:42
ULONG CurrentEFL
Definition: shell.c:113
volatile BOOLEAN bNotifyToExit
Definition: shell.c:76
COMMAND_PROTOTYPE ( SetBreakpoint  )

Definition at line 582 of file parse.c.

583 {
584  ULONG addr,addrorg;
585  USHORT segment;
586 
587  if(pArgs->Count<=2)
588  {
589  if(pArgs->bNotTranslated[0]==FALSE)
590  {
591  if(gCurrentSelector)
592  {
593  addr=pArgs->Value[0];
594  addrorg=gCurrentOffset;
595  segment=gCurrentSelector;
596  }
597  else
598  {
599  addrorg=addr=pArgs->Value[0];
600  segment=CurrentCS;
601  }
602 
603  if(InstallSWBreakpoint(GetLinearAddress(segment,addr),FALSE,NULL) )
604  {
605  PICE_sprintf(tempCmd,"BP #%u set to %.4X:%.8X\n",0,segment,addr);
606  }
607  else
608  {
609  PICE_sprintf(tempCmd,"BP #%u NOT set (either page not valid OR already used)\n",0);
610  }
612  }
613  else
614  {
615  if(InstallVirtualSWBreakpoint((LPSTR)pArgs->Value[0],(LPSTR)pArgs->Value[1]) )
616  {
617  PICE_sprintf(tempCmd,"BP #%u virtually set to %s!%s\n",0,(LPSTR)pArgs->Value[0],(LPSTR)pArgs->Value[1]);
618  }
619  else
620  {
621  PICE_sprintf(tempCmd,"BP #%u NOT set (maybe no symbols loaded)\n",0);
622  }
624  }
625 
626  RepaintSource();
627 
628  }
629  return TRUE;
630 }
USHORT CurrentCS
Definition: shell.c:116
static void segment(struct gl_context *ctx, struct LineInfo *line, plot_func plot, GLfloat t0, GLfloat t1)
Definition: s_aaline.c:326
#define TRUE
Definition: types.h:120
void RepaintSource(void)
Definition: parse.c:304
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
BOOLEAN InstallVirtualSWBreakpoint(LPSTR ModName, LPSTR FunctionName)
Definition: bp.c:300
char * LPSTR
Definition: xmlstorage.h:182
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
BOOLEAN InstallSWBreakpoint(ULONG ulAddress, BOOLEAN bPermanent, void(*SWBreakpointCallback)(void))
Definition: bp.c:236
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:557
GLenum const GLvoid * addr
Definition: glext.h:9621
ULONG GetLinearAddress(USHORT Segment, ULONG Offset)
Definition: utils.c:782
char tempCmd[1024]
Definition: parse.c:225
unsigned short USHORT
Definition: pedump.c:61
USHORT gCurrentSelector
Definition: parse.c:44
unsigned int ULONG
Definition: retypes.h:1
ULONG gCurrentOffset
Definition: parse.c:45
COMMAND_PROTOTYPE ( ListBreakpoints  )

Definition at line 636 of file parse.c.

637 {
638  ULONG i;
639 
641 
642  for(i=0;i<4;i++)
643  {
644  if(Bp[i].Used)
645  {
646  PICE_sprintf(tempCmd,"(%u) %s %.4X:%.8X(linear %.8X)\n",i,Bp[i].Active?"*":" ",Bp[i].Segment,Bp[i].Offset,Bp[i].LinearAddress);
648  }
649  }
650  return TRUE;
651 }
#define TRUE
Definition: types.h:120
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
GLenum GLclampf GLint i
Definition: glfuncs.h:14
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
Definition: sacdrv.h:288
_Inout_ PVOID Segment
Definition: exfuncs.h:893
char tempCmd[1024]
Definition: parse.c:225
BP Bp[4]
Definition: parse.c:245
unsigned int ULONG
Definition: retypes.h:1
void ListSWBreakpoints(void)
Definition: bp.c:549
COMMAND_PROTOTYPE ( ClearBreakpoints  )

Definition at line 657 of file parse.c.

658 {
659  if(pArgs->Count)
660  {
661  if(pArgs->Value[0]<4)
662  {
663  Bp[pArgs->Value[0]].Used=Bp[pArgs->Value[0]].Active=FALSE;
664  }
665  RepaintSource();
666  }
667  else
668  {
669  ULONG i;
670 
672 
673  for(i=0;i<4;i++)Bp[i].Used=Bp[i].Active=FALSE;
674  RepaintSource();
675  }
676  return TRUE;
677 }
#define TRUE
Definition: types.h:120
void RepaintSource(void)
Definition: parse.c:304
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define FALSE
Definition: types.h:117
Definition: sacdrv.h:288
BOOLEAN Active
Definition: parse.h:80
BOOLEAN RemoveAllSWBreakpoints(BOOLEAN bEvenPermanents)
Definition: bp.c:463
BOOLEAN Used
Definition: parse.h:79
BP Bp[4]
Definition: parse.c:245
unsigned int ULONG
Definition: retypes.h:1
COMMAND_PROTOTYPE ( LeaveIce  )

Definition at line 683 of file parse.c.

684 {
685  // SetHardwareBreakPoints();
686 
689  return TRUE;
690 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
volatile BOOLEAN bSingleStep
Definition: shell.c:129
volatile BOOLEAN bNotifyToExit
Definition: shell.c:76
COMMAND_PROTOTYPE ( ShowGdt  )

Definition at line 696 of file parse.c.

697 {
698  ULONG gdtr[2];
699  USHORT i;
700  PGDT pGdt;
701  static ULONG addr=0;
702  LPSTR pVerbose;
703 
704  // get GDT register
705  __asm__ ("sgdt %0\n"
706  :"=m" (gdtr));
707 
708  // info out
709  PICE_sprintf(tempCmd,"Address=%.8X Limit=%.4X\n",(gdtr[1]<<16)|(gdtr[0]>>16),gdtr[0]&0xFFFF);
711  WaitForKey();
712 
713  // make pointer to GDT
714  pGdt=(PGDT)(((ULONG)(gdtr[1]<<16))|((ULONG)(gdtr[0]>>16)));
715  if(pArgs->Count==1)
716  {
717  ULONG limit=((pGdt[addr].Limit_19_16<<16)|pGdt[addr].Limit_15_0);
718 
719  addr=pArgs->Value[0];
720  addr&=(~0x7);
721  if(pGdt[addr>>3].Gran)limit=(limit*4096)|0xfff;
722 
723  if(!pGdt[addr>>3].DescType)
724  pVerbose = SystemSegmentTypes[pGdt[addr>>3].SegType];
725  else
726  pVerbose = NonSystemSegmentTypes[pGdt[addr>>3].SegType];
727 
728  PICE_sprintf(tempCmd,"%.4X %.8X %.8X %s %u %s\n",
729  addr,
730  (pGdt[addr>>3].Base_31_24<<24)|(pGdt[addr>>3].Base_23_16<<16)|(pGdt[addr>>3].Base_15_0),
731  limit,
732  pGdt[addr>>3].Present?" P":"NP",
733  pGdt[addr>>3].Dpl,
734  pVerbose);
736  }
737  else if(pArgs->Count==0)
738  {
739  for(i=0;i<((gdtr[0]&0xFFFF)>>3);i++)
740  {
741  ULONG limit=((pGdt[i].Limit_19_16<<16)|pGdt[i].Limit_15_0);
742 
743  if(!pGdt[i].DescType)
744  pVerbose = SystemSegmentTypes[pGdt[i].SegType];
745  else
746  pVerbose = NonSystemSegmentTypes[pGdt[i].SegType];
747 
748  if(pGdt[i].Gran)limit=(limit*4096)|0xfff;
749 
750  PICE_sprintf(tempCmd,"%.4X %.8X %.8X %s %u %s\n",
751  i<<3,
752  (pGdt[i].Base_31_24<<24)|(pGdt[i].Base_23_16<<16)|(pGdt[i].Base_15_0),
753  limit,
754  pGdt[i].Present?" P":"NP",
755  pGdt[i].Dpl,
756  pVerbose);
758  if(WaitForKey()==FALSE)break;
759  }
760  }
761  return TRUE;
762 }
#define TRUE
Definition: types.h:120
char * SystemSegmentTypes[]
Definition: parse.c:276
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
ULONG SegType
Definition: utils.h:165
char * LPSTR
Definition: xmlstorage.h:182
__asm__("\t.globl GetPhys\n""GetPhys:\t\n""mflr 0\n\t""stwu 0,-16(1)\n\t""mfmsr 5\n\t""andi. 6,5,0xffef\n\t""mtmsr 6\n\t""isync\n\t""sync\n\t""lwz 3,0(3)\n\t""mtmsr 5\n\t""isync\n\t""sync\n\t""lwz 0,0(1)\n\t""addi 1,1,16\n\t""mtlr 0\n\t""blr")
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
GLint limit
Definition: glext.h:10326
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define FALSE
Definition: types.h:117
Definition: utils.h:160
BOOLEAN WaitForKey(void)
Definition: parse.c:374
struct tagGdt * PGDT
GLenum const GLvoid * addr
Definition: glext.h:9621
char tempCmd[1024]
Definition: parse.c:225
unsigned short USHORT
Definition: pedump.c:61
char * NonSystemSegmentTypes[]
Definition: parse.c:256
unsigned int ULONG
Definition: retypes.h:1
ULONG Limit_19_16
Definition: utils.h:169
COMMAND_PROTOTYPE ( ShowIdt  )

Definition at line 835 of file parse.c.

836 {
837  ULONG idtr[2];
838  USHORT i;
839  PIDT pIdt;
840  ULONG addr=0;
841 
842  ENTER_FUNC();
843 
844  // get GDT register
845  __asm__ ("sidt %0\n"
846  :"=m" (idtr));
847  // info out
848  PICE_sprintf(tempCmd,"Address=%.8X Limit=%.4X\n",(idtr[1]<<16)|(idtr[0]>>16),idtr[0]&0xFFFF);
850  WaitForKey();
851  // make pointer to GDT
852  pIdt=(PIDT)(((ULONG)(idtr[1]<<16))|((ULONG)(idtr[0]>>16)));
853  if(pArgs->Count==1)
854  {
855  addr=pArgs->Value[0];
856  addr&=(~0x7);
857 
858  }
859  else if(pArgs->Count==0)
860  {
861  for(i=0;i<((idtr[0]&0xFFFF)>>3);i++)
862  {
863  OutputIdtEntry(pIdt,i);
864  if(WaitForKey()==FALSE)break;
865  }
866  }
867  LEAVE_FUNC();
868  return TRUE;
869 }
struct tagIdt * PIDT
#define TRUE
Definition: types.h:120
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
#define LEAVE_FUNC()
Definition: debug.h:43
__asm__("\t.globl GetPhys\n""GetPhys:\t\n""mflr 0\n\t""stwu 0,-16(1)\n\t""mfmsr 5\n\t""andi. 6,5,0xffef\n\t""mtmsr 6\n\t""isync\n\t""sync\n\t""lwz 3,0(3)\n\t""mtmsr 5\n\t""isync\n\t""sync\n\t""lwz 0,0(1)\n\t""addi 1,1,16\n\t""mtlr 0\n\t""blr")
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define FALSE
Definition: types.h:117
Definition: utils.h:177
BOOLEAN WaitForKey(void)
Definition: parse.c:374
GLenum const GLvoid * addr
Definition: glext.h:9621
char tempCmd[1024]
Definition: parse.c:225
unsigned short USHORT
Definition: pedump.c:61
unsigned int ULONG
Definition: retypes.h:1
#define ENTER_FUNC()
Definition: debug.h:42
void OutputIdtEntry(PIDT pIdt, ULONG i)
Definition: parse.c:768
COMMAND_PROTOTYPE ( ShowHelp  )

Definition at line 875 of file parse.c.

876 {
877  ULONG i,j;
878 
879  PutStatusText("COMMAND KEYWORD DESCRIPTION");
880  for(j=0;j<COMMAND_GROUP_LAST;j++)
881  {
882  PICE_sprintf(tempCmd,"= %-20s =====================================\n",CommandGroups[j]);
884  WaitForKey();
885 
886  for(i=0;CmdTable[i].Cmd!=NULL;i++)
887  {
888  if(CmdTable[i].CommandGroup == j)
889  {
890  PICE_sprintf(tempCmd,"%-20s %s\n",CmdTable[i].Cmd,CmdTable[i].Help);
892  if(WaitForKey()==FALSE)return TRUE;
893  }
894  }
895  }
896  return TRUE;
897 }
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint j
Definition: glfuncs.h:98
void PutStatusText(LPSTR p)
Definition: parse.c:360
#define TRUE
Definition: types.h:120
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
CMDTABLE CmdTable[]
Definition: parse.c:175
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
GLenum GLclampf GLint i
Definition: glfuncs.h:14
char * Cmd
Definition: parse.h:53
#define FALSE
Definition: types.h:117
LPSTR CommandGroups[]
Definition: parse.c:159
smooth NULL
Definition: ftsmooth.c:557
BOOLEAN WaitForKey(void)
Definition: parse.c:374
#define COMMAND_GROUP_LAST
Definition: parse.c:157
Definition: sacdrv.h:278
char tempCmd[1024]
Definition: parse.c:225
PCHAR Help
Definition: kdb_cli.c:134
unsigned int ULONG
Definition: retypes.h:1
COMMAND_PROTOTYPE ( ShowPageDirs  )

Definition at line 903 of file parse.c.

904 {
905  ULONG i;
906  PPAGEDIR pPageDir;
907  PULONG pPGD;
908  PULONG pPTE;
909  PEPROCESS my_current = IoGetCurrentProcess();
910 
911  ENTER_FUNC();
912 
913  DPRINT((0,"ShowPageDirs(): my_current = %.8X\n",(ULONG)my_current));
914 
915  // don't touch if not valid process
916  if(my_current)
917  {
918  // no arguments supplied -> show all page directories
919  if(!pArgs->Count)
920  {
921  PutStatusText("Linear Physical Attributes");
922  // there are 1024 page directories each mapping 1024*4k of address space
923  for(i=0;i<1024;i++)
924  {
925  ULONG ulAddress = i<<22;
926  // from the mm_struct get pointer to page directory for this address
927  pPGD = ADDR_TO_PDE(ulAddress);
928  // create a structurized pointer from PGD
929  pPageDir = (PPAGEDIR)pPGD;
930 
931  if(pPageDir->PTBase)
932  {
933 
934  PICE_sprintf(tempCmd,"%.8X-%.8X %.8X %s %s %s\n",
935  ulAddress, ulAddress + 0x400000,
936  (pPageDir->PTBase<<12),
937  pPageDir->P?"P ":"NP",
938  pPageDir->RW?"RW":"R ",
939  pPageDir->US?"U":"S");
941 
942  if(WaitForKey()==FALSE)break;
943  }
944  }
945  }
946 
947  // one arg supplied -> show individual page
948  else if(pArgs->Count == 1)
949  {
950  pPGD = ADDR_TO_PDE((ULONG)pArgs->Value[0]);
951 
952  DPRINT((0,"ShowPageDirs(): VA = %.8X\n",pArgs->Value[0]));
953  DPRINT((0,"ShowPageDirs(): pPGD = %.8X\n",(ULONG)pPGD));
954 
955  if(pPGD && ((*pPGD)&_PAGE_PRESENT))
956  {
957  // 4M page
958  if((*pPGD)&_PAGE_4M)
959  {
960  PPAGEDIR pPage = (PPAGEDIR)pPGD;
961 
962  PutStatusText("Linear Physical Attributes");
963 
964  PICE_sprintf(tempCmd,"%.8X %.8X %s %s %s (LARGE PAGE PTE @ %.8X)\n",
965  pArgs->Value[0],
966  (pPage->PTBase<<12)|(pArgs->Value[0]&0x7FFFFF),
967  pPage->P?"P ":"NP",
968  pPage->RW?"RW":"R ",
969  pPage->US?"U":"S",
970  (ULONG)pPGD);
971  }
972  else
973  {
974  pPTE = ADDR_TO_PTE(pArgs->Value[0]);
975  DPRINT((0,"ShowPageDirs(): pPTE = %.8X\n",(ULONG)pPTE));
976  if(pPTE)
977  {
978  PPAGEDIR pPage = (PPAGEDIR)pPTE;
979  DPRINT((0,"ShowPageDirs(): pPage->PTBase = %.8X\n",(ULONG)pPage->PTBase));
980 
981  PutStatusText("Linear Physical Attributes");
982 
983  PICE_sprintf(tempCmd,"%.8X %.8X %s %s %s (PTE @ %.8X)\n",
984  pArgs->Value[0],
985  (pPage->PTBase<<12)|(pArgs->Value[0]&(_PAGE_SIZE-1)),
986  (pPage->P==1)?"P ":"NP",
987  pPage->RW?"RW":"R ",
988  pPage->US?"U":"S",
989  (ULONG)pPTE);
990  }
991 
992  }
994  }
995  else
996  {
997  PICE_sprintf(tempCmd,"page at %.8X not present.\n",pArgs->Value[0]);
999  }
1000 
1001  }
1002  }
1003  return TRUE;
1004 }
ULONG P
Definition: utils.h:147
void PutStatusText(LPSTR p)
Definition: parse.c:360
#define TRUE
Definition: types.h:120
#define _PAGE_4M
Definition: utils.h:268
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
#define ADDR_TO_PTE(v)
Definition: parse.h:181
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define FALSE
Definition: types.h:117
void DPRINT(...)
Definition: polytest.cpp:61
ULONG US
Definition: utils.h:149
ULONG RW
Definition: utils.h:148
BOOLEAN WaitForKey(void)
Definition: parse.c:374
#define _PAGE_PRESENT
Definition: compat.h:67
PEPROCESS NTAPI IoGetCurrentProcess(VOID)
Definition: util.c:112
#define _PAGE_SIZE
Definition: utils.h:269
ULONG PTBase
Definition: utils.h:157
#define ADDR_TO_PDE(v)
Definition: parse.h:179
struct tagPageDir * PPAGEDIR
char tempCmd[1024]
Definition: parse.c:225
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1
#define ENTER_FUNC()
Definition: debug.h:42
COMMAND_PROTOTYPE ( ShowProcesses  )

Definition at line 1010 of file parse.c.

1011 {
1012  PEPROCESS my_current = IoGetCurrentProcess();
1013  PLIST_ENTRY current_entry;
1014  PEPROCESS currentps;
1015 
1016  ENTER_FUNC();
1017 
1018  current_entry = pPsProcessListHead->Flink;
1019 
1020  if( current_entry ){
1021 
1022  PutStatusText("NAME TASK PID");
1023 
1024  while( current_entry != pPsProcessListHead ){
1025  currentps = CONTAINING_RECORD(current_entry,
1026  EPROCESS,
1027  ProcessListEntry);
1028  DPRINT((0,"currentps = %x\n",currentps));
1029  //ei would be nice to mark current process!
1030  PICE_sprintf(tempCmd,"%-16.16s %-12x %x\n",currentps->ImageFileName,
1031  (ULONG)currentps,currentps->UniqueProcessId);
1033  if(WaitForKey()==FALSE)
1034  break;
1035  current_entry = current_entry->Flink;
1036  }
1037  }
1038  LEAVE_FUNC();
1039  return TRUE;
1040 }
LIST_ENTRY * pPsProcessListHead
Definition: utils.h:301
void PutStatusText(LPSTR p)
Definition: parse.c:360
#define TRUE
Definition: types.h:120
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
#define LEAVE_FUNC()
Definition: debug.h:43
HANDLE UniqueProcessId
Definition: pstypes.h:1199
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
#define FALSE
Definition: types.h:117
void DPRINT(...)
Definition: polytest.cpp:61
BOOLEAN WaitForKey(void)
Definition: parse.c:374
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
PEPROCESS NTAPI IoGetCurrentProcess(VOID)
Definition: util.c:112
Definition: typedefs.h:117
char tempCmd[1024]
Definition: parse.c:225
CHAR ImageFileName[16]
Definition: pstypes.h:1258
unsigned int ULONG
Definition: retypes.h:1
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:259
#define ENTER_FUNC()
Definition: debug.h:42
COMMAND_PROTOTYPE ( DisplayMemoryDword  )

Definition at line 1046 of file parse.c.

1047 {
1048  ULONG i,j,k;
1049  static ULONG addr=0,addrorg;
1050  static USHORT segment;
1051  char temp[8];
1052  LPSTR pSymbolName;
1053 
1054  ENTER_FUNC();
1055  DPRINT((0,"DisplayMemoryDword()\n"));
1056  if(pArgs->Count==2)
1057  {
1058  segment=(USHORT)pArgs->Value[0];
1059  if(!segment)segment=GLOBAL_DATA_SEGMENT;
1060  addr=pArgs->Value[1];
1061  OldSelector = segment;
1062  OldOffset = addr;
1063  addrorg=addr;
1064  addr=GetLinearAddress(segment,addr);
1065  }
1066  else if(pArgs->Count==1)
1067  {
1068  segment=CurrentDS;
1069  addr=pArgs->Value[0];
1070  OldOffset = addr;
1071  addrorg=addr;
1072  addr=GetLinearAddress(segment,addr);
1073  }
1074  else if(pArgs->Count==0)
1075  {
1076  addr += sizeof(ULONG)*4*4;
1077  OldOffset = addr;
1078  }
1079 
1080  if(ScanExportsByAddress(&pSymbolName,addr))
1081  {
1082  PICE_sprintf(tempCmd," %s ",pSymbolName);
1086  ResetColor();
1087  }
1088 
1090 
1091  if(DisplayMemory != DisplayMemoryDword)
1092  {
1093  Clear(DATA_WINDOW);
1094  DisplayMemory = DisplayMemoryDword;
1095  }
1096  else
1097  Home(DATA_WINDOW);
1098 
1099  for(k=0;k<wWindow[DATA_WINDOW].cy;k++) // 4 lines
1100  {
1101  PICE_sprintf(tempCmd,"%.4X:%.8X: ",segment,addrorg+k*16);
1102  Print(1,tempCmd);
1103  for(i=0;i<4;i++) // 4 dwords
1104  {
1105  tempCmd[0]=0;
1106  Print(1," ");
1107  for(j=0;j<4;j++) // 1 dword = 4 bytes
1108  {
1109  if(IsAddressValid(addr+i*4+j+k*16))
1110  {
1111  PICE_sprintf(temp,"%.2x",*(PUCHAR)(addr+i*4+j+k*16));
1112  PICE_strrev(temp);
1113  PICE_strcat(tempCmd,temp);
1114  }
1115  else
1116  {
1117  PICE_strcat(tempCmd,"??");
1118  }
1119  }
1121  Print(1,tempCmd);
1122  }
1123  Print(1," ");
1124  tempCmd[0]=0;
1125  for(j=0;j<16;j++) // 1 dword = 4 bytes
1126  {
1128  if(IsAddressValid(addr+j+k*16))
1129  {
1130  PICE_sprintf(temp,"%c",PICE_isprint(*(PUCHAR)(addr+j+k*16))?(*(PUCHAR)(addr+j+k*16)):'.');
1131  PICE_strcat(tempCmd,temp);
1132  }
1133  else
1134  {
1135  PICE_strcat(tempCmd,"?");
1136  }
1137  }
1138  Print(1,tempCmd);
1139  Print(1,"\n");
1140  }
1142  addr+=16*4;
1143  return TRUE;
1144 }
static void segment(struct gl_context *ctx, struct LineInfo *line, plot_func plot, GLfloat t0, GLfloat t1)
Definition: s_aaline.c:326
void SetForegroundColor(ECOLORS c)
Definition: hardware.c:576
BOOLEAN PICE_isprint(char c)
Definition: utils.c:248
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint j
Definition: glfuncs.h:98
#define TRUE
Definition: types.h:120
BOOLEAN(* DisplayMemory)(PARGS)
Definition: parse.c:56
void EnableScroll(USHORT Window)
Definition: hardware.c:532
ULONG GLOBAL_SCREEN_WIDTH
Definition: hardware.c:62
unsigned char * PUCHAR
Definition: retypes.h:3
ULONG OldOffset
Definition: shell.c:90
#define GLOBAL_DATA_SEGMENT
Definition: utils.h:247
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
USHORT PICE_strlen(const char *s)
Definition: utils.c:547
USHORT cy
Definition: hardware.h:33
char * LPSTR
Definition: xmlstorage.h:182
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
GLenum GLclampf GLint i
Definition: glfuncs.h:14
char * PICE_strrev(char *s)
Definition: utils.c:527
void Home(USHORT Window)
Definition: hardware.c:693
#define COLOR_TEXT
Definition: hardware.h:158
void DPRINT(...)
Definition: polytest.cpp:61
WINDOW wWindow[4]
Definition: hardware.c:59
char * PICE_strcat(char *s1, char *s2)
Definition: utils.c:315
USHORT CurrentDS
Definition: shell.c:116
GLenum const GLvoid * addr
Definition: glext.h:9621
ULONG GetLinearAddress(USHORT Segment, ULONG Offset)
Definition: utils.c:782
static stack_node_t temp
Definition: rpn.c:18
void PutChar(LPSTR p, ULONG x, ULONG y)
Definition: hardware.c:604
char tempCmd[1024]
Definition: parse.c:225
void DisableScroll(USHORT Window)
Definition: hardware.c:543
unsigned short USHORT
Definition: pedump.c:61
USHORT usCurX
Definition: hardware.h:34
void SetBackgroundColor(ECOLORS c)
Definition: hardware.c:590
unsigned int ULONG
Definition: retypes.h:1
#define ENTER_FUNC()
Definition: debug.h:42
BOOLEAN ScanExportsByAddress(LPSTR *pFind, ULONG ulValue)
Definition: symbols.c:599
void ResetColor(void)
Definition: hardware.c:500
void Clear(USHORT Window)
Definition: hardware.c:705
USHORT OldSelector
Definition: shell.c:89
#define COLOR_CAPTION
Definition: hardware.h:156
INT INT y
Definition: msvc.h:62
int k
Definition: mpi.c:3369
BOOLEAN IsAddressValid(ULONG address)
Definition: utils.c:611
COMMAND_PROTOTYPE ( DisplayMemoryByte  )

Definition at line 1150 of file parse.c.

1151 {
1152  ULONG j,k;
1153  static ULONG addr=0,addrorg;
1154  static USHORT segment;
1155  char temp[8];
1156  LPSTR pSymbolName;
1157 
1158  if(pArgs->Count==2)
1159  {
1160  segment=(USHORT)pArgs->Value[0];
1161  if(!segment)segment=GLOBAL_DATA_SEGMENT;
1162  addr=pArgs->Value[1];
1163  OldSelector = segment;
1164  OldOffset = addr;
1165  addrorg=addr;
1166  addr=GetLinearAddress(segment,addr);
1167  }
1168  else if(pArgs->Count==1)
1169  {
1170  segment=CurrentDS;
1171  addr=pArgs->Value[0];
1172  OldOffset = addr;
1173  addrorg=addr;
1174  addr=GetLinearAddress(segment,addr);
1175  }
1176  else if(pArgs->Count==0)
1177  {
1178  addr += sizeof(ULONG)*4*4;
1179  OldOffset = addr;
1180  }
1181 
1182  if(DisplayMemory != DisplayMemoryByte)
1183  {
1184  Clear(DATA_WINDOW);
1185  DisplayMemory = DisplayMemoryByte;
1186  }
1187  else
1188  Home(DATA_WINDOW);
1189 
1190  if(ScanExportsByAddress(&pSymbolName,addr))
1191  {
1192  PICE_sprintf(tempCmd," %s ",pSymbolName);
1196  ResetColor();
1197  }
1198 
1200  for(k=0;k<wWindow[DATA_WINDOW].cy;k++) // 4 lines
1201  {
1202  PICE_sprintf(tempCmd,"%.4X:%.8X: ",segment,addrorg+k*16);
1203  Print(1,tempCmd);
1204  tempCmd[0]=0;
1205  Print(1," ");
1206  for(j=0;j<16;j++) // 1 dword = 4 bytes
1207  {
1208  if(IsAddressValid(addr+j+k*16))
1209  {
1210  PICE_sprintf(temp,"%.2x ",*(PUCHAR)(addr+j+k*16));
1211  PICE_strcat(tempCmd,temp);
1212  }
1213  else
1214  {
1215  PICE_strcat(tempCmd,"?? ");
1216  }
1217  }
1218  Print(1,tempCmd);
1219  Print(1," ");
1220  tempCmd[0]=0;
1221  for(j=0;j<16;j++) // 1 dword = 4 bytes
1222  {
1224  if(IsAddressValid(addr+j+k*16))
1225  {
1226  PICE_sprintf(temp,"%c",PICE_isprint(*(PUCHAR)(addr+j+k*16))?(*(PUCHAR)(addr+j+k*16)):'.');
1227  PICE_strcat(tempCmd,temp);
1228  }
1229  else
1230  {
1231  PICE_strcat(tempCmd,"?");
1232  }
1233  }
1234  Print(1,tempCmd);
1235  Print(1,"\n");
1236  }
1238  addr+=16*4;
1239  return TRUE;
1240 }
static void segment(struct gl_context *ctx, struct LineInfo *line, plot_func plot, GLfloat t0, GLfloat t1)
Definition: s_aaline.c:326
void SetForegroundColor(ECOLORS c)
Definition: hardware.c:576
BOOLEAN PICE_isprint(char c)
Definition: utils.c:248
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint j
Definition: glfuncs.h:98
#define TRUE
Definition: types.h:120
BOOLEAN(* DisplayMemory)(PARGS)
Definition: parse.c:56
void EnableScroll(USHORT Window)
Definition: hardware.c:532
ULONG GLOBAL_SCREEN_WIDTH
Definition: hardware.c:62
unsigned char * PUCHAR
Definition: retypes.h:3
ULONG OldOffset
Definition: shell.c:90
#define GLOBAL_DATA_SEGMENT
Definition: utils.h:247
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
USHORT PICE_strlen(const char *s)
Definition: utils.c:547
USHORT cy
Definition: hardware.h:33
char * LPSTR
Definition: xmlstorage.h:182
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
void Home(USHORT Window)
Definition: hardware.c:693
#define COLOR_TEXT
Definition: hardware.h:158
WINDOW wWindow[4]
Definition: hardware.c:59
char * PICE_strcat(char *s1, char *s2)
Definition: utils.c:315
USHORT CurrentDS
Definition: shell.c:116
GLenum const GLvoid * addr
Definition: glext.h:9621
ULONG GetLinearAddress(USHORT Segment, ULONG Offset)
Definition: utils.c:782
static stack_node_t temp
Definition: rpn.c:18
void PutChar(LPSTR p, ULONG x, ULONG y)
Definition: hardware.c:604
char tempCmd[1024]
Definition: parse.c:225
void DisableScroll(USHORT Window)
Definition: hardware.c:543
unsigned short USHORT
Definition: pedump.c:61
USHORT usCurX
Definition: hardware.h:34
void SetBackgroundColor(ECOLORS c)
Definition: hardware.c:590
unsigned int ULONG
Definition: retypes.h:1
BOOLEAN ScanExportsByAddress(LPSTR *pFind, ULONG ulValue)
Definition: symbols.c:599
void ResetColor(void)
Definition: hardware.c:500
void Clear(USHORT Window)
Definition: hardware.c:705
USHORT OldSelector
Definition: shell.c:89
#define COLOR_CAPTION
Definition: hardware.h:156
INT INT y
Definition: msvc.h:62
int k
Definition: mpi.c:3369
BOOLEAN IsAddressValid(ULONG address)
Definition: utils.c:611
COMMAND_PROTOTYPE ( DisplayPhysMemDword  )

Definition at line 1246 of file parse.c.

1247 {
1248  ULONG i,j,k;
1249  static ULONG addr=0,addrorg;
1250  static USHORT segment;
1251  char temp[8];
1252 
1253  ENTER_FUNC();
1254  DPRINT((0,"DisplayPhysMemDword()\n"));
1255 
1256  if(pArgs->Count==1)
1257  {
1258  segment=CurrentDS;
1259  addr=pArgs->Value[0];
1260  OldOffset = addr;
1261  addrorg=addr;
1262  addr=GetLinearAddress(segment,addr);
1263  }
1264  else if(pArgs->Count==0)
1265  {
1266  addr += sizeof(ULONG)*4*4;
1267  OldOffset = addr;
1268  }
1269 
1271 
1272  if(DisplayMemory != DisplayPhysMemDword)
1273  {
1274  Clear(DATA_WINDOW);
1275  DisplayMemory = DisplayPhysMemDword;
1276  }
1277  else
1278  Home(DATA_WINDOW);
1279 
1280  for(k=0;k<wWindow[DATA_WINDOW].cy;k++) // 4 lines
1281  {
1282  PICE_sprintf(tempCmd,"PHYS:%.8X: ",addrorg+k*16);
1283  Print(1,tempCmd);
1284  for(i=0;i<4;i++) // 4 dwords
1285  {
1286  tempCmd[0]=0;
1287  PICE_sprintf(tempCmd," %.8X",ReadPhysMem(addr+i*4+k*16,sizeof(ULONG)));
1288  Print(1,tempCmd);
1289  }
1290  Print(1," ");
1291  tempCmd[0]=0;
1292  for(j=0;j<16;j++) // 1 dword = 4 bytes
1293  {
1294  UCHAR ucData;
1296  ucData = ReadPhysMem(addr+j+k*16,sizeof(UCHAR));
1297  PICE_sprintf(temp,"%c",PICE_isprint(ucData)?ucData:'.');
1298  PICE_strcat(tempCmd,temp);
1299  }
1300  Print(1,tempCmd);
1301  Print(1,"\n");
1302  }
1304  addr+=16*4;
1305  return TRUE;
1306 }
static void segment(struct gl_context *ctx, struct LineInfo *line, plot_func plot, GLfloat t0, GLfloat t1)
Definition: s_aaline.c:326
BOOLEAN PICE_isprint(char c)
Definition: utils.c:248
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint j
Definition: glfuncs.h:98
#define TRUE
Definition: types.h:120
BOOLEAN(* DisplayMemory)(PARGS)
Definition: parse.c:56
void EnableScroll(USHORT Window)
Definition: hardware.c:532
ULONG GLOBAL_SCREEN_WIDTH
Definition: hardware.c:62
ULONG OldOffset
Definition: shell.c:90
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
USHORT cy
Definition: hardware.h:33
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
GLenum GLclampf GLint i
Definition: glfuncs.h:14
void Home(USHORT Window)
Definition: hardware.c:693
void DPRINT(...)
Definition: polytest.cpp:61
WINDOW wWindow[4]
Definition: hardware.c:59
char * PICE_strcat(char *s1, char *s2)
Definition: utils.c:315
USHORT CurrentDS
Definition: shell.c:116
unsigned char UCHAR
Definition: xmlstorage.h:181
GLenum const GLvoid * addr
Definition: glext.h:9621
ULONG GetLinearAddress(USHORT Segment, ULONG Offset)
Definition: utils.c:782
ULONG ReadPhysMem(ULONG Address, ULONG ulSize)
Definition: utils.c:1633
static stack_node_t temp
Definition: rpn.c:18
char tempCmd[1024]
Definition: parse.c:225
void DisableScroll(USHORT Window)
Definition: hardware.c:543
unsigned short USHORT
Definition: pedump.c:61
USHORT usCurX
Definition: hardware.h:34
unsigned int ULONG
Definition: retypes.h:1
#define ENTER_FUNC()
Definition: debug.h:42
void Clear(USHORT Window)
Definition: hardware.c:705
int k
Definition: mpi.c:3369
COMMAND_PROTOTYPE ( Unassemble  )

Definition at line 1569 of file parse.c.

1570 {
1571  ULONG i;
1572  ULONG addr=0,addrorg,addrstart,ulLineNumber;
1573  USHORT segment=0;
1574  ULONG addrbefore;
1575  LPSTR pSymbolName;
1576  BOOLEAN bSWBpAtAddr;
1577  LPSTR pSrc,pFilename,pSrcStart,pSrcEnd;
1578  BOOLEAN bForceDisassembly = FALSE;
1579 
1580  DPRINT((0,"Unassemble: CountSwitches: %u, count: %u\n", pArgs->CountSwitches, pArgs->Count));
1581  if(pArgs->CountSwitches>1)
1582  return TRUE;
1583 
1584  if(pArgs->CountSwitches==1)
1585  {
1586  if(pArgs->Switch[0] == 'f')
1587  bForceDisassembly = TRUE;
1588  }
1589 
1590  // we have args
1591  if(pArgs->Count==2)
1592  {
1593  addr=pArgs->Value[1];
1594  segment=(USHORT)pArgs->Value[0];
1595  addrorg=addrstart=addr;
1596  addr=GetLinearAddress(segment,addr);
1597 
1600  }
1601  else if(pArgs->Count==1)
1602  {
1603  addr=pArgs->Value[0];
1604  segment=CurrentCS;
1605  addrorg=addrstart=addr;
1606  addr=GetLinearAddress(segment,addr);
1607 
1610  }
1611  else if(pArgs->Count==0)
1612  {
1613  segment = usOldDisasmSegment;
1614  addrorg=addrstart=addr;
1616  }
1617  else
1618  return TRUE;
1619 
1620 
1621  DPRINT((0,"Unassemble(%0.4X:%0.8X), lastst: %x, lastend:%x\n",segment,addr,ulLastDisassStartAddress,ulLastDisassEndAddress));
1622 
1623  //
1624  // unassemble
1625  //
1627 
1628  // if we're inside last disassembly range we only need to move to highlight
1630  addr<ulLastDisassEndAddress )
1631  {
1633  }
1634  else
1635  {
1637  }
1638 
1641 
1643 
1644  ResetColor();
1645 
1646  if(ScanExportsByAddress(&pSymbolName,addr))
1647  {
1650  PICE_sprintf(tempCmd," %s ",pSymbolName);
1652  ResetColor();
1653  }
1654 
1656  if(pCurrentMod)
1657  {
1658  ULONG mod_addr;
1659  DPRINT((0,"Unassemble(): pCurrentMod->name = %S\n",pCurrentMod->name));
1660  mod_addr = (ULONG)pCurrentMod->BaseAddress;
1661 
1662  pCurrentSymbols = FindModuleSymbols(mod_addr);
1663  DPRINT((0,"Unassemble(): pCurrentSymbols = %x\n",(ULONG)pCurrentSymbols));
1664  }
1665  DPRINT((0,"Unassemble(): pCurrentMod = %x, showsrc: %d\n",pCurrentMod, bShowSrc));
1666 
1668 
1669  if(bShowSrc && bForceDisassembly == FALSE && (pSrc = FindSourceLineForAddress(addr,&ulLineNumber,&pSrcStart,&pSrcEnd,&pFilename)) )
1670  {
1671  DPRINT((0,"FoundSourceLineForAddress: file: %s line: %d\n", pFilename, ulLineNumber));
1672  PICE_strcpy(szCurrentFile,pFilename);
1673 
1674  ulCurrentlyDisplayedLineNumber = ulLineNumber;
1675 
1677 
1678  // display file name
1681 
1682  if(PICE_strlen(pFilename)<GLOBAL_SCREEN_WIDTH/2)
1683  {
1684  PutChar(pFilename,1,wWindow[SOURCE_WINDOW].y-1);
1685  }
1686  else
1687  {
1688  LPSTR p;
1689 
1690  p = strrchr(pFilename,'/');
1691  if(!p)
1692  {
1693  p = pFilename;
1694  }
1695  else
1696  {
1697  p++;
1698  }
1699 
1700  PutChar(p,1,wWindow[SOURCE_WINDOW].y-1);
1701  }
1702 
1703  ResetColor();
1704 
1705  // display the source
1706  if(ulLineNumber>(wWindow[SOURCE_WINDOW].cy/2) )
1707  {
1708  DisplaySourceFile(pSrcStart,pSrcEnd,ulLineNumber-(wWindow[SOURCE_WINDOW].cy/2),ulLineNumber);
1709  }
1710  else
1711  {
1712  DisplaySourceFile(pSrcStart,pSrcEnd,ulLineNumber,ulLineNumber);
1713  }
1714  }
1715  else
1716  {
1717  *szCurrentFile = 0;
1718  DPRINT((0,"Couldn't find source for file\n"));
1720  // for each line in the disassembly window
1721  for(i=0;i<wWindow[SOURCE_WINDOW].cy;i++)
1722  {
1723  extern ULONG ulWindowOffset;
1724 
1725  bSWBpAtAddr = FALSE;
1726  // if there is a potential SW breakpoint at address
1727  // we might have to put back the original opcode
1728  // in order to disassemble correctly.
1729  if(IsSwBpAtAddress(addr))
1730  {
1731  // if INT3 is there, remove it while disassembling
1732  if((bSWBpAtAddr = IsSwBpAtAddressInstalled(addr)))
1733  {
1734  DeInstallSWBreakpoint(addr);
1735  }
1736  }
1737 
1739 
1740  // invert the line that we're about to execute
1741  if(addr==CurrentEIP)
1742  {
1746  }
1747 
1748  // output segment:offset address
1749  PICE_sprintf(tempCmd,"%0.4X:%0.8X ",segment,addr);
1751 
1752  // disassemble a line
1753  addrbefore=addr;
1754  if(bCodeOn)
1755  {
1756  tempCmd[30]=0;
1757  Disasm(&addr,&tempCmd[30]);
1758  }
1759  else
1760  {
1761  tempCmd[0]=0;
1762  Disasm(&addr,tempCmd);
1763  }
1764  addrorg+=(addr-addrbefore);
1765 
1766  // want to display opcode bytes
1767  if(bCodeOn)
1768  {
1769  ULONG j;
1770 
1771  for(j=0;j<15;j++)
1772  {
1773  if(j<addr-addrbefore)
1774  {
1775  if(IsAddressValid(addrbefore+j))
1776  {
1777  tempCmd[j*2]=HexDigit[((*(PUCHAR)(addrbefore+j)&0xF0)>>4)];
1778  tempCmd[j*2+1]=HexDigit[((*(PUCHAR)(addrbefore+j)&0xF))];
1779  }
1780  else
1781  {
1782  tempCmd[j*2]='?';
1783  tempCmd[j*2+1]='?';
1784  }
1785  }
1786  else
1787  {
1788  tempCmd[j*2]=' ';
1789  tempCmd[j*2+1]=' ';
1790  }
1791  }
1792  }
1793  PICE_strcat(tempCmd,"\n");
1794 
1795  if(ulWindowOffset)
1796  {
1798  if(ulWindowOffset < len)
1799  PICE_memcpy(tempCmd,&tempCmd[ulWindowOffset],len-ulWindowOffset);
1800  else
1801  tempCmd[0]='\n';
1802  }
1803 
1805 
1806  if(addrbefore==CurrentEIP)
1807  {
1808  ResetColor();
1809  }
1810 
1811  // if potential SW breakpoint, undo marked text
1812  if(IsSwBpAtAddress(addrbefore))
1813  {
1815  }
1816 
1817  // if breakpoint was installed before disassembly, put it back
1818  if(bSWBpAtAddr)
1819  {
1820  ReInstallSWBreakpoint(addrbefore);
1821  }
1822 
1823  }
1824 
1826  {
1827  ulLastDisassStartAddress=addrstart;
1829  }
1830 
1831  if(!IsAddressValid(addrstart))
1832  {
1835  }
1836 
1837  }
1838 
1840 
1841  return TRUE;
1842 }
USHORT CurrentCS
Definition: shell.c:116
static void segment(struct gl_context *ctx, struct LineInfo *line, plot_func plot, GLfloat t0, GLfloat t1)
Definition: s_aaline.c:326
void SetForegroundColor(ECOLORS c)
Definition: hardware.c:576
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint j
Definition: glfuncs.h:98
#define TRUE
Definition: types.h:120
void EnableScroll(USHORT Window)
Definition: hardware.c:532
PDEBUG_MODULE pCurrentMod
Definition: parse.c:59
PDEBUG_MODULE FindModuleFromAddress(ULONG addr)
Definition: symbols.c:507
ULONG GLOBAL_SCREEN_WIDTH
Definition: hardware.c:62
unsigned char * PUCHAR
Definition: retypes.h:3
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
BOOLEAN bCodeOn
Definition: parse.c:253
USHORT PICE_strlen(const char *s)
Definition: utils.c:547
USHORT cy
Definition: hardware.h:33
ULONG ulLastInvertedAddress
Definition: parse.c:43
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
char * LPSTR
Definition: xmlstorage.h:182
void HatchLine(ULONG line)
Definition: hardware.c:652
void DisplaySourceFile(LPSTR pSrcLine, LPSTR pSrcEnd, ULONG ulLineNumber, ULONG ulLineNumberToInvert)
Definition: parse.c:1313
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
char * PICE_strcpy(char *s1, char *s2)
Definition: utils.c:302
BOOLEAN bShowSrc
Definition: parse.c:252
ULONG ulOldDisasmOffset
Definition: parse.c:48
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define FALSE
Definition: types.h:117
PICE_SYMBOLFILE_HEADER * pCurrentSymbols
Definition: parse.c:60
long LONG
Definition: pedump.c:60
char szCurrentFile[256]
Definition: parse.c:58
void Home(USHORT Window)
Definition: hardware.c:693
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
PICE_SYMBOLFILE_HEADER * FindModuleSymbols(ULONG addr)
Definition: symbols.c:463
#define COLOR_TEXT
Definition: hardware.h:158
LONG ulCurrentlyDisplayedLineNumber
Definition: parse.c:46
void ClrLine(ULONG line)
Definition: hardware.c:662
void DPRINT(...)
Definition: polytest.cpp:61
WINDOW wWindow[4]
Definition: hardware.c:59
#define COLOR_FOREGROUND
Definition: hardware.h:160
char HexDigit[]
Definition: parse.c:227
unsigned char BOOLEAN
char * PICE_strcat(char *s1, char *s2)
Definition: utils.c:315
ULONG ulLastDisassStartAddress
Definition: parse.c:43
void PICE_memcpy(void *t, void *s, int sz)
Definition: utils.c:239
GLenum const GLvoid * addr
Definition: glext.h:9621
ULONG GetLinearAddress(USHORT Segment, ULONG Offset)
Definition: utils.c:782
BOOLEAN Disasm(PULONG pOffset, PUCHAR pchDst)
Definition: disassembler.c:705
USHORT usOldDisasmSegment
Definition: parse.c:47
GLenum GLsizei len
Definition: glext.h:6722
ULONG ulLastDisassEndAddress
Definition: parse.c:43
BOOLEAN ReInstallSWBreakpoint(ULONG ulAddress)
Definition: bp.c:197
LPSTR FindSourceLineForAddress(ULONG addr, PULONG pulLineNumber, LPSTR *ppSrcStart, LPSTR *ppSrcEnd, LPSTR *ppFilename)
Definition: symbols.c:1476
void PutChar(LPSTR p, ULONG x, ULONG y)
Definition: hardware.c:604
char tempCmd[1024]
Definition: parse.c:225
void DisableScroll(USHORT Window)
Definition: hardware.c:543
unsigned short USHORT
Definition: pedump.c:61
BOOLEAN IsSwBpAtAddress(ULONG ulAddress)
Definition: bp.c:133
ULONG CurrentEIP
Definition: shell.c:113
BOOLEAN DeInstallSWBreakpoint(ULONG ulAddress)
Definition: bp.c:428
void SetBackgroundColor(ECOLORS c)
Definition: hardware.c:590
ULONG ulWindowOffset
Definition: shell.c:63
BOOLEAN IsSwBpAtAddressInstalled(ULONG ulAddress)
Definition: bp.c:113
PVOID BaseAddress
Definition: symbols.h:51
unsigned int ULONG
Definition: retypes.h:1
WCHAR name[DEBUG_MODULE_NAME_LEN]
Definition: symbols.h:53
BOOLEAN ScanExportsByAddress(LPSTR *pFind, ULONG ulValue)
Definition: symbols.c:599
#define COLOR_BACKGROUND
Definition: hardware.h:164
void ResetColor(void)
Definition: hardware.c:500
void Clear(USHORT Window)
Definition: hardware.c:705
GLfloat GLfloat p
Definition: glext.h:8902
#define COLOR_CAPTION
Definition: hardware.h:156
INT INT y
Definition: msvc.h:62
BOOLEAN IsAddressValid(ULONG address)
Definition: utils.c:611
COMMAND_PROTOTYPE ( ShowModules  )

Definition at line 1848 of file parse.c.

1849 {
1850  PDEBUG_MODULE pMod;
1851  DPRINT((0,"ShowModules()\n"));
1852 
1853  if(BuildModuleList())
1854  {
1855  pMod = pdebug_module_head;
1856  do
1857  {
1858  if(pMod->size)
1859  {
1860  if(pMod == pCurrentMod)
1861  {
1862  PICE_sprintf(tempCmd,"%.8X - %.8X *%-32S\n",
1863  (unsigned int)pMod->BaseAddress,
1864  (unsigned int) ((unsigned int)pMod->BaseAddress+pMod->size),pMod->name);
1865  }
1866  else
1867  {
1868  PICE_sprintf(tempCmd,"%.8X - %.8X %-32S\n",
1869  (unsigned int)pMod->BaseAddress,
1870  (unsigned int) ((unsigned int)pMod->BaseAddress+pMod->size),
1871  pMod->name);
1872  }
1873  }
1875  if(WaitForKey()==FALSE)
1876  break;
1877  }while((pMod = pMod->next)!=pdebug_module_tail);
1878  }
1879  return TRUE;
1880 }
#define TRUE
Definition: types.h:120
PDEBUG_MODULE pCurrentMod
Definition: parse.c:59
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
struct _DEBUG_MODULE_ * next
Definition: symbols.h:49
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
PDEBUG_MODULE pdebug_module_head
Definition: init.c:46
#define FALSE
Definition: types.h:117
ULONG size
Definition: symbols.h:50
void DPRINT(...)
Definition: polytest.cpp:61
BOOLEAN WaitForKey(void)
Definition: parse.c:374
BOOLEAN BuildModuleList(void)
Definition: symbols.c:266
char tempCmd[1024]
Definition: parse.c:225
PVOID BaseAddress
Definition: symbols.h:51
WCHAR name[DEBUG_MODULE_NAME_LEN]
Definition: symbols.h:53
PDEBUG_MODULE pdebug_module_tail
Definition: init.c:45
COMMAND_PROTOTYPE ( ShowVirtualMemory  )

Definition at line 1944 of file parse.c.

1945 {
1946  PEPROCESS my_current = IoGetCurrentProcess();
1947  PLIST_ENTRY current_entry;
1948  PMADDRESS_SPACE vma = NULL;
1950  char filename[64];
1951 
1952  DPRINT((0,"ShowVirtualMemory()\n"));
1953  if( my_current )
1954  vma = &(my_current->AddressSpace);
1955  if( !vma )
1956  vma = my_init_mm;
1957  while( vma )
1958  {
1959  if(pArgs->Count == 0)
1960  {
1961  PutStatusText("START END LENGTH VMA TYPE ATTR");
1962  current_entry = vma->MAreaListHead.Flink;
1963  while (current_entry != &vma->MAreaListHead)
1964  {
1965  *filename = 0;
1966 
1967  current = CONTAINING_RECORD(current_entry,
1968  MEMORY_AREA,
1969  Entry);
1970  // find the filename
1971  if(((current->Type == MEMORY_AREA_SECTION_VIEW) ) &&
1972  current->Data.SectionData.Section->FileObject)
1973  {
1974  if(IsAddressValid((ULONG)current->Data.SectionData.Section->FileObject->FileName.Buffer) )
1975  PICE_sprintf(filename,"%.64S",current->Data.SectionData.Section->FileObject->FileName.Buffer);
1976  }
1977 
1978  PICE_sprintf(tempCmd,"%.8X %.8X %.8X %.8X %x %x %s\n",
1979  (ULONG)current->BaseAddress,
1980  (ULONG)current->BaseAddress+current->Length,
1981  current->Length,
1982  (ULONG)current,
1983  current->Type, current->Attributes,//DecodeVmFlags(current->Type, current->Attributes),
1984  filename);
1986 
1987  if(WaitForKey()==FALSE)
1988  break;
1989  current_entry = current_entry->Flink;
1990  }
1991  }
1992  if( vma == &(my_current->AddressSpace) )
1993  vma = my_init_mm; // switch to kernel memory area
1994  else vma = 0; // if we already did kernel, end loop
1995  }
1996  return TRUE;
1997 }
void PutStatusText(LPSTR p)
Definition: parse.c:360
#define TRUE
Definition: types.h:120
union _MEMORY_AREA::@1561 Data
ULONG Type
Definition: mm.h:210
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
PMADDRESS_SPACE my_init_mm
Definition: utils.h:300
#define FALSE
Definition: types.h:117
LPCSTR filename
Definition: alphablend.c:63
smooth NULL
Definition: ftsmooth.c:557
void DPRINT(...)
Definition: polytest.cpp:61
#define MEMORY_AREA_SECTION_VIEW
Definition: mm.h:69
BOOLEAN WaitForKey(void)
Definition: parse.c:374
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
PEPROCESS NTAPI IoGetCurrentProcess(VOID)
Definition: util.c:112
Definition: typedefs.h:117
struct _MEMORY_AREA::@1561::@1562 SectionData
char tempCmd[1024]
Definition: parse.c:225
unsigned int ULONG
Definition: retypes.h:1
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:259
base of all file and directory entries
Definition: entries.h:82
BOOLEAN IsAddressValid(ULONG address)
Definition: utils.c:611
struct task_struct * current
Definition: linux.c:32
COMMAND_PROTOTYPE ( Ver  )

Definition at line 2003 of file parse.c.

2004 {
2005  //ei add kernel version info??!!
2006  PICE_sprintf(tempCmd,"pICE: version %u.%u (build %u) for ReactOS\n",
2009  PICE_BUILD);
2010 
2012 
2013 /* PICE_sprintf(tempCmd,"pICE: loaded on %s kernel release %s\n",
2014  system_utsname.sysname,
2015  system_utsname.release);
2016  */
2018  Print(OUTPUT_WINDOW,"pICE: written by Klaus P. Gerlicher and Goran Devic.\n");
2019  Print(OUTPUT_WINDOW,"pICE: ported to ReactOS by Eugene Ingerman.\n");
2020 
2021  return TRUE;
2022 }
#define TRUE
Definition: types.h:120
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
#define PICE_MAJOR_VERSION
Definition: pice_ver.h:32
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
#define PICE_MINOR_VERSION
Definition: pice_ver.h:33
#define PICE_BUILD
Definition: pice_ver.h:36
char tempCmd[1024]
Definition: parse.c:225
COMMAND_PROTOTYPE ( Hboot  )

Definition at line 2028 of file parse.c.

2029 {
2030  // nudge the reset line through keyboard controller
2031  __asm__("\n\t \
2032  movb $0xFE,%al\n\t \
2033  outb %al,$0x64");
2034  // never gets here
2035  return TRUE;
2036 }
#define TRUE
Definition: types.h:120
__asm__("\t.globl GetPhys\n""GetPhys:\t\n""mflr 0\n\t""stwu 0,-16(1)\n\t""mfmsr 5\n\t""andi. 6,5,0xffef\n\t""mtmsr 6\n\t""isync\n\t""sync\n\t""lwz 3,0(3)\n\t""mtmsr 5\n\t""isync\n\t""sync\n\t""lwz 0,0(1)\n\t""addi 1,1,16\n\t""mtlr 0\n\t""blr")
COMMAND_PROTOTYPE ( SetSrcDisplay  )

Definition at line 2042 of file parse.c.

2043 {
2044  ARGS Args;
2045 
2046  if(pArgs->Count==0)
2047  {
2049  PICE_memset(&Args,0,sizeof(ARGS));
2050  // make unassembler refresh all again
2052  Args.Count=0;
2053  Unassemble(&Args);
2054  }
2055  return TRUE;
2056 }
ULONG Count
Definition: parse.h:34
#define TRUE
Definition: types.h:120
BOOLEAN bShowSrc
Definition: parse.c:252
#define FALSE
Definition: types.h:117
char ** Args
Definition: acdebug.h:342
ULONG ulLastDisassStartAddress
Definition: parse.c:43
Definition: parse.h:31
ULONG ulLastDisassEndAddress
Definition: parse.c:43
void PICE_memset(void *p, unsigned char c, int sz)
Definition: utils.c:228
COMMAND_PROTOTYPE ( I3here  )

Definition at line 2062 of file parse.c.

2063 {
2064  if(pArgs->Count==1)
2065  {
2066  if(pArgs->Value[0]==1)
2067  {
2068  if(!bInt3Here)
2069  {
2070  bInt3Here=TRUE;
2071  Print(OUTPUT_WINDOW,"I3HERE is now ON\n");
2072  }
2073  else
2074  Print(OUTPUT_WINDOW,"I3HERE is already ON\n");
2075  }
2076  else if(pArgs->Value[0]==0)
2077  {
2078  if(bInt3Here)
2079  {
2080  bInt3Here=FALSE;
2081  Print(OUTPUT_WINDOW,"I3HERE is now OFF\n");
2082  }
2083  else
2084  Print(OUTPUT_WINDOW,"I3HERE is already OFF\n");
2085  }
2086  }
2087  else if(pArgs->Count==0)
2088  {
2089  if(bInt3Here)
2090  {
2091  Print(OUTPUT_WINDOW,"I3HERE is ON\n");
2092  }
2093  else
2094  {
2095  Print(OUTPUT_WINDOW,"I3HERE is OFF\n");
2096  }
2097  }
2098  // never gets here
2099  return TRUE;
2100 }
#define TRUE
Definition: types.h:120
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
#define FALSE
Definition: types.h:117
BOOLEAN bInt3Here
Definition: parse.c:64
COMMAND_PROTOTYPE ( I1here  )

Definition at line 2102 of file parse.c.

2103 {
2104  if(pArgs->Count==1)
2105  {
2106  if(pArgs->Value[0]==1)
2107  {
2108  if(!bInt1Here)
2109  {
2110  bInt1Here=TRUE;
2111  Print(OUTPUT_WINDOW,"I1HERE is now ON\n");
2112  }
2113  else
2114  Print(OUTPUT_WINDOW,"I1HERE is already ON\n");
2115  }
2116  else if(pArgs->Value[0]==0)
2117  {
2118  if(bInt1Here)
2119  {
2120  bInt1Here=FALSE;
2121  Print(OUTPUT_WINDOW,"I1HERE is now OFF\n");
2122  }
2123  else
2124  Print(OUTPUT_WINDOW,"I1HERE is already OFF\n");
2125  }
2126  }
2127  else if(pArgs->Count==0)
2128  {
2129  if(bInt1Here)
2130  {
2131  Print(OUTPUT_WINDOW,"I1HERE is ON\n");
2132  }
2133  else
2134  {
2135  Print(OUTPUT_WINDOW,"I1HERE is OFF\n");
2136  }
2137  }
2138  // never gets here
2139  return TRUE;
2140 }
#define TRUE
Definition: types.h:120
BOOLEAN bInt1Here
Definition: parse.c:65
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
#define FALSE
Definition: types.h:117
COMMAND_PROTOTYPE ( NextInstr  )

Definition at line 2142 of file parse.c.

2143 {
2144  static char tempDisasm[256];
2145  ULONG addr,addrbefore;
2146 
2148 
2149  if(!pArgs->Count)
2150  {
2151  addr=addrbefore=GetLinearAddress(CurrentCS,CurrentEIP);
2152  DPRINT((0,"addr before %.8X\n",addrbefore));
2153  Disasm(&addr,tempDisasm);
2154  DPRINT((0,"addr after %.8X\n",addr));
2155  CurrentEIP=CurrentEIP+(addr-addrbefore);
2156  // display register contents
2157  DisplayRegs();
2158  // unassemble
2159  DPRINT((0,"new CS:EIP %04.x:%.8X\n",CurrentCS,CurrentEIP));
2160  PICE_memset(pArgs,0,sizeof(ARGS));
2161  // make unassembler refresh all again
2163  pArgs->Count=2;
2164  pArgs->Value[0]=(ULONG)CurrentCS;
2165  pArgs->Value[1]=CurrentEIP;
2166  Unassemble(pArgs);
2167  }
2169  return TRUE;
2170 }
USHORT CurrentCS
Definition: shell.c:116
#define TRUE
Definition: types.h:120
BOOLEAN bNeedToFillBuffer
Definition: parse.c:254
#define FALSE
Definition: types.h:117
void DPRINT(...)
Definition: polytest.cpp:61
ULONG ulLastDisassStartAddress
Definition: parse.c:43
Definition: parse.h:31
GLenum const GLvoid * addr
Definition: glext.h:9621
ULONG GetLinearAddress(USHORT Segment, ULONG Offset)
Definition: utils.c:782
BOOLEAN Disasm(PULONG pOffset, PUCHAR pchDst)
Definition: disassembler.c:705
void DisplayRegs(void)
Definition: utils.c:1097
ULONG ulLastDisassEndAddress
Definition: parse.c:43
ULONG CurrentEIP
Definition: shell.c:113
unsigned int ULONG
Definition: retypes.h:1
void PICE_memset(void *p, unsigned char c, int sz)
Definition: utils.c:228
COMMAND_PROTOTYPE ( SetGetRegisters  )

Definition at line 2172 of file parse.c.

2173 {
2174  ULONG i;
2175 
2176  if(pArgs->Count==0)
2177  {
2178  // display whole set
2179  for(i=0;RegKeyWords[i].pValue!=0;i++)
2180  {
2181  switch(RegKeyWords[i].ulSize)
2182  {
2183  case 1:
2184  PICE_sprintf(tempCmd,"%s = %.8X\n",RegKeyWords[i].KeyWord,*(PUCHAR)(RegKeyWords[i].pValue));
2185  break;
2186  case 2:
2187  PICE_sprintf(tempCmd,"%s = %.8X\n",RegKeyWords[i].KeyWord,*(PUSHORT)(RegKeyWords[i].pValue));
2188  break;
2189  case 4:
2190  PICE_sprintf(tempCmd,"%s = %.8X\n",RegKeyWords[i].KeyWord,*(PULONG)(RegKeyWords[i].pValue));
2191  break;
2192  }
2194  if(WaitForKey()==FALSE)break;
2195  }
2196  }
2197  else if(pArgs->Count==1)
2198  {
2199  // display selected register
2200  for(i=0;RegKeyWords[i].pValue!=0;i++)
2201  {
2202  if(PICE_strcmpi(pArgs->pToken[0],RegKeyWords[i].KeyWord)==0)
2203  {
2204  switch(RegKeyWords[i].ulSize)
2205  {
2206  case 1:
2207  PICE_sprintf(tempCmd,"%s = %.2X\n",RegKeyWords[i].KeyWord,*(PUCHAR)(RegKeyWords[i].pValue));
2208  break;
2209  case 2:
2210  PICE_sprintf(tempCmd,"%s = %.4X\n",RegKeyWords[i].KeyWord,*(PUSHORT)(RegKeyWords[i].pValue));
2211  break;
2212  case 4:
2213  PICE_sprintf(tempCmd,"%s = %.8X\n",RegKeyWords[i].KeyWord,*(PULONG)(RegKeyWords[i].pValue));
2214  break;
2215  }
2217  break;
2218  }
2219  }
2220  }
2221  else if(pArgs->Count==2)
2222  {
2223  // set selected register to value
2224  for(i=0;RegKeyWords[i].pValue!=0;i++)
2225  {
2226  if(PICE_strcmpi(pArgs->pToken[0],RegKeyWords[i].KeyWord)==0)
2227  {
2228  switch(RegKeyWords[i].ulSize)
2229  {
2230  case 1:
2231  *(PUCHAR)(RegKeyWords[i].pValue)=(UCHAR)pArgs->Value[1];
2232  break;
2233  case 2:
2234  *(PUSHORT)(RegKeyWords[i].pValue)=(USHORT)pArgs->Value[1];
2235  break;
2236  case 4:
2237  *(PULONG)(RegKeyWords[i].pValue)=(ULONG)pArgs->Value[1];
2238  break;
2239  }
2240  DisplayRegs();
2241  RepaintSource();
2242  break;
2243  }
2244  }
2245  }
2246  return TRUE;
2247 }
char * KeyWord
Definition: parse.h:64
#define TRUE
Definition: types.h:120
void RepaintSource(void)
Definition: parse.c:304
unsigned char * PUCHAR
Definition: retypes.h:3
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
KEYWORDS RegKeyWords[]
Definition: parse.c:67
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define FALSE
Definition: types.h:117
PVOID pValue
Definition: parse.h:65
BOOLEAN WaitForKey(void)
Definition: parse.c:374
unsigned short * PUSHORT
Definition: retypes.h:2
unsigned char UCHAR
Definition: xmlstorage.h:181
void DisplayRegs(void)
Definition: utils.c:1097
char tempCmd[1024]
Definition: parse.c:225
unsigned short USHORT
Definition: pedump.c:61
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1
ULONG PICE_strcmpi(char *s1, char *s2)
Definition: utils.c:387
COMMAND_PROTOTYPE ( SetCodeDisplay  )

Definition at line 2253 of file parse.c.

2254 {
2255  ARGS Args;
2256 
2257  if(pArgs->Count==0)
2258  {
2260 
2261  PICE_memset(&Args,0,sizeof(ARGS));
2262  Args.Count=0;
2263  // make unassembler refresh all again
2265  Unassemble(&Args);
2266  }
2267  else if(pArgs->Count==1)
2268  {
2269  bCodeOn=(pArgs->Value[0]==0)?FALSE:TRUE;
2270 
2271  PICE_memset(&Args,0,sizeof(ARGS));
2272  Args.Count=0;
2273  // make unassembler refresh all again
2275  Unassemble(&Args);
2276  }
2277  return TRUE;
2278 }
ULONG Count
Definition: parse.h:34
#define TRUE
Definition: types.h:120
BOOLEAN bCodeOn
Definition: parse.c:253
#define FALSE
Definition: types.h:117
char ** Args
Definition: acdebug.h:342
ULONG ulLastDisassStartAddress
Definition: parse.c:43
Definition: parse.h:31
ULONG ulLastDisassEndAddress
Definition: parse.c:43
void PICE_memset(void *p, unsigned char c, int sz)
Definition: utils.c:228
COMMAND_PROTOTYPE ( ShowCPU  )

Definition at line 2284 of file parse.c.

2285 {
2286 ULONG i;
2287 
2288  for(i=0;CPUInfo[i].pValue!=NULL;i++)
2289  {
2290  PICE_sprintf(tempCmd,"%s = %.8X\n",CPUInfo[i].Name,*(CPUInfo[i].pValue));
2292  if(WaitForKey()==FALSE)break;
2293  }
2294  return TRUE;
2295 }
#define TRUE
Definition: types.h:120
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:557
BOOLEAN WaitForKey(void)
Definition: parse.c:374
_In_ PUNICODE_STRING Name
Definition: mrx.h:218
char tempCmd[1024]
Definition: parse.c:225
CPUINFO CPUInfo[]
Definition: parse.c:231
unsigned int ULONG
Definition: retypes.h:1
PULONG pValue
Definition: parse.h:44
COMMAND_PROTOTYPE ( WalkStack  )

Definition at line 2301 of file parse.c.

2302 {
2303  if(!pArgs->Count)
2304  {
2306  }
2307 
2308  return TRUE;
2309 }
#define TRUE
Definition: types.h:120
void IntelStackWalk(ULONG pc, ULONG ebp, ULONG esp)
Definition: utils.c:1530
ULONG CurrentEIP
Definition: shell.c:113
ULONG CurrentEBP
Definition: shell.c:115
ULONG CurrentESP
Definition: shell.c:115
COMMAND_PROTOTYPE ( PokeDword  )

Definition at line 2315 of file parse.c.

2316 {
2317  ULONG ulData;
2318 
2319  // read old data
2320  ulData = ReadPhysMem(pArgs->Value[1],sizeof(ULONG));
2321  PICE_sprintf(tempCmd,"value @ %.8X was %.8X\n",pArgs->Value[1],ulData);
2323 
2324  // write new data
2325  WritePhysMem(pArgs->Value[1],pArgs->Value[2],sizeof(ULONG));
2326 
2327  // read check
2328  ulData = ReadPhysMem(pArgs->Value[1],sizeof(ULONG));
2329  PICE_sprintf(tempCmd,"value @ %.8X = %.8X\n",pArgs->Value[1],ulData);
2331 
2332  return TRUE;
2333 }
#define TRUE
Definition: types.h:120
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
ULONG ReadPhysMem(ULONG Address, ULONG ulSize)
Definition: utils.c:1633
void WritePhysMem(ULONG Address, ULONG Datum, ULONG ulSize)
Definition: utils.c:1680
char tempCmd[1024]
Definition: parse.c:225
unsigned int ULONG
Definition: retypes.h:1
COMMAND_PROTOTYPE ( PokeMemory  )

Definition at line 2339 of file parse.c.

2340 {
2341  DPRINT((0,"PokeMemory()\n"));
2342  DPRINT((0,"PokeMemory(): value[0] = %.8X value[1] = %.8X value[3] = %.8X count = %.8X\n",pArgs->Value[0],pArgs->Value[1],pArgs->Value[2],pArgs->Count));
2343 
2344  // must be three parameters
2345  if(pArgs->Count == 3)
2346  {
2347  switch(pArgs->Value[0])
2348  {
2349  case 4:
2350  return PokeDword(pArgs);
2351  default:
2352  case 1:
2353  case 2:
2354  break;
2355  }
2356  }
2357  else
2358  {
2359  Print(OUTPUT_WINDOW,"you need to supply a physical address and datum to write!\n");
2360  }
2361 
2362  return TRUE;
2363 }
#define TRUE
Definition: types.h:120
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
void DPRINT(...)
Definition: polytest.cpp:61
COMMAND_PROTOTYPE ( PeekDword  )

Definition at line 2370 of file parse.c.

2371 {
2372  ULONG ulData;
2373 
2374  ulData = ReadPhysMem(pArgs->Value[1],sizeof(ULONG));
2375  PICE_sprintf(tempCmd,"%.8X\n",ulData);
2377 
2378  return TRUE;
2379 }
#define TRUE
Definition: types.h:120
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
ULONG ReadPhysMem(ULONG Address, ULONG ulSize)
Definition: utils.c:1633
char tempCmd[1024]
Definition: parse.c:225
unsigned int ULONG
Definition: retypes.h:1
COMMAND_PROTOTYPE ( PeekWord  )

Definition at line 2385 of file parse.c.

2386 {
2387  USHORT usData;
2388 
2389  usData = (USHORT)ReadPhysMem(pArgs->Value[1],sizeof(USHORT));
2390  PICE_sprintf(tempCmd,"%.4X\n",usData);
2392 
2393  return TRUE;
2394 }
#define TRUE
Definition: types.h:120
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
ULONG ReadPhysMem(ULONG Address, ULONG ulSize)
Definition: utils.c:1633
char tempCmd[1024]
Definition: parse.c:225
unsigned short USHORT
Definition: pedump.c:61
COMMAND_PROTOTYPE ( PeekByte  )

Definition at line 2400 of file parse.c.

2401 {
2402  UCHAR ucData;
2403 
2404  ucData = (UCHAR)ReadPhysMem(pArgs->Value[1],sizeof(UCHAR));
2405  PICE_sprintf(tempCmd,"%.2X\n",ucData);
2407 
2408  return TRUE;
2409 }
#define TRUE
Definition: types.h:120
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
unsigned char UCHAR
Definition: xmlstorage.h:181
ULONG ReadPhysMem(ULONG Address, ULONG ulSize)
Definition: utils.c:1633
char tempCmd[1024]
Definition: parse.c:225
COMMAND_PROTOTYPE ( PeekMemory  )

Definition at line 2415 of file parse.c.

2416 {
2417  DPRINT((0,"PeekMemory()\n"));
2418  DPRINT((0,"PeekMemory(): value[0] = %.8X value[1] = %.8X count = %.8X\n",pArgs->Value[0],pArgs->Value[1],pArgs->Count));
2419 
2420  if(pArgs->Count == 2)
2421  {
2422  switch(pArgs->Value[0])
2423  {
2424  case 1:
2425  return PeekByte(pArgs);
2426  case 2:
2427  return PeekWord(pArgs);
2428  case 4:
2429  return PeekDword(pArgs);
2430  default:
2431  break;
2432  }
2433  }
2434 
2435  return TRUE;
2436 }
#define TRUE
Definition: types.h:120
void DPRINT(...)
Definition: polytest.cpp:61
static USHORT PeekByte(PUCHAR ReadDataPort)
Definition: hardware.c:211
COMMAND_PROTOTYPE ( UnassembleAtCurrentEip  )

Definition at line 2442 of file parse.c.

2443 {
2444  PICE_memset(pArgs,0,sizeof(ARGS));
2445  pArgs->Count = 2;
2446  pArgs->Value[0] = CurrentCS;
2447  pArgs->Value[1] = CurrentEIP;
2448  Unassemble(pArgs);
2449  return TRUE;
2450 }
USHORT CurrentCS
Definition: shell.c:116
#define TRUE
Definition: types.h:120
Definition: parse.h:31
ULONG CurrentEIP
Definition: shell.c:113
void PICE_memset(void *p, unsigned char c, int sz)
Definition: utils.c:228
COMMAND_PROTOTYPE ( SwitchTables  )

Definition at line 2456 of file parse.c.

2457 {
2458  ULONG i;
2459 
2460  DPRINT((0,"SwitchTables()\n"));
2461 
2462  // no arguments -> display load symbol tables
2463  if(!pArgs->Count)
2464  {
2465  for(i=0;i<DIM(apSymbols);i++)
2466  {
2467  if(apSymbols[i])
2468  {
2469  if(apSymbols[i] == pCurrentSymbols)
2470  PICE_sprintf(tempCmd,"*%-32S @ %.8X (%5u source files)\n",apSymbols[i]->name,(ULONG)apSymbols[i],apSymbols[i]->ulNumberOfSrcFiles);
2471  else
2472  PICE_sprintf(tempCmd," %-32S @ %.8X (%5u source files)\n",apSymbols[i]->name,(ULONG)apSymbols[i],apSymbols[i]->ulNumberOfSrcFiles);
2474  if(WaitForKey()==FALSE)break;
2475  }
2476  }
2477  }
2478  // 1 argument -> set new current symbols
2479  else if(pArgs->Count == 1)
2480  {
2481  PDEBUG_MODULE pTempMod;
2483 
2484  pCurrentSymbols = (PICE_SYMBOLFILE_HEADER*)pArgs->Value[0];
2486 
2487  DPRINT((0,"TableSwitchSym: pCurrentSymbols: %x, Name: %s\n", pCurrentSymbols, temp));
2488 
2489  pTempMod = IsModuleLoaded(temp);
2490  if( pTempMod )
2491  pCurrentMod = pTempMod;
2492  }
2493 
2494  return TRUE;
2495 }
PDEBUG_MODULE IsModuleLoaded(LPSTR p)
Definition: symbols.c:296
#define TRUE
Definition: types.h:120
PICE_SYMBOLFILE_HEADER * apSymbols[32]
Definition: symbols.c:53
PDEBUG_MODULE pCurrentMod
Definition: parse.c:59
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define FALSE
Definition: types.h:117
PICE_SYMBOLFILE_HEADER * pCurrentSymbols
Definition: parse.c:60
#define DEBUG_MODULE_NAME_LEN
Definition: shared.h:79
WCHAR name[DEBUG_MODULE_NAME_LEN]
Definition: shared.h:83
void DPRINT(...)
Definition: polytest.cpp:61
BOOLEAN WaitForKey(void)
Definition: parse.c:374
static stack_node_t temp
Definition: rpn.c:18
void CopyWideToAnsi(LPSTR pAnsi, PWSTR pWide)
Definition: utils.c:591
char tempCmd[1024]
Definition: parse.c:225
#define DIM
Definition: s_texfetch.c:44
Definition: name.c:23
unsigned int ULONG
Definition: retypes.h:1
COMMAND_PROTOTYPE ( SwitchFiles  )

Definition at line 2501 of file parse.c.

2502 {
2503  PICE_SYMBOLFILE_SOURCE* pSrc;
2504  ULONG i;
2505  LPSTR p;
2506 
2507  DPRINT((0,"SwitchFiles()\n"));
2508  // no arguments -> show files for current symbols
2509  if(!pArgs->Count)
2510  {
2512  {
2513  LPSTR pCurrentFile=NULL;
2514 
2515  // find out the current file name
2516  if(*szCurrentFile!=0)
2517  {
2518  if((pCurrentFile = strrchr(szCurrentFile,'/')) )
2519  {
2520  pCurrentFile++;
2521  }
2522  else
2523  {
2524  pCurrentFile = szCurrentFile;
2525  }
2526  }
2527 
2529 
2530  for(i=0;i<pCurrentSymbols->ulNumberOfSrcFiles;i++)
2531  {
2532  if(pCurrentFile)
2533  {
2534  if((p = strrchr(pSrc->filename,'/')) )
2535  {
2536  if(PICE_strcmpi(p+1,pCurrentFile)==0)
2537  PICE_sprintf(tempCmd,"*%-32s @ %.8X\n",p+1,(ULONG)pSrc);
2538  else
2539  PICE_sprintf(tempCmd," %-32s @ %.8X\n",p+1,(ULONG)pSrc);
2540  }
2541  else
2542  {
2543  if(PICE_strcmpi(pSrc->filename,pCurrentFile)==0)
2544  PICE_sprintf(tempCmd,"*%-32s @ %.8X\n",pSrc->filename,(ULONG)pSrc);
2545  else
2546  PICE_sprintf(tempCmd," %-32s @ %.8X\n",pSrc->filename,(ULONG)pSrc);
2547  }
2548  }
2549  else
2550  {
2551  if((p = strrchr(pSrc->filename,'/')) )
2552  {
2553  PICE_sprintf(tempCmd,"%-32s @ %.8X\n",p+1,(ULONG)pSrc);
2554  }
2555  else
2556  {
2557  PICE_sprintf(tempCmd,"%-32s @ %.8X\n",pSrc->filename,(ULONG)pSrc);
2558  }
2559  }
2561 
2562  if(WaitForKey()==FALSE)break;
2563  (LPSTR)pSrc += pSrc->ulOffsetToNext;
2564  }
2565  }
2566  else
2567  Print(OUTPUT_WINDOW,"No source files available!\n");
2568  }
2569  // 1 argument -> argument is pointer PICE_SYMBOLFILE_SOURCE struct ->
2570  // set current file and show it
2571  else if(pArgs->Count == 1)
2572  {
2573  PICE_SYMBOLFILE_SOURCE* pSrc = (PICE_SYMBOLFILE_SOURCE*)pArgs->Value[0];
2574  LPSTR pFilename = pSrc->filename;
2575 
2577 
2578  if(PICE_strlen(pFilename)<GLOBAL_SCREEN_WIDTH/2)
2579  {
2580  PutChar(pFilename,1,wWindow[SOURCE_WINDOW].y-1);
2581  }
2582  else
2583  {
2584  LPSTR p;
2585 
2586  p = strrchr(pFilename,'/');
2587  if(!p)
2588  {
2589  p = pFilename;
2590  }
2591  else
2592  {
2593  p++;
2594  }
2595 
2596  PutChar(p,1,wWindow[SOURCE_WINDOW].y-1);
2597  }
2598 
2599  // set new current file
2600  PICE_strcpy(szCurrentFile,pFilename);
2601 
2603 
2605  (LPSTR)pSrc+pSrc->ulOffsetToNext,
2606  1,
2607  -1);
2608  }
2609 
2610  return TRUE;
2611 }
#define TRUE
Definition: types.h:120
ULONG GLOBAL_SCREEN_WIDTH
Definition: hardware.c:62
ULONG ulOffsetToSrcFiles
Definition: shared.h:89
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
USHORT PICE_strlen(const char *s)
Definition: utils.c:547
ULONG ulNumberOfSrcFiles
Definition: shared.h:89
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
char * LPSTR
Definition: xmlstorage.h:182
void DisplaySourceFile(LPSTR pSrcLine, LPSTR pSrcEnd, ULONG ulLineNumber, ULONG ulLineNumberToInvert)
Definition: parse.c:1313
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
char * PICE_strcpy(char *s1, char *s2)
Definition: utils.c:302
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define FALSE
Definition: types.h:117
PICE_SYMBOLFILE_HEADER * pCurrentSymbols
Definition: parse.c:60
char szCurrentFile[256]
Definition: parse.c:58
char filename[256]
Definition: shared.h:103
smooth NULL
Definition: ftsmooth.c:557
LONG ulCurrentlyDisplayedLineNumber
Definition: parse.c:46
void ClrLine(ULONG line)
Definition: hardware.c:662
void DPRINT(...)
Definition: polytest.cpp:61
WINDOW wWindow[4]
Definition: hardware.c:59
BOOLEAN WaitForKey(void)
Definition: parse.c:374
void PutChar(LPSTR p, ULONG x, ULONG y)
Definition: hardware.c:604
char tempCmd[1024]
Definition: parse.c:225
unsigned int ULONG
Definition: retypes.h:1
GLfloat GLfloat p
Definition: glext.h:8902
INT INT y
Definition: msvc.h:62
ULONG PICE_strcmpi(char *s1, char *s2)
Definition: utils.c:387
COMMAND_PROTOTYPE ( ShowLocals  )

Definition at line 2617 of file parse.c.

2618 {
2620 
2621  if(pArgs->Count==0)
2622  {
2624  DPRINT((0,"ShowLocals: %x\n", p));
2625  if(p)
2626  {
2627  DPRINT((0,"ShowLocals: name %s, type_name %s\n", p->name, p->type_name));
2628  while(PICE_strlen(p->name))
2629  {
2630  if(!p->bRegister)
2631  {
2632  PICE_sprintf(tempCmd,"[EBP%.4d / #%u] %x %s %s \n",p->offset,p->line,p->value,p->type_name,p->name);
2633  }
2634  else
2635  {
2636  PICE_sprintf(tempCmd,"[%-8s / #%u] %x %s %s #%u\n",LocalVarRegs[p->offset],p->line,p->value,p->type_name,p->name);
2637  }
2639  p++;
2640  }
2641  }
2642  }
2643  return TRUE;
2644 }
USHORT CurrentCS
Definition: shell.c:116
#define TRUE
Definition: types.h:120
LPSTR LocalVarRegs[]
Definition: parse.c:101
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
USHORT PICE_strlen(const char *s)
Definition: utils.c:547
ULONG offset
Definition: symbols.h:36
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
void DPRINT(...)
Definition: polytest.cpp:61
PLOCAL_VARIABLE FindLocalsByAddress(ULONG addr)
Definition: symbols.c:1317
char name[64]
Definition: symbols.h:35
ULONG value
Definition: symbols.h:36
ULONG GetLinearAddress(USHORT Segment, ULONG Offset)
Definition: utils.c:782
BOOLEAN bRegister
Definition: symbols.h:37
char tempCmd[1024]
Definition: parse.c:225
ULONG CurrentEIP
Definition: shell.c:113
char type_name[64]
Definition: symbols.h:34
GLfloat GLfloat p
Definition: glext.h:8902
ULONG line
Definition: symbols.h:36
COMMAND_PROTOTYPE ( ShowSymbols  )

Definition at line 2650 of file parse.c.

2651 {
2652  PICE_SYMBOLFILE_HEADER* pSymbols;
2653  ULONG index,addr;
2654  LPSTR pSearchString,pName,pFind;
2655 
2656  // no args -> list full symbols for current module
2657  if(!pArgs->Count)
2658  {
2659  // have current module ?
2660  if(pCurrentMod)
2661  {
2662  DPRINT((0,"ShowSymbols(): full listing of symbols for %S\n",pCurrentMod->name));
2663  addr = (ULONG)pCurrentMod->BaseAddress;
2664 
2665  if((pSymbols = FindModuleSymbols(addr)) )
2666  {
2667  PICE_sprintf(tempCmd,"symbols for module \"%S\"\n",pCurrentMod->name);
2669 
2670  index = 0;
2671  while((index = ListSymbolStartingAt(pCurrentMod,pSymbols,index,tempCmd)))
2672  {
2674  if(WaitForKey()==FALSE)break;
2675  }
2676  }
2677  }
2678  }
2679  // partial name
2680  else if(pArgs->Count == 1)
2681  {
2682  if(pCurrentMod)
2683  {
2684  addr = (ULONG)pCurrentMod->BaseAddress;
2685 
2686  if((pSymbols = FindModuleSymbols(addr)))
2687  {
2688  pSearchString = (LPSTR)pArgs->Value[0];
2689 
2690  PICE_sprintf(tempCmd,"symbols for module \"%S\" (searching for \"%s\")\n",pCurrentMod->name,pSearchString);
2692 
2693  if(pSearchString)
2694  {
2695  if(*pSearchString=='*' && pSearchString[PICE_strlen(pSearchString)-1]=='*')
2696  {
2697  pSearchString[PICE_strlen(pSearchString)-1] = 0;
2698  pSearchString++;
2699  index = 0;
2700  while((index = ListSymbolStartingAt(pCurrentMod,pSymbols,index,tempCmd)))
2701  {
2702  pName = strrchr(tempCmd,' ');
2703  pName++;
2704  pFind = strstr(pName,pSearchString);
2705  if(pFind)
2706  {
2708  if(WaitForKey()==FALSE)break;
2709  }
2710  }
2711  // TODO
2712  }
2713  else if(pSearchString[PICE_strlen(pSearchString)-1]=='*')
2714  {
2715  pSearchString[PICE_strlen(pSearchString)-1] = 0;
2716  index = 0;
2717 
2718  index = ListSymbolStartingAt(pCurrentMod,pSymbols,index,tempCmd);
2719  if(index)
2720  {
2721  do
2722  {
2723  pName = strrchr(tempCmd,' ');
2724  pName++;
2725  pFind = strstr(pName,pSearchString);
2726  if(pFind && (((ULONG)pName-(ULONG)pFind)==0) )
2727  {
2729  if(WaitForKey()==FALSE)break;
2730  }
2731  }while((index = ListSymbolStartingAt(pCurrentMod,pSymbols,index,tempCmd)));
2732  }
2733  }
2734  }
2735  }
2736  }
2737  }
2738 
2739  return TRUE;
2740 }
#define TRUE
Definition: types.h:120
PDEBUG_MODULE pCurrentMod
Definition: parse.c:59
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
USHORT PICE_strlen(const char *s)
Definition: utils.c:547
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
char * LPSTR
Definition: xmlstorage.h:182
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
#define FALSE
Definition: types.h:117
PICE_SYMBOLFILE_HEADER * FindModuleSymbols(ULONG addr)
Definition: symbols.c:463
void DPRINT(...)
Definition: polytest.cpp:61
BOOLEAN WaitForKey(void)
Definition: parse.c:374
static LPSTR pName
Definition: security.c:78
GLenum const GLvoid * addr
Definition: glext.h:9621
#define index(s, c)
Definition: various.h:29
char tempCmd[1024]
Definition: parse.c:225
PVOID BaseAddress
Definition: symbols.h:51
unsigned int ULONG
Definition: retypes.h:1
WCHAR name[DEBUG_MODULE_NAME_LEN]
Definition: symbols.h:53
ULONG ListSymbolStartingAt(PDEBUG_MODULE pMod, PICE_SYMBOLFILE_HEADER *pSymbols, ULONG index, LPSTR pOutput)
Definition: symbols.c:1792
COMMAND_PROTOTYPE ( EvaluateExpression  )

Definition at line 2746 of file parse.c.

2747 {
2748  PICE_SYMBOLFILE_HEADER* pSymbols;
2749  ULONG addr;
2750 
2751  if(pArgs->Count == 1)
2752  {
2753  if(pCurrentMod)
2754  {
2755  addr = (ULONG)pCurrentMod->BaseAddress;
2756 
2757  if( (pSymbols = FindModuleSymbols(addr) ) )
2758  {
2759  DPRINT((0,"EvaluateExpression: %s\n", (LPSTR)pArgs->Value[0]));
2760  Evaluate(pSymbols,(LPSTR)pArgs->Value[0]);
2761  }
2762  }
2763  }
2764  return TRUE;
2765 }
#define TRUE
Definition: types.h:120
PDEBUG_MODULE pCurrentMod
Definition: parse.c:59
void Evaluate(PICE_SYMBOLFILE_HEADER *pSymbols, LPSTR p)
Definition: symbols.c:2918
char * LPSTR
Definition: xmlstorage.h:182
PICE_SYMBOLFILE_HEADER * FindModuleSymbols(ULONG addr)
Definition: symbols.c:463
void DPRINT(...)
Definition: polytest.cpp:61
GLenum const GLvoid * addr
Definition: glext.h:9621
PVOID BaseAddress
Definition: symbols.h:51
unsigned int ULONG
Definition: retypes.h:1
COMMAND_PROTOTYPE ( SizeCodeWindow  )

Definition at line 2771 of file parse.c.

2772 {
2773  ULONG NewHeight,TotalHeight;
2774 
2775  if(pArgs->Count == 1)
2776  {
2777  NewHeight = pArgs->Value[0];
2778 
2779  TotalHeight = wWindow[SOURCE_WINDOW].cy +
2781 
2782  if(NewHeight < TotalHeight)
2783  {
2784  if(wWindow[SOURCE_WINDOW].cy != NewHeight)
2785  {
2786  wWindow[SOURCE_WINDOW].cy = NewHeight;
2788  wWindow[OUTPUT_WINDOW].cy = TotalHeight - NewHeight;
2789 
2790  RepaintDesktop();
2791  }
2792  }
2793  }
2794  else
2795  {
2796  PICE_sprintf(tempCmd,"code window at position %u has %u lines \n",wWindow[SOURCE_WINDOW].y,wWindow[SOURCE_WINDOW].cy);
2798  }
2799 
2800  return TRUE;
2801 }
#define TRUE
Definition: types.h:120
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
USHORT cy
Definition: hardware.h:33
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
void RepaintDesktop(void)
Definition: parse.c:324
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
WINDOW wWindow[4]
Definition: hardware.c:59
USHORT y
Definition: hardware.h:33
char tempCmd[1024]
Definition: parse.c:225
unsigned int ULONG
Definition: retypes.h:1
INT INT y
Definition: msvc.h:62
COMMAND_PROTOTYPE ( SizeDataWindow  )

Definition at line 2807 of file parse.c.

2808 {
2809  ULONG NewHeight,TotalHeight;
2810 
2811  if(pArgs->Count)
2812  {
2813  NewHeight = pArgs->Value[0];
2814 
2815  TotalHeight = wWindow[DATA_WINDOW].cy +
2817 
2818  if(NewHeight < TotalHeight)
2819  {
2820  if(wWindow[DATA_WINDOW].cy != NewHeight)
2821  {
2822  wWindow[DATA_WINDOW].cy = NewHeight;
2824  wWindow[SOURCE_WINDOW].cy = TotalHeight - NewHeight;
2825 
2826  RepaintDesktop();
2827  }
2828  }
2829  }
2830  else
2831  {
2832  PICE_sprintf(tempCmd,"data window has %u lines \n",wWindow[DATA_WINDOW].cy);
2834  }
2835 
2836  return TRUE;
2837 }
#define TRUE
Definition: types.h:120
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
USHORT cy
Definition: hardware.h:33
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
void RepaintDesktop(void)
Definition: parse.c:324
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
WINDOW wWindow[4]
Definition: hardware.c:59
USHORT y
Definition: hardware.h:33
char tempCmd[1024]
Definition: parse.c:225
unsigned int ULONG
Definition: retypes.h:1
COMMAND_PROTOTYPE ( ClearScreen  )

Definition at line 2843 of file parse.c.

2844 {
2845  EmptyRingBuffer();
2846 
2848  CheckRingBuffer();
2849 
2850  return TRUE;
2851 }
#define TRUE
Definition: types.h:120
void EmptyRingBuffer(void)
Definition: hardware.c:104
void CheckRingBuffer(void)
Definition: hardware.c:133
void Clear(USHORT Window)
Definition: hardware.c:705
COMMAND_PROTOTYPE ( ShowMappings  )

Definition at line 2857 of file parse.c.

2858 {
2859 #if 0
2860  ULONG ulPageDir;
2861  ULONG ulPageTable;
2862  ULONG address;
2863  ULONG phys_addr;
2864  pgd_t * pPGD;
2865  pmd_t * pPMD;
2866  pte_t * pPTE;
2867  struct mm_struct* p = NULL;
2868  struct task_struct* my_current = (struct task_struct*)0xFFFFE000;
2869 
2870  DPRINT((0,"ShowMappings()\n"));
2871 
2872  if(pArgs->Count == 1)
2873  {
2874  // We're in DebuggerShell(), so we live on a different stack
2875  (ULONG)my_current &= ulRealStackPtr;
2876 
2877  // in case we have a user context we use it's mm_struct
2878  if(my_current->mm)
2879  {
2880  p = my_current->mm;
2881  }
2882  // no user context -> use kernel's context
2883  else
2884  {
2885  p = my_init_mm;
2886  }
2887 
2888  // get the requested address from arguments
2889  phys_addr = pArgs->Value[0];
2890 
2891  DPRINT((0,"ShowMappings(): p = %X phys_addr = %X\n",(ULONG)p,phys_addr));
2892 
2893  // for every page directory
2894  for(ulPageDir=0;ulPageDir<1024;ulPageDir++)
2895  {
2896  address = (ulPageDir<<22);
2897 
2898  // get the page directory for the address
2899  pPGD = pgd_offset(p,address);
2900  // if page dir present
2901  if(pPGD && pgd_val(*pPGD)&_PAGE_PRESENT)
2902  {
2903  DPRINT((0,"ShowMappings(): page directory present for %x\n",address));
2904  // not large page
2905  if(!(pgd_val(*pPGD)&_PAGE_4M))
2906  {
2907  DPRINT((0,"ShowMappings(): page directory for 4k pages\n"));
2908  for(ulPageTable=0;ulPageTable<1024;ulPageTable++)
2909  {
2910  address = (ulPageDir<<22)|(ulPageTable<<12);
2911 
2912  pPMD = pmd_offset(pPGD,address);
2913  if(pPMD)
2914  {
2915  pPTE = pte_offset(pPMD,address);
2916  if(pPTE)
2917  {
2918  if(*(PULONG)pPTE & _PAGE_PRESENT)
2919  {
2920  ULONG ulPte = *(PULONG)pPTE & 0xFFFFF000;
2921 
2922  if(ulPte == (phys_addr & 0xFFFFF000))
2923  {
2924  PICE_sprintf(tempCmd,"%.8X\n",address+(phys_addr&0xFFF));
2926  if(WaitForKey()==FALSE)return TRUE;
2927  }
2928  }
2929  }
2930  }
2931  }
2932  }
2933  // large page
2934  else
2935  {
2936  address = (ulPageDir<<22);
2937  if((pgd_val(*pPGD)&0xFFC00000) == (phys_addr & 0xFFC00000) )
2938  {
2939  if( ((address|(phys_addr&0x7FFFFF))&~TASK_SIZE) == phys_addr)
2940  PICE_sprintf(tempCmd,"%.8X (identity map %.8X+%.8X)\n",address|(phys_addr&0x7FFFFF),TASK_SIZE,phys_addr);
2941  else
2942  PICE_sprintf(tempCmd,"%.8X\n",address|(phys_addr&0x7FFFFF));
2944  if(WaitForKey()==FALSE)return TRUE;
2945  }
2946  }
2947  }
2948  }
2949  }
2950 #endif
2951  PICE_sprintf(tempCmd,"Not implemented yet!\n");
2953  return TRUE;
2954 }
#define TRUE
Definition: types.h:120
#define _PAGE_4M
Definition: utils.h:268
ULONG ulRealStackPtr
Definition: shell.c:82
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
PMADDRESS_SPACE my_init_mm
Definition: utils.h:300
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:557
void DPRINT(...)
Definition: polytest.cpp:61
BOOLEAN WaitForKey(void)
Definition: parse.c:374
#define _PAGE_PRESENT
Definition: compat.h:67
GLuint address
Definition: glext.h:9393
char tempCmd[1024]
Definition: parse.c:225
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1
GLfloat GLfloat p
Definition: glext.h:8902
COMMAND_PROTOTYPE ( ShowTimers  )

Definition at line 2960 of file parse.c.

2961 {
2962 
2963  return TRUE;
2964 }
#define TRUE
Definition: types.h:120
COMMAND_PROTOTYPE ( ShowPCI  )

Definition at line 2987 of file parse.c.

2988 {
2989  ULONG oldCF8,data,bus,dev,reg,i,ulNumBaseAddresses,bus_req=0,dev_req=0;
2990  PCI_NUMBER pciNumber;
2991  PCI_COMMON_CONFIG pciConfig,*ppciConfig;
2992  PULONG p;
2993  LPSTR pVendorName;
2994  char temp[32];
2995  BOOLEAN bShowAll = FALSE,bUseDev=TRUE,bUseBus=TRUE;
2996 
2997 
2998  DPRINT((0,"ShowPCI()\n"));
2999 
3000  if(pArgs->CountSwitches>1)
3001  return TRUE;
3002 
3003  if(pArgs->CountSwitches==1)
3004  {
3005  if(pArgs->Switch[0] == 'a')
3006  bShowAll = TRUE;
3007  }
3008 
3009  if(pArgs->Count < 3)
3010  {
3011  if(pArgs->Count > 0)
3012  {
3013  bUseBus = FALSE;
3014  bus_req = pArgs->Value[0];
3015  }
3016  if(pArgs->Count > 1)
3017  {
3018  bUseDev = FALSE;
3019  dev_req = pArgs->Value[1];
3020  }
3021 
3022  // save old config space selector
3023  oldCF8 = inl((PULONG)0xcf8);
3024 
3025  for(bus=0;bus<256;bus++)
3026  {
3027  for(dev=0;dev<32;dev++)
3028  {
3029  if(!((bUseDev || dev == dev_req) &&
3030  (bUseBus || bus == bus_req) ))
3031  continue;
3032 
3033  pciNumber.u.AsUlong = 0;
3034  pciNumber.u.bits.dev = dev;
3035  pciNumber.u.bits.bus = bus;
3036  pciNumber.u.bits.func = 0;
3037  pciNumber.u.bits.ce = 1;
3038  outl(pciNumber.u.AsUlong,(PULONG)0xcf8);
3039  data = inl((PULONG)0xcfc);
3040 
3041  if(data != 0xFFFFFFFF) // valid device
3042  {
3043  if((pVendorName = FindPCIVendorName((USHORT)data)) )
3044  {
3045  PICE_sprintf(tempCmd,"Bus%-8uDev%-8u === %.4X %.4X %s ====\n",bus,dev,(USHORT)data,(USHORT)(data>>16),pVendorName);
3046  }
3047  else
3048  {
3049  PICE_sprintf(tempCmd,"Bus%-8uDev%-8u === %.4X %.4X N/A ====\n",bus,dev,(USHORT)data,(USHORT)(data>>16));
3050  }
3052  if(WaitForKey()==FALSE)goto CommonShowPCIExit;
3053 
3054  p = (PULONG)&pciConfig;
3055  for(reg=0;reg<sizeof(PCI_COMMON_CONFIG)/sizeof(ULONG);reg++)
3056  {
3057  pciNumber.u.AsUlong = 0;
3058  pciNumber.u.bits.dev = dev;
3059  pciNumber.u.bits.bus = bus;
3060  pciNumber.u.bits.func = 0;
3061  pciNumber.u.bits.reg = reg;
3062  pciNumber.u.bits.ce = 1;
3063 
3064  outl(pciNumber.u.AsUlong,(PULONG)0xcf8);
3065  *p++ = inl((PULONG)0xcfc);
3066  }
3067  PICE_sprintf(tempCmd,"SubVendorId %.4X SubSystemId %.4X\n",pciConfig.u.type0.SubVendorID,pciConfig.u.type0.SubSystemID);
3069  if(WaitForKey()==FALSE)goto CommonShowPCIExit;
3070 
3071  if(bShowAll)
3072  {
3073  for(ulNumBaseAddresses=0,i=0;i<6;i++)
3074  {
3075  if(pciConfig.u.type0.BaseAddresses[i] != 0)
3076  ulNumBaseAddresses++;
3077  }
3078  if(ulNumBaseAddresses)
3079  {
3080  Print(OUTPUT_WINDOW,"BaseAddresses:");
3081  tempCmd[0] = 0;
3082  for(i=0;i<6;i++)
3083  {
3084  if(pciConfig.u.type0.BaseAddresses[i] != 0)
3085  {
3086  PICE_sprintf(temp," %u:%.8X",i,pciConfig.u.type0.BaseAddresses[i]);
3087  PICE_strcat(tempCmd,temp);
3088  }
3089  }
3091  Print(OUTPUT_WINDOW,"\n");
3092  if(WaitForKey()==FALSE)goto CommonShowPCIExit;
3093  }
3094  ppciConfig = &pciConfig;
3095  #if 0
3096  // sedwards
3097  SHOW_FIELD_WORD(ppciConfig,Status,TRUE);
3098  SHOW_FIELD_WORD(ppciConfig,Command,TRUE);
3099  SHOW_FIELD_BYTE(ppciConfig,RevisionID,TRUE);
3100  SHOW_FIELD_BYTE(ppciConfig,ProgIf,TRUE);
3101  SHOW_FIELD_BYTE(ppciConfig,BaseClass,TRUE);
3102  SHOW_FIELD_BYTE(ppciConfig,SubClass,TRUE);
3103  SHOW_FIELD_BYTE(ppciConfig,CacheLineSize,TRUE);
3104  SHOW_FIELD_BYTE(ppciConfig,LatencyTimer,TRUE);
3105  #endif
3106  }
3107  }
3108  }
3109  }
3110 
3111 CommonShowPCIExit:
3112  // restore old config space selector
3113  outl(oldCF8,(PULONG)0xcf8);
3114 
3115  }
3116  else if(pArgs->Count == 1)
3117  {
3118  }
3119 
3120  return TRUE;
3121 }
#define TRUE
Definition: types.h:120
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
#define SHOW_FIELD_BYTE(ptr, field, wait)
Definition: utils.h:68
Definition: shell.h:41
char * LPSTR
Definition: xmlstorage.h:182
static int dev
Definition: mkdosfs.c:536
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
_In_ USHORT _In_ UCHAR RevisionID
Definition: iotypes.h:859
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define SHOW_FIELD_WORD(ptr, field, wait)
Definition: utils.h:76
#define FALSE
Definition: types.h:117
ULONG inl(PULONG port)
Definition: utils.c:2184
union _PCI_NUMBER::@1380 u
struct _PCI_NUMBER::@1380::@1381 bits
void DPRINT(...)
Definition: polytest.cpp:61
BOOLEAN WaitForKey(void)
Definition: parse.c:374
unsigned char BOOLEAN
char * PICE_strcat(char *s1, char *s2)
Definition: utils.c:315
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
struct _PCI_COMMON_CONFIG PCI_COMMON_CONFIG
static stack_node_t temp
Definition: rpn.c:18
Status
Definition: gdiplustypes.h:24
char tempCmd[1024]
Definition: parse.c:225
unsigned short USHORT
Definition: pedump.c:61
VOID outl(ULONG data, PULONG port)
Definition: utils.c:2164
unsigned int * PULONG
Definition: retypes.h:1
static int reg
Definition: i386-dis.c:1275
unsigned int ULONG
Definition: retypes.h:1
GLfloat GLfloat p
Definition: glext.h:8902
LPSTR FindPCIVendorName(USHORT vendorid)
Definition: parse.c:2970
ULONG AsUlong
Definition: utils.h:113
COMMAND_PROTOTYPE ( SetKeyboardLayout  )

Definition at line 3127 of file parse.c.

3128 {
3130 
3131  ENTER_FUNC();
3132 
3133  layout = GetKeyboardLayout();
3134 
3135  switch(pArgs->Count)
3136  {
3137  case 0:
3138  PICE_sprintf(tempCmd,"current layout = %s\n", layout->name);
3140  break;
3141  case 1:
3142  layout = SetKeyboardLayoutByName((LPSTR)pArgs->Value[0]);
3143  PICE_sprintf(tempCmd,"current layout = %s\n", layout->name);
3145  break;
3146  }
3147 
3148  LEAVE_FUNC();
3149 
3150  return TRUE;
3151 }
#define TRUE
Definition: types.h:120
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
#define LEAVE_FUNC()
Definition: debug.h:43
char * LPSTR
Definition: xmlstorage.h:182
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
static DWORD layout
Definition: bitmap.c:47
char tempCmd[1024]
Definition: parse.c:225
PKEYBOARD_LAYOUT GetKeyboardLayout()
Definition: utils.c:194
PKEYBOARD_LAYOUT SetKeyboardLayoutByName(LPSTR Name)
Definition: utils.c:208
#define ENTER_FUNC()
Definition: debug.h:42
COMMAND_PROTOTYPE ( ShowSysCallTable  )

Definition at line 3157 of file parse.c.

3158 {
3159 #if 0
3160  LPSTR pName;
3161  ULONG i;
3162 
3163  ENTER_FUNC();
3164 
3165  if(pArgs->Count == 0)
3166  {
3167  PICE_sprintf(tempCmd,"%u system calls\n",190);
3169  if(WaitForKey()!=FALSE)
3170  for(i=0;i<190;i++)
3171  {
3172  if((pName = FindFunctionByAddress(sys_call_table[i],NULL,NULL)) )
3173  {
3174  PICE_sprintf(tempCmd,"%-.3u: %.8X (%s)\n",i,sys_call_table[i],pName);
3175  }
3176  else
3177  {
3178  PICE_sprintf(tempCmd,"%-.3u: %.8X (%s)\n",i,sys_call_table[i],pName);
3179  }
3181  if(WaitForKey()==FALSE)
3182  break;
3183  }
3184  }
3185  else if(pArgs->Count == 1)
3186  {
3187  i = pArgs->Value[0];
3188  if(i<190)
3189  {
3190  if((pName = FindFunctionByAddress(sys_call_table[i],NULL,NULL)) )
3191  {
3192  PICE_sprintf(tempCmd,"%-.3u: %.8X (%s)\n",i,sys_call_table[i],pName);
3193  }
3194  else
3195  {
3196  PICE_sprintf(tempCmd,"%-.3u: %.8X (%s)\n",i,sys_call_table[i],pName);
3197  }
3199  }
3200  }
3201 
3202  LEAVE_FUNC();
3203 #endif
3204  PICE_sprintf(tempCmd,"Not implemented yet!\n");
3206  return TRUE;
3207 }
#define TRUE
Definition: types.h:120
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
#define LEAVE_FUNC()
Definition: debug.h:43
char * LPSTR
Definition: xmlstorage.h:182
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
GLenum GLclampf GLint i
Definition: glfuncs.h:14
LPSTR FindFunctionByAddress(ULONG ulValue, PULONG pulstart, PULONG pulend)
Definition: symbols.c:767
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:557
BOOLEAN WaitForKey(void)
Definition: parse.c:374
static LPSTR pName
Definition: security.c:78
char tempCmd[1024]
Definition: parse.c:225
unsigned int ULONG
Definition: retypes.h:1
#define ENTER_FUNC()
Definition: debug.h:42
COMMAND_PROTOTYPE ( SetAltKey  )

Definition at line 3213 of file parse.c.

3214 {
3215  if(pArgs->Count == 1)
3216  {
3217  ucBreakKey = (UCHAR)pArgs->Value[0];
3218 
3219  PICE_sprintf(tempCmd,"new break key is CTRL-%c\n",ucBreakKey);
3221  }
3222  else if(pArgs->Count == 0)
3223  {
3224  PICE_sprintf(tempCmd,"current break key is CTRL-%c\n",ucBreakKey);
3226  }
3227 
3228 
3229  COMMAND_RET;
3230 }
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
UCHAR ucBreakKey
Definition: patch.c:56
unsigned char UCHAR
Definition: xmlstorage.h:181
char tempCmd[1024]
Definition: parse.c:225
#define COMMAND_RET
Definition: parse.h:120
COMMAND_PROTOTYPE ( ShowContext  )

Definition at line 3236 of file parse.c.

3237 {
3238  COMMAND_RET;
3239 }
#define COMMAND_RET
Definition: parse.h:120
void CompactString ( LPSTR  p)

Definition at line 3292 of file parse.c.

Referenced by PICE_strtok().

3293 {
3294 ULONG i;
3295 
3296  for(i=1;i<PICE_strlen(p);i++)
3297  {
3298  if(p[i]==' ' && p[i-1]==' ')
3299  {
3300  PICE_strcpy(&p[i-1],&p[i]);
3301  i=1;
3302  }
3303  }
3304 }
USHORT PICE_strlen(const char *s)
Definition: utils.c:547
char * PICE_strcpy(char *s1, char *s2)
Definition: utils.c:302
GLenum GLclampf GLint i
Definition: glfuncs.h:14
unsigned int ULONG
Definition: retypes.h:1
GLfloat GLfloat p
Definition: glext.h:8902
BOOLEAN ConvertSizeToKeyword ( LPSTR  p,
PULONG  pValue 
)

Definition at line 3651 of file parse.c.

Referenced by Parse().

3652 {
3653  ULONG count;
3654 
3655  count=StrLenUpToWhiteChar(p," ");
3656  if(count > 1)
3657  return FALSE;
3658 
3659  switch(*p)
3660  {
3661  // BYTE
3662  case 'b':
3663  case 'B':
3664  *pValue = 1;
3665  break;
3666  // WORD
3667  case 'w':
3668  case 'W':
3669  *pValue = 2;
3670  break;
3671  // DWORD
3672  case 'd':
3673  case 'D':
3674  *pValue = 4;
3675  break;
3676  // QWORD
3677  case 'q':
3678  case 'Q':
3679  *pValue = 4;
3680  break;
3681  default:
3682  return FALSE;
3683  }
3684 
3685  return TRUE;
3686 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLuint GLuint GLsizei count
Definition: gl.h:1545
ULONG StrLenUpToWhiteChar(LPSTR p, LPSTR WhiteChars)
Definition: parse.c:3816
unsigned int ULONG
Definition: retypes.h:1
GLfloat GLfloat p
Definition: glext.h:8902
BOOLEAN ConvertTokenToDec ( LPSTR  p,
PULONG  pValue 
)

Definition at line 3410 of file parse.c.

Referenced by Parse().

3411 {
3412  ULONG result=0;
3413  char c;
3414 
3415  while((c = *p))
3416  {
3417  if(c >= '0' && c <= '9')
3418  {
3419  result *= 10;
3420  result += (ULONG)(c - '0');
3421  }
3422  else