Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add c.s.j.win32.Psapi.QueryWorkingSetEx, c.s.j.win32.Kernel32.VirtualLock, c.s.j.win32.Kernel32.VirtualUnlock #1459

Merged

Commits on Aug 9, 2022

  1. Configuration menu
    Copy the full SHA
    d4ccd5c View commit details
    Browse the repository at this point in the history

Commits on Aug 11, 2022

  1. Drop definition of PSAPI_WORKING_SET_EX_BLOCK, move functions to PSAP…

    …I_WORKING_SET_EX_INFORMATION, adjust function names
    
    The definition of PSAPI_WORKING_SET_EX_BLOCK was not correct. The outer
    definition is a UNION with two members:
    
    - ULONG_PTR Flags and
    - another anonymous union holding two bitfield definitions
    
    It effectively defines a union with 3 defintions.
    
    The bitfield definition differs between 32bit and 64bit. The 32bit
    version defines data elements filling exactly the 32bits a single
    ULONG_PTR can hold. The 64bit version adds an additional 32bit reserved
    element, which agains fill the full size a single ULONG_PTR can hold on
    64bit.
    
    The two bitfield definitions both map to ULONG_PTR, so 
    PSAPI_WORKING_SET_EX_BLOCK is basicly just a ULONG_PTR with C syntactic
    sugar for decoding.
    
    The PSAPI_WORKING_SET_EX_BLOCK is only used in 
    PSAPI_WORKING_SET_EX_INFORMATION and given that the union definition
    of PSAPI_WORKING_SET_EX_BLOCK is syntactic sugar, we can drop the
    definition and integrate the decoding logic directly into
    PSAPI_WORKING_SET_EX_INFORMATION.
    
    -----------------------------------------------------------------------
    
    typedef struct _PSAPI_WORKING_SET_EX_INFORMATION {
        PVOID VirtualAddress;
        PSAPI_WORKING_SET_EX_BLOCK VirtualAttributes;                                                                                                                                                  
    } PSAPI_WORKING_SET_EX_INFORMATION, *PPSAPI_WORKING_SET_EX_INFORMATION;
    
    typedef union _PSAPI_WORKING_SET_EX_BLOCK {
        ULONG_PTR Flags;
        union {
            struct {
                ULONG_PTR Valid : 1;
                ULONG_PTR ShareCount : 3;
                ULONG_PTR Win32Protection : 11;
                ULONG_PTR Shared : 1;
                ULONG_PTR Node : 6;
                ULONG_PTR Locked : 1;
                ULONG_PTR LargePage : 1;
                ULONG_PTR Reserved : 7;
                ULONG_PTR Bad : 1;
    
    #if defined(_WIN64)
                ULONG_PTR ReservedUlong : 32;
    #endif
            };
            struct {
                ULONG_PTR Valid : 1;            // Valid = 0 in this format.
                ULONG_PTR Reserved0 : 14;
                ULONG_PTR Shared : 1;
                ULONG_PTR Reserved1 : 15;
                ULONG_PTR Bad : 1;
    
    #if defined(_WIN64)
                ULONG_PTR ReservedUlong : 32;
    #endif
            } Invalid;
        };
    } PSAPI_WORKING_SET_EX_BLOCK, *PPSAPI_WORKING_SET_EX_BLOCK;
    matthiasblaesing committed Aug 11, 2022
    Configuration menu
    Copy the full SHA
    dbf8751 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    04ae48f View commit details
    Browse the repository at this point in the history

Commits on Aug 12, 2022

  1. Configuration menu
    Copy the full SHA
    d5258ea View commit details
    Browse the repository at this point in the history