Visual Studio 2010 注册信息修改器

之所以要改这个,就是看那个启动界面不爽。嘎嘎,显示什么微软用户。当然了这个东西可以直接修改注册表或者手工修改,为了简单一点,直接做了个工具出来。

猛击此处下载!

 

界面如下:

源代码在这里,没什么东西。很简单。

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, SkinExCtrls, SkinCtrls, Mask, SkinBoxCtrls, SkinData,
  DynamicSkinForm ,registry,ShellAPI, spMessages, spTrayIcon;

type
  TForm1 = class(TForm)
    spDynamicSkinForm1: TspDynamicSkinForm;
    spSkinData1: TspSkinData;
    spSkinFrame1: TspSkinFrame;
    spCompressedStoredSkin1: TspCompressedStoredSkin;
    spCompressedSkinList1: TspCompressedSkinList;
    spResourceStrData1: TspResourceStrData;
    spSkinShadowLabel1: TspSkinShadowLabel;
    spSkinShadowLabel2: TspSkinShadowLabel;
    spSkinStatusBar1: TspSkinStatusBar;
    spSkinButton2: TspSkinButton;
    spSkinEdit_org: TspSkinEdit;
    spSkinEdit_name: TspSkinEdit;
    spSkinStatusPanel1: TspSkinStatusPanel;
    spSkinStatusPanel2: TspSkinStatusPanel;
    spSkinLinkLabel1: TspSkinLinkLabel;
    spSkinShadowLabel3: TspSkinShadowLabel;
    spSkinEdit_path: TspSkinEdit;
    spSkinMessage1: TspSkinMessage;
    spTrayIcon1: TspTrayIcon;
    procedure FormCreate(Sender: TObject);
    procedure spSkinButton2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  regKeyName:TRegistry;
  regKeyOrg:TRegistry;
  vsPathKey:TRegistry;
  IsWin64bit:Boolean;
implementation

{$R *.dfm}

function IsWin64: Boolean;
var
  Kernel32Handle: THandle;
  IsWow64Process: function(Handle: Windows.THandle; var Res: Windows.BOOL): Windows.BOOL; stdcall;
  GetNativeSystemInfo: procedure(var lpSystemInfo: TSystemInfo); stdcall;
  isWoW64: Bool;
  SystemInfo: TSystemInfo;
const
  PROCESSOR_ARCHITECTURE_AMD64 = 9;
  PROCESSOR_ARCHITECTURE_IA64 = 6;
begin
  Kernel32Handle := GetModuleHandle('KERNEL32.DLL');
  if Kernel32Handle = 0 then
    Kernel32Handle := LoadLibrary('KERNEL32.DLL');
  if Kernel32Handle <> 0 then
  begin
    IsWOW64Process := GetProcAddress(Kernel32Handle,'IsWow64Process');
    GetNativeSystemInfo := GetProcAddress(Kernel32Handle,'GetNativeSystemInfo');
    if Assigned(IsWow64Process) then
    begin
      IsWow64Process(GetCurrentProcess,isWoW64);
      Result := isWoW64 and Assigned(GetNativeSystemInfo);
      if Result then
      begin
        GetNativeSystemInfo(SystemInfo);
        Result := (SystemInfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64) or
                  (SystemInfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_IA64);
      end;
    end
    else Result := False;
  end
  else Result := False;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
   regKeyName := TRegistry.Create;
   regKeyName.RootKey := HKEY_LOCAL_MACHINE;
   regKeyOrg := TRegistry.Create;
   regKeyOrg.RootKey := HKEY_LOCAL_MACHINE;
   vsPathKey := TRegistry.Create;
   vsPathKey.RootKey := HKEY_LOCAL_MACHINE;
   IsWin64bit := IsWin64();
   if IsWin64bit then  begin
      regKeyName.OpenKey('SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Registration',True);
      spSkinEdit_name.Text := regKeyName.ReadString('UserName') ;
      regKeyOrg.OpenKey('SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion',True);
      spSkinEdit_org.Text := regKeyOrg.ReadString('RegisteredOrganization');
   end else begin
      regKeyName.OpenKey('SOFTWARE\Microsoft\VisualStudio\10.0\Registration',True);
      spSkinEdit_name.Text := regKeyName.ReadString('UserName') ;
      regKeyOrg.OpenKey('SOFTWARE\Microsoft\Windows NT\CurrentVersion',True);
      spSkinEdit_org.Text := regKeyOrg.ReadString('RegisteredOrganization');
   end;
   vsPathKey.OpenKey('SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VS',True);
   spSkinEdit_path.Text := vsPathKey.ReadString('EnvironmentDirectory');
   if spSkinEdit_path.Text = '' then begin
      spSkinButton2.Enabled := False;
      spSkinMessage1.MessageDlg('当前系统可能没有安装Visual Studio 2010 !',mtWarning,[mbOK],0 );
   end;
end;

procedure TForm1.spSkinButton2Click(Sender: TObject);
var
  tmpcmd:string;
begin
    regKeyOrg.WriteString('RegisteredOrganization',spSkinEdit_org.Text);
    regKeyName.WriteString('UserName',spSkinEdit_name.Text);
    tmpcmd := '"' + spSkinEdit_path.Text + 'devenv.exe"';
    //WinExec(PAnsiChar(tmpcmd),SW_SHOWNORMAL);
    ShellExecute(handle,nil,PWideChar(tmpcmd),pchar(' /setup'),nil,sw_hide);
    //ShowMessage('已经修改成功,请重新启动Visual Studio 2010 查看效果!');
    spSkinMessage1.MessageDlg('已经修改成功,请重新启动Visual Studio 2010 查看效果!',mtInformation,[mbOK],0 );
end;

end.

 

☆版权☆

* 网站名称:obaby@mars
* 网址:https://oba.by/
* 个性:https://oba.by/
* 本文标题: 《Visual Studio 2010 注册信息修改器》
* 本文链接:https://www.zhongxiaojie.cn/2012/06/4225
* 短链接:https://oba.by/?p=4225
* 转载文章请标明文章来源,原文标题以及原文链接。请遵从 《署名-非商业性使用-相同方式共享 2.5 中国大陆 (CC BY-NC-SA 2.5 CN) 》许可协议。


You may also like

2 comments

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注