Skip to content

Commit bdf8bba

Browse files
Merge of #634: Switch from winapi to windows-sys
Currently, this avoids actually depending on `windows-bindgen` at build-time by simply using a file generated with the arguments in `bindings.txt`. This is similar to how `std` does it, and avoids issues with `as-if-std`. While similar to the previous method, this way the windows system APIs are generated entirely by the same system as `windows-sys`, and are based on the official API metadata.
2 parents dcd0aaa + 2831b30 commit bdf8bba

File tree

15 files changed

+1342
-1112
lines changed

15 files changed

+1342
-1112
lines changed

.github/workflows/main.yml

+167-169
Large diffs are not rendered by default.

Cargo.lock

+115-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

-17
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ version = "0.36.0"
4949
default-features = false
5050
features = ['read_core', 'elf', 'macho', 'pe', 'xcoff', 'unaligned', 'archive']
5151

52-
[target.'cfg(windows)'.dependencies]
53-
winapi = { version = "0.3.9", optional = true }
54-
5552
[build-dependencies]
5653
# Only needed for Android, but cannot be target dependent
5754
# https://github.com/rust-lang/cargo/issues/4932
@@ -82,20 +79,6 @@ dladdr = []
8279
kernel32 = []
8380
libunwind = []
8481
unix-backtrace = []
85-
verify-winapi = [
86-
'winapi/dbghelp',
87-
'winapi/handleapi',
88-
'winapi/libloaderapi',
89-
'winapi/memoryapi',
90-
'winapi/minwindef',
91-
'winapi/processthreadsapi',
92-
'winapi/synchapi',
93-
'winapi/tlhelp32',
94-
'winapi/winbase',
95-
'winapi/winnt',
96-
'winapi/winnls',
97-
'winapi/stringapiset',
98-
]
9982

10083
[[example]]
10184
name = "backtrace"

bindings.txt

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
--out src/windows_sys.rs
2+
--config std flatten
3+
--filter
4+
Windows.Win32.Foundation.CloseHandle
5+
Windows.Win32.Foundation.FALSE
6+
Windows.Win32.Foundation.HINSTANCE
7+
Windows.Win32.Foundation.INVALID_HANDLE_VALUE
8+
Windows.Win32.Foundation.TRUE
9+
Windows.Win32.Globalization.CP_UTF8
10+
Windows.Win32.Globalization.lstrlenW
11+
Windows.Win32.Globalization.WideCharToMultiByte
12+
Windows.Win32.System.Diagnostics.Debug.AddrModeFlat
13+
Windows.Win32.System.Diagnostics.Debug.CONTEXT
14+
Windows.Win32.System.Diagnostics.Debug.EnumerateLoadedModulesW64
15+
Windows.Win32.System.Diagnostics.Debug.IMAGEHLP_LINEW64
16+
Windows.Win32.System.Diagnostics.Debug.MAX_SYM_NAME
17+
Windows.Win32.System.Diagnostics.Debug.PENUMLOADED_MODULES_CALLBACKW64
18+
Windows.Win32.System.Diagnostics.Debug.PFUNCTION_TABLE_ACCESS_ROUTINE64
19+
Windows.Win32.System.Diagnostics.Debug.PGET_MODULE_BASE_ROUTINE64
20+
Windows.Win32.System.Diagnostics.Debug.PREAD_PROCESS_MEMORY_ROUTINE64
21+
Windows.Win32.System.Diagnostics.Debug.PTRANSLATE_ADDRESS_ROUTINE64
22+
Windows.Win32.System.Diagnostics.Debug.RtlCaptureContext
23+
Windows.Win32.System.Diagnostics.Debug.RtlLookupFunctionEntry
24+
Windows.Win32.System.Diagnostics.Debug.RtlVirtualUnwind
25+
Windows.Win32.System.Diagnostics.Debug.STACKFRAME64
26+
Windows.Win32.System.Diagnostics.Debug.STACKFRAME_EX
27+
Windows.Win32.System.Diagnostics.Debug.StackWalk64
28+
Windows.Win32.System.Diagnostics.Debug.StackWalkEx
29+
Windows.Win32.System.Diagnostics.Debug.SymAddrIncludeInlineTrace
30+
Windows.Win32.System.Diagnostics.Debug.SYMBOL_INFOW
31+
Windows.Win32.System.Diagnostics.Debug.SymFromAddrW
32+
Windows.Win32.System.Diagnostics.Debug.SymFromInlineContextW
33+
Windows.Win32.System.Diagnostics.Debug.SymFunctionTableAccess64
34+
Windows.Win32.System.Diagnostics.Debug.SymGetLineFromAddrW64
35+
Windows.Win32.System.Diagnostics.Debug.SymGetLineFromInlineContextW
36+
Windows.Win32.System.Diagnostics.Debug.SymGetModuleBase64
37+
Windows.Win32.System.Diagnostics.Debug.SymGetOptions
38+
Windows.Win32.System.Diagnostics.Debug.SymGetSearchPathW
39+
Windows.Win32.System.Diagnostics.Debug.SymInitializeW
40+
Windows.Win32.System.Diagnostics.Debug.SYMOPT_DEFERRED_LOADS
41+
Windows.Win32.System.Diagnostics.Debug.SymQueryInlineTrace
42+
Windows.Win32.System.Diagnostics.Debug.SymSetOptions
43+
Windows.Win32.System.Diagnostics.Debug.SymSetSearchPathW
44+
Windows.Win32.System.Diagnostics.ToolHelp.CreateToolhelp32Snapshot
45+
Windows.Win32.System.Diagnostics.ToolHelp.Module32FirstW
46+
Windows.Win32.System.Diagnostics.ToolHelp.Module32NextW
47+
Windows.Win32.System.Diagnostics.ToolHelp.MODULEENTRY32W
48+
Windows.Win32.System.Diagnostics.ToolHelp.TH32CS_SNAPMODULE
49+
Windows.Win32.System.LibraryLoader.GetProcAddress
50+
Windows.Win32.System.LibraryLoader.LoadLibraryA
51+
Windows.Win32.System.Memory.CreateFileMappingA
52+
Windows.Win32.System.Memory.FILE_MAP_READ
53+
Windows.Win32.System.Memory.MapViewOfFile
54+
Windows.Win32.System.Memory.PAGE_READONLY
55+
Windows.Win32.System.Memory.UnmapViewOfFile
56+
Windows.Win32.System.SystemInformation.IMAGE_FILE_MACHINE_I386
57+
Windows.Win32.System.Threading.CreateMutexA
58+
Windows.Win32.System.Threading.GetCurrentProcess
59+
Windows.Win32.System.Threading.GetCurrentProcessId
60+
Windows.Win32.System.Threading.GetCurrentThread
61+
Windows.Win32.System.Threading.INFINITE
62+
Windows.Win32.System.Threading.ReleaseMutex
63+
Windows.Win32.System.Threading.WaitForSingleObjectEx

crates/as-if-std/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ features = ['read_core', 'elf', 'macho', 'pe', 'xcoff', 'unaligned', 'archive']
2929
[build-dependencies]
3030
# Dependency of the `backtrace` crate
3131
cc = "1.0.97"
32+
windows-bindgen = "0.56"
3233

3334
[features]
3435
default = ['backtrace']

0 commit comments

Comments
 (0)