def from_bytes(cls, data: bytes) -> NetrShareEnumResponse: # TODO: Make this more concise. info_struct, num_info_struct_bytes = ShareEnumStruct.from_bytes( data=data) offset = num_info_struct_bytes total_entries = struct_unpack('<I', data[offset:offset + 4])[0] offset += 4 resume_handle = Pointer.from_bytes(data=data[offset:offset + 8]).representation offset += len(resume_handle) return cls(info_struct=info_struct, total_entries=total_entries, resume_handle=resume_handle, return_code=Win32ErrorCode( struct_unpack('<I', data[offset:offset + 4])[0]))
def from_bytes(cls, data: bytes) -> ROpenSCManagerWResponse: return cls( scm_handle=data[:20], return_code=Win32ErrorCode(struct_unpack('<I', data[20:24])[0]) )
def from_bytes(cls, data: bytes) -> RDeleteServiceResponse: return cls( return_code=Win32ErrorCode(struct_unpack('<I', data[:4])[0]))
def from_bytes(cls, data: bytes) -> RChangeServiceConfigWResponse: return cls( tag_id=struct_unpack('<I', data[:4])[0], return_code=Win32ErrorCode(struct_unpack('<I', data[4:8])[0]) )
def from_bytes(cls, data: bytes) -> RCreateServiceWResponse: return cls(tag_id=struct_unpack('<I', data[:4])[0], service_handle=data[4:24], return_code=Win32ErrorCode( struct_unpack('<I', data[24:28])[0]))
def from_bytes(cls, data: bytes) -> RCloseServiceHandleResponse: return cls(service_handle=data[:20], return_code=Win32ErrorCode( struct_unpack('<I', data[20:24])[0]))
def from_bytes(cls, data: bytes) -> RControlServiceResponse: return cls(service_status=ServiceStatus.from_bytes(data=data[:28]), return_code=Win32ErrorCode( struct_unpack('<I', data[28:32])[0]))