HEX
Server: Apache
System: Linux dinesh8189 5.15.98-grsec-sharedvalley-2.lc.el8.x86_64 #1 SMP Thu Mar 9 09:07:30 -03 2023 x86_64
User: cgmgerenciamento1 (814285)
PHP: 8.1.26
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: //opt/puppetlabs/puppet/lib/ruby/vendor_ruby/hiera/util/win32.rb
class Hiera
  module Util
    module Win32
      if !!File::ALT_SEPARATOR
        require 'fiddle/import'
        require 'fiddle/types'

        # import, dlload, include and typealias must be ordered this way
        extend Fiddle::Importer
        dlload 'shell32'
        include Fiddle::Win32Types # adds HWND, HANDLE, DWORD type aliases
        typealias 'LPWSTR', 'wchar_t*'
        typealias 'LONG', 'long'
        typealias 'HRESULT','LONG'

        # https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx
        # HRESULT SHGetFolderPath(
        #   _In_  HWND   hwndOwner,
        #   _In_  int    nFolder,
        #   _In_  HANDLE hToken,
        #   _In_  DWORD  dwFlags,
        #   _Out_ LPTSTR pszPath
        # );
        extern 'HRESULT SHGetFolderPathW(HWND, int, HANDLE, DWORD, LPWSTR)'

        COMMON_APPDATA = 0x0023
        S_OK           = 0x0
        MAX_PATH       = 260;

        def self.get_common_appdata
          # null terminated MAX_PATH string in wchar (i.e. 2 bytes per char)
          buffer = 0.chr * ((MAX_PATH + 1) * 2)
          result = SHGetFolderPathW(0, COMMON_APPDATA, 0, 0, buffer)
          raise "Could not find COMMON_APPDATA path - HRESULT: #{result}" unless result == S_OK
          buffer.force_encoding(Encoding::UTF_16LE).encode(Encoding::UTF_8).strip
        end
      end
    end
  end
end