tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

InsertIEHistory.cpp (1075B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * https://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 /**
      5 * Insert URLs into Internet Explorer (IE) history so we can test importing
      6 * them.
      7 *
      8 * See API docs at
      9 * https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774949(v%3dvs.85)
     10 */
     11 
     12 #include <urlhist.h>  // IUrlHistoryStg
     13 #include <shlguid.h>  // SID_SUrlHistory
     14 
     15 int main(int argc, char** argv) {
     16  HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
     17  if (FAILED(hr)) {
     18    CoUninitialize();
     19    return -1;
     20  }
     21  IUrlHistoryStg* ieHist;
     22 
     23  hr =
     24      ::CoCreateInstance(CLSID_CUrlHistory, nullptr, CLSCTX_INPROC_SERVER,
     25                         IID_IUrlHistoryStg, reinterpret_cast<void**>(&ieHist));
     26  if (FAILED(hr)) return -2;
     27 
     28  hr = ieHist->AddUrl(L"http://www.mozilla.org/1", L"Mozilla HTTP Test", 0);
     29  if (FAILED(hr)) return -3;
     30 
     31  hr =
     32      ieHist->AddUrl(L"https://www.mozilla.org/2", L"Mozilla HTTPS Test 🦊", 0);
     33  if (FAILED(hr)) return -4;
     34 
     35  CoUninitialize();
     36 
     37  return 0;
     38 }