Author: ekohl Date: Mon Apr 26 17:35:57 2010 New Revision: 47038
URL: http://svn.reactos.org/svn/reactos?rev=47038&view=rev Log: [MKHIVE] Partial revert of r47019 because mkhive failed on Linux machines.
Modified: trunk/reactos/tools/mkhive/mkhive.rbuild trunk/reactos/tools/mkhive/reginf.c trunk/reactos/tools/mkhive/rtl.c
Modified: trunk/reactos/tools/mkhive/mkhive.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/mkhive.rbuild?... ============================================================================== --- trunk/reactos/tools/mkhive/mkhive.rbuild [iso-8859-1] (original) +++ trunk/reactos/tools/mkhive/mkhive.rbuild [iso-8859-1] Mon Apr 26 17:35:57 2010 @@ -1,13 +1,13 @@ <?xml version="1.0"?> <!DOCTYPE module SYSTEM "../../tools/rbuild/project.dtd"> <module name="mkhive" type="buildtool"> - <include base="newinflibhost">.</include> + <include base="inflibhost">.</include> <include base="cmlibhost">.</include> <include base="zlibhost">.</include> <include base="rtl">.</include> <define name="MKHIVE_HOST" /> <compilerflag compilerset="gcc">-fshort-wchar</compilerflag> - <library>newinflibhost</library> + <library>inflibhost</library> <library>cmlibhost</library> <library>host_wcsfuncs</library> <file>binhive.c</file>
Modified: trunk/reactos/tools/mkhive/reginf.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/reginf.c?rev=4... ============================================================================== --- trunk/reactos/tools/mkhive/reginf.c [iso-8859-1] (original) +++ trunk/reactos/tools/mkhive/reginf.c [iso-8859-1] Mon Apr 26 17:35:57 2010 @@ -51,34 +51,34 @@ /* FUNCTIONS ****************************************************************/
static BOOL -GetRootKey (PWCHAR Name) +GetRootKey (PCHAR Name) { - if (!_wcsicmp (Name, L"HKCR")) - { - wcscpy (Name, L"\Registry\Machine\SOFTWARE\Classes\"); - return TRUE; - } - - if (!_wcsicmp (Name, L"HKCU")) - { - wcscpy (Name, L"\Registry\User\.DEFAULT\"); - return TRUE; - } - - if (!_wcsicmp (Name, L"HKLM")) - { - wcscpy (Name, L"\Registry\Machine\"); - return TRUE; - } - - if (!_wcsicmp (Name, L"HKU")) - { - wcscpy (Name, L"\Registry\User\"); + if (!strcasecmp (Name, "HKCR")) + { + strcpy (Name, "\Registry\Machine\SOFTWARE\Classes\"); + return TRUE; + } + + if (!strcasecmp (Name, "HKCU")) + { + strcpy (Name, "\Registry\User\.DEFAULT\"); + return TRUE; + } + + if (!strcasecmp (Name, "HKLM")) + { + strcpy (Name, "\Registry\Machine\"); + return TRUE; + } + + if (!strcasecmp (Name, "HKU")) + { + strcpy (Name, "\Registry\User\"); return TRUE; }
#if 0 - if (!_wcsicmp (Name, L"HKR")) + if (!strcasecmp (Name, "HKR")) return FALSE; #endif
@@ -94,19 +94,19 @@ static VOID AppendMultiSzValue ( IN HKEY KeyHandle, - IN PWCHAR ValueName, - IN PWCHAR Strings, + IN PCHAR ValueName, + IN PCHAR Strings, IN SIZE_T StringSize) { SIZE_T Size; ULONG Type; size_t Total; - PWCHAR Buffer; - PWCHAR p; + PCHAR Buffer; + PCHAR p; size_t len; LONG Error;
- Error = RegQueryValueExW ( + Error = RegQueryValueExA ( KeyHandle, ValueName, NULL, @@ -117,11 +117,11 @@ (Type != REG_MULTI_SZ)) return;
- Buffer = malloc (Size + (StringSize * sizeof(WCHAR))); + Buffer = malloc (Size + StringSize); if (Buffer == NULL) return;
- Error = RegQueryValueExW ( + Error = RegQueryValueExA ( KeyHandle, ValueName, NULL, @@ -135,25 +135,25 @@ Total = Size; while (*Strings != 0) { - len = wcslen (Strings) + 1; - - for (p = Buffer; *p != 0; p += wcslen (p) + 1) - if (!_wcsicmp (p, Strings)) + len = strlen (Strings) + 1; + + for (p = Buffer; *p != 0; p += strlen (p) + 1) + if (!strcasecmp (p, Strings)) break;
if (*p == 0) /* not found, need to append it */ { - memcpy (p, Strings, len * sizeof(WCHAR)); + memcpy (p, Strings, len); p[len] = 0; - Total += len * sizeof(WCHAR); + Total += len; } Strings += len; }
if (Total != Size) { - DPRINT ("setting value %S to %S\n", ValueName, Buffer); - RegSetValueExW ( + DPRINT ("setting value %s to %s\n", ValueName, Buffer); + RegSetValueExA ( KeyHandle, ValueName, 0, @@ -175,11 +175,11 @@ static BOOL do_reg_operation( IN HKEY KeyHandle, - IN PWCHAR ValueName, + IN PCHAR ValueName, IN PINFCONTEXT Context, IN ULONG Flags) { - WCHAR EmptyStr = (WCHAR)0; + CHAR EmptyStr = (CHAR)0; ULONG Type; ULONG Size; LONG Error; @@ -188,11 +188,11 @@ { if (ValueName) { - RegDeleteValueW (KeyHandle, ValueName); - } - else - { - RegDeleteKeyW (KeyHandle, NULL); + RegDeleteValueA (KeyHandle, ValueName); + } + else + { + RegDeleteKeyA (KeyHandle, NULL); }
return TRUE; @@ -203,7 +203,7 @@
if (Flags & (FLG_ADDREG_NOCLOBBER | FLG_ADDREG_OVERWRITEONLY)) { - Error = RegQueryValueExW ( + Error = RegQueryValueExA ( KeyHandle, ValueName, NULL, @@ -253,7 +253,7 @@ if (!(Flags & FLG_ADDREG_BINVALUETYPE) || (Type == REG_DWORD && InfHostGetFieldCount (Context) == 5)) { - WCHAR *Str = NULL; + CHAR *Str = NULL;
if (Type == REG_MULTI_SZ) { @@ -262,7 +262,7 @@
if (Size) { - Str = malloc (Size * sizeof(WCHAR)); + Str = malloc (Size); if (Str == NULL) return FALSE;
@@ -292,7 +292,7 @@
if (Size) { - Str = malloc (Size * sizeof(WCHAR)); + Str = malloc (Size); if (Str == NULL) return FALSE;
@@ -302,11 +302,11 @@
if (Type == REG_DWORD) { - ULONG dw = Str ? wcstoul (Str, NULL, 0) : 0; - - DPRINT("setting dword %S to %x\n", ValueName, dw); - - RegSetValueExW ( + ULONG dw = Str ? strtoul (Str, NULL, 0) : 0; + + DPRINT("setting dword %s to %x\n", ValueName, dw); + + RegSetValueExA ( KeyHandle, ValueName, 0, @@ -316,27 +316,27 @@ } else { - DPRINT("setting value %S to %S\n", ValueName, Str); + DPRINT("setting value %s to %s\n", ValueName, Str);
if (Str) { - RegSetValueExW ( + RegSetValueExA ( KeyHandle, ValueName, 0, Type, (PVOID)Str, - (ULONG)Size * sizeof(WCHAR)); + (ULONG)Size); } else { - RegSetValueExW ( + RegSetValueExA ( KeyHandle, ValueName, 0, Type, (PVOID)&EmptyStr, - (ULONG)sizeof(WCHAR)); + (ULONG)sizeof(CHAR)); } } free (Str); @@ -354,11 +354,11 @@ if (Data == NULL) return FALSE;
- DPRINT("setting binary data %S len %d\n", ValueName, Size); + DPRINT("setting binary data %s len %d\n", ValueName, Size); InfHostGetBinaryField (Context, 5, Data, Size, NULL); }
- RegSetValueExW ( + RegSetValueExA ( KeyHandle, ValueName, 0, @@ -378,10 +378,10 @@ * Called once for each AddReg and DelReg entry in a given section. */ static BOOL -registry_callback (HINF hInf, PWCHAR Section, BOOL Delete) +registry_callback (HINF hInf, PCHAR Section, BOOL Delete) { - WCHAR Buffer[MAX_INF_STRING_LENGTH]; - PWCHAR ValuePtr; + CHAR Buffer[MAX_INF_STRING_LENGTH]; + PCHAR ValuePtr; ULONG Flags; size_t Length;
@@ -403,11 +403,11 @@ continue;
/* get key */ - Length = wcslen (Buffer); + Length = strlen (Buffer); if (InfHostGetStringField (Context, 2, Buffer + Length, MAX_INF_STRING_LENGTH - (ULONG)Length, NULL) != 0) *Buffer = 0;
- DPRINT("KeyName: <%S>\n", Buffer); + DPRINT("KeyName: <%s>\n", Buffer);
if (Delete) { @@ -424,17 +424,17 @@
if (Delete || (Flags & FLG_ADDREG_OVERWRITEONLY)) { - if (RegOpenKeyW (NULL, Buffer, &KeyHandle) != ERROR_SUCCESS) - { - DPRINT("RegOpenKey(%S) failed\n", Buffer); + if (RegOpenKeyA (NULL, Buffer, &KeyHandle) != ERROR_SUCCESS) + { + DPRINT("RegOpenKey(%s) failed\n", Buffer); continue; /* ignore if it doesn't exist */ } } else { - if (RegCreateKeyW (NULL, Buffer, &KeyHandle) != ERROR_SUCCESS) - { - DPRINT("RegCreateKey(%S) failed\n", Buffer); + if (RegCreateKeyA (NULL, Buffer, &KeyHandle) != ERROR_SUCCESS) + { + DPRINT("RegCreateKey(%s) failed\n", Buffer); continue; } } @@ -469,18 +469,18 @@ ULONG ErrorLine;
/* Load inf file from install media. */ - if (InfHostOpenFile(&hInf, FileName, 0, &ErrorLine) != 0) + if (InfHostOpenFile(&hInf, FileName, &ErrorLine) != 0) { DPRINT1 ("InfHostOpenFile(%s) failed\n", FileName); return FALSE; }
- if (!registry_callback (hInf, L"DelReg", TRUE)) + if (!registry_callback (hInf, "DelReg", TRUE)) { DPRINT1 ("registry_callback() for DelReg failed\n"); }
- if (!registry_callback (hInf, L"AddReg", FALSE)) + if (!registry_callback (hInf, "AddReg", FALSE)) { DPRINT1 ("registry_callback() for AddReg failed\n"); }
Modified: trunk/reactos/tools/mkhive/rtl.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/rtl.c?rev=4703... ============================================================================== --- trunk/reactos/tools/mkhive/rtl.c [iso-8859-1] (original) +++ trunk/reactos/tools/mkhive/rtl.c [iso-8859-1] Mon Apr 26 17:35:57 2010 @@ -207,32 +207,3 @@ } return Mask ? 1 : 0; } - -#undef tolower -WCHAR towlower(WCHAR ch) -{ - if (ch < L'A') - { - return ch; - } - else if (ch <= L'Z') - { - return ch + (L'a' - L'A'); - } - - return ch; -} - -int _wcsicmp(PCWSTR cs, PCWSTR ct) -{ - while (towlower(*cs) == towlower(*ct)) - { - if (*cs == 0) - return 0; - - cs++; - ct++; - } - - return towlower(*cs) - towlower(*ct); -}