1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 #include <stddef.h> 10 11 #include "base/base_export.h" 12 #include "base/macros.h" 13 14 namespace base { 15 namespace win { 16 17 // Manages the lifetime of additional attributes in STARTUPINFOEX. 18 class BASE_EXPORT StartupInformation { 19 public: 20 StartupInformation(); 21 22 ~StartupInformation(); 23 24 // Initialize the attribute list for the specified number of entries. 25 bool InitializeProcThreadAttributeList(DWORD attribute_count); 26 27 // Sets one entry in the initialized attribute list. 28 // |value| needs to live at least as long as the StartupInformation object 29 // this is called on. 30 bool UpdateProcThreadAttribute(DWORD_PTR attribute, 31 void* value, 32 size_t size); 33 startup_info()34 LPSTARTUPINFOW startup_info() { return &startup_info_.StartupInfo; } startup_info()35 LPSTARTUPINFOW startup_info() const { 36 return const_cast<const LPSTARTUPINFOW>(&startup_info_.StartupInfo); 37 } 38 has_extended_startup_info()39 bool has_extended_startup_info() const { 40 return !!startup_info_.lpAttributeList; 41 } 42 43 private: 44 STARTUPINFOEXW startup_info_; 45 DISALLOW_COPY_AND_ASSIGN(StartupInformation); 46 }; 47 48 } // namespace win 49 } // namespace base 50 51 #endif // BASE_WIN_STARTUP_INFORMATION_H_ 52