convert std::string to const BYTE* for RegSetValueEx()

后端 未结 4 986
深忆病人
深忆病人 2021-01-19 07:54

I have a function that gets a std::string. That function calls

RegSetValueEx

the 5th parameter is the value of the registry value and expects a variable of t

4条回答
  •  再見小時候
    2021-01-19 08:28

    Shouldn't it be wNewValue.size()*2+2 ? The +2 for the null character? MSDN says: The size of the information pointed to by the lpData parameter, in bytes. If the data is of type REG_SZ, REG_EXPAND_SZ, or REG_MULTI_SZ, cbData must include the size of the terminating null character or characters.

提交回复
热议问题