MCPcopy Create free account
hub / github.com/ELMERIKH/PyinMemoryPE / computer_name

Method computer_name

windows/winobject/system.py:162–175  ·  view source on GitHub ↗

The name of the computer :type: :class:`str`

(self)

Source from the content-addressed store, hash-verified

160 #TODO: use GetComputerNameExA ? and recover other names ?
161 @utils.fixedpropety
162 def computer_name(self):
163 """The name of the computer
164
165 :type: :class:`str`
166 """
167 size = gdef.DWORD(0x1000)
168 # For now I don't know what is best as A vs W APIs...
169 if windows.pycompat.is_py3:
170 buf = ctypes.create_unicode_buffer(size.value)
171 winproxy.GetComputerNameW(buf, ctypes.byref(size))
172 else:
173 buf = ctypes.create_string_buffer(size.value)
174 winproxy.GetComputerNameA(buf, ctypes.byref(size))
175 return buf[:size.value]
176
177 def _computer_name_ex(self, nametype):
178 size = gdef.DWORD(0)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected