RegistryHelper::saveToFile

0 0 2025-05-29 本文地址:http://www.pnpon.com/fun/detail-31.html
void RegistryHelper::saveToFile(wstring key, vector<wstring> valuenames, wstring filepath)
{
    wofstream stream(filepath);
    if (!stream.good())
        throw RegistryException(L"Error while opening file " + filepath + L" for writing");

    stream << L"Windows Registry Editor Version 5.00\n" << endl;
    stream << L"[HKEY_LOCAL_MACHINE\\" << key << L"]" << endl;
    for (vector<wstring>::iterator it = valuenames.begin(); it != valuenames.end(); it++)
    {
        wstring& valuename = *it;
        wstring value = readValue(key, valuename);

        stream << L"\"" << valuename << L"\"=\"" << value << L"\"" << endl;
    }
    stream << endl;

    stream.close();
}
取消
感谢您的支持,我会继续努力的!
扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

您的支持,是我们前进的动力!