Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added kernel structures example#122

Open
vablings wants to merge 5 commits intomemflow:mainfrom
vablings:main
Open

Added kernel structures example#122
vablings wants to merge 5 commits intomemflow:mainfrom
vablings:main

Conversation

@vablings
Copy link

Simple example showing how you can use Pod to transmute easily into given structures.

I think its a good demo of how flexible memflow is

patrickjeremic

This comment was marked as duplicate.

@memflow memflow deleted a comment from patrickjeremic Mar 14, 2025
@memflow memflow deleted a comment from patrickjeremic Mar 14, 2025
@memflow memflow deleted a comment from patrickjeremic Mar 14, 2025
@memflow memflow deleted a comment from patrickjeremic Mar 14, 2025
Copy link
Member

@ko1N ko1N left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution! I have a couple smaller nitpicks but then we can merge it 👍

}
);
//implement for Plain Old Data, this transmutes the read to the structure.
unsafe impl Pod for _EPROCESS {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required to manually implement Pod? What is the actual size of the struct? Maybe it would be nice if we could specify that as well (e.g. when you want to read arrays)

Copy link
Author

@vablings vablings Mar 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required to manually implement Pod?

I found that using `#[derive(Pod)] was fiddly with the macro expansion

There are other examples of memflow internally using unsafe impl Pod for T {} as its a required trait bound for Pointer<U, T>

What is the actual size of the struct? Maybe it would be nice if we could specify that as well (e.g. when you want to read arrays)

Currently offseter doesnt provide a method to pass in the size. its something i could look at getting put in later.
As a workaround usually i just add the last field of a struct or pad it with bytes at the end

@vablings
Copy link
Author

I now have a fork of offsetter that supports sizing of struct fields rather than padding. It was mentioned this morning in the discord about switching from dataview to bytemuck for the Pod type so id assume for now this can wait until then

@ko1N ko1N force-pushed the main branch 2 times, most recently from 5454125 to ab8d7d3 Compare May 26, 2025 18:47
@ko1N ko1N force-pushed the main branch 4 times, most recently from 83f316e to 04978ac Compare November 4, 2025 22:28
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.

3 participants