Sam program prosty w napisaniu.
Więcej roboty było ze strukturą katalogów i zdejmowaniem uprawnień
Źródełko dla zainteresowanych:
using System;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using Microsoft.Win32;
using System.Runtime.InteropServices;
namespace Windows_7_PL_Pack
{
public partial class Win7plFormGL : Form
{
CommandLinkButton cl = new CommandLinkButton();
public Win7plFormGL()
{
InitializeComponent();
cl.Text = "Zmień język na polski...";
cl.Height = 58;
cl.Width = 294;
cl.Left = 0;
cl.Top = 0;
cl.HelpText = "Aby zmienić język wyświetlania na polski ;)";
this.panel1.Controls.Add(cl);
cl.Click += new System.EventHandler(cl_Click);
}
[DllImport("user32", CharSet = CharSet.Unicode)]
internal static extern IntPtr SendMessage(IntPtr hWnd, IntPtr wParam, string lParam);
public class CommandLinkButton : Button
{
public CommandLinkButton()
{
base.FlatStyle = FlatStyle.System;
}
private string helpText = "";
public string HelpText
{
get
{
return this.helpText;
}
set
{
SendMessage(this.Handle,
0x00001009, // BCM_SETNOTE
IntPtr.Zero, value);
this.helpText = value;
}
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.Style |= 0x0000000e; //BS_COMMANDLINK
return cp;
}
}
}
public void PrzejmijKatalog(string sKatalog)
{
ProcessStartInfo psx = new ProcessStartInfo();
Process proc;
psx.Arguments = "/F " + sKatalog + " /R /A";
psx.FileName = "takeown";
psx.WindowStyle = ProcessWindowStyle.Hidden;
proc = Process.Start(psx);
proc.WaitForExit();
psx.Arguments = sKatalog + " /grant Administrators:F /t";
psx.FileName = "icacls";
psx.WindowStyle = ProcessWindowStyle.Hidden;
proc = Process.Start(psx);
proc.WaitForExit();
}
public void ZmienBootLocales()
{
ProcessStartInfo psx = new ProcessStartInfo();
Process proc;
psx.Arguments = "/set {current} locale pl-PL";
psx.FileName = "bcdedit";
psx.WindowStyle = ProcessWindowStyle.Hidden;
proc = Process.Start(psx);
proc.WaitForExit();
psx.Arguments = "%WinDir% /l pl-PL";
psx.FileName = "bcdboot";
psx.WindowStyle = ProcessWindowStyle.Hidden;
proc = Process.Start(psx);
proc.WaitForExit();
}
private static bool CopyDirectory(string SourcePath, string DestinationPath, bool overwriteexisting)
{
bool ret = false;
try
{
SourcePath = SourcePath.EndsWith(@"\") ? SourcePath : SourcePath + @"\";
DestinationPath = DestinationPath.EndsWith(@"\") ? DestinationPath : DestinationPath + @"\";
if (Directory.Exists(SourcePath))
{
if (Directory.Exists(DestinationPath) == false)
Directory.CreateDirectory(DestinationPath);
foreach (string fls in Directory.GetFiles(SourcePath))
{
FileInfo flinfo = new FileInfo(fls);
flinfo.CopyTo(DestinationPath + flinfo.Name, overwriteexisting);
}
foreach (string drs in Directory.GetDirectories(SourcePath))
{
DirectoryInfo drinfo = new DirectoryInfo(drs);
if (CopyDirectory(drs, DestinationPath + drinfo.Name, overwriteexisting) == false)
ret = false;
}
}
ret = true;
}
catch (Exception ex)
{
ret = false;
}
return ret;
}
private void cl_Click(object sender, EventArgs e)
{
MessageBox.Show("Program rozpocznie polonizację, to może trochę potrwać\nNa końcu zostanie wyświetlony komunikat ;)\nAby rozpocząć - Kliknij OK i czekaj...", "PL MUI Pack by sCooBy^", MessageBoxButtons.OK, MessageBoxIcon.Information);
cl.Enabled = false;
String sKatalogWindows = (string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "SystemRoot", "");
String sKatalogPFiles = (string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "ProgramFilesDir", "");
String sKatalogCData = (string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Common AppData", "c:\\ProgramData");
PrzejmijKatalog(sKatalogWindows + @"\Boot\DVD\PCAT");
PrzejmijKatalog(sKatalogWindows + @"\diagnostics\scheduled\Maintenance");
PrzejmijKatalog(sKatalogWindows + @"\servicing");
PrzejmijKatalog(sKatalogWindows + @"\System32\Boot");
PrzejmijKatalog(sKatalogWindows + @"\System32\DriverStore");
PrzejmijKatalog(sKatalogWindows + @"\System32\Speech\SpeechUX");
CopyDirectory("Windows\\", sKatalogWindows + "\\", true);
CopyDirectory("Program Files\\", sKatalogPFiles + "\\", true);
CopyDirectory("ProgramData\\", sKatalogCData + "\\", true);
ZmienBootLocales();
Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MUI\UILanguages\pl-PL",
"LCID", "1045", RegistryValueKind.DWord);
Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MUI\UILanguages\pl-PL",
"Type", "146", RegistryValueKind.DWord);
Registry.SetValue(@"HKEY_CURRENT_USER\Control Panel\Desktop\MuiCached",
"MachinePreferredUILanguages", new string[] { "pl-PL" }, RegistryValueKind.MultiString);
Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Language",
"InstallLanguage", "0415", RegistryValueKind.String);
Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Language",
"Default", "0415", RegistryValueKind.String);
Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Locale",
"", "00000415", RegistryValueKind.String);
Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Locale",
"(Default)", "00000415", RegistryValueKind.String);
MessageBox.Show("Zrobione ;)\nAby zobaczyć zmiany - Restart...","PL MUI Pack by sCooBy^", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
Sotom: Narzędzie Wycinanie