Comments (8)
I can transfer this issue to the Win32 metadata repo for discussion.
from win32metadata.
SEH is a system service that requires compiler (and language/language runtime) support. This should be filed against rustc for resolution.
@riverar This goes beyond (or underneath) API calls. MapViewOfFile()
, for example, returns the equivalent of a region of memory. Dereferencing a pointer anywhere inside the reported valid range of the mapping can raise an SEH exception (e.g. when the file object backing the mapping becomes inaccessible).
The core issue here cannot be solved by annotating APIs alone, and a cursory search didn't uncover any hope for a resolution over the current workaround.
from win32metadata.
Adding some folks who may have some comments on SEH in Rust as well as some who are currently using a mix of Rust and C to make it work. @sivadeilra @dpaoliello @zadjii-msft
from win32metadata.
As for me, we don't have metadata at the moment that calls out which functions use SEH so I don't think this is very actionable at the moment.
https://kennykerr.ca/rust-getting-started/how-are-crates-built.html
from win32metadata.
I'm somewhat surprised that something like that isn't tracked through the metadata yet; I'd assume the information is relevant internally and the win32 C/C++ docs do make mention of using the __try
handlers in some places. Should I open an issue there to ask for including it in the metadata output?
from win32metadata.
Do you have some example APIs in mind?
from win32metadata.
Not quite sure which end of the issue you'd want example API's for; the existing APIs where __try
/__except
are currently used, examples for the Rust end of things, or examples for the metadata definitions?
My initial request was aimed mostly at situations where the function call itself can reasonably cause these to be thrown, e.g. accessing networked locations can cause EXCEPTION_IN_PAGE_ERROR
and in some situations, or for getting a generic function that allows users to register their own filter and handler functions; that said some of the SDK functions can also cause some of the recoverable ones to be thrown. The simple wrapper could look like
// Code may not be perfect, I'm not experienced in passing around functions in C++
void TryUserFn(DWORD[] handles, *void callable, *void handler, *void outvar) {
__try {
*outvar = callable();
}
__except(arr_contains(handles, GetExceptionCode())) {
handler();
*outvar = NULL;
}
return 0;
}
as a bare method of allowing people to attempt recovery or warning users
from win32metadata.
Not aware of any APIs using SEH so closing this for now. Feel free to keep the discussion going and let one of us know if we need to re-open this. Thanks!
from win32metadata.
Related Issues (20)
- WinMD TypeRef Metadata length of table HOT 1
- COINIT documentation is wrong HOT 3
- Function entrypoint Apis missing from winmd HOT 2
- Cannot specify `cString` in `ScriptStringAnalyse` HOT 14
- RT_MANIFEST is u32 while RT_ICON is PCWSTR HOT 1
- VARENUM needs the flags attribute
- Missing lang/locale default constants
- Add `StringCchCopyW` and other string safe functions from "strsafe.h" HOT 4
- IXpsOMGeometryFigure::SetSegments definition is wrong HOT 2
- `RAIIFree` implies `InvalidHandleValue` HOT 3
- `RAIIFree` functions have wrong type HOT 2
- `EventRegister` needs handle type HOT 1
- DWRITE_PAINT_FEATURE_LEVEL is defined twice with one definition that's wrong HOT 1
- `ICERR_*` constants should be typed as `LRESULT` HOT 1
- Determine if we need to do something re: nonmoveable structures
- Need Rust bindings for bcrypt_provider.h and ncrypt_provider.h HOT 6
- `BCRYPT_HANDLE` should not have a `RAIIFree` attribute HOT 2
- Update to latest D3D12 Agility SDK 1.614.0 HOT 1
- There's no `NtOpenDirectoryObject` and `NtQueryDirectoryObject` HOT 3
- Legacy Direct3D Versions (2-8) Support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from win32metadata.