Commit ae8a4019 authored by Hidenori Takeshima's avatar Hidenori Takeshima Committed by Alexandre Julliard

The 'dword' values should be stored as big endian values.

parent 2e40b964
...@@ -361,26 +361,14 @@ static INT getCommand(LPSTR commandName) ...@@ -361,26 +361,14 @@ static INT getCommand(LPSTR commandName)
*/ */
static DWORD convertHexToDWord(char *str, BYTE *buf) static DWORD convertHexToDWord(char *str, BYTE *buf)
{ {
char *s = str; /* Pointer to current */ DWORD dw;
char *b = buf; /* Pointer to result */ char xbuf[9];
ULONG strPos = 0;
memcpy(xbuf,str,8);
memset(buf, 0, 4); xbuf[8]='\0';
sscanf(xbuf,"%08lx",&dw);
while (strPos < 4) /* 8 byte in a DWORD */ memcpy(buf,&dw,sizeof(DWORD));
{ return sizeof(DWORD);
char xbuf[3];
char wc;
memcpy(xbuf,s,2); xbuf[2]='\0';
sscanf(xbuf,"%02x",(UINT*)&wc);
*b++ =(unsigned char)wc;
s+=2;
strPos+=1;
}
return 4; /* always 4 byte for the word */
} }
/****************************************************************************** /******************************************************************************
...@@ -420,24 +408,14 @@ static char* convertHexToHexCSV(BYTE *buf, ULONG bufLen) ...@@ -420,24 +408,14 @@ static char* convertHexToHexCSV(BYTE *buf, ULONG bufLen)
static char* convertHexToDWORDStr(BYTE *buf, ULONG bufLen) static char* convertHexToDWORDStr(BYTE *buf, ULONG bufLen)
{ {
char* str; char* str;
char* ptrStr; DWORD dw;
BYTE* ptrBuf;
ULONG current = 0;
str = HeapAlloc(GetProcessHeap(), 0, (bufLen*2)+1); if ( bufLen != sizeof(DWORD) ) return NULL;
memset(str, 0, (bufLen*2)+1);
ptrStr = str; /* Pointer to result */
ptrBuf = buf; /* Pointer to current */
while (current < bufLen) str = HeapAlloc(GetProcessHeap(), 0, (bufLen*2)+1);
{
BYTE bCur = ptrBuf[current++];
char res[3];
sprintf(res, "%02x", (unsigned int)*&bCur); memcpy(&dw,buf,sizeof(DWORD));
strcat(str, res); sprintf(str, "%08lx", dw);
}
/* Get rid of the last comma */ /* Get rid of the last comma */
return str; return str;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment