@@ -45,19 +45,18 @@ DSAcquireParams(
4545
4646 DPRINT1 ("DSAcquireParams()\n" );
4747
48+ Reply .Reply = ERROR_SUCCESS ;
49+
4850 ApiLock ();
4951
5052 Adapter = AdapterFindName (Req -> Body .AcquireParams .AdapterName );
51- DPRINT1 ("Adapter: %p\n" , Adapter );
52-
5353 if (Adapter == NULL || Adapter -> DhclientState .state == S_STATIC )
5454 {
55- Reply .Reply = 0 ;
56- ApiUnlock ();
57- return Send (CommPipe , & Reply );
55+ Reply .Reply = ERROR_FILE_NOT_FOUND ;
56+ goto done ;
5857 }
5958
60- Reply . Reply = 1 ;
59+ DPRINT1 ( "Adapter: %p\n" , Adapter ) ;
6160
6261 proto = find_protocol_by_adapter (& Adapter -> DhclientInfo );
6362 if (proto )
@@ -73,6 +72,7 @@ DSAcquireParams(
7372 if (hAdapterStateChangedEvent != NULL )
7473 SetEvent (hAdapterStateChangedEvent );
7574
75+ done :
7676 ApiUnlock ();
7777
7878 return Send (CommPipe , & Reply );
@@ -91,37 +91,41 @@ DSReleaseParams(
9191
9292 DPRINT1 ("DSReleaseParams()\n" );
9393
94+ Reply .Reply = ERROR_SUCCESS ;
95+
9496 ApiLock ();
9597
9698 Adapter = AdapterFindName (Req -> Body .AcquireParams .AdapterName );
97- DPRINT1 ("Adapter: %p\n" , Adapter );
99+ if (Adapter == NULL )
100+ {
101+ Reply .Reply = ERROR_FILE_NOT_FOUND ;
102+ goto done ;
103+ }
98104
99- Reply . Reply = Adapter ? 1 : 0 ;
105+ DPRINT1 ( " Adapter: %p\n" , Adapter ) ;
100106
101- if (Adapter )
107+ if (Adapter -> NteContext )
102108 {
103- if (Adapter -> NteContext )
104- {
105- DeleteIPAddress (Adapter -> NteContext );
106- Adapter -> NteContext = 0 ;
107- }
108- if (Adapter -> RouterMib .dwForwardNextHop )
109- {
110- DeleteIpForwardEntry (& Adapter -> RouterMib );
111- Adapter -> RouterMib .dwForwardNextHop = 0 ;
112- }
109+ DeleteIPAddress (Adapter -> NteContext );
110+ Adapter -> NteContext = 0 ;
111+ }
112+ if (Adapter -> RouterMib .dwForwardNextHop )
113+ {
114+ DeleteIpForwardEntry (& Adapter -> RouterMib );
115+ Adapter -> RouterMib .dwForwardNextHop = 0 ;
116+ }
113117
114- proto = find_protocol_by_adapter (& Adapter -> DhclientInfo );
115- if (proto )
116- remove_protocol (proto );
118+ proto = find_protocol_by_adapter (& Adapter -> DhclientInfo );
119+ if (proto )
120+ remove_protocol (proto );
117121
118- Adapter -> DhclientInfo .client -> active = NULL ;
119- Adapter -> DhclientInfo .client -> state = S_INIT ;
122+ Adapter -> DhclientInfo .client -> active = NULL ;
123+ Adapter -> DhclientInfo .client -> state = S_INIT ;
120124
121- if (hAdapterStateChangedEvent != NULL )
122- SetEvent (hAdapterStateChangedEvent );
123- }
125+ if (hAdapterStateChangedEvent != NULL )
126+ SetEvent (hAdapterStateChangedEvent );
124127
128+ done :
125129 ApiUnlock ();
126130
127131 return Send (CommPipe , & Reply );
0 commit comments