读取地址指向的数据

Reading data pointed to by an address

在这里研究我的倒车技能,我发现了一些我认为我理解的东西,但我设法把自己弄糊涂了。

主要用C语言工作

我的功能returns我要访问的信息的地址。

LRESULT ret = SendMessage(hComboBox, CB_GETITEMDATA, (WPARAM)0 , (LPARAM) 0); 
// the exact function doesn't really matter here.
printf("Address: %p\n", ret); // Output is 09437DF8

该地址的转储导致

09437DF8  A0 55 E8 12

这是我真正要读取的数据的地址(注意字节顺序)。 12e855A0

12 E8 55 A0 - 30 00 3A 00 30 00 33 00 3A 00 32 00 32 00 00 00 - UNICODE "0:03:22"

现在我相当确定这只是基本的 pointers/referencing/de-referencing 但我无法理解我必须做些什么才能实用地读取这个值。

wprintf(L"%s\n", <value at address pointed to by ret>);
// Yes its a null terminated string
// Im working via injected dll, so no access violations
// string is unicode

也许是这样的?

  #include <stdio.h>
  #include <wchar.h>

  int main()
    {
    wchar_t *name = L"UNICODE String";
    void **ret = (void **)&name;

    wprintf(L"%ls \n", *(wchar_t **)ret);
    return 0;
    }