Contributions are very much appreciated. With thousands of Win32 APIs, there's a lot of ground to cover. Don't hesitate to ask questions.
Some tips:
-
When wrapping a Win32 API, use the Unicode (
'W'
) wide variants of these APIs, rather than the ANSI ('A'
) variants. For example: CredWriteW, rather than CredWriteA. -
To create a new API, don't edit the main library files themselves; these get overwritten. Instead, edit the win32_functions.json file and execute the
tool\generate.cmd
script to update the library files. -
Structs can be auto-generated by including them in the win32_structs.json file and executing the
tool\generate.cmd
script, which will generate the corresponding Dart files.Once generated, compile the struct_sizes.cpp on a
64-bit
machine architecture, typically using the Visual Studio Developer Command Prompt with the following command (replacexxxxx
with the installed Windows SDK build):cl /I "C:\Program Files (x86)\Windows Kits\10\Include\10.0.xxxxx.0\winrt" \ tool\struct_sizes\struct_sizes.cpp
Once compiled, run the resulting
struct_sizes.exe
file located in the project root to obtain struct sizes; copy the output directly into thestructSizeMap
within the struct_sizes.dart file, and finally, execute thetool\generate.cmd
script to generate struct size tests for each struct. -
Constants belong in the constants.dart; please add documentation. In rare cases (where the constant is truly self-documenting), you may add to the constants_nodoc.dart, although the goal is to gradually document more constants.
-
There are plenty of good existing patterns to build off in these locations; try to mirror an existing function if you can for consistency!
-
Ideally pull requests for new API submissions include a sample (
example\
directory) and some tests (tests\
directory).
Begin by editing the com_types.json file, specifying the
desired COM interface, and then execute the tool\generate.cmd
script to
generate the relevant class in the lib\src\com
directory.