c++ - How to change Firefox Homepage using GPO (Group policy) -


so far, have developed solution in c# doesn't use gpo. modifies prefs.js file.

this have tried far using c#:

using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.io; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms;  namespace firefoxhomepagechanger {     public partial class form1 : form     {         public form1()         {             initializecomponent();         }          public static void setmozilla(string strurl)         {             try             {                 string strsystemuname = environment.username.tostring().trim();                 string systemdrive = environment.expandenvironmentvariables("%systemdrive%");                 string strdirectory = "";                 string strpreffolder = "";                 if (directory.exists(systemdrive + "\\documents , settings\\" + strsystemuname + "\\application data\\mozilla\\firefox\\profiles"))                 {                     strdirectory = systemdrive + "\\documents , settings\\" + strsystemuname + "\\application data\\mozilla\\firefox\\profiles";                 }                 else if (directory.exists(systemdrive + "\\windows\\application data\\mozilla\\firefox\\profiles"))                 {                     strdirectory = systemdrive + "\\windows\\application data\\mozilla\\firefox\\profiles";                 }                 if (strdirectory.trim().length != 0)                 {                     system.io.directoryinfo odir = new directoryinfo(strdirectory);                     //system.io.directoryinfo[] osubdir;                     //osubdir = odir.getdirectories(strdirectory);                     foreach (directoryinfo ofolder in odir.getdirectories())                     {                         if (ofolder.fullname.indexof(".default") >= 0)                         {                             strpreffolder = ofolder.fullname;                             createprefs(strurl, strpreffolder);                         }                     }                  }             }             catch             { }         }         private static void createprefs(string strurl, string strfolder)         {             stringbuilder sbprefs = new stringbuilder();             sbprefs.append("# mozilla user preferences\n\r");             sbprefs.append("/* not edit file.\n\r*\n\r");             sbprefs.append("* if make changes file while application running,\n\r");             sbprefs.append("* changes overwritten when application exits.,\n\r*\n\r");             sbprefs.append("* make manual change preferences, can visit url about:config\n\r");             sbprefs.append("* more information, see http://www.mozilla.org/unix/customizing.html#prefs\n\r");             sbprefs.append("*/\n\r");             sbprefs.append("user_pref(\"app.update.lastupdatetime.addon-background-update-timer\", 1188927425);\n\r");             sbprefs.append("user_pref(\"app.update.lastupdatetime.background-update-timer\", 1188927425);\n\r");             sbprefs.append("user_pref(\"app.update.lastupdatetime.blocklist-background-update-timer\", 1188927425);\n\r");             sbprefs.append("user_pref(\"app.update.lastupdatetime.search-engine-update-timer\", 1188927425);\n\r");             sbprefs.append("user_pref(\"browser.anchor_color\", \"#0000ff\");\n\r");             sbprefs.append("user_pref(\"browser.display.background_color\", \"#c0c0c0\");\n\r");             sbprefs.append("user_pref(\"browser.display.use_system_colors\", true);\n\r");             sbprefs.append("user_pref(\"browser.formfill.enable\", false);\n\r");             sbprefs.append("user_pref(\"browser.history_expire_days\", 20);\n\r");             sbprefs.append("user_pref(\"browser.shell.checkdefaultbrowser\", false);\n\r");             sbprefs.append("user_pref(\"browser.startup.homepage\", \"" + strurl + "\");\n\r");             sbprefs.append("user_pref(\"browser.startup.homepage_override.mstone\", \"rv:1.8.1.6\");\n\r");             sbprefs.append("user_pref(\"browser.visited_color\", \"#800080\");\n\r");             sbprefs.append("user_pref(\"extensions.lastappversion\", \"2.0.0.6\");\n\r");             sbprefs.append("user_pref(\"intl.charsetmenu.browser.cache\", \"utf-8, iso-8859-1\");\n\r");             sbprefs.append("user_pref(\"network.cookie.prefsmigrated\", true);\n\r");             sbprefs.append("user_pref(\"security.warn_entering_secure\", false);\n\r");             sbprefs.append("user_pref(\"security.warn_leaving_secure\", false);\n\r");             sbprefs.append("user_pref(\"security.warn_submit_insecure\", false);\n\r");             sbprefs.append("user_pref(\"security.warn_submit_insecure.show_once\", false);\n\r");             sbprefs.append("user_pref(\"spellchecker.dictionary\", \"en-us\");\n\r");             sbprefs.append("user_pref(\"urlclassifier.tableversion.goog-black-enchash\", \"1.32944\");\n\r");             sbprefs.append("user_pref(\"urlclassifier.tableversion.goog-black-url\", \"1.14053\");\n\r");             sbprefs.append("user_pref(\"urlclassifier.tableversion.goog-white-domain\", \"1.23\");\n\r");             sbprefs.append("user_pref(\"urlclassifier.tableversion.goog-white-url\", \"1.371\");\n\r");             streamwriter writer = new streamwriter(strfolder + "\\prefs.js");             writer.write(sbprefs.tostring());             writer.close();             writer.dispose();             gc.collect();         }          private void button1_click(object sender, eventargs e)         {             string urlstring;             urlstring = textbox1.text;             setmozilla(urlstring);              label2.text =string.format( "home page changed to: {0}",urlstring);         }     } } 

this solution works, want in c++.

now, there way of doing want using native c++ , group policy on windows machine ? thanks.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -