Author: cwittich
Date: Fri Apr 17 20:40:31 2009
New Revision: 40559
URL:
http://svn.reactos.org/svn/reactos?rev=40559&view=rev
Log:
revert 40488 as it breaks regsvr32
Modified:
trunk/reactos/dll/win32/kernel32/misc/profile.c
Modified: trunk/reactos/dll/win32/kernel32/misc/profile.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/pr…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/profile.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/profile.c [iso-8859-1] Fri Apr 17 20:40:31 2009
@@ -213,30 +213,29 @@
for ( ; section; section = section->next)
{
- int len = 4;
-
- if (section->name[0]) len += wcslen(section->name);
+ int len = 0;
+
+ if (section->name[0]) len += wcslen(section->name) + 4;
for (key = section->key; key; key = key->next)
{
- len += wcslen(key->name);
- if (key->value && key->value[0]) len += wcslen(key->value);
- len += 3; /* '=' and "\r\n" */
+ len += wcslen(key->name) + 2;
+ if (key->value) len += wcslen(key->value) + 1;
}
buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (!buffer) return;
p = buffer;
- *p++ = '[';
if (section->name[0])
{
+ *p++ = '[';
wcscpy( p, section->name );
p += wcslen(p);
- }
- *p++ = ']';
- *p++ = '\r';
- *p++ = '\n';
+ *p++ = ']';
+ *p++ = '\r';
+ *p++ = '\n';
+ }
for (key = section->key; key; key = key->next)
{