Skip to content

Commit

Permalink
Merge branch 'main' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
timsneath committed May 6, 2023
2 parents ad4ce11 + 7092026 commit 20c02fb
Show file tree
Hide file tree
Showing 308 changed files with 647 additions and 42,920 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ updates:
schedule:
interval: "daily"
- package-ecosystem: "pub"
directory: "/tool/generator"
directory: "/tool/win32gen"
schedule:
interval: "daily"
6 changes: 3 additions & 3 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
run: dart pub get

- name: Install dependencies for generation tool
working-directory: tool/generator
working-directory: tool/win32gen
run: dart pub get

- name: Verify formatting
Expand All @@ -53,10 +53,10 @@ jobs:
run: dart analyze --fatal-warnings

- name: Check documentation can be generated without errors
run: dart doc --dry-run --validate-links
run: dart doc --validate-links

- name: Run tests on generation tool
working-directory: tool/generator
working-directory: tool/win32gen
run: dart test

- name: Run tests
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ build/

# These files vary from machine to machine
.vscode/c_cpp_properties.json
.vscode/settings.json
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"markdownlint.config": {
"MD041": false
}
}
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ Some tips:
[CredWriteA](https://docs.microsoft.com/en-us/windows/win32/api/wincred/nf-wincred-credwritea).

- To create a new API, *don't* edit the main library files themselves; these get
overwritten. Instead, edit `functions.json` in the `data\` folder and run
overwritten. Instead, edit `win32_functions.json` in the `data\` folder and run
`tool\generate.cmd` to update the library files. This might seem a pain, but
it gives protection against any changes to dart:ffi, since the typedef syntax
can be easily recreated as necessary.

- Structs can be auto-generated by adding them to `win32_structs.json` or
`winrt_structs.json`, which generate the appropriate Dart files.
- Structs can be auto-generated by adding them to `win32_structs.json` which
generate the appropriate Dart files.

- Constants belong in `constants.dart`; please add documentation. In rare cases
(where the constant is truly self-documenting), you may add to
Expand All @@ -41,7 +41,7 @@ Some tips:

## COM APIs

- Edit `inputs\interfaces.dart` with the COM interface to be generated.
- Edit `data\com_types.json` with the COM interface to be generated.

Now run `generate.cmd` from the `tools\` directory, which should create the
relevant class in the `\lib\src\com` directory.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ APIs for accessing the Windows registry that don't require knowledge of FFI.
## Usage

This package lets you write apps that use the Windows API directly from Dart, by
wrapping common Win32, COM and Windows Runtime APIs using Dart FFI.
wrapping common Win32 and COM APIs using Dart FFI.

You could use it to call a Win32 API like
[EnumFontFamiliesEx](https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-enumfontfamiliesexw)
Expand Down Expand Up @@ -92,7 +92,7 @@ objects](https://pub.dev/documentation/win32/latest/topics/com-topic.html).
## Examples

There are many examples included with this package that demonstrate calling
various Win32, COM and WinRT APIs. These can be found in the `example\` folder;
various Win32 and COM APIs. These can be found in the `example\` folder;
a short description of each example can be found [here](
https://pub.dev/packages/win32/example).

Expand Down
9 changes: 9 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@ linter:
rules:
# Some additional lints we want to enforce
always_declare_return_types: true
avoid_type_to_string: true
cascade_invocations: true
comment_references: true
discarded_futures: true
directives_ordering: true
# invalid_case_patterns: true // Turn on when Dart 3 is stable
leading_newlines_in_multiline_strings: true
literal_only_boolean_expressions: true
no_default_cases: true
omit_local_variable_types: true
prefer_const_constructors: true
prefer_const_literals_to_create_immutables: true
Expand All @@ -23,9 +30,11 @@ linter:
prefer_relative_imports: true
sort_child_properties_last: true
sort_unnamed_constructors_first: true
test_types_in_equals: true
unawaited_futures: true
unnecessary_lambdas: true
unnecessary_parenthesis: true
unnecessary_statements: true
use_super_parameters: true

# This is a good lint, but
Expand Down
4 changes: 2 additions & 2 deletions dartdoc_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dartdoc:
markdown: doc/comctl32.md
"comdlg32":
markdown: doc/comdlg32.md
"crypt32":
"crypt32":
markdown: doc/crypt32.md
"dxva2":
markdown: doc/dxva2.md
Expand Down Expand Up @@ -72,4 +72,4 @@ dartdoc:
nodoc: ['lib/src/constants_nodoc.dart']
ignore:
- broken-link
- missing-from-search-index
- missing-from-search-index
1 change: 0 additions & 1 deletion doc/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ examples use the Win32 API for all UI display and do not require Flutter.
| `scroll.dart` | Example of horizontal and vertical scrolling text window |
| `console.dart` | Shows usage of console APIs |
| `msgbox.dart` | Demonstrates a MessageBox from the console |
| `calendar.dart` | Gets information about the calendar from a WinRT API |
| `sendinput.dart` | Sends keyboard and mouse input to another window |
| `knownfolder.dart` | Retrieves known folders from the current user profile |
| `window.dart` | Enumerates open windows and basic window manipulation |
Expand Down
6 changes: 1 addition & 5 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ demonstrate various aspects of invoking Windows APIs, including:
- Building classic (Win32) desktop UI
- Using callback functions with Win32 APIs
- Invoking COM classes (both `IUnknown` and `IDispatch` interface types)
- Accessing the Windows Runtime APIs
- Integrating Windows code with Flutter

Other examples of packages that use Win32 can be found on pub.dev, at the
Expand Down Expand Up @@ -78,18 +77,15 @@ following location:
| `tetris\main.dart` | Port of an open-source Tetris game to Dart |
| `window.dart` | Enumerates open windows and basic window manipulation |

## COM and Windows Runtime APIs
## COM APIs

| Example | Description |
| --------------------- | --------------------------------------------------------- |
| `calendar.dart` | Gets information about the calendar from a WinRT API |
| `com_context.dart` | Shows interaction of Dart isolates and COM apartments |
| `com_demo.dart` | Demonstrates COM object reference counting |
| `geolocation.dart` | Retrieve geolocation coordinates via WinRT APIs |
| `guid.dart` | Creates a globally unique identifier (GUID) |
| `idispatch.dart` | Demonstrates calling a method using `IDispatch` |
| `winmd.dart` | Interrogate Windows Runtime types |
| `winrt_picker.dart` | Demonstrates picking a file through a WinRT API |
| `wmi_perf.dart` | Uses WMI to retrieve performance counters |
| `wmi_wql.dart` | Uses WMI to retrieve information using WQL |

Expand Down
48 changes: 0 additions & 48 deletions example/appcontainer.dart

This file was deleted.

39 changes: 0 additions & 39 deletions example/calendar.dart

This file was deleted.

35 changes: 0 additions & 35 deletions example/geolocation.dart

This file was deleted.

12 changes: 7 additions & 5 deletions example/pipe.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,11 @@ class ServerCommand extends Command<void> {
}
}

void main(List<String> args) {
CommandRunner<void>('pipe', 'A demonstration of Win32 named pipes.')
..addCommand(ClientCommand())
..addCommand(ServerCommand())
..run(args);
void main(List<String> args) async {
final command =
CommandRunner<void>('pipe', 'A demonstration of Win32 named pipes.')
..addCommand(ClientCommand())
..addCommand(ServerCommand());

await command.run(args);
}
35 changes: 0 additions & 35 deletions example/winrt_picker.dart

This file was deleted.

2 changes: 1 addition & 1 deletion lib/src/com/iaudiocaptureclient.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const IID_IAudioCaptureClient = '{c8adbd64-e71e-48a0-a4de-185c395cd317}';

/// The IAudioCaptureClient interface enables a client to read input data
/// from a capture endpoint buffer. The client obtains a reference to the
/// [IAudioCaptureClient] interface on a stream object by calling the
/// `IAudioCaptureClient` interface on a stream object by calling the
/// `IAudioClient::GetService` method with parameter `riid` set to REFIID
/// [IID_IAudioCaptureClient].
///
Expand Down
2 changes: 1 addition & 1 deletion lib/src/com/iaudioclock.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const IID_IAudioClock = '{cd63314f-3fba-4a1b-812c-ef96358728e7}';

/// The IAudioClock interface enables a client to monitor a stream's data
/// rate and the current position in the stream. The client obtains a
/// reference to the [IAudioClock] interface of a stream object by calling
/// reference to the `IAudioClock` interface of a stream object by calling
/// the `IAudioClient::GetService` method with parameter `riid` set to
/// REFIID [IID_IAudioClock].
///
Expand Down
2 changes: 1 addition & 1 deletion lib/src/com/iaudiorenderclient.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const IID_IAudioRenderClient = '{f294acfc-3146-4483-a7bf-addca7c260e2}';

/// The IAudioRenderClient interface enables a client to write output data
/// to a rendering endpoint buffer. The client obtains a reference to the
/// [IAudioRenderClient] interface of a stream object by calling the
/// `IAudioRenderClient` interface of a stream object by calling the
/// `IAudioClient::GetService` method with parameter `riid` set to REFIID
/// [IID_IAudioRenderClient].
///
Expand Down
2 changes: 1 addition & 1 deletion lib/src/com/ienumnetworkconnections.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const IID_IEnumNetworkConnections = '{dcb00006-570f-4a9b-8d69-199fdba5723b}';
/// The IEnumNetworkConnections interface provides a standard enumerator for
/// network connections. It enumerates active, disconnected, or all network
/// connections within a network. This interface can be obtained from the
/// [INetwork] interface.
/// INetwork interface.
///
/// {@category Interface}
/// {@category com}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/com/ienumnetworks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const IID_IEnumNetworks = '{dcb00003-570f-4a9b-8d69-199fdba5723b}';

/// The IEnumNetworks interface is a standard enumerator for networks. It
/// enumerates all networks available on the local machine. This interface
/// can be obtained from the [INetworkListManager] interface.
/// can be obtained from the `INetworkListManager` interface.
///
/// {@category Interface}
/// {@category com}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/com/ienumstring.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import 'iunknown.dart';
/// @nodoc
const IID_IEnumString = '{00000101-0000-0000-c000-000000000046}';

/// Enumerate strings. [LPWSTR] is the type that indicates a pointer to a
/// Enumerate strings. `LPWSTR` is the type that indicates a pointer to a
/// zero-terminated string of wide, or Unicode, characters.
///
/// {@category Interface}
Expand Down

0 comments on commit 20c02fb

Please sign in to comment.