tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

startup_information.h (1477B)


      1 // Copyright 2012 The Chromium Authors
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef BASE_WIN_STARTUP_INFORMATION_H_
      6 #define BASE_WIN_STARTUP_INFORMATION_H_
      7 
      8 #include <windows.h>
      9 
     10 #include <stddef.h>
     11 
     12 #include <memory>
     13 
     14 #include "base/base_export.h"
     15 
     16 namespace base {
     17 namespace win {
     18 
     19 // Manages the lifetime of additional attributes in STARTUPINFOEX.
     20 class BASE_EXPORT StartupInformation {
     21 public:
     22  StartupInformation();
     23 
     24  StartupInformation(const StartupInformation&) = delete;
     25  StartupInformation& operator=(const StartupInformation&) = delete;
     26 
     27  ~StartupInformation();
     28 
     29  // Initialize the attribute list for the specified number of entries.
     30  bool InitializeProcThreadAttributeList(DWORD attribute_count);
     31 
     32  // Sets one entry in the initialized attribute list.
     33  // |value| needs to live at least as long as the StartupInformation object
     34  // this is called on.
     35  bool UpdateProcThreadAttribute(DWORD_PTR attribute, void* value, size_t size);
     36 
     37  LPSTARTUPINFOW startup_info() { return &startup_info_.StartupInfo; }
     38  LPSTARTUPINFOW startup_info() const {
     39    return const_cast<const LPSTARTUPINFOW>(&startup_info_.StartupInfo);
     40  }
     41 
     42  bool has_extended_startup_info() const {
     43    return !!startup_info_.lpAttributeList;
     44  }
     45 
     46 private:
     47  std::unique_ptr<char[]> attribute_list_;
     48  STARTUPINFOEXW startup_info_;
     49 };
     50 
     51 }  // namespace win
     52 }  // namespace base
     53 
     54 #endif  // BASE_WIN_STARTUP_INFORMATION_H_