修改注册表权限可以使用命令regini(XP系统自带)
使用方法:
regini regset.ini
regset.ini内容
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run [17]
把run项设为只允许system控制 其他用户不可控制 [17] 为控制参数 其他参数看下面的帮助
usage: REGINI [-m machinename | -h hivefile hiveroot | -w Win95 Directory]
[-i n] [-o outputWidth]
[-b] textFiles...
where: -m specifies a remote windows NT machine whose registry is to be manipula
ted.
-h specifies a specify local hive to manipulate.
-w specifies the paths to a windows 95 system.dat and user.dat files
-i n specifies the display indentation multiple. Default is 4
-o outputWidth specifies how wide the output is to be. By default the
outputWidth is set to the width of the console window if standard
output has not been redirected to a file. In the latter case, an
outputWidth of 240 is used.
-b specifies that REGINI should be backward compatible with older
versions of REGINI that did not strictly enforce line continuations
and quoted strings Specifically, REG_BINARY, REG_RESOURCE_LIST and
REG_RESOURCE_REQUIREMENTS_LIST data types did not need line
continuations after the first number that gave the size of the data.
It just kept looking on following lines until it found enough data
values to equal the data length or hit invalid input. Quoted
strings were only allowed in REG_MULTI_SZ. They could not be
specified around key or value names, or around values for REG_SZ or
REG_EXPAND_SZ Finally, the old REGINI did not support the semicolon
as an end of line comment character.
textFiles is one or more ANSI or Unicode text files with registry data.
The easiest way to understand the format of the input textFile is to use
the REGDMP command with no arguments to dump the current contents of
your NT Registry to standard out. Redirect standard out to a file and
this file is acceptable as input to REGINI
Some general rules are:
Semicolon character is an end-of-line comment character, provided it
is the first non-blank character on a line
Backslash character is a line continuation character. All
characters from the backslash up to but not including the first
non-blank character of the next line are ignored. If there is more
than one space before the line continuation character, it is
replaced by a single space.
Indentation is used to indicate the tree structure of registry keys
The REGDMP program uses indentation in multiples of 4. You may use
hard tab characters for indentation, but embedded hard tab
characters are converted to a single space regardless of their
position
Values should come before child keys, as they are associated with
the previous key at or above the value's indentation level.
For key names, leading and trailing space characters are ignored and
not included in the key name, unless the key name is surrounded by
quotes. Imbedded spaces are part of a key name.
Key names can be followed by an Access Control List (ACL) which is a
series of decimal numbers, separated by spaces, bracketed by a
square brackets (e.g. [8 4 17]). The valid numbers and their
meanings are:
1 - Administrators Full Access
2 - Administrators Read Access
3 - Administrators Read and Write Access
4 - Administrators Read, Write and Delete Access
5 - Creator Full Access
6 - Creator Read and Write Access
7 - World Full Access
8 - World Read Access
9 - World Read and Write Access
10 - World Read, Write and Delete Access
11 - Power Users Full Access
12 - Power Users Read and Write Access
13 - Power Users Read, Write and Delete Access
14 - System Operators Full Access
15 - System Operators Read and Write Access
16 - System Operators Read, Write and Delete Access
17 - System Full Access
18 - System Read and Write Access
19 - System Read Access
20 - Administrators Read, Write and Execute Access
21 - Interactive User Full Access
22 - Interactive User Read and Write Access
23 - Interactive User Read, Write and Delete Access
例子:
@echo off
rem 修改注册表sam的访问权限
(echo HKEY_LOCAL_MACHINE\SAM\ [1]
echo HKEY_LOCAL_MACHINE\SAM\SAM\ [1]
echo HKEY_LOCAL_MACHINE\SAM\SAM\Domains\ [1]
echo HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\ [1]
echo HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\ [1]
echo HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F4 [1]
echo HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5 [1]
)>1.txt
regini.exe 1.txt
REGINI.EXE
Microsoft® Windows NT™ Resource Kit Utility
Documentation
Copyright © Microsoft Corp. 1993-1997
Contents
1. Introduction
2. Command-line syntax
3. Creating a REGINI script file
3.1 Script-file syntax
3.2 Line formatting
3.3 Key names
3.3.1 Key name syntax
3.3.2 Kernel and User key names
3.4 ACLs
3.5 Values
4. Sample script files
4.1 Bypassing the automatic logon feature
4.2 Adding a mail key value for the current user
4.2.1 Example 1
4.2.2 Example 2
4.3 Setting the default name
4.4 Complex sample
1. Introduction
REGINI.EXE is a character-based utility that you can use to add and modify keys and values in the Windows NT Registry by specifying a Registry script. This document details and provides examples of how to run REGINI and how to create script files for it.
Wherever possible, you should use Control Panel and applications in the Administrative Tools program group to make changes to the system configuration and thus to the Registry. When you want functionality similar to that of REGINI in an interactive process, use the Windows NT Registry Editors, REGEDT32.EXE and REGEDIT.EXE.
When you need to automate the process of modifying the Registry, however, REGINI provides a way to add or modify values in the Registry with scripts that you can write. For example, you can use REGINI for batch implementation of corporate standards such as background bitmaps, sounds, and security settings. For installing new device drivers or hardware, though, it is preferable to use the Setup application programming interfaces (APIs) provided for that purpose.
2. Command-line syntax
To run REGINI, type at the command prompt:
regini [InputTextFile] [InputTextFile] [... InputTextFile]
where:
InputTextFile
is the filename (and optionally the path) of one or more script files to be processed into the Windows NT Registry. The filename can have any extension or none.
Script files must be in ANSI format, but are converted to Unicode when read from the disk. Currently, you cannot specify a Unicode text file as the script file.
For example:
regini \\myserver\public\myfolder\srv.ini
saves a file named SRV.INI in the shared folder \\myserver\public\myfolder\.
3. Creating a REGINI script file
3.1 Script-file syntax
In a REGINI script file specifying Registry changes, you must locate the new or changed key on the first line followed by the value of that key on the second line, in this format:
\Registry\Key [ACL]
ValueName = DataType ValueData
The elements of this syntax are explained in sections 3.3 through 3.5.
If a line does not contain an equal sign (=), then REGINI interprets that line as specifying a Registry key name.
If a line contains an equal sign (=), then REGINI interprets that line as specifying a Registry value.
Note: Make sure the text editor you use to create the script file puts a carriage return at the end of each line. Lack of carriage returns can cause unpredictable results.
For example, a REGINI script file named SRV.INI saved on the shared directory \\myserver\public\myfolder\ contains the following text:
\Registry\Machine\System\CurrentControlSet\Services\Lanmanserver\Parameters
DiskSpaceThreshhold = REG_DWORD 0x00000000
The following, typed at the command prompt, places the DiskSpaceThreshhold parameter in the Registry or changes the value that is already there:
regini \\myserver\public\myfolder\srv.ini
Note: The filename can have any extension or none. Script files must be in ANSI format, but are converted to Unicode when read from the disk. Currently, there is no way to specify a Unicode text file as the script file.
3.2 Line formatting
The format of the script file is line-oriented. If you are unable to fit all the information for a Registry key name or value on a line, use the backslash character (\) as a line-continuation character.
For example:
123456\
1234 \
12
is treated as single line containing:
1234561234 12
3.3 Key names
3.3.1 Key name syntax
If a line does not contain an equal sign (=), then the line specifies a Registry key name. In a REGINI script file, the key name consists of all text from the first non-blank character to the end of the line, including spaces, on any line that does not contain an equal sign.
Leading spaces are significant. If there are no leading spaces, then the named key is an absolute path from the Registry.
For example:
\Registry\Machine\Software
or
USER:Control Panel
In the second example, USER: is replaced by the full path to the root of the currently logged-on users profile (for example, \Registry\Users\S-x-x-xxxx...).
If a line in the script file does not contain an equal sign, and there are one or more spaces at the beginning of that line, then the key name on that line is defined relative to the preceding key in the Registry hierarchy. If the number of leading spaces is the same as in the preceeding key, then REGINI locates the key is at the same level. If the number is less, REGINI locates the key one level higher; if the number is more, REGINI locates the key one level lower.
For example:
\Registry\Machine\Software
Level1a
Level2a
Level2b
Level3a
Level1b
3.3.2 Kernel and User key names
Note that REGINI works with Kernel Registry strings. When you access the Registry in User mode to modify the HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER, or HKEY_CURRENT_USER keys, the string is converted in Kernel mode as follows:
HKEY_LOCAL_MACHINE is converted to \Registry\Machine.
HKEY_USERS is converted to \Registry\User.
HKEY_CURRENT_USER is converted to \Registry\User\User_SID, where User_SID is the security ID (SID) associated with the current user.
3.4 ACL
After the key name, you can optionally specify an ACL (access control list). The ACL is a list of decimal numbers separated by spaces within square brackets. The decimal numbers represent the following user rights:
1 Administrator Full
2 Administrator R
3 Administrator RW
4 Administrator RWD
5 Creator Full
6 Creator RW
7 World Full
8 World R
9 World RW
10 World RWD
11 Power Users Full
12 Power Users RW
13 Power Users RWD
14 System OpFull
15 System OpRW
16 System OpRWD
17 System Full
18 System RW
19 System R
20 Administrator RWX
3.5 Values
If a line in a script contains an equal sign (=), then that line specifies a Registry value. The text to the left of the equal sign, if any, is the value name. The text to the right of the equal sign specifies the data type and value data. Syntax for a value line follows:
ValueName = DataType ValueData
The value name consists of all characters from the first non-blank character on the line to the last non-blank character before the equal sign. The value data consists of the first non-blank character after the data type to the end of the line.
Eight data-type keywords are supported. If none is specified, the default data type, REG_SZ, is used. The data types and the format of the value data for each are:
Data Type
Value Data Sets the Registry data type to
Notes
REG_SZ A string. REG_SZ REG_SZ is the default data type.
REG_EXPAND_SZ A string REG_EXPAND_SZ
REG_MULTI_SZ One or more strings, each delimited by quotes REG_MULTI_SZ
REG_MULTISZFILE A path to a file REG_MULTI_SZ The file is opened and each quoted string is added to the value data.
REG_DWORD A decimal number REG_DWORD Use 0x to specify a hexadecimal value, 0o to specify an octal value, and 0b to specify a binary value. You can also use the strings On, Yes or True, each of which is converted to 0x00000001 and the strings Off, No or False, each of which is converted to 0x00000000.
REG_BINARY Two or more decimal numbers REG_BINARY The first decimal number must be the number of bytes of data that follow. The remaining numbers are converted into 32-bit numbers. Thus, the value length should always be a multiple of 4 bytes.
REG_BINARYFILE A path to a file REG_BINARY The named file is opened and its contents stored in the Registry as the value. The length of the value will be the length of the file.
DELETE [No value data] [No data type] If this keyword is specified as the data type, the value name is deleted.
4. Sample script files
This section shows some examples of REGINI script files. The sample script files show how to modify the automatic logon feature, how to add a mail key value for the current user and how to modify several Registry keys at the same time.
4.1 Bypassing the automatic logon feature
This example shows you how to bypass the automatic logon feature of the Windows NT platform by using a REGINI script.
The problem with bypassing the automatic logon feature is that the original DefaultUserName is not kept for subsequent logons, because the name of the last user to log on is the one retained in the Username box of the Welcome dialog box and in the Registry. To reenable the AutoAdminLogon, enter the original DefaultUserName and password in the Welcome dialog box. If the original DefaultUserName and password are unknown, use REGINI.EXE to modify the parameters in the Registry to reflect the correct user name with each logon.
To ensure that the DefaultUserName value never changes, create an script file with the following text:
\Registry\Machine
Software
Microsoft
Windows NT
CurrentVersion
Winlogon
DefaultUserName = REG_SZ USERNAMETEST
where DefaultUserName is the value name, REG_SZ is the data type and USERNAMETEST is the desired result or value.
To reference the script file, create a .BAT or .CMD file containing the following command:
c:\reskit\regini c:\usernametest.ini
where the name of the script file saved is USERNAMETEST.INI.
To ensure that the DefaultUserName will not change regardless of how many users log on, you must put this .CMD or .BAT file in the Common Startup group.
4.2 Adding a mail key value for the current user
These examples show you how to add a value for the current user in the mail key.
To do so, you must first find the current user SID. Run the REGEDT32 utility and go into HKEY_USERS. You will see only two subkeys, ".DEFAULT" and the current user SID. When a user logs on, the system loads the hive corresponding to the user Registry settings. Therefore, HKEY_CURRENT_USER is simply a link to HKEY_USERS\loggeduser_sid.
The following two sample scripts show how to use this information with REGINI when you want to include multiple Registry keys.
4.2.1 Example 1
\registry\user\.DEFAULT\toto
Type = REG_DWORD 0x00000001
Start = REG_DWORD 0x00000003
Group = Extended base
ErrorControl = REG_DWORD 0x00000001
4.2.2 Example 2
\registry\user\S-1-5-21-2185238159-1414228629-1939875897-1000\toto
Type = REG_DWORD 0x00000001
Start = REG_DWORD 0x00000003
Group = Extended base
ErrorControl = REG_DWORD 0x00000001
Replace the SID in the examples with your own SID.
4.3 Setting the default name
This example, DEFLTNAM.INI, shows how to use REGINI to set the default name at the logon prompt. This script modifies HKEY_LOCAL_MACHINE.
\Registry\Machine
Software
Microsoft
Windows NT
CurrentVersion
Winlogon
DefaultUserName = REG_SZ bmiller
4.4 Complex sample
\Registry\Machine\Software
Classes
AudioCD [10 1 17 5]
EditFlags = REG_BINARY 0x00000004 0x00000002
DefaultIcon
= REG_EXPAND_SZ %SystemRoot%\system32\shell32.dll,40
shell
= play
play
= &Play
command
= REG_EXPAND_SZ %SystemRoot%\system32\cdplayer.exe \
/play %1
Microsoft
Rpc
DCOM Protocols = REG_MULTI_SZ "ncadg_ip_udp" \
"ncadg_ipx" \
"ncacn_ip_tcp" \
"ncacn_spx" \
"ncacn_nb_nb" \
"ncacn_nb_ipx"
NameService
Protocol=ncacn_np
NetworkAddress=\\.
ServerNetworkAddress=\\.
Endpoint=\pipe\locator
DefaultSyntax=3
NetBios
ServerProtocols
ncacn_np=rpclts1.dll
ncalrpc=ncalrpc
ncacn_vns=rpclts8.dll
ClientProtocols
ncacn_np=rpcltc1.dll
ncalrpc=ncalrpc
ncacn_vns=rpcltc8.dll
NetDDE [17 1]
DDE Shares
SerialNumber = REG_BINARY 8 0x09000005 0x01000000
CLPBK$
fuCmdShow = REG_DWORD 0x7
ItemList = REG_MULTI_SZ
NewStyleLink = REG_SZ
NumItems = REG_DWORD 0x0
OldStyleLink = REG_SZ
Revision = REG_DWORD 0x1
SecurityDescriptor = REG_BINARY 0x6C \
0x80040001 \
0x0000004C \
0x0000005C \
0x00000000 \
0x00000014 \
0x00380002 \
0x00000002 \
0x00180200 \
0x000F03FF \
0x00000201 \
0x05000000 \
0x00000020 \
0x00000220 \
0x00180200 \
0x000002BD \
0x00000101 \
0x01000000 \
0x00000000 \
0x00000220 \
0x00000201 \
0x05000000 \
0x00000020 \
0x00000220 \
0x00000201 \
0x05000000 \
0x00000020 \
0x00000220
SerialNumber = REG_BINARY 8 0x09000005 0x01000000
Service = REG_DWORD 0x1
SharedFlag = REG_DWORD 0x1
ShareName = REG_SZ CLPBK$
ShareType = REG_DWORD 0x4
StartAppFlag = REG_DWORD 0x0
StaticDataLink = REG_SZ ClipSrv|System
REGINI.DOC Version 0.90
Last revised: January 8, 1997
欢迎光临 批处理之家 (http://bathome.net./) | Powered by Discuz! 7.2 |