REGRESSION: environment variables no longer possible

Dmitry Timoshkov dmitry at baikal.ru
Tue Aug 19 06:10:41 CDT 2003


"Marcus Meissner" <meissner at suse.de> wrote:

> Apparently the changes from yesterday removed support of environment variables
> in registry keys (very useful for the "Path" keys in the "Drive" sections).
> 
> Can it be readded? Or is there a rational behind it?

Actually it's just the format of the Wine config has changed. Now all
environment variables should be surrounded by the percent signes (%HOME%),
and are handled by the normal registry code. Alexandre has changed the sample
config as well.

Attached patch is rather useless, but however it makes the old profile
code be consistent with the new behaviour. A better approach is to
completely remove environment handling from profile.c.

Changelog:
    Adopt profile functions to the recent change.

-- 
Dmitry.


-------------- next part --------------
--- cvs/hq/wine/files/profile.c	Tue Aug 19 19:02:59 2003
+++ wine/files/profile.c	Tue Aug 19 19:56:19 2003
@@ -130,14 +130,14 @@ static void PROFILE_CopyEntry( LPWSTR bu
     p = value;
     while (*p && (len > 1))
     {
-        if ((*p == '$') && (p[1] == '{'))
+        if (*p == '%')
         {
             WCHAR env_val[1024];
-            LPCWSTR p2 = strchrW( p, '}' );
+            LPCWSTR p2 = strchrW( p + 1, '%' );
             int copy_len;
             if (!p2) continue;  /* ignore it */
-            copy_len = min( 1024, (int)(p2-p)-1 );
-            strncpyW(env_val, p + 2, copy_len );
+            copy_len = min( 1024, p2 - p );
+            strncpyW(env_val, p + 1, copy_len - 1);
             env_val[copy_len - 1] = 0; /* ensure 0 termination */
             *buffer = 0;
             if (GetEnvironmentVariableW( env_val, buffer, len))


More information about the wine-patches mailing list