[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ros-diffs
Subject:    [ros-diffs] [weiden] 19782: fixed call to
From:       <weiden () svn ! reactos ! com>
Date:       2005-11-30 18:26:56
Message-ID: 000001c5f5db$a4e15180$6b01a8c0 () PENELOPE
[Download RAW message or body]

fixed call to SetupDiGetClassDevPropertySheets
Modified: trunk/reactos/lib/devmgr/advprop.c
  _____  

Modified: trunk/reactos/lib/devmgr/advprop.c
--- trunk/reactos/lib/devmgr/advprop.c	2005-11-30 17:28:42 UTC (rev
19781)
+++ trunk/reactos/lib/devmgr/advprop.c	2005-11-30 18:26:43 UTC (rev
19782)
@@ -169,23 +169,12 @@

     PROPSHEETHEADER psh = {0};
     PROPSHEETPAGE pspGeneral = {0};
     DWORD nPropSheets = 0;
-    DWORD nDevSheetsStart = 0;
     PPROPERTYSHEETW pPropertySheetW;
     PCREATEPROPERTYSHEETPAGEW pCreatePropertySheetPageW;
     PDESTROYPROPERTYSHEETPAGE pDestroyPropertySheetPage;
     PDEVADVPROP_INFO DevAdvPropInfo;
     DWORD PropertySheetType;
     HANDLE hMachine = NULL;
-    UINT nPages = 0;
-    union
-    {
-        ULONG Mask;
-        struct
-        {
-            ULONG General : 1;
-            ULONG Device : 1;
-        } Page;
-    } DelPropSheets = {0};
     INT_PTR Ret = -1;
 
     /* we don't want to statically link against comctl32, so find the
@@ -283,60 +272,44 @@
         psh.phpage[0] = pCreatePropertySheetPageW(&pspGeneral);
         if (psh.phpage[0] != NULL)
         {
-            DelPropSheets.Page.General = TRUE;
-            nDevSheetsStart++;
-            nPages++;
+            psh.nPages++;
         }
 
         if (nPropSheets != 0)
         {
-            /* create the device property sheets but don't overwrite
-               the "General" property sheet handle */
-            psh.phpage += nDevSheetsStart;
+            /* create the device property sheets */
             if (!SetupDiGetClassDevPropertySheets(DeviceInfoSet,
                                                   DeviceInfoData,
                                                   &psh,
-                                                  nPropSheets,
+                                                  nPropSheets +
psh.nPages,
                                                   NULL,
                                                   PropertySheetType))
             {
                 goto Cleanup;
             }
-            psh.phpage -= nDevSheetsStart;
-
-            DelPropSheets.Page.Device = TRUE;
-            nPages += nPropSheets;
         }
 
-        psh.nPages = nPages;
-
         /* FIXME - add the "Driver" property sheet if necessary */
 
-        Ret = pPropertySheetW(&psh);
+        if (psh.nPages != 0)
+        {
+            Ret = pPropertySheetW(&psh);
 
-        /* no need to destroy the property sheets anymore */
-        DelPropSheets.Mask = 0;
+            /* NOTE: no need to destroy the property sheets anymore! */
+        }
+        else
+        {
+            UINT i;
 
 Cleanup:
-        /* in case of failure the property sheets must be destroyed */
-        if (DelPropSheets.Mask != 0)
-        {
-            if (DelPropSheets.Page.General && psh.phpage[0] != NULL)
+            /* in case of failure the property sheets must be destroyed
*/
+            for (i = 0;
+                 i < psh.nPages;
+                 i++)
             {
-                pDestroyPropertySheetPage(psh.phpage[0]);
-            }
-
-            if (DelPropSheets.Page.Device)
-            {
-                UINT i;
-                for (i = 0;
-                     i < nPropSheets;
-                     i++)
+                if (psh.phpage[i] != NULL)
                 {
-                    if (psh.phpage[i + 1] != NULL)
-                    {
-                        pDestroyPropertySheetPage(psh.phpage[i + 1]);
-                    }
+                    pDestroyPropertySheetPage(psh.phpage[i]);
                 }
             }
         }

[Attachment #3 (text/html)]

<html>
<head>
<style>
<!--
body { background-color:#ffffff }
.file { border:1px solid #eeeeee; margin-top:1em; margin-bottom:1em }
.pathname { font-family:monospace; float:right }
.fileheader { margin-bottom:.5em }
.diff { margin:0 }
.tasklist { padding:4px; border:1px dashed #000000; margin-top:1em }
.tasklist ul { margin-top:0; margin-bottom:0 }
tr.alt { background-color:#eeeeee }
#added { background-color:#ddffdd }
#addedchars { background-color:#99ff99; font-weight:bolder }
tr.alt #added { background-color:#ccf7cc }
#removed { background-color:#ffdddd }
#removedchars { background-color:#ff9999; font-weight:bolder }
tr.alt #removed { background-color:#f7cccc }
#info { color:#888888 }
#context { background-color:#eeeeee }
td {padding-left:.3em; padding-right:.3em }
tr.head { border-bottom-width:1px; border-bottom-style:solid }
tr.head td { padding:0; padding-top:.2em }
.task { background-color:#ffff00 }
.comment { padding:4px; border:1px dashed #000000; background-color:#ffffdd }
.error { color:red }
hr { border-width:0px; height:2px; background:black }
-->
</style>
</head>
<body>
<pre class="comment">fixed call to SetupDiGetClassDevPropertySheets</pre><pre \
class="diff" id="context">Modified: trunk/reactos/lib/devmgr/advprop.c </pre><hr \
/><div class="file"> <div class="fileheader"><big><b>Modified: \
trunk/reactos/lib/devmgr/advprop.c</b></big></div> <pre class="diff"><small \
                id="info">--- trunk/reactos/lib/devmgr/advprop.c	2005-11-30 17:28:42 \
                UTC (rev 19781)
+++ trunk/reactos/lib/devmgr/advprop.c	2005-11-30 18:26:43 UTC (rev 19782)
@@ -169,23 +169,12 @@
</small></pre><pre class="diff" id="context"> &nbsp; &nbsp; PROPSHEETHEADER psh = \
{0};  &nbsp; &nbsp; PROPSHEETPAGE pspGeneral = {0};
 &nbsp; &nbsp; DWORD nPropSheets = 0;
</pre><pre class="diff" id="removed">- &nbsp; &nbsp;DWORD nDevSheetsStart = 0;
</pre><pre class="diff" id="context"> &nbsp; &nbsp; PPROPERTYSHEETW pPropertySheetW;
 &nbsp; &nbsp; PCREATEPROPERTYSHEETPAGEW pCreatePropertySheetPageW;
 &nbsp; &nbsp; PDESTROYPROPERTYSHEETPAGE pDestroyPropertySheetPage;
 &nbsp; &nbsp; PDEVADVPROP_INFO DevAdvPropInfo;
 &nbsp; &nbsp; DWORD PropertySheetType;
 &nbsp; &nbsp; HANDLE hMachine = NULL;
</pre><pre class="diff" id="removed">- &nbsp; &nbsp;UINT nPages = 0;
- &nbsp; &nbsp;union
- &nbsp; &nbsp;{
- &nbsp; &nbsp; &nbsp; &nbsp;ULONG Mask;
- &nbsp; &nbsp; &nbsp; &nbsp;struct
- &nbsp; &nbsp; &nbsp; &nbsp;{
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ULONG General : 1;
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ULONG Device : 1;
- &nbsp; &nbsp; &nbsp; &nbsp;} Page;
- &nbsp; &nbsp;} DelPropSheets = {0};
</pre><pre class="diff" id="context"> &nbsp; &nbsp; INT_PTR Ret = -1;
 
 &nbsp; &nbsp; /* we don't want to statically link against comctl32, so find the
@@ -283,60 +272,44 @@
</pre><pre class="diff" id="context"> &nbsp; &nbsp; &nbsp; &nbsp; psh.phpage[0] = \
pCreatePropertySheetPageW(&amp;pspGeneral);  &nbsp; &nbsp; &nbsp; &nbsp; if \
(psh.phpage[0] != NULL)  &nbsp; &nbsp; &nbsp; &nbsp; {
</pre><pre class="diff" id="removed">- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
                &nbsp;DelPropSheets.Page.General = TRUE;
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nDevSheetsStart++;
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nPages++;
</pre><pre class="diff" id="added">+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span \
id="addedchars">psh.</span>nPages++; </pre><pre class="diff" id="context"> &nbsp; \
&nbsp; &nbsp; &nbsp; }  
 &nbsp; &nbsp; &nbsp; &nbsp; if (nPropSheets != 0)
 &nbsp; &nbsp; &nbsp; &nbsp; {
</pre><pre class="diff" id="removed">- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/* \
                create the device property sheets but don't overwrite
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; the &quot;General&quot; property \
                sheet handle */
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span id="removedchars">psh.phpage += \
nDevSheetsStart;</span> </pre><pre class="diff" id="added">+ &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp;<span id="addedchars">/* create the device property sheets \
*/</span> </pre><pre class="diff" id="context"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; if (!SetupDiGetClassDevPropertySheets(DeviceInfoSet,  &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DeviceInfoData, \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &amp;psh, </pre><pre class="diff" id="removed">- &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nPropSheets, </pre><pre \
class="diff" id="added">+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nPropSheets<span id="addedchars"> + \
psh.nPages</span>, </pre><pre class="diff" id="context"> &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NULL,  &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
PropertySheetType))  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; goto Cleanup;
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
</pre><pre class="diff" id="removed">- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
                &nbsp;psh.phpage -= nDevSheetsStart;
-
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DelPropSheets.Page.Device = TRUE;
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nPages += nPropSheets;
</pre><pre class="diff" id="context"> &nbsp; &nbsp; &nbsp; &nbsp; }
 
</pre><pre class="diff" id="removed">- &nbsp; &nbsp; &nbsp; &nbsp;psh.nPages = \
                nPages;
-
</pre><pre class="diff" id="context"> &nbsp; &nbsp; &nbsp; &nbsp; /* FIXME - add the \
&quot;Driver&quot; property sheet if necessary */  
</pre><pre class="diff" id="removed">- &nbsp; &nbsp; &nbsp; &nbsp;<span \
id="removedchars">Ret = pPropertySheetW(&amp;psh);</span> </pre><pre class="diff" \
id="added">+ &nbsp; &nbsp; &nbsp; &nbsp;<span id="addedchars">if (psh.nPages != \
0)</span> + &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Ret = pPropertySheetW(&amp;psh);
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">- &nbsp; &nbsp; &nbsp; &nbsp;/* no need to \
                destroy the property sheets anymore */
- &nbsp; &nbsp; &nbsp; &nbsp;<span id="removedchars">DelPropSheets.Mask = 0;</span>
</pre><pre class="diff" id="added">+ &nbsp; &nbsp; &nbsp; &nbsp;<span \
id="addedchars"> &nbsp; &nbsp;/* NOTE: no need to destroy the property sheets \
anymore! */</span> + &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;else
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;UINT i;
</pre><pre class="diff" id="context"> 
 Cleanup:
</pre><pre class="diff" id="removed">- &nbsp; &nbsp; &nbsp; &nbsp;/* in case of \
                failure the property sheets must be destroyed */
- &nbsp; &nbsp; &nbsp; &nbsp;if (DelPropSheets.Mask != 0)
- &nbsp; &nbsp; &nbsp; &nbsp;{
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span id="removedchars">if \
(DelPropSheets.Page.General &amp;&amp; psh.phpage[0] != NULL)</span> </pre><pre \
class="diff" id="added">+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span \
id="addedchars">/* in case of failure the property sheets must be destroyed */</span> \
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (i = 0; + &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; i &lt; psh.nPages; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; i++) </pre><pre class="diff" id="context"> &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; { </pre><pre class="diff" id="removed">- &nbsp; &nbsp; &nbsp; \
                &nbsp; &nbsp; &nbsp; &nbsp; \
                &nbsp;pDestroyPropertySheetPage(psh.phpage[0]);
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
-
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (DelPropSheets.Page.Device)
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;UINT i;
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (i = 0;
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i &lt; \
                nPropSheets;
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span id="removedchars"> \
&nbsp; &nbsp; i++</span>) </pre><pre class="diff" id="added">+ &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span id="addedchars">if (psh.phpage[i] != \
NULL</span>) </pre><pre class="diff" id="context"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; { </pre><pre class="diff" id="removed">- &nbsp; &nbsp; &nbsp; \
                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (psh.phpage[i + 1] \
                != NULL)
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
                &nbsp;pDestroyPropertySheetPage(psh.phpage[i + 1]);
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span \
id="removedchars">}</span> </pre><pre class="diff" id="added">+ &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span \
id="addedchars">pDestroyPropertySheetPage(psh.phpage[i]);</span> </pre><pre \
class="diff" id="context"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }  \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }  &nbsp; &nbsp; &nbsp; &nbsp; }
</pre>
</div>

</body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic