*****************************************************************
***                Registry NSIS plugin v1.0                  ***
*****************************************************************

2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)


Features:
- Powerful registry search:
   -fast algorithm
   -principle of turn in stack (first in -> last out)
     i.e. search from first registry key to last
   -search for key, value and/or string in any root
   -search with name and/or type
   -search with banner support
   -search with subkeys or not
- Read value of any type
- Write value of any type
- Create key
- Delete key       (same as DeleteRegKey)
- Delete value     (same as DeleteRegValue)


**** Output variables ****
.r0-.r9 == $0-$9
.R0-.R9 == $R0-$R9


**** Registry Search ****
registry::Open /NOUNLOAD "[fullpath]" "[Options]" .r0
registry::Find /NOUNLOAD .r1 .r2 .r3 .r4
registry::Close


### Open for search ###
registry::Open /NOUNLOAD "[fullpath]" "[Options]" .r0

"[fullpath]"  - Registry path (Root\SubKey)

	Root:
	HKEY_CLASSES_ROOT HKCR
	HKEY_CURRENT_USER HKCU
	HKEY_LOCAL_MACHINE HKLM
	HKEY_USERS HKU
	HKEY_PERFORMANCE_DATA HKPD
	HKEY_CURRENT_CONFIG HKCC
	HKEY_DYN_DATA HKDD

"[Options]"   - "/K=[1|0] /V=[1|0] /S=[1|0] /N=[name] /T=[TYPE] /G=[1|0] /B=[0|1|2]"

	/K=[1|0]
	/K=1  - Search Keys (default)
	/K=0  - Don't search Keys

	/V=[1|0]
	/V=1  - Search Values (default)
	/V=0  - Don't search Values

	/S=[1|0]
	/S=1  - Search Strings (default)
	/S=0  - Don't search Values

	/N=[name]   (can be in quotes "[name]", '[name]', `[name]`)
	/N=          - Search for all (default)
	/N=version   - Search for "version"

	/T=[TYPE]
	/T=                       - Search for all types (default)
	/T=REG_BINARY             - Search for REG_BINARY
	/T=REG_DWORD              - Search for REG_DWORD
	/T=REG_DWORD_BIG_ENDIAN   - Search for REG_DWORD_BIG_ENDIAN
	/T=REG_EXPAND_SZ          - Search for REG_EXPAND_SZ
	/T=REG_LINK               - Search for REG_LINK
	/T=REG_MULTI_SZ           - Search for REG_MULTI_SZ
	/T=REG_NONE               - Search for REG_NONE
	/T=REG_RESOURCE_LIST      - Search for REG_RESOURCE_LIST
	/T=REG_SZ                 - Search for REG_SZ
	/T=REG_INVALID            - Search for REG_INVALID

	/G=[1|0]
	/G=1  - Search with subkeys
	/G=0  - Don't search subkeys

	/B=[0|1|2]
	/B=0  - Banner isn't used (default)
	/B=1  - Banner isn't used, but show
		in the details current searching path
	/B=2  - Banner is used. Return: "path", "", "", "", "BANNER"
		when starts to search in new key

.r0  - $0=errorlevel:
	 0 - success
	-1 - error


### Find first and next (call one or more times) ###
registry::Find /NOUNLOAD .r1 .r2 .r3 .r4

.r1  - $1="path"
.r2  - $2="value" or "key"
.r3  - $3="string"
.r4  - $4="TYPE"
	TYPE:
	""                     -Search is finished
	"BANNER"               -Banner is used, return only path
	"REG_KEY"              -Registry key is found
	"REG_BINARY"           -Raw binary data
	"REG_DWORD"            -Double word in machine format (low-endian on Intel)
	"REG_DWORD_BIG_ENDIAN" -Double word in big-endian format
	"REG_EXPAND_SZ"        -String with unexpanded environment variables
	"REG_LINK"             -Unicode symbolic link
	"REG_MULTI_SZ"         -Multiple strings, next string separated by new line '$\n'
	"REG_NONE"             -Undefined type
	"REG_RESOURCE_LIST"    -Device-driver resource list
	"REG_SZ"               -Null-terminated string
	"REG_INVALID"          -Invalid type code


### Close search (free memory, free stack) ###
registry::Close


**** Registry Read ****
registry::Read "[fullpath]" "[value]" .r0 .r1 .r2 .r3 .r4

Outputs same as registry::Find


**** Registry Write ****
registry::Write "[fullpath]" "[value]" "[string]" "[TYPE]" .r0

"[TYPE]"  - Type of string to write
	REG_BINARY    (e.g. 591B0000451F)           same as WriteRegBin
	REG_DWORD     (e.g. 1234567890)             same as WriteRegDWORD
	REG_EXPAND_SZ (e.g. %WINDIR%\notepad.exe)   same as WriteRegExpandStr
	REG_MULTI_SZ  (e.g. First$\nSecond$\nThird) 
	REG_SZ        (e.g. String #1)              same as WriteRegStr

.r0  - $0=errorlevel:
	 0 - success
	-1 - error


**** Create Registry Key ****
registry::CreateKey "[fullpath]" "[newpath]" .r0

"[newpath]"  - New key to create (recursively if necessary)
		(e.g. SubKey1\SubKey2\SubKey3)

.r0  - $0=errorlevel:
	 1 - [newpath] already exists
	 0 - [newpath] successfully created
	-1 - error


**** Delete Registry Key (same as DeleteRegKey) ****
registry::DeleteKey "[fullpath]" .r0

.r0  - $0=errorlevel:
	 0 - success
	-1 - error


**** Delete Registry Value (same as DeleteRegValue) ****
registry::DeleteValue "[fullpath]" "[value]" .r0

.r0  - $0=errorlevel:
	 0 - success
	-1 - error
