Class: TurboRex::Windows::ALPC::PortMessage
- Inherits:
-
Object
- Object
- TurboRex::Windows::ALPC::PortMessage
- Defined in:
- lib/turborex/windows/alpc.rb
Defined Under Namespace
Classes: ClientID
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#buf_size ⇒ Object
readonly
Returns the value of attribute buf_size.
-
#callback_id ⇒ Object
Returns the value of attribute callback_id.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_view_size ⇒ Object
readonly
Returns the value of attribute client_view_size.
-
#data_info_offset ⇒ Object
readonly
Returns the value of attribute data_info_offset.
-
#data_length ⇒ Object
Returns the value of attribute data_length.
-
#do_not_use_this_field ⇒ Object
readonly
Returns the value of attribute do_not_use_this_field.
-
#header ⇒ Object
Returns the value of attribute header.
-
#header_size ⇒ Object
readonly
Returns the value of attribute header_size.
-
#length ⇒ Object
readonly
header data member.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#message_id ⇒ Object
Returns the value of attribute message_id.
-
#message_size ⇒ Object
readonly
Returns the value of attribute message_size.
-
#payload ⇒ Object
Returns the value of attribute payload.
-
#payload_size ⇒ Object
readonly
Returns the value of attribute payload_size.
-
#total_length ⇒ Object
Returns the value of attribute total_length.
-
#type ⇒ Object
Returns the value of attribute type.
-
#zero_init ⇒ Object
readonly
Returns the value of attribute zero_init.
Instance Method Summary collapse
- #get_total_and_data_len ⇒ Object
-
#initialize(opts = {}) ⇒ PortMessage
constructor
A new instance of PortMessage.
- #refresh_message ⇒ Object
- #set_data_length(len) ⇒ Object
- #set_header ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ PortMessage
Returns a new instance of PortMessage.
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
# File 'lib/turborex/windows/alpc.rb', line 424 def initialize(opts = {}) = opts[:raw_message] payload = opts[:payload] @payload = payload @attributes = MessageAttribute.new.struct if elsif payload = opts[:port_message] @header = ( ||= APIProxy.alloc_c_struct('PORT_MESSAGE')) set_header #@message_size = @header_size = port_message.sizeof if payload.is_a? String pure_set_msg payload, payload.bytesize elsif payload.is_a? ::Metasm::C::AllocCStruct pure_set_msg payload.str, payload.sizeof else raise TurboRex::Exception::ALPC::UnknownPayloadType end elsif opts[:alloc_size] @header = APIProxy.alloc_c_struct('PORT_MESSAGE') set_header @payload = 0.chr * opts[:alloc_size].to_i pure_set_msg @payload, @payload.bytesize end end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
411 412 413 |
# File 'lib/turborex/windows/alpc.rb', line 411 def attributes @attributes end |
#buf_size ⇒ Object (readonly)
Returns the value of attribute buf_size.
403 404 405 |
# File 'lib/turborex/windows/alpc.rb', line 403 def buf_size @buf_size end |
#callback_id ⇒ Object
Returns the value of attribute callback_id.
422 423 424 |
# File 'lib/turborex/windows/alpc.rb', line 422 def callback_id @callback_id end |
#client_id ⇒ Object
Returns the value of attribute client_id.
418 419 420 |
# File 'lib/turborex/windows/alpc.rb', line 418 def client_id @client_id end |
#client_view_size ⇒ Object (readonly)
Returns the value of attribute client_view_size.
421 422 423 |
# File 'lib/turborex/windows/alpc.rb', line 421 def client_view_size @client_view_size end |
#data_info_offset ⇒ Object (readonly)
Returns the value of attribute data_info_offset.
416 417 418 |
# File 'lib/turborex/windows/alpc.rb', line 416 def data_info_offset @data_info_offset end |
#data_length ⇒ Object
Returns the value of attribute data_length.
409 410 411 |
# File 'lib/turborex/windows/alpc.rb', line 409 def data_length @data_length end |
#do_not_use_this_field ⇒ Object (readonly)
Returns the value of attribute do_not_use_this_field.
419 420 421 |
# File 'lib/turborex/windows/alpc.rb', line 419 def do_not_use_this_field @do_not_use_this_field end |
#header ⇒ Object
Returns the value of attribute header.
410 411 412 |
# File 'lib/turborex/windows/alpc.rb', line 410 def header @header end |
#header_size ⇒ Object (readonly)
Returns the value of attribute header_size.
404 405 406 |
# File 'lib/turborex/windows/alpc.rb', line 404 def header_size @header_size end |
#length ⇒ Object (readonly)
header data member
414 415 416 |
# File 'lib/turborex/windows/alpc.rb', line 414 def length @length end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
405 406 407 |
# File 'lib/turborex/windows/alpc.rb', line 405 def @message end |
#message_id ⇒ Object
Returns the value of attribute message_id.
420 421 422 |
# File 'lib/turborex/windows/alpc.rb', line 420 def @message_id end |
#message_size ⇒ Object (readonly)
Returns the value of attribute message_size.
402 403 404 |
# File 'lib/turborex/windows/alpc.rb', line 402 def @message_size end |
#payload ⇒ Object
Returns the value of attribute payload.
406 407 408 |
# File 'lib/turborex/windows/alpc.rb', line 406 def payload @payload end |
#payload_size ⇒ Object (readonly)
Returns the value of attribute payload_size.
407 408 409 |
# File 'lib/turborex/windows/alpc.rb', line 407 def payload_size @payload_size end |
#total_length ⇒ Object
Returns the value of attribute total_length.
408 409 410 |
# File 'lib/turborex/windows/alpc.rb', line 408 def total_length @total_length end |
#type ⇒ Object
Returns the value of attribute type.
415 416 417 |
# File 'lib/turborex/windows/alpc.rb', line 415 def type @type end |
#zero_init ⇒ Object (readonly)
Returns the value of attribute zero_init.
417 418 419 |
# File 'lib/turborex/windows/alpc.rb', line 417 def zero_init @zero_init end |
Instance Method Details
#get_total_and_data_len ⇒ Object
477 478 479 |
# File 'lib/turborex/windows/alpc.rb', line 477 def get_total_and_data_len [@header.u1.s1.TotalLength, @header.u1.s1.DataLength] end |
#refresh_message ⇒ Object
532 533 534 535 |
# File 'lib/turborex/windows/alpc.rb', line 532 def return unless @message @message end |
#set_data_length(len) ⇒ Object
469 470 471 472 473 474 475 |
# File 'lib/turborex/windows/alpc.rb', line 469 def set_data_length(len) @total_length = @header_size + len @data_length = len @header.u1.s1.TotalLength = @total_length @header.u1.s1.DataLength = @data_length end |
#set_header ⇒ Object
489 490 491 492 493 494 495 496 497 498 499 |
# File 'lib/turborex/windows/alpc.rb', line 489 def set_header @total_length, @data_length = get_total_and_data_len @length = @header.u1.Length @type = @header.u2.s2.Type @data_info_offset = @header.u2.s2.DataInfoOffset @zero_init = @header.u2.ZeroInit @client_id = @do_not_use_this_field = ClientID.new(@header.ClientId.UniqueProcess, @header.ClientId.UniqueThread) @message_id = @header.MessageId @client_view_size = @callback_id = @header.ClientViewSize @header_size = @header.sizeof end |