Skip to content

Conversation

@BanacialPC2
Copy link

@BanacialPC2 BanacialPC2 commented Jun 23, 2024

Needed this for

var hr = self.enumerator.?.IMMDeviceEnumerator_GetDefaultAudioEndpoint(...)

where mmdeviceapi defines:

#define E_NOTFOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND)

which is not the same as

// here pub const E_NOTFOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147479539));
// but should be  = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147023728));
// perhabs different  E_NOTFOUND ' s ???
pub const E_NOTFOUND = @import("../win32.zig").data.html_help.E_NOTFOUND;

Adding 2.1.2 HRESULT From WIN32 Error Code Macro
-> Learn\2.1.2 HRESULT From WIN32 Error Code Macro https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/0c0bcf55-277e-4120-b5dc-f6115fc8dc38

Needed this for:

            var hr = self.enumerator.?.IMMDeviceEnumerator_GetDefaultAudioEndpoint(win32.eRender, win32.eConsole, &default_playback_device); 
            defer _ = default_playback_device.?.IUnknown_Release();
            switch (hr) {
                win32.S_OK => {},
                win32.E_POINTER => unreachable,
                win32.E_INVALIDARG => unreachable,
                win32.E_OUTOFMEMORY => return error.OutOfMemory,
                // Here -> 
                win32_utils.HRESULT_FROM_WIN32(win32.ERROR_NOT_FOUND) => break :blk null,
                else => return error.OpeningDevice,
            }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant