@@ -221,18 +221,6 @@ pub fn get_service(input: &WindowsService) -> Result<WindowsService, ServiceErro
221221
222222 let svc = unsafe { read_service_state ( service_handle. 0 , & service_key_name) } ?;
223223
224- // If both name and display_name were provided, verify they match
225- if input. name . is_some ( ) && let Some ( expected_dn) = input. display_name . as_ref ( ) {
226- // let expected_dn = input.display_name.as_ref().unwrap();
227- let actual_dn = svc. display_name . as_deref ( ) . unwrap_or ( "" ) ;
228- if !actual_dn. eq_ignore_ascii_case ( expected_dn) {
229- return Err (
230- t ! ( "get.displayNameMismatch" , expected = expected_dn, actual = actual_dn)
231- . to_string ( )
232- . into ( ) ,
233- ) ;
234- }
235- }
236224
237225 Ok ( svc)
238226}
@@ -966,11 +954,8 @@ fn matches_filter(service: &WindowsService, filter: &WindowsService) -> bool {
966954/// that would be applied. If the service does not exist, returns the desired
967955/// state with a single `whatIf` entry describing the failure to open it.
968956fn what_if_set ( input : & WindowsService , name : & str ) -> Result < WindowsService , ServiceError > {
969- // Look up the current state using only the service key name. Forwarding
970- // the entire `input` here would cause `get_service` to verify any desired
971- // `displayName` against the live service and surface a `displayNameMismatch`
972- // error — which would defeat what-if for any change that targets the
973- // display name.
957+ // Look up the current state using only the service key name; we want the
958+ // live values to compare against, not a re-validation of the desired ones.
974959 let lookup = WindowsService {
975960 name : Some ( name. to_string ( ) ) ,
976961 ..Default :: default ( )
0 commit comments