structstd.debug.SelfInfo.WindowsModule[src]

How is this different than Module when the host is Windows? Why are both stored in the SelfInfo struct? Boy, it sure would be nice if someone added documentation comments for this struct explaining it.

Fields

base_address: usize
size: u32
name: []const u8
handle: windows.HMODULE
mapped_file: ?struct {
    file: File,
    section_handle: windows.HANDLE,
    section_view: []const u8,

    pub fn deinit(self: @This()) void {
        const process_handle = windows.GetCurrentProcess();
        assert(windows.ntdll.NtUnmapViewOfSection(process_handle, @constCast(@ptrCast(self.section_view.ptr))) == .SUCCESS);
        windows.CloseHandle(self.section_handle);
        self.file.close();
    }
} = null

Functions

Functiondeinit[src]

pub fn deinit(self: @This()) void

Parameters

self: @This()

Source Code

Source code
pub fn deinit(self: @This()) void {
    const process_handle = windows.GetCurrentProcess();
    assert(windows.ntdll.NtUnmapViewOfSection(process_handle, @constCast(@ptrCast(self.section_view.ptr))) == .SUCCESS);
    windows.CloseHandle(self.section_handle);
    self.file.close();
}

Source Code

Source code
pub const WindowsModule = struct {
    base_address: usize,
    size: u32,
    name: []const u8,
    handle: windows.HMODULE,

    // Set when the image file needed to be mapped from disk
    mapped_file: ?struct {
        file: File,
        section_handle: windows.HANDLE,
        section_view: []const u8,

        pub fn deinit(self: @This()) void {
            const process_handle = windows.GetCurrentProcess();
            assert(windows.ntdll.NtUnmapViewOfSection(process_handle, @constCast(@ptrCast(self.section_view.ptr))) == .SUCCESS);
            windows.CloseHandle(self.section_handle);
            self.file.close();
        }
    } = null,
}