Hi, guys i am trying to create a String in the Windows Registry to imput some nice Proxy Adress. But i failed to input the correct datatype. I do not have any problems with Type (DWORD)... But (REG_SZ) has not work. Can someone tell me how can i input in the Registry a HTTPs Adress like "HTTPS://www.google.com" as a test. :)
Thank you
Below my code the secound part works fine :) I am struggling with REG_SZ :(
include
include
void add_proxy()
long pro;
HKEY hKeyp;
// under this field should be the Type REG_SZ to input a Proxy Adress
REG_SZ "proxy";
pro = RegCreateKeyEx(
HKEY_CURRENT_USER,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\test",
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS | KEY_WOW64_32KEY,
NULL,
&hKeyp,
NULL);
// Status of work
if (pro != ERROR_SUCCESS)
{
std::cout << "Registry creation failed & Error No - " << GetLastError() << std::
endl;
}
std::cout << "Registry creation success" << std::endl;
lReg = RegSetValueEx(
hKeyp,
L"ProxyEnable",
NULL,
REG_SZ,
(LPBYTE)&value,
sizeof(value)
);
//Status of work
if (pro != ERROR_SUCCESS)
{
std::cout << "Registry creation failed & Error No - " << GetLastError() << std::
endl;
}
std::cout << "Registry creation success" << std::endl;
RegCloseKey(pro);
//Part 2
LONG lReg;
HKEY hKey;
DWORD dwData =00000001;
lReg = RegCreateKeyEx(
HKEY_CURRENT_USER,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS | KEY_WOW64_32KEY,
NULL,
&hKey,
NULL);
// Status of work
if (lReg != ERROR_SUCCESS)
{
std::cout << "Registry creation failed & Error No - " << GetLastError() << std::
endl;
}
std::cout << "Registry creation success" << std::endl;
lReg = RegSetValueEx(
hKey,
L"ProxyEnable",
NULL,
REG_DWORD,
(LPBYTE)&dwData,
sizeof(dwData)
);
//Status of work
if (lReg != ERROR_SUCCESS)
{
std::cout << "Registry creation failed & Error No - " << GetLastError() << std::
endl;
}
std::cout << "Registry creation success" << std::endl;
RegCloseKey(hKey);
system("PAUSE");