Module: Chef::ReservedNames::Win32::API::CommandLineHelper
- Extended by:
- Chef::ReservedNames::Win32::API
- Included in:
- Provider::Package::Chocolatey
- Defined in:
- lib/chef/win32/api/command_line_helper.rb
Instance Method Summary collapse
-
#command_line_to_argv_w_helper(args) ⇒ Object
It takes the supplied string and splits it into an array.
Instance Method Details
#command_line_to_argv_w_helper(args) ⇒ Object
It takes the supplied string and splits it into an array.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/chef/win32/api/command_line_helper.rb', line 64 def command_line_to_argv_w_helper(args) arguments_list = [] argv = args.to_wstring result = get_command_line argc = FFI::MemoryPointer.new(:int) # Parses a Unicode command line string # It is return an array of pointers to the command line arguments. # Along with a count of such arguments result = command_line_to_argv_w(argv, argc) str_ptr = result.read_pointer offset = 0 number_of_agrs = argc.read_int number_of_agrs.times do new_str_pointer = str_ptr.+(offset) argument = new_str_pointer.read_wstring arguments_list << argument offset = offset + argument.length * 2 + 2 end local_free(result) arguments_list end |