* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS hive maker
/*
* TODO:
- * - Implement RegDeleteKey()
+ * - Implement RegDeleteKeyW()
* - Implement RegEnumValue()
- * - Implement RegQueryValueExA()
+ * - Implement RegQueryValueExW()
*/
#include <stdlib.h>
LocalKeyName = (PWSTR)KeyName;
for (;;)
{
- End = (PWSTR) xwcschr(LocalKeyName, '\\');
+ End = (PWSTR) utf16_wcschr(LocalKeyName, '\\');
if (End)
{
KeyString.Buffer = LocalKeyName;
RtlInitUnicodeString(&KeyString, LocalKeyName);
/* Redirect from 'CurrentControlSet' to 'ControlSet001' */
- if (!xwcsncmp(LocalKeyName, L"CurrentControlSet", 17) &&
- ParentKey->NameSize == 12 &&
- !memcmp(ParentKey->Name, L"SYSTEM", 12))
+ if (!utf16_wcsncmp(LocalKeyName, L"CurrentControlSet", 17) &&
+ ParentKey->NameSize == 12 &&
+ !memcmp(ParentKey->Name, L"SYSTEM", 12))
RtlInitUnicodeString(&KeyString, L"ControlSet001");
/* Check subkey in memory structure */
}
LONG WINAPI
-RegDeleteKeyA(HKEY Key,
- LPCSTR Name)
+RegDeleteKeyW(
+ IN HKEY hKey,
+ IN LPCWSTR lpSubKey)
+{
+ DPRINT1("FIXME!\n");
+ return ERROR_SUCCESS;
+}
+
+LONG WINAPI
+RegDeleteKeyA(
+ IN HKEY hKey,
+ IN LPCSTR lpSubKey)
{
- if (Name != NULL && strchr(Name, '\\') != NULL)
- return(ERROR_INVALID_PARAMETER);
+ PWSTR lpSubKeyW = NULL;
+ LONG rc;
+
+ if (lpSubKey != NULL && strchr(lpSubKey, '\\') != NULL)
+ return ERROR_INVALID_PARAMETER;
+
+ if (lpSubKey)
+ {
+ lpSubKeyW = MultiByteToWideChar(lpSubKey);
+ if (!lpSubKeyW)
+ return ERROR_OUTOFMEMORY;
+ }
- DPRINT1("FIXME!\n");
+ rc = RegDeleteKeyW(hKey, lpSubKeyW);
- return(ERROR_SUCCESS);
+ if (lpSubKey)
+ free(lpSubKeyW);
+
+ return rc;
}
LONG WINAPI
if (cbData <= sizeof(HCELL_INDEX))
{
/* If data size <= sizeof(HCELL_INDEX) then store data in the data offset */
- DPRINT("ValueCell->DataLength %lu\n", ValueCell->DataLength);
+ DPRINT("ValueCell->DataLength %u\n", ValueCell->DataLength);
if (DataCell)
HvFreeCell(&Key->RegistryHive->Hive, ValueCell->Data);
* data block and allocate a new one. */
HCELL_INDEX NewOffset;
- DPRINT("ValueCell->DataLength %lu\n", ValueCell->DataLength);
+ DPRINT("ValueCell->DataLength %u\n", ValueCell->DataLength);
NewOffset = HvAllocateCell(&Key->RegistryHive->Hive, cbData, Stable, HCELL_NIL);
if (NewOffset == HCELL_NIL)
{
- DPRINT("HvAllocateCell() failed with status 0x%08lx\n", Status);
+ DPRINT("HvAllocateCell() failed with status 0x%08x\n", Status);
return ERROR_UNSUCCESSFUL;
}
HvMarkCellDirty(&Key->RegistryHive->Hive, Key->KeyCellOffset, FALSE);
- DPRINT("Return status 0x%08lx\n", Status);
+ DPRINT("Return status 0x%08x\n", Status);
return Status;
}
Status = CmiInitializeTempHive(HiveToConnect);
if (!NT_SUCCESS(Status))
{
- DPRINT1("CmiInitializeTempHive() failed with status 0x%08lx\n", Status);
+ DPRINT1("CmiInitializeTempHive() failed with status 0x%08x\n", Status);
return FALSE;
}
return TRUE;
}
-static BOOL
-MyExportBinaryHive (PCHAR FileName,
- PCMHIVE RootHive)
-{
- FILE *File;
- BOOL ret;
-
- /* Create new hive file */
- File = fopen (FileName, "w+b");
- if (File == NULL)
- {
- printf(" Error creating/opening file\n");
- return FALSE;
- }
-
- fseek (File, 0, SEEK_SET);
-
- RootHive->FileHandles[HFILE_TYPE_PRIMARY] = (HANDLE)File;
- ret = HvWriteHive(&RootHive->Hive);
- fclose (File);
- return ret;
-}
-
LIST_ENTRY CmiHiveListHead;
VOID
Status = CmiInitializeTempHive(&RootHive);
if (!NT_SUCCESS(Status))
{
- DPRINT1("CmiInitializeTempHive() failed with status 0x%08lx\n", Status);
+ DPRINT1("CmiInitializeTempHive() failed with status 0x%08x\n", Status);
return;
}