• Rémi Bernon's avatar
    opengl32: Implement wow64 thunk for glGetString (et al.). · 17abb6f4
    Rémi Bernon authored
    This is a bit tricky because the strings are supposed to be static, but
    we also cannot return the unix strings directly either.
    
    So instead we keep track, on the unix side, of known unix / wow64 string
    associations, and return the known wow64 string if the unix string was
    already requested before.
    
    If the string wasn't found, the syscall returns STATUS_BUFFER_TOO_SMALL,
    and the PE side allocates the required memory, calling the syscall once
    again with the wow64 string pointer to copy the string to.
    
    On concurrent calls, the syscall may return a different wow64 string, in
    which case the PE side uses it instead and frees the one it allocated.
    
    Lastly, the PE side also keeps record of wow64 strings it had allocated,
    so that we can free them on process detach. The unix side also does some
    cleanup of its mapping buffer, as there's no guarantee that it will be
    completely unloaded.
    17abb6f4
unixlib.h 409 KB