[runtime] Use coop handles for System.Environment.internalBroadcastSettingChange
authorAleksey Kliger <aleksey@xamarin.com>
Wed, 3 May 2017 15:17:35 +0000 (11:17 -0400)
committerAleksey Kliger <aleksey@xamarin.com>
Wed, 10 May 2017 15:14:00 +0000 (11:14 -0400)
mono/metadata/icall-def.h
mono/metadata/icall-internals.h
mono/metadata/icall-windows-uwp.c
mono/metadata/icall-windows.c
mono/metadata/icall.c

index 242fb35d7f50a2bcb54ab485b8db4cd0cf09d9e9..19a6ef5590c78db3a28e856ac02ea0eade25c320 100644 (file)
@@ -281,7 +281,7 @@ ICALL(ENV_14, "get_ProcessorCount", mono_cpu_count)
 ICALL(ENV_15, "get_TickCount", ves_icall_System_Environment_get_TickCount)
 HANDLES(ICALL(ENV_16, "get_UserName", ves_icall_System_Environment_get_UserName))
 HANDLES(ICALL(ENV_16b, "get_bundled_machine_config", ves_icall_System_Environment_get_bundled_machine_config))
-ICALL(ENV_16m, "internalBroadcastSettingChange", ves_icall_System_Environment_BroadcastSettingChange)
+HANDLES(ICALL(ENV_16m, "internalBroadcastSettingChange", ves_icall_System_Environment_BroadcastSettingChange))
 HANDLES(ICALL(ENV_17, "internalGetEnvironmentVariable_native", ves_icall_System_Environment_GetEnvironmentVariable_native))
 HANDLES(ICALL(ENV_18, "internalGetGacPath", ves_icall_System_Environment_GetGacPath))
 HANDLES(ICALL(ENV_19, "internalGetHome", ves_icall_System_Environment_InternalGetHome))
index 60cca8316b0ae31da8f794ecc075c71558cdae13..c172b8404bcbf9d646418553d29c3281ee6b9b5a 100644 (file)
@@ -44,8 +44,8 @@ mono_icall_set_environment_variable (MonoString *name, MonoString *value);
 MonoStringHandle
 mono_icall_get_windows_folder_path (int folder, MonoError *error);
 
-void
-mono_icall_broadcast_setting_change (void);
+MonoBoolean
+mono_icall_broadcast_setting_change (MonoError *error);
 
 void
 mono_icall_write_windows_debug_string (MonoString *message);
index 2708e90e26e5b2d2faa2c0f53e1606de13f66efe..918510b1c7b9d66a741a1e798f0ba871b733505c 100644 (file)
@@ -44,20 +44,18 @@ mono_icall_get_logical_drives (void)
        return NULL;
 }
 
-void
-mono_icall_broadcast_setting_change (void)
+MonoBoolean
+mono_icall_broadcast_setting_change (MonoError *error)
 {
-       MonoError mono_error;
-       error_init (&mono_error);
+       error_init (error);
 
        g_unsupported_api ("SendMessageTimeout");
 
-       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "SendMessageTimeout");
-       mono_error_set_pending_exception (&mono_error);
+       mono_error_set_not_supported (error, G_UNSUPPORTED_API, "SendMessageTimeout");
 
        SetLastError (ERROR_NOT_SUPPORTED);
 
-       return;
+       return is_ok (error);
 }
 
 guint32
index 21a759157c08641bc2d5cfdcac05f8ebd6c738ca..691d1b03b30fa50e3a3c62a02fd439eebe195e96 100644 (file)
@@ -197,10 +197,12 @@ mono_icall_get_windows_folder_path (int folder, MonoError *error)
 #endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
 
 #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-void
-mono_icall_broadcast_setting_change (void)
+MonoBoolean
+mono_icall_broadcast_setting_change (MonoError *error)
 {
+       error_init (error);
        SendMessageTimeout (HWND_BROADCAST, WM_SETTINGCHANGE, (WPARAM)NULL, (LPARAM)L"Environment", SMTO_ABORTIFHUNG, 2000, 0);
+       return TRUE;
 }
 
 gint32
index 33376d734921926e39e1d9b1611ccb1bea606cd8..fad74732cf483c9b49a1fb0f7e403f2c84d9a928 100644 (file)
@@ -6885,17 +6885,19 @@ ves_icall_System_Environment_get_HasShutdownStarted (void)
 }
 
 #ifndef HOST_WIN32
-static inline void
-mono_icall_broadcast_setting_change (void)
+static inline MonoBoolean
+mono_icall_broadcast_setting_change (MonoError *error)
 {
-       return;
+       error_init (error);
+       return TRUE;
 }
 #endif /* !HOST_WIN32 */
 
 ICALL_EXPORT void
-ves_icall_System_Environment_BroadcastSettingChange (void)
+ves_icall_System_Environment_BroadcastSettingChange (MonoError *error)
 {
-       mono_icall_broadcast_setting_change ();
+       error_init (error);
+       mono_icall_broadcast_setting_change (error);
 }
 
 ICALL_EXPORT