[ros-diffs] [gedmurphy] 30235: only write out key/values in the lpSettings struct

gedmurphy at svn.reactos.org gedmurphy at svn.reactos.org
Wed Nov 7 01:10:25 CET 2007


Author: gedmurphy
Date: Wed Nov  7 03:10:24 2007
New Revision: 30235

URL: http://svn.reactos.org/svn/reactos?rev=30235&view=rev
Log:
only write out key/values in the lpSettings struct

Modified:
    trunk/reactos/base/applications/mstsc/rdpfile.c

Modified: trunk/reactos/base/applications/mstsc/rdpfile.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/rdpfile.c?rev=30235&r1=30234&r2=30235&view=diff
==============================================================================
--- trunk/reactos/base/applications/mstsc/rdpfile.c (original)
+++ trunk/reactos/base/applications/mstsc/rdpfile.c Wed Nov  7 03:10:24 2007
@@ -79,32 +79,39 @@
     WCHAR line[MAXKEY + MAXVALUE + 4];
     DWORD BytesToWrite, BytesWritten;
     BOOL bRet;
-    INT i;
+    INT i, k;
 
     for (i = 0; i < pRdpSettings->NumSettings; i++)
     {
-        if (pRdpSettings->pSettings[i].Type == L'i')
-        {
-            _snwprintf(line, MAXKEY + MAXVALUE + 4, L"%s:i:%d\r\n",
-                       pRdpSettings->pSettings[i].Key,
-                       pRdpSettings->pSettings[i].Value.i);
-        }
-        else
-        {
-            _snwprintf(line, MAXKEY + MAXVALUE + 4, L"%s:s:%s\r\n",
-                       pRdpSettings->pSettings[i].Key,
-                       pRdpSettings->pSettings[i].Value.s);
-        }
-
-        BytesToWrite = wcslen(line) * sizeof(WCHAR);
-
-        bRet = WriteFile(hFile,
-                          line,
-                          BytesToWrite,
-                          &BytesWritten,
-                          NULL);
-        if (!bRet || BytesWritten == 0)
-            return FALSE;
+        /* only write out values in the lpSettings struct */
+        for (k = 0; k < NUM_SETTINGS; k++)
+        {
+            if (wcscmp(lpSettings[k], pRdpSettings->pSettings[i].Key) == 0)
+            {
+                if (pRdpSettings->pSettings[i].Type == L'i')
+                {
+                    _snwprintf(line, MAXKEY + MAXVALUE + 4, L"%s:i:%d\r\n",
+                               pRdpSettings->pSettings[i].Key,
+                               pRdpSettings->pSettings[i].Value.i);
+                }
+                else
+                {
+                    _snwprintf(line, MAXKEY + MAXVALUE + 4, L"%s:s:%s\r\n",
+                               pRdpSettings->pSettings[i].Key,
+                               pRdpSettings->pSettings[i].Value.s);
+                }
+
+                BytesToWrite = wcslen(line) * sizeof(WCHAR);
+
+                bRet = WriteFile(hFile,
+                                 line,
+                                 BytesToWrite,
+                                 &BytesWritten,
+                                 NULL);
+                if (!bRet || BytesWritten == 0)
+                    return FALSE;
+            }
+        }
     }
 
     return TRUE;




More information about the Ros-diffs mailing list