怎么把以下内容写到注册表里:
"sdp_record"=hex:\
      36,01,57,36,01,54,09,00,00,0a,30,00,00,00,09,00,01,35,03,19,11,24,09,00,04,\
      35,0d,35,06,19,01,00,09,00,11,35,03,19,00,11,09,00,06,35,09,09,65,6e,09,00,\
      6a,09,01,00,09,00,09,35,08,35,06,19,00,11,09,01,00,09,00,0d,35,0f,35,0d,35,\
      06,19,01,00,09,00,13,35,03,19,00,11,09,01,00,25,0c,48,49,44,20,4b,65,79,62,\
      6f,61,72,64,09,02,00,09,25,01,09,02,01,09,01,00,09,02,02,08,40,09,02,03,08,\
      00,09,02,04,28,01,09,02,05,28,01,09,02,06,36,00,af,36,00,ac,08,22,25,a8,05,\
      01,09,06,a1,01,05,07,85,01,19,e0,29,e7,15,00,25,01,75,01,95,08,81,02,95,01,\
      75,08,81,01,95,05,75,01,05,08,19,01,29,05,91,02,95,01,75,03,91,01,95,06,75,\
      08,15,00,26,a4,00,05,07,19,00,29,a4,81,00,c0,05,0c,09,01,a1,01,85,03,75,10,\
      95,02,15,01,26,8c,02,19,01,2a,8c,02,81,60,c0,06,00,ff,09,01,a1,01,85,10,75,\
      08,95,06,15,00,26,ff,00,09,01,81,00,09,01,91,00,c0,06,00,ff,09,02,a1,01,85,\
      11,75,08,95,13,15,00,26,ff,00,09,02,81,00,09,02,91,00,c0,05,06,09,27,a1,01,\
      85,ff,95,01,75,02,09,24,09,26,81,02,75,06,81,01,c0,09,02,07,35,08,35,06,09,\
      04,09,09,01,00,09,02,0b,09,01,00,09,02,0d,28,01,09,02,0e,28,01

解决方案 »

  1.   

    你用RegSetValueEx保存为REG_BINARY类型试试看。
      

  2.   

    你不是有个变量保存这个16进制数了吗?要我说你用一个for循环把它转换为字符串(网上搜下就出来了),需要的时候读出来再转换为16进制数。
      

  3.   


    #define ArraySize(p) (sizeof(p)/sizeof((p)[0]))

    HKEY hkey;
    if(ERROR_SUCCESS == ::RegCreateKeyEx(HKEY_CURRENT_USER,
    "software\\Test",0,NULL,0,
    KEY_ALL_ACCESS,NULL,&hkey,NULL))
    {
    BYTE bValue[]={0x36,0x01,0x57,0x36,0x01,0x54,0x09,0x00,0x00,0x0a,0x30,0x00,0x00,0x00,0x09,0x00,0x01,0x35,0x03,0x19,0x11,0x24,0x09,0x00,0x04,\
    0x35,0x0d,0x35,0x06,0x19,0x01,0x00,0x09,0x00,0x11,0x35,0x03,0x19,0x00,0x11,0x09,0x00,0x06,0x35,0x09,0x09,0x65,0x6e,0x09,0x00,\
    0x6a,0x09,0x01,0x00,0x09,0x00,0x09,0x35,0x08,0x35,0x06,0x19,0x00,0x11,0x09,0x01,0x00,0x09,0x00,0x0d,0x35,0x0f,0x35,0x0d,0x35,\
    0x06,0x19,0x01,0x00,0x09,0x00,0x13,0x35,0x03,0x19,0x00,0x11,0x09,0x01,0x00,0x25,0x0c,0x48,0x49,0x44,0x20,0x4b,0x65,0x79,0x62,\
    0x6f,0x61,0x72,0x64,0x09,0x02,0x00,0x09,0x25,0x01,0x09,0x02,0x01,0x09,0x01,0x00,0x09,0x02,0x02,0x08,0x40,0x09,0x02,0x03,0x08,\
    0x00,0x09,0x02,0x04,0x28,0x01,0x09,0x02,0x05,0x28,0x01,0x09,0x02,0x06,0x36,0x00,0xaf,0x36,0x00,0xac,0x08,0x22,0x25,0xa8,0x05,\
    0x01,0x09,0x06,0xa1,0x01,0x05,0x07,0x85,0x01,0x19,0xe0,0x29,0xe7,0x15,0x00,0x25,0x01,0x75,0x01,0x95,0x08,0x81,0x02,0x95,0x01,\
    0x75,0x08,0x81,0x01,0x95,0x05,0x75,0x01,0x05,0x08,0x19,0x01,0x29,0x05,0x91,0x02,0x95,0x01,0x75,0x03,0x91,0x01,0x95,0x06,0x75,\
    0x08,0x15,0x00,0x26,0xa4,0x00,0x05,0x07,0x19,0x00,0x29,0xa4,0x81,0x00,0xc0,0x05,0x0c,0x09,0x01,0xa1,0x01,0x85,0x03,0x75,0x10,\
    0x95,0x02,0x15,0x01,0x26,0x8c,0x02,0x19,0x01,0x2a,0x8c,0x02,0x81,0x60,0xc0,0x06,0x00,0xff,0x09,0x01,0xa1,0x01,0x85,0x10,0x75,\
    0x08,0x95,0x06,0x15,0x00,0x26,0xff,0x00,0x09,0x01,0x81,0x00,0x09,0x01,0x91,0x00,0xc0,0x06,0x00,0xff,0x09,0x02,0xa1,0x01,0x85,\
    0x11,0x75,0x08,0x95,0x13,0x15,0x00,0x26,0xff,0x00,0x09,0x02,0x81,0x00,0x09,0x02,0x91,0x00,0xc0,0x05,0x06,0x09,0x27,0xa1,0x01,\
    0x85,0xff,0x95,0x01,0x75,0x02,0x09,0x24,0x09,0x26,0x81,0x02,0x75,0x06,0x81,0x01,0xc0,0x09,0x02,0x07,0x35,0x08,0x35,0x06,0x09,\
    0x04,0x09,0x09,0x01,0x00,0x09,0x02,0x0b,0x09,0x01,0x00,0x09,0x02,0x0d,0x28,0x01,0x09,0x02,0x0e,0x28,0x01};
    //AfxMessageBox((char *)bValue);
    DWORD dwWrite=ArraySize(bValue);
    if(ERROR_SUCCESS != ::RegSetValueEx(hkey,"Test",0,REG_BINARY,bValue,dwWrite))
    {
    CString strMsg;
    strMsg.Format("%d",GetLastError());
    AfxMessageBox(strMsg);
    }
    RegCloseKey(hkey);
    }
      

  4.   

    赋值可以用memcpy函数拷贝,长度可以用#define ArraySize(p) (sizeof(p)/sizeof((p)[0])) 计算出来。