Header files for address checks.  
More...
Go to the source code of this file.
Header files for address checks. 
- Author
- Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
- Version
- 0.2 
- Date
- 2023-04-27
- Copyright
- This project is released under the GNU Public License v3. 
◆ CheckAddressCanonicality()
Checks if the address is canonical based on x86 processor's virtual address width or not. 
- Parameters
- 
  
    | VAddr | virtual address to check |  | IsKernelAddress | Filled to show whether the address is a kernel address or user-address |  
 
IsKernelAddress wouldn't check for page attributes, it just checks the address convention in Windows
- Returns
- BOOLEAN 
   67{
   69    UINT64 MaxVirtualAddrLowHalf, MinVirtualAddressHighHalf;
 
   70 
   71    
   72    
   73    
   75 
   76    
   77    
   78    
   79    
   80    MaxVirtualAddrLowHalf = ((
UINT64)1ull << (AddrWidth - 1)) - 1;
 
   81 
   82    
   83    
   84    
   85    
   86    MinVirtualAddressHighHalf = ~MaxVirtualAddrLowHalf;
   87 
   88    
   89    
   90    
   91    if ((Addr > MaxVirtualAddrLowHalf) && (Addr < MinVirtualAddressHighHalf))
   92    {
   93        *IsKernelAddress = 
FALSE;
 
   95    }
   96 
   97    
   98    
   99    
  100    if (MinVirtualAddressHighHalf < Addr)
  101    {
  102        *IsKernelAddress = 
TRUE;
 
  103    }
  104    else
  105    {
  106        *IsKernelAddress = 
FALSE;
 
  107    }
  108 
  110}
#define TRUE
Definition BasicTypes.h:55
#define FALSE
Definition BasicTypes.h:54
unsigned __int64 UINT64
Definition BasicTypes.h:21
unsigned int UINT32
Definition BasicTypes.h:48
COMPATIBILITY_CHECKS_STATUS g_CompatibilityCheck
Different attributes and compatibility checks of the current processor.
Definition GlobalVariables.h:26
UINT32 VirtualAddressWidth
Definition CompatibilityChecks.h:30