From ddc7371f1d909f206e447a5ca16ad9aaeccb647d Mon Sep 17 00:00:00 2001 From: Halil Durmus Date: Sun, 24 Mar 2024 03:16:10 +0300 Subject: [PATCH] Deprecate `WBEM_TIMEOUT_TYPE` (#833) --- CHANGELOG.md | 9 ++++++--- example/wmi_wql.dart | 3 +-- lib/fix_data/fix_win32/fix_constants.yaml | 24 +++++++++++++++++++++++ lib/src/constants_nodoc.dart | 7 +++++++ test_fixes/win32/constants.dart | 2 ++ test_fixes/win32/constants.dart.expect | 2 ++ 6 files changed, 42 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 565d54d56..907da8222 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,14 @@ - Fix constant values `ERROR_SERVICE_NOT_ACTIVE`, `KF_FLAG_ALIAS_ONLY`, `QS_INPUT`, `STD_INPUT_HANDLE`, `STD_OUTPUT_HANDLE`, `STD_ERROR_HANDLE`, - `UIA_ItemTypePropertyId`, and `UIA_OrientationPropertyId` (#XXX) -- Introduce Win32 enumerations as extension types based on `int` (#XXX) + `UIA_ItemTypePropertyId`, and `UIA_OrientationPropertyId` (#832) +- Introduce Win32 enumerations as extension types based on `int` (#832) - Deprecate constants for the Win32 enumerations in favor of the newly introduced extension types. For example, replace the usage of `ERROR_SUCCESS` - with `WIN32_ERROR.ERROR_SUCCESS` (#XXX) + with `WIN32_ERROR.ERROR_SUCCESS` (#832) +- Deprecate constant values `WBEM_TIMEOUT_TYPE.WBEM_NO_WAIT` and + `WBEM_TIMEOUT_TYPE.WBEM_INFINITE` in favor of the newly introduced constants + `WBEM_NO_WAIT` and `WBEM_INFINITE` (#833) You can automatically migrate your code to use the new constants by running `dart fix --apply` in your terminal. diff --git a/example/wmi_wql.dart b/example/wmi_wql.dart index 0aa32f654..950b93e65 100644 --- a/example/wmi_wql.dart +++ b/example/wmi_wql.dart @@ -133,8 +133,7 @@ void main() { while (enumerator.ptr.address > 0) { final pClsObj = calloc(); - hr = enumerator.next( - WBEM_TIMEOUT_TYPE.WBEM_INFINITE, 1, pClsObj.cast(), uReturn); + hr = enumerator.next(WBEM_INFINITE, 1, pClsObj.cast(), uReturn); // Break out of the while loop if we've run out of processes to inspect if (uReturn.value == 0) break; diff --git a/lib/fix_data/fix_win32/fix_constants.yaml b/lib/fix_data/fix_win32/fix_constants.yaml index 60332cae4..73016a62f 100644 --- a/lib/fix_data/fix_win32/fix_constants.yaml +++ b/lib/fix_data/fix_win32/fix_constants.yaml @@ -26732,3 +26732,27 @@ transforms: uris: ['package:win32/win32.dart'] field: 'LIST_MODULES_DEFAULT' inClass: 'ENUM_PROCESS_MODULES_EX_FLAGS' + + - title: "Migrate to 'WBEM_NO_WAIT'" + date: 2024-03-23 + element: + uris: ['package:win32/win32.dart'] + field: 'WBEM_NO_WAIT' + inClass: 'WBEM_TIMEOUT_TYPE' + changes: + - kind: 'replacedBy' + newElement: + uris: ['package:win32/win32.dart'] + variable: 'WBEM_NO_WAIT' + + - title: "Migrate to 'WBEM_INFINITE'" + date: 2024-03-23 + element: + uris: ['package:win32/win32.dart'] + field: 'WBEM_INFINITE' + inClass: 'WBEM_TIMEOUT_TYPE' + changes: + - kind: 'replacedBy' + newElement: + uris: ['package:win32/win32.dart'] + variable: 'WBEM_INFINITE' diff --git a/lib/src/constants_nodoc.dart b/lib/src/constants_nodoc.dart index dbf1d9412..832d360d5 100644 --- a/lib/src/constants_nodoc.dart +++ b/lib/src/constants_nodoc.dart @@ -3731,11 +3731,18 @@ class WBEM_REFRESHER_FLAGS { } /// {@category enum} +@Deprecated('No replacement') class WBEM_TIMEOUT_TYPE { + @Deprecated('Use WBEM_NO_WAIT instead') static const WBEM_NO_WAIT = 0; + + @Deprecated('Use WBEM_INFINITE instead') static const WBEM_INFINITE = 0xffffffff; } +const WBEM_NO_WAIT = 0; +const WBEM_INFINITE = 0xffffffff; + /// {@category enum} class NLM_CONNECTIVITY { static const NLM_CONNECTIVITY_DISCONNECTED = 0; diff --git a/test_fixes/win32/constants.dart b/test_fixes/win32/constants.dart index e1bea78c6..f08883b2e 100644 --- a/test_fixes/win32/constants.dart +++ b/test_fixes/win32/constants.dart @@ -2227,3 +2227,5 @@ const $2219 = CORRECTIVE_ACTION.NONE; const $2220 = CORRECTIVE_ACTION.GET_SUGGESTIONS; const $2221 = CORRECTIVE_ACTION.REPLACE; const $2222 = CORRECTIVE_ACTION.DELETE; +const $2223 = WBEM_TIMEOUT_TYPE.WBEM_NO_WAIT; +const $2224 = WBEM_TIMEOUT_TYPE.WBEM_INFINITE; diff --git a/test_fixes/win32/constants.dart.expect b/test_fixes/win32/constants.dart.expect index 29845b3de..326c62c59 100644 --- a/test_fixes/win32/constants.dart.expect +++ b/test_fixes/win32/constants.dart.expect @@ -2227,3 +2227,5 @@ const $2219 = CORRECTIVE_ACTION.CORRECTIVE_ACTION_NONE; const $2220 = CORRECTIVE_ACTION.CORRECTIVE_ACTION_GET_SUGGESTIONS; const $2221 = CORRECTIVE_ACTION.CORRECTIVE_ACTION_REPLACE; const $2222 = CORRECTIVE_ACTION.CORRECTIVE_ACTION_DELETE; +const $2223 = WBEM_NO_WAIT; +const $2224 = WBEM_INFINITE;