Back to Index
This page describes param to InvokeRmOperation call and returned value from OnRmOperationResult for snapinId = 15004.
- Note
When operation fails, OnRmOperationResult comes with non-zero status and Error object in value:
{
"Error" : {
"code" : 4101,
"message" : "Failed to send RM command"
}
}
When status is zero, value is as provided in following documentation.
Paged output
RM requests may yield lots of data so responses are restricted in size.
That's where StartAt, UpTo and Total are used.
StartAt
- -1 value - execute request on the host, cache data, return starting part of the data
- >=0 value - get cached data from that position
UpTo says which StartAt use next to continue data retrieval
Total says how many data at all. When UpTo equals to Total, then all data has been retrieved.
Registry constants
Key values:
- 2147483648 HKEY_CLASSES_ROOT
- 2147483649 HKEY_CURRENT_USER
- 2147483650 HKEY_LOCAL_MACHINE
- 2147483651 HKEY_USERS
- 2147483653 HKEY_CURRENT_CONFIG
- Note
- Other predefined keys mentioned in MSDN cannot be used and will produce Invalid handle error.
Type values:
- 1 REG_SZ
- 2 REG_EXPAND_SZ
- 3 REG_BINARY
- 4 REG_DWORD
- 7 REG_MULTI_SZ
See Registry Value Types in MSDN documentation.
Operation: Check if supported
snapinId=15004 opId=0
Check if host supports Registry subsystem (Snap-In) for RM calls.
Parameters
Returns
Supported 1 if supports, 0 if not
Operation: Get registry item
snapinId=15004 opId=501
Parameters
{ "StartAt":-1, "Key":2147483649, "SubKey":"Control Panel\\Appearance"}
Key see Key values
StartAt see Paged output
Returns
{
"Keys" : [
{
"HasChildren" : 1,
"Name" : "New Schemes"
},
{
"HasChildren" : 0,
"Name" : "Schemes"
}
],
"StartAt" : 0,
"Total" : 6,
"UpTo" : 6,
"Values" : [
{
"Name" : "",
"Value" : "",
"Type" : 1,
"ValSize" : 0
},
{
"Name" : "Current",
"Value" : "",
"Type" : 1,
"ValSize" : 2
},
{
"Value" : [
255,
255,
255,
0,
...
0
],
"Name" : "CustomColors",
"Type" : 3,
"ValSize" : 64
},
{
"Name" : "NewCurrent",
"Value" : "",
"Type" : 1,
"ValSize" : 2
}
]
}
Type see Type values
May return Error with code
- 2 no such item (check Subkey)
Operation: Rename registry item
snapinId=15004 opId=502
Parameters
{
"IsValue" : 0,
"Key" : 2147483649,
"Name" : "__Test__",
"NewName" : "__Test2__",
"Subkey" : ""
}
Key see Key values
Subkey f.e. "Software\\Acme Corp"
IsValue whether Name refers to named value or key
May return Error with code
- 183 NewName is used already
- 2 no such item (check Subkey and Name)
Returns
Operation: Delete registry item
snapinId=15004 opId=503
Parameters
{
"IsValue" : 0,
"Key" : 2147483649,
"Name" : "__Test2__",
"Subkey" : ""
}
Key see Key values
Subkey f.e. "Software\\Acme Corp"
IsValue whether or not Subkey refers to named value
Returns
Operation: Add registry key
snapinId=15004 opId=504
Parameters
{
"Key" : 2147483649,
"Subkey" : "Software"
}
Key see Key values
Subkey f.e. "Software\\Acme Corp"
Returns
{
"Name" : "New Key #3"
}
Operation: Add registry value
snapinId=15004 opId=505
Parameters
{
"Value" : 33,
"Key" : 2147483649,
"Subkey" : "Software\\Acme Co",
"Type" : 4
}
Key see Key values
Type see Type values
Returns
{
"Name" : "New Value #12"
}
Operation: Set registry value
snapinId=15004 opId=506
Parameters
{
"Value" : 33,
"Key" : 2147483649,
"Name" : "",
"Subkey" : "__Test__",
"Type" : 4
}
Key see Key values
Subkey f.e. "Software\\Acme Corp"
Returns
Operation: Find registry item
snapinId=15004 opId=507
Parameters
{
"Key" : 2147483649,
"Subkey" : "",
"IsValue" : 0,
"Value" : "Acme Co",
"Name": "",
"Flags" : 7
}
Returns
{
"Key" : 2147483649,
"Subkey" : "Software\\Acme Co",
"IsValue" : 0,
"Value" : "Acme Co",
"Name": "",
"Flags" : 7
}
Key see Key values
Subkey f.e. "Software\\Acme Corp"
Flags
- 1 - find in key names
- 2 - find in value names
- 4 - find in data
- 2147483648 - find full strings only
- 16777216 - search is continued for the next Key
Value text to search
Name name of the named value
IsValue whether or not there is named value
When search yields no result in the current hive SubKey will be empty, otherwise SubKey points to the key where data is found.
To resume search
- in the current hive: pass the previously returned values;
- in the next hive: set Key to the next hive constant, SubKey to empty string, add 16777216 to flags
Operation: Import registry key
snapinId=15004 opId=508
Parameters
Command has two forms:
1)
{
"Data" : "REGEDIT4\r\n\r\n[HKEY_CURRENT_USER\\Software\\Acme Co]\r\n\"SomeData\"=\"SomeValue\"\r\n",
"StartAt" : 0
}
2)
{
"FileName" : "c:\\sample.reg",
"StartAt" : 0
}
Key see Key values
FileName is the name of the file on Guest side that will be imported to Host registry
".reg" extension is appended, if not present already
Returns
{
"StartAt" : 0,
"Total" : 104,
"UpTo" : 104
}
Client should continue to call this operation with StartAt set to UpTo from the previous call. When UpTo=Total then all data is transmitted.
Operation: Export registry key
snapinId=15004 opId=509
Parameters
Command has two forms:
1)
{
"Key" : 2147483649,
"StartAt" : 0,
"Subkey" : "Software\\Acme Co"
}
2)
{
"FileName" : "C:\\HKCU_Software_Microsoft_Windows.reg",
"Key" : 2147483649,
"StartAt" : 0,
"Subkey" : "Software\\Microsoft\\Windows"
}
Key see Key values
FileName is the name of the file that will be created on Guest side
".reg" extension is appended, if not present already
Returns when in request FileName is omitted:
{
"Data" : "REGEDIT4\r\n\r\n[HKEY_CURRENT_USER\\Software\\Acme Co]\r\n\"SomeData\"=\"SomeValue\"\r\n\r\n",
"StartAt" : 0,
"Total" : 76,
"UpTo" : 76
}
when in request FileName is present:
{
"FileName" : "C:\\HKCU_Software_Microsoft_Windows.reg",
"StartAt" : 0,
"Total" : 875206,
"UpTo" : 4096
}
Client should continue to call this operation with StartAt set to UpTo from the previous call. When UpTo=Total then all data is retrieved.