Thursday, November 12, 2015

Decryption of DLGINIT .rc file entry

Visual Studio saves ComboBox item list in DLGINIT entries of .rc files as ASCIIZ strings, in WORD format:

IDD_DIALOG1 DLGINIT
BEGIN
    IDC_STR1, 0x403, 16, 0
0x7241, 0x2063, 0x6c63, 0x636f, 0x776b, 0x7369, 0x0065,

    IDC_STR2, 0x403, 18, 0
0x6c41, 0x6177, 0x7379, 0x6120, 0x2074, 0x6874, 0x2065, 0x6964, 0x0065,
    0
END

Using simple type conversion we can reveal, what do these strings contain.



#include <stdio.h>
#include <iostream>

int main()
{
   short data1[] = {0x7241, 0x2063, 0x6c63, 0x636f, 0x776b, 0x7369, 0x0065};
   char * str1 = (char*)(void*)data1;
   printf("str1 = \"%s\"\n", str1);

   short data2[] = {0x6c41, 0x6177, 0x7379, 0x6120, 0x2074, 0x6874, 0x2065, 0x6970, 0x006e};
   char * str2 = (char*)(void*)data2;
   printf("str2 = \"%s\"\n", str2);
}

Output is:
str1 = "Arc clockwise"
str2 = "Always at the pin"

No comments:

Post a Comment