def get_privilege_information():
	"""
	Get all privileges associated with the current process.
	"""
	# first call with zero length to determine what size buffer we need

	return_length = wintypes.DWORD()
	params = [
		get_process_token(),
		privilege.TOKEN_INFORMATION_CLASS.TokenPrivileges,
		None,
		0,
		return_length,
	]

	res = privilege.GetTokenInformation(*params)

	# assume we now have the necessary length in return_length

	buffer = ctypes.create_string_buffer(return_length.value)
	params[2] = buffer
	params[3] = return_length.value

	res = privilege.GetTokenInformation(*params)
	assert res > 0, "Error in second GetTokenInformation (%d)" % res

	privileges = ctypes.cast(
		buffer, ctypes.POINTER(privilege.TOKEN_PRIVILEGES)).contents
	return privileges
Get all privileges associated with the current process.