示例#1
0
 def get_token_infomations(self, infos_class, rtype):
     required_size = self._get_required_token_information_size(infos_class)
     requested_size = max(required_size, ctypes.sizeof(rtype))
     buffer = utils.BUFFER(rtype, 1)(size=requested_size)
     cbsize = gdef.DWORD()
     winproxy.GetTokenInformation(self.handle, infos_class, buffer, buffer.real_size, cbsize)
     return buffer[0]
示例#2
0
 def get_required_information_size(self, info_type):
     cbsize = DWORD()
     try:
         winproxy.GetTokenInformation(self.handle, info_type, None, 0, ctypes.byref(cbsize))
     except WindowsError:
         pass
     return cbsize.value
示例#3
0
 def _get_required_token_information_size(self, infos_class):
     cbsize = gdef.DWORD()
     try:
         winproxy.GetTokenInformation(self.handle, infos_class, None, 0, ctypes.byref(cbsize))
     except winproxy.WinproxyError as e:
          if not e.winerror in (gdef.ERROR_INSUFFICIENT_BUFFER, gdef.ERROR_BAD_LENGTH):
             raise
     return cbsize.value
示例#4
0
 def get_informations(self, info_type, data):
     cbsize = DWORD()
     winproxy.GetTokenInformation(self.handle, info_type, ctypes.byref(data), ctypes.sizeof(data), ctypes.byref(cbsize))
     return cbsize.value