I’m new to Rust, so forgive me if this is more a more rudimentary issue than I realize.
I’m working on a program that uses WinAPI. I’m trying to make use of the extra window memory on my main window. For those unfamiliar with WinAPI, extra window memory works like this: when calling the function that creates a window, one can request up to 40 bytes of additional memory, which are appended to the end of the memory range the operating system reserves for the window. Once the window has been created, one can then call SetWindowLongPtr in order to select any isize-sized chunk of this memory and fill it with anything one chooses, and likewise call GetWindowLongPtr to retrieve it in isize-sized chunks.
What I would like to do is use the memory to store the address of a struct that contains everything I need, so that I don’t have to worry about the possibility of the struct overflowing the limit of 40 bytes as I add fields over the course of expanding the program. I would like to be able to mutate this struct from within the window’s own window procedure. First of all, what kind of pointer would it be most appropriate to treat the memory as - reference, raw pointer, Box, or something else? And if Box is best, what is the best way to convert to and from the isize that SetWindowLongPtr requires and GetWindowLongPtr returns? I might have more questions depending on the answers.