## 3 Constructing a Lightweight Key-Value Store Based on the Windows Native Features  
### The Concept  
In this section, we propose a method to construct a lightweight key-value store based on the Windows native features. We call the proposed key-value store _WR-Store_. For WR-Store, we design  
\begin{table}
\begin{tabular}{c c} \hline \hline
**APIs** & **Description** \\ \hline RegOpenKeyEx & Open a specified registry key \\ RegCreateKeyEx & Create a specified registry key \\ RegSetValueEx & Set the data and type of a specified value in an opened registry key \\ RegQueryValueEx & Retrieve the data of a specified value in an opened registry key \\ RegDeleteKeyValue & Remove a specified value from an opened registry key \\ RegDeleteTree & Delete all the subkeys and values of an opened registry key recursively \\ RegCloseKey & Close a specified registry key \\ \hline \hline \end{tabular}
\end{table}
Table 1: Windows APIs to manipulate the Windows registry [27].  
Figure 1: The structure of the Windows registry.  
the Windows registry as the key-value store. Because we typically store configurations and meta data of the system and applications in the Windows registry, there have been no efforts that regard the Windows registry as a general-purpose data storage. We design WR-Store by mapping the components in the key-value store onto the components. Table 2 shows the mapping.  
Figure 2 shows the concept of WR-Store. WR-Store consists of two parts: (1) storage for key-value data and (2) index structure. The right pane in Figure 2 shows the storage for key-value data in WR-Store. We can store multiple values under a registry key. In the figure, a Window registry key, \"\(Computer\backslash HKCl\backslash kvs\backslash fe\backslash 40\backslash 8a \backslash 96\)\", is storing two key-value pairs. The key of one key-value pair is \"792479\", and its associated value is \"#Scotland\"; the key of the other key-value pair is \"2149\", and the value is \"(\(-115.223125\), \(36.232915\))\".  
The left pane in Figure 2 shows the index structure of WR-Store. In WR-Store, we use keys and subkeys in the Windows registry as the index structure. As a result, we store key-value data in the leaf subkeys of the registry path. For example, in Figure 2, \"fe\", \"40\", \"8a\", and \"96\" is a path to access key-value data for the keys \"792479\" and \"2149\". Because multiple values are allowed to store in a registry key, we identify actual key-value pairs by the name attribute in the value of the  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Key-Value Store** & **Window Registry** \\ \hline Key & The name attribute of the value in the registry \\ Value & The data attribute of the value in the registry \\ Database & A registry key under a root key in the registry \\ Index & Registry subkeys under a registry key for the database \\ \hline \hline \end{tabular}
\end{table}
Table 2: Mapping of the components in the key-value store onto the components in the Windows registry.  
Figure 2: The concept of WR-Store.  
registry. Here, we determine the names of keys and subkeys in the registry path from the given key. The detailed mechanism will be explained in Section 3.2.  
We create a new database for WR-Store under a certain root registry. Here, we can choose a root registry key according to the desired security level for the key-value store because any logged in users can access HKCU, but only administrators can access HKLM. Consequently, we make a database in one of the following paths: (1) \"Computer\HKLM\DBName\" or (2) \"Computer\HKCU\DBName\". In Figure 2, the used root key is HKCU, and the database name is \"_kvs_\".