Смекни!
smekni.com

Настройка Windows по средствам системного реестра (стр. 4 из 8)

i: integer; iRes: integer; s: String; hTemp: HKEY; Buf: Pointer; BufSize: Cardinal;

begin

Result := False;

ResultList := '';

if RegOpenKeyEx(RootKey, PChar(Name), 0, KEY_READ, hTemp) = ERROR_SUCCESS then begin

Result := True;

BufSize := 1024;

GetMem(buf, BufSize);

i := 0;

iRes := ERROR_SUCCESS;

while iRes = ERROR_SUCCESS do begin

BufSize := 1024;

if DoKeys then

iRes := RegEnumKeyEx(hTemp, i, buf, BufSize, nil, nil, nil, nil)

else

iRes := RegEnumValue(hTemp, i, buf, BufSize, nil, nil, nil, nil);

if iRes = ERROR_SUCCESS then begin

SetLength(s, BufSize);

CopyMemory(@s[1], buf, BufSize);

if ResultList = '' then

ResultList := s

Else ResultList := Concat(ResultList, #13#10,s);

inc(i);

end; end;

FreeMem(buf);

RegCloseKey(hTemp);

end; end;

function RegEnumValues(RootKey: HKEY; Name: String; var ValueList: String): boolean;

begin

Result := RegEnum(RootKey, Name, ValueList, False);

end;

function RegEnumKeys(RootKey: HKEY; Name: String; var KeyList: String): boolean;

begin Result := RegEnum(RootKey, Name, KeyList, True);

end;

en


3.2 Основной модуль программы (Unit1)


unit Unit1;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics,

Controls, Forms, Dialogs, ComCtrls, StdCtrls, ExtCtrls,

Buttons, ExtDlgs;

const

ClearPageFileAtShutdown: String =

'SYSTEM\CurrentControlSet\Control\Session '

+'Manager\Memory Management\ClearPageFileAtShutdown';

DebugDrWatsonAuto: String =

'SOFTWARE\Microsoft\Windows NT\CurrentVersion\'

+'AeDebug\Auto';

AlwaysUnloadDLL: String =

'SOFTWARE\Microsoft\Windows\CurrentVersion\'

+'Explorer\AlwaysUnloadDLL';

NoInstrumentation: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\Explorer\NoInstrumentation';

DefaultSeparateVDM: String =

'SYSTEM\CurrentControlSet\Control\WOW\'

+'DefaultSeparateVDM';

DoReport: String =

'SOFTWARE\Microsoft\PCHealth\ErrorReporting\DoReport';

ShowUI: String =

'SOFTWARE\Microsoft\PCHealth\ErrorReporting\ShowUI';

PromptPasswordOnResume: String =

'Software\Policies\Microsoft\Windows\'

+'System\Power\PromptPasswordOnResume';

BootOptimizeFunction: String =

'SOFTWARE\Microsoft\Dfrg\BootOptimizeFunction\'

+'Enable';

ConsoleQuickEdit: String = 'Console\QuickEdit';

ShutdownReasonUI: String =

'Software\Policies\Microsoft\Windows NT\'

+'Reliability\ShutdownReasonUI';

NoLowDiskSpaceChecks: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\Explorer\NoLowDiskSpaceChecks';

MinAnimate: String =

'Control Panel\Desktop\WindowMetrics\MinAnimate';

SeparateProcess: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Explorer\Advanced\SeparateProcess';

AutoRestartShell: String =

'SOFTWARE\Microsoft\Windows NT\CurrentVersion\'

+'Winlogon\AutoRestartShell';

IsShortcut: String = 'SOFTWARE\Classes\lnkfile\IsShortcut';

LinkImg: String =

'Software\Microsoft\Windows\CurrentVersion\Explorer\link';

NoSaveSettings: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\Explorer\NoSaveSettings';

DragFullWindows: String =

'Control Panel\Desktop\DragFullWindows';

EnableBalloonTips: String = 'Software\Microsoft\Windows\CurrentVersion\'

+'Explorer\Advanced\EnableBalloonTips';

TaskbarGlomming: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Explorer\Advanced\TaskbarGlomming';

TaskbarGroupSize: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Explorer\Advanced\TaskbarGroupSize';

NoRecentDocsHistory: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\Explorer\NoRecentDocsHistory';

Start_AutoCascade: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Explorer\Advanced\Start_AutoCascade';

NoCommonGroups: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\Explorer\NoCommonGroups';

StartMenuScrollPrograms: String =

'Software\Microsoft\Windows\'

+'CurrentVersion\Explorer\Advanced\StartMenuScrollPrograms';

IntelliMenus: String = 'Software\Microsoft\Windows\'

+'CurrentVersion\Explorer\Advanced\IntelliMenus';

Start_LargeIcons: String = 'Software\Microsoft\Windows\'

+'CurrentVersion\Explorer\Advanced\Start_LargeIcons';

StartMenuChange: String = 'Software\Microsoft\Windows\'

+'CurrentVersion\Explorer\Advanced\StartMenuChange';

CodePage: String =

'SYSTEM\CurrentControlSet\Control\Nls\CodePage\';

DosKeybCodes: String =

'SYSTEM\CurrentControlSet\Control\Keyboard Layout\'

+'DosKeybCodes\00000409';

AutoEndTasks: String = 'Control Panel\Desktop\AutoEndTasks';

AutoRunCD: String =

'SYSTEM\CurrentControlSet\Services\Cdrom\AutoRun';

DontDisplayLastUserName: String =

'SOFTWARE\Microsoft\Windows\CurrentVersion\'

+'Policies\System\dontdisplaylastusername';

DisableStatusMessages: String =

'SOFTWARE\Microsoft\Windows\CurrentVersion\'

+'Policies\System\DisableStatusMessages';

VerboseStatus: String =

'SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\'

+'System\verbosestatus';

Hotkey: String = '.DEFAULT\Keyboard Layout\Toggle\Hotkey';

InitialKeyboardIndicators: String = '.DEFAULT\Control Panel\Keyboard\'

+'InitialKeyboardIndicators';

DisableTaskMgr: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\System\DisableTaskMgr';

DisableRegistryTools: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\System\DisableRegistryTools';

NoLogOff: String =

'Software\Microsoft\Windows\CurrentVersion\Policies\'

+'Explorer\NoLogOff';

NoClose: String =

'Software\Microsoft\Windows\CurrentVersion\Policies\'

+'Explorer\NoClose';

NoControlPanel: String =

'Software\Microsoft\Windows\CurrentVersion\Policies\'

+'Explorer\NoControlPanel';

NoDispCPL: String =

'Software\Microsoft\Windows\CurrentVersion\Policies\'

+'System\NoDispCPL';

DisableCMD: String =

'Software\Policies\Microsoft\Windows\System\DisableCMD';

LanmanServer: String =

'SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\';

RestrictAnonymous: String =

'SYSTEM\CurrentControlSet\Control\Lsa\RestrictAnonymous';

NoViewContextMenu: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\Explorer\NoViewContextMenu';

NoFileMenu: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\Explorer\NoFileMenu';

NoShellSearchButton: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\Explorer\NoShellSearchButton';

NoSetTaskbar: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\Explorer\NoSetTaskbar';

NoChangeStartMenu: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\Explorer\NoChangeStartMenu';

NoFind: String = 'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\Explorer\NoFind';

NoRun: String = 'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\Explorer\NoRun';

NoSMHelp: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\Explorer\NoSMHelp';

NoRecentDocsMenu: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\Explorer\NoRecentDocsMenu';

NoTrayContextMenu: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\Explorer\NoTrayContextMenu';

PaintDesktopVersion: String = 'Control Panel\Desktop\PaintDesktopVersion';

NoDesktop: String =

'Software\Microsoft\Windows\CurrentVersion\Policies\'

+'Explorer\NoDesktop';

NoActiveDesktop: String =

'Software\Microsoft\Windows\CurrentVersion\Policies\'

+'Explorer\NoActiveDesktop';

NoDispBackgroundPage: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\System\NoDispBackgroundPage';

NoDispScrSavPage: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\System\NoDispScrSavPage';

NoDispSettingsPage: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\System\NoDispSettingsPage';

NoDispAppearancePage: String =

'Software\Microsoft\Windows\CurrentVersion\'

+'Policies\System\NoDispAppearancePage';

Wallpaper: String = 'Control Panel\Desktop\Wallpaper';

TileWallpaper: String = 'Control Panel\Desktop\TileWallpaper';

procedure IncEdit1; stdcall;

procedure IncEdit2; stdcall;

procedure IncEdit3; stdcall;

type

TForm1 = class(TForm)

PageControl1: TPageControl;

TabSheet1: TTabSheet;

PageControl2: TPageControl;

TabSheet6: TTabSheet;

CheckBox1: TCheckBox;

CheckBox2: TCheckBox;

CheckBox3: TCheckBox;

CheckBox4: TCheckBox;

CheckBox5: TCheckBox;

CheckBox6: TCheckBox;

CheckBox8: TCheckBox;

CheckBox9: TCheckBox;

TabSheet7: TTabSheet;

CheckBox12: TCheckBox;

CheckBox13: TCheckBox;

CheckBox14: TCheckBox;

CheckBox15: TCheckBox;

CheckBox17: TCheckBox;

CheckBox18: TCheckBox;

CheckBox19: TCheckBox;

TabSheet9: TTabSheet;

CheckBox20: TCheckBox;

CheckBox23: TCheckBox;

CheckBox24: TCheckBox;

CheckBox25: TCheckBox;

CheckBox26: TCheckBox;

CheckBox28: TCheckBox;

TabSheet10: TTabSheet;

CheckBox29: TCheckBox;

CheckBox30: TCheckBox;

CheckBox31: TCheckBox;

TabSheet11: TTabSheet;

CheckBox32: TCheckBox;

CheckBox33: TCheckBox;

CheckBox34: TCheckBox;

CheckBox35: TCheckBox;

CheckBox36: TCheckBox;

TabSheet3: TTabSheet;

PageControl4: TPageControl;

TabSheet14: TTabSheet;

TabSheet16: TTabSheet;

TabSheet17: TTabSheet;

TabSheet4: TTabSheet;