Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use metadata for minimum OS version numbers #582

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
598be65
Update dependencies and add dependabot
timsneath Oct 28, 2022
135d1d9
Win32 metadata renamed BLUETOOTH_ADDRESS
timsneath Oct 28, 2022
137ffcd
libraryFromDllName is no longer required
timsneath Oct 28, 2022
a311adb
Handle Bluetooth struct name regression
timsneath Oct 29, 2022
658ab14
Use Win32 metadata for module names
timsneath Oct 29, 2022
318f2b2
Update structs
timsneath Oct 29, 2022
347d221
Remove dllLibrary reference
timsneath Oct 29, 2022
57c67f7
Don't filter functions by library
timsneath Oct 29, 2022
903cab5
Fix libraryDartName
timsneath Oct 29, 2022
996e482
Fix category generation
timsneath Oct 29, 2022
d2b4e46
Fix --no-test flag
timsneath Oct 29, 2022
be7dd97
Lowercase DLL name
timsneath Oct 29, 2022
7cc4704
Generate structs
timsneath Oct 29, 2022
16316d0
Regenerate APIs and update exports & sample
timsneath Oct 29, 2022
d1b99f7
Remove old redundant files
timsneath Oct 29, 2022
eae7e8b
Add function categories
timsneath Oct 29, 2022
39d5ebd
Update struct_size tests
timsneath Oct 29, 2022
d37c6b2
Fix casing issue
timsneath Oct 29, 2022
4b0c707
Remove corhdr.h
timsneath Oct 29, 2022
1cbf07f
Merge branch 'main' into winmd-2.4.0
timsneath Oct 29, 2022
0b640ab
Add back test generation
timsneath Oct 29, 2022
5fcff76
Merge branch 'winmd-2.4.0' of https://github.com/timsneath/win32 into…
timsneath Oct 29, 2022
7bdbe76
Fix unfiltered methods (oops!)
timsneath Oct 29, 2022
675c4ae
Complete API test tidyup
timsneath Oct 29, 2022
c8d15ca
Workaround metadata bug for now
timsneath Oct 29, 2022
5abd9f9
Update documentation
timsneath Oct 29, 2022
f99b001
Use metadata for minVer
timsneath Oct 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ updates:
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "pub"
directory: "/tool/generator"
schedule:
interval: "daily"
4 changes: 0 additions & 4 deletions doc/kernelbase.md

This file was deleted.

3 changes: 0 additions & 3 deletions doc/shcore.md

This file was deleted.

8 changes: 4 additions & 4 deletions example/bluetooth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void findRadioInfo(int hRadio) {
}
}

String convertBluetoothAddress(BLUETOOTH_ADDRESS address) {
String convertBluetoothAddress(BLUETOOTH_ADDRESS_STRUCT address) {
final bytes = address.rgBytes;
final buffer = StringBuffer();
for (var idx = 0; idx < 6; idx++) {
Expand All @@ -74,7 +74,7 @@ String convertBluetoothAddress(BLUETOOTH_ADDRESS address) {
return buffer.toString();
}

void printBluetoothDeviceInfo(BLUETOOTH_DEVICE_INFO info) {
void printBluetoothDeviceInfo(BLUETOOTH_DEVICE_INFO_STRUCT info) {
print('Device address: ${convertBluetoothAddress(info.Address)}');
print(' Name: ${info.szName}');
print(' Authenticated: ${info.fAuthenticated != FALSE ? 'True' : 'False'}');
Expand All @@ -91,8 +91,8 @@ void findBluetoothDevices() {
..ref.fReturnUnknown = TRUE
..ref.fIssueInquiry = TRUE
..ref.cTimeoutMultiplier = 1;
final info = calloc<BLUETOOTH_DEVICE_INFO>()
..ref.dwSize = sizeOf<BLUETOOTH_DEVICE_INFO>();
final info = calloc<BLUETOOTH_DEVICE_INFO_STRUCT>()
..ref.dwSize = sizeOf<BLUETOOTH_DEVICE_INFO_STRUCT>();

try {
final firstDeviceHandle = BluetoothFindFirstDevice(params, info);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/api_ms_win_core_apiquery_l2_1_0.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final _api_ms_win_core_apiquery_l2_1_0 =
/// on the computer.
///
/// ```c
/// APICONTRACT BOOL IsApiSetImplemented(
/// BOOL IsApiSetImplemented(
/// PCSTR Contract
/// );
/// ```
Expand Down
43 changes: 43 additions & 0 deletions lib/src/api_ms_win_core_comm_l1_1_1.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// Maps FFI prototypes onto the corresponding Win32 API function calls

// THIS FILE IS GENERATED AUTOMATICALLY AND SHOULD NOT BE EDITED DIRECTLY.

// ignore_for_file: unused_import, non_constant_identifier_names
// ignore_for_file: constant_identifier_names, camel_case_types

import 'dart:ffi';

import 'package:ffi/ffi.dart';

import 'callbacks.dart';
import 'combase.dart';
import 'guid.dart';
import 'structs.g.dart';
import 'variant.dart';

final _api_ms_win_core_comm_l1_1_1 =
DynamicLibrary.open('api-ms-win-core-comm-l1-1-1.dll');

/// Attempts to open a communication device.
///
/// ```c
/// HANDLE OpenCommPort(
/// ULONG uPortNumber,
/// DWORD dwDesiredAccess,
/// DWORD dwFlagsAndAttributes
/// );
/// ```
/// {@category kernel32}
int OpenCommPort(
int uPortNumber, int dwDesiredAccess, int dwFlagsAndAttributes) =>
_OpenCommPort(uPortNumber, dwDesiredAccess, dwFlagsAndAttributes);

final _OpenCommPort = _api_ms_win_core_comm_l1_1_1.lookupFunction<
IntPtr Function(Uint32 uPortNumber, Uint32 dwDesiredAccess,
Uint32 dwFlagsAndAttributes),
int Function(int uPortNumber, int dwDesiredAccess,
int dwFlagsAndAttributes)>('OpenCommPort');
43 changes: 43 additions & 0 deletions lib/src/api_ms_win_core_comm_l1_1_2.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// Maps FFI prototypes onto the corresponding Win32 API function calls

// THIS FILE IS GENERATED AUTOMATICALLY AND SHOULD NOT BE EDITED DIRECTLY.

// ignore_for_file: unused_import, non_constant_identifier_names
// ignore_for_file: constant_identifier_names, camel_case_types

import 'dart:ffi';

import 'package:ffi/ffi.dart';

import 'callbacks.dart';
import 'combase.dart';
import 'guid.dart';
import 'structs.g.dart';
import 'variant.dart';

final _api_ms_win_core_comm_l1_1_2 =
DynamicLibrary.open('api-ms-win-core-comm-l1-1-2.dll');

/// Gets an array that contains the well-formed COM ports.
///
/// ```c
/// ULONG GetCommPorts(
/// PULONG lpPortNumbers,
/// ULONG uPortNumbersCount,
/// PULONG puPortNumbersFound
/// );
/// ```
/// {@category kernel32}
int GetCommPorts(Pointer<Uint32> lpPortNumbers, int uPortNumbersCount,
Pointer<Uint32> puPortNumbersFound) =>
_GetCommPorts(lpPortNumbers, uPortNumbersCount, puPortNumbersFound);

final _GetCommPorts = _api_ms_win_core_comm_l1_1_2.lookupFunction<
Uint32 Function(Pointer<Uint32> lpPortNumbers, Uint32 uPortNumbersCount,
Pointer<Uint32> puPortNumbersFound),
int Function(Pointer<Uint32> lpPortNumbers, int uPortNumbersCount,
Pointer<Uint32> puPortNumbersFound)>('GetCommPorts');
41 changes: 41 additions & 0 deletions lib/src/api_ms_win_core_handle_l1_1_0.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// Maps FFI prototypes onto the corresponding Win32 API function calls

// THIS FILE IS GENERATED AUTOMATICALLY AND SHOULD NOT BE EDITED DIRECTLY.

// ignore_for_file: unused_import, non_constant_identifier_names
// ignore_for_file: constant_identifier_names, camel_case_types

import 'dart:ffi';

import 'package:ffi/ffi.dart';

import 'callbacks.dart';
import 'combase.dart';
import 'guid.dart';
import 'structs.g.dart';
import 'variant.dart';

final _api_ms_win_core_handle_l1_1_0 =
DynamicLibrary.open('api-ms-win-core-handle-l1-1-0.dll');

/// Compares two object handles to determine if they refer to the same
/// underlying kernel object.
///
/// ```c
/// BOOL CompareObjectHandles(
/// HANDLE hFirstObjectHandle,
/// HANDLE hSecondObjectHandle
/// );
/// ```
/// {@category kernel32}
int CompareObjectHandles(int hFirstObjectHandle, int hSecondObjectHandle) =>
_CompareObjectHandles(hFirstObjectHandle, hSecondObjectHandle);

final _CompareObjectHandles = _api_ms_win_core_handle_l1_1_0.lookupFunction<
Int32 Function(IntPtr hFirstObjectHandle, IntPtr hSecondObjectHandle),
int Function(int hFirstObjectHandle,
int hSecondObjectHandle)>('CompareObjectHandles');
40 changes: 40 additions & 0 deletions lib/src/api_ms_win_core_sysinfo_l1_2_3.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// Maps FFI prototypes onto the corresponding Win32 API function calls

// THIS FILE IS GENERATED AUTOMATICALLY AND SHOULD NOT BE EDITED DIRECTLY.

// ignore_for_file: unused_import, non_constant_identifier_names
// ignore_for_file: constant_identifier_names, camel_case_types

import 'dart:ffi';

import 'package:ffi/ffi.dart';

import 'callbacks.dart';
import 'combase.dart';
import 'guid.dart';
import 'structs.g.dart';
import 'variant.dart';

final _api_ms_win_core_sysinfo_l1_2_3 =
DynamicLibrary.open('api-ms-win-core-sysinfo-l1-2-3.dll');

/// Retrieves the best estimate of the diagonal size of the built-in screen,
/// in inches.
///
/// ```c
/// HRESULT GetIntegratedDisplaySize(
/// double *sizeInInches
/// );
/// ```
/// {@category kernel32}
int GetIntegratedDisplaySize(Pointer<Double> sizeInInches) =>
_GetIntegratedDisplaySize(sizeInInches);

final _GetIntegratedDisplaySize =
_api_ms_win_core_sysinfo_l1_2_3.lookupFunction<
Int32 Function(Pointer<Double> sizeInInches),
int Function(Pointer<Double> sizeInInches)>('GetIntegratedDisplaySize');
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import 'guid.dart';
import 'structs.g.dart';
import 'variant.dart';

final _shcore = DynamicLibrary.open('shcore.dll');
final _api_ms_win_shcore_scaling_l1_1_1 =
DynamicLibrary.open('api-ms-win-shcore-scaling-l1-1-1.dll');

/// Queries the dots per inch (dpi) of a display.
///
Expand All @@ -31,12 +32,12 @@ final _shcore = DynamicLibrary.open('shcore.dll');
/// UINT *dpiY
/// );
/// ```
/// {@category shcore}
/// {@category user32}
int GetDpiForMonitor(int hmonitor, int dpiType, Pointer<Uint32> dpiX,
Pointer<Uint32> dpiY) =>
_GetDpiForMonitor(hmonitor, dpiType, dpiX, dpiY);

final _GetDpiForMonitor = _shcore.lookupFunction<
final _GetDpiForMonitor = _api_ms_win_shcore_scaling_l1_1_1.lookupFunction<
Int32 Function(IntPtr hmonitor, Int32 dpiType, Pointer<Uint32> dpiX,
Pointer<Uint32> dpiY),
int Function(int hmonitor, int dpiType, Pointer<Uint32> dpiX,
Expand All @@ -50,13 +51,15 @@ final _GetDpiForMonitor = _shcore.lookupFunction<
/// PROCESS_DPI_AWARENESS *value
/// );
/// ```
/// {@category shcore}
/// {@category user32}
int GetProcessDpiAwareness(int hprocess, Pointer<Int32> value) =>
_GetProcessDpiAwareness(hprocess, value);

final _GetProcessDpiAwareness = _shcore.lookupFunction<
Int32 Function(IntPtr hprocess, Pointer<Int32> value),
int Function(int hprocess, Pointer<Int32> value)>('GetProcessDpiAwareness');
final _GetProcessDpiAwareness =
_api_ms_win_shcore_scaling_l1_1_1.lookupFunction<
Int32 Function(IntPtr hprocess, Pointer<Int32> value),
int Function(
int hprocess, Pointer<Int32> value)>('GetProcessDpiAwareness');

/// Gets the scale factor of a specific monitor.
///
Expand All @@ -66,13 +69,15 @@ final _GetProcessDpiAwareness = _shcore.lookupFunction<
/// DEVICE_SCALE_FACTOR *pScale
/// );
/// ```
/// {@category shcore}
/// {@category user32}
int GetScaleFactorForMonitor(int hMon, Pointer<Int32> pScale) =>
_GetScaleFactorForMonitor(hMon, pScale);

final _GetScaleFactorForMonitor = _shcore.lookupFunction<
Int32 Function(IntPtr hMon, Pointer<Int32> pScale),
int Function(int hMon, Pointer<Int32> pScale)>('GetScaleFactorForMonitor');
final _GetScaleFactorForMonitor =
_api_ms_win_shcore_scaling_l1_1_1.lookupFunction<
Int32 Function(IntPtr hMon, Pointer<Int32> pScale),
int Function(
int hMon, Pointer<Int32> pScale)>('GetScaleFactorForMonitor');

/// Sets the process-default DPI awareness level. This is equivalent to
/// calling SetProcessDpiAwarenessContext with the corresponding
Expand All @@ -83,9 +88,9 @@ final _GetScaleFactorForMonitor = _shcore.lookupFunction<
/// PROCESS_DPI_AWARENESS value
/// );
/// ```
/// {@category shcore}
/// {@category user32}
int SetProcessDpiAwareness(int value) => _SetProcessDpiAwareness(value);

final _SetProcessDpiAwareness = _shcore.lookupFunction<
Int32 Function(Int32 value),
int Function(int value)>('SetProcessDpiAwareness');
final _SetProcessDpiAwareness = _api_ms_win_shcore_scaling_l1_1_1
.lookupFunction<Int32 Function(Int32 value), int Function(int value)>(
'SetProcessDpiAwareness');
Loading