+ if (*p++ == '=')
+ {
+ while (*p == ' ') p++;
+ len = strlenW( p );
+ while (len && p[len - 1] == ' ') len--;
+
+ if (!(cookie->value = heap_alloc( (len + 1) * sizeof(WCHAR) )))
+ {
+ free_cookie( cookie );
+ return NULL;
+ }
+ memcpy( cookie->value, p, len * sizeof(WCHAR) );
+ cookie->value[len] = 0;
+ }
+ return cookie;
+}
+
+struct attr
+{
+ WCHAR *name;
+ WCHAR *value;
+};
+
+static void free_attr( struct attr *attr )
+{
+ if (!attr) return;
+ heap_free( attr->name );
+ heap_free( attr->value );
+ heap_free( attr );
+}
+
+static struct attr *parse_attr( const WCHAR *str, int *used )
+{
+ const WCHAR *p = str, *q;
+ struct attr *attr;
+ int len;
+