#THREAD_ALL_ACCESS correct in PB?
Posted: Sun Jul 19, 2009 12:48 pm
In the MSDN at > http://msdn.microsoft.com/en-us/library ... S.85).aspx
It says this for THREAD_ALL_ACCESS:
"Windows Server 2003 and Windows XP/2000: The size of the THREAD_ALL_ACCESS flag increased on Windows Server 2008 and Windows Vista. If an application compiled for Windows Server 2008 and Windows Vista is run on Windows Server 2003 or Windows XP/2000, the THREAD_ALL_ACCESS flag is too large and the function specifying this flag fails with ERROR_ACCESS_DENIED. To avoid this problem, specify the minimum set of access rights required for the operation. If THREAD_ALL_ACCESS must be used, set _WIN32_WINNT to the minimum operating system targeted by your application (for example,
#define _WIN32_WINNT _WIN32_WINNT_WINXP
). For more information, see Using the Windows Headers. "
So...refering to the WinNT.h in the latest SDK, I find this:
where:
0xFFFF = 65535 (this is NTDDI_LONGHORN = Vista - Win 7 - Server 2008)
0xFFF = 4095 (this is all others not Vista or Win 7 or Server 2008)
So for Vista - Windows 7 - Server 2008 #PROCESS_ALL_ACCESS should be:
And for all other versions of windows (i.e... XP and below) it should be this:
The constant in Purebasic has this value:
#PROCESS_ALL_ACCESS = 2035711 (which is $1F0FFF)
So the constant in PureBasic is not valid for use with Vista -Windows 7 - Server 2008 ???
It says this for THREAD_ALL_ACCESS:
"Windows Server 2003 and Windows XP/2000: The size of the THREAD_ALL_ACCESS flag increased on Windows Server 2008 and Windows Vista. If an application compiled for Windows Server 2008 and Windows Vista is run on Windows Server 2003 or Windows XP/2000, the THREAD_ALL_ACCESS flag is too large and the function specifying this flag fails with ERROR_ACCESS_DENIED. To avoid this problem, specify the minimum set of access rights required for the operation. If THREAD_ALL_ACCESS must be used, set _WIN32_WINNT to the minimum operating system targeted by your application (for example,
#define _WIN32_WINNT _WIN32_WINNT_WINXP
). For more information, see Using the Windows Headers. "
So...refering to the WinNT.h in the latest SDK, I find this:
Code: Select all
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
#define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \ 0xFFFF)
#else
#define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \ 0xFFF)
0xFFFF = 65535 (this is NTDDI_LONGHORN = Vista - Win 7 - Server 2008)
0xFFF = 4095 (this is all others not Vista or Win 7 or Server 2008)
So for Vista - Windows 7 - Server 2008 #PROCESS_ALL_ACCESS should be:
Code: Select all
Debug #STANDARD_RIGHTS_REQUIRED | #SYNCHRONIZE | 65535
= 2097151
Code: Select all
Debug #STANDARD_RIGHTS_REQUIRED | #SYNCHRONIZE | 4095
= 2035711 (which is $1F0FFF) which is the PureBasic value for #PROCESS_ALL_ACCESS
The constant in Purebasic has this value:
#PROCESS_ALL_ACCESS = 2035711 (which is $1F0FFF)
So the constant in PureBasic is not valid for use with Vista -Windows 7 - Server 2008 ???