@@ -107,7 +107,7 @@ extern "system" fn rpc_server_register_if_ex(
107107}
108108
109109type FnAiEnableDesktopRpcInterface = unsafe extern "system" fn ( ) -> RPC_STATUS ;
110- pub unsafe fn ai_enable_desktop_rpc_interface ( ) -> RPC_STATUS {
110+ pub fn ai_enable_desktop_rpc_interface ( ) -> RPC_STATUS {
111111 static FUN : OnceLock < FnAiEnableDesktopRpcInterface > = OnceLock :: new ( ) ;
112112
113113 let init = || {
@@ -116,16 +116,16 @@ pub unsafe fn ai_enable_desktop_rpc_interface() -> RPC_STATUS {
116116 . resolve_symbol ( "AiEnableDesktopRpcInterface" )
117117 . expect ( "failed to find AiEnableDesktopRpcInterface" ) ;
118118
119- // SAFETY: We assume appinfo.dll's AiEnableDesktopRpcInterface has decompiled signature.
119+ // SAFETY: We assume appinfo.dll's AiEnableDesktopRpcInterface has the correct decompiled signature.
120120 unsafe { mem:: transmute :: < _ , FnAiEnableDesktopRpcInterface > ( orig) }
121121 } ;
122122
123- // SAFETY: Calling the function pointer obtained from appinfo.dll.
123+ // SAFETY: Calling the dynamically loaded AiEnableDesktopRpcInterface function from appinfo.dll.
124124 unsafe { FUN . get_or_init ( init) ( ) }
125125}
126126
127127type FnAiDisableDesktopRpcInterface = unsafe extern "system" fn ( ) ;
128- pub unsafe fn ai_disable_desktop_rpc_interface ( ) {
128+ pub fn ai_disable_desktop_rpc_interface ( ) {
129129 static FUN : OnceLock < FnAiDisableDesktopRpcInterface > = OnceLock :: new ( ) ;
130130
131131 let init = || {
@@ -134,11 +134,11 @@ pub unsafe fn ai_disable_desktop_rpc_interface() {
134134 . resolve_symbol ( "AiDisableDesktopRpcInterface" )
135135 . expect ( "failed to find AiDisableDesktopRpcInterface" ) ;
136136
137- // SAFETY: We assume appinfo.dll's AiDisableDesktopRpcInterface has decompiled signature.
137+ // SAFETY: We assume appinfo.dll's AiDisableDesktopRpcInterface has the correct decompiled signature.
138138 unsafe { mem:: transmute :: < _ , FnAiDisableDesktopRpcInterface > ( orig) }
139139 } ;
140140
141- // SAFETY: Calling the function pointer obtained from appinfo.dll.
141+ // SAFETY: Calling the dynamically loaded AiDisableDesktopRpcInterface function from appinfo.dll.
142142 unsafe { FUN . get_or_init ( init) ( ) }
143143}
144144
@@ -150,16 +150,16 @@ pub fn dump_interfaces() -> Result<Box<[RpcServerInterfacePointer]>> {
150150 }
151151
152152 // SAFETY: Calling Windows API function to disable RPC interface.
153- unsafe { ai_disable_desktop_rpc_interface ( ) } ;
153+ ai_disable_desktop_rpc_interface ( ) ;
154154 // SAFETY: Enabling the hook to intercept RPC calls.
155155 if let Err ( err) = unsafe { rpc_server_register_if_ex_hook ( ) . enable ( ) } {
156156 // SAFETY: Calling Windows API function to enable RPC interface.
157- let _ = unsafe { ai_enable_desktop_rpc_interface ( ) } ;
157+ let _ = ai_enable_desktop_rpc_interface ( ) ;
158158 bail ! ( err) ;
159159 }
160160
161161 // SAFETY: Calling Windows API function to enable RPC interface.
162- let _ = unsafe { ai_enable_desktop_rpc_interface ( ) } ;
162+ let _ = ai_enable_desktop_rpc_interface ( ) ;
163163 // SAFETY: Disabling the hook after capturing interface information.
164164 if let Err ( err) = unsafe { rpc_server_register_if_ex_hook ( ) . disable ( ) } {
165165 bail ! ( err) ;
0 commit comments