Anonymous
November 19th, 2002, 14:04
Hey Gigapede!
It'd be handy if your CmdLine plugin would show ascii and dec values of a hex string when the "?" command is used. SoftIce does that.
I'm not good at C (work as Java coder), but I made a small modification to the Express function. Here is the code, don't laugh if I've made some mistake. Anyway, it works for me.
It'd be handy if your CmdLine plugin would show ascii and dec values of a hex string when the "?" command is used. SoftIce does that.
I'm not good at C (work as Java coder), but I made a small modification to the Express function. Here is the code, don't laugh if I've made some mistake. Anyway, it works for me.Code:
int IsHex(const char* str)
{
char* ec;
if (str == (char*)0 || *str == '\0')
return 0 ;
(void)strtoul(str, &ec, 16) ;
return *ec == '\0' ;
}
int Express(char *answer,ulong parm) {
int i;
char *p;
char *v = value.value;
char *tmp;
tmp = malloc(5);
tmp[4] = '\0';
if(IsHex(v))
{
for(i = 0; i < 4; i++)
tmp[I] = (char)(v[i*2] * 0x10 + v[i*2+1]);
sprintf(answer, "HEX: %s - ASCII: %s - DEC: %d", v, tmp, strtol(v, &p, 16));
}
else
strcpy(answer,v);
free(tmp);
return 0;
};

