Skip to content

Commit

Permalink
Deprecate WBEM_TIMEOUT_TYPE (#833)
Browse files Browse the repository at this point in the history
  • Loading branch information
halildurmus committed Mar 24, 2024
1 parent 06518c9 commit ddc7371
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 5 deletions.
9 changes: 6 additions & 3 deletions CHANGELOG.md
Expand Up @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions example/wmi_wql.dart
Expand Up @@ -133,8 +133,7 @@ void main() {
while (enumerator.ptr.address > 0) {
final pClsObj = calloc<IntPtr>();

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;
Expand Down
24 changes: 24 additions & 0 deletions lib/fix_data/fix_win32/fix_constants.yaml
Expand Up @@ -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'
7 changes: 7 additions & 0 deletions lib/src/constants_nodoc.dart
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions test_fixes/win32/constants.dart
Expand Up @@ -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;
2 changes: 2 additions & 0 deletions test_fixes/win32/constants.dart.expect
Expand Up @@ -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;

0 comments on commit ddc7371

Please sign in to comment.