// Copyright (c) The NodeRT Contributors
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the ""License""); you may
// not use this file except in compliance with the License. You may obtain a
// copy of the License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED ON AN  *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing permissions
// and limitations under the License.

// TODO: Verify that this is is still needed..
#define NTDDI_VERSION 0x06010000

#include <v8.h>
#include "nan.h"
#include <string>
#include <ppltasks.h>
#include "CollectionsConverter.h"
#include "CollectionsWrap.h"
#include "node-async.h"
#include "NodeRtUtils.h"
#include "OpaqueWrapper.h"
#include "WrapperBase.h"

#using <Windows.WinMD>

// this undefs fixes the issues of compiling Windows.Data.Json, Windows.Storag.FileProperties, and Windows.Stroage.Search
// Some of the node header files brings windows definitions with the same names as some of the WinRT methods
#undef DocumentProperties
#undef GetObject
#undef CreateEvent
#undef FindText
#undef SendMessage

const char* REGISTRATION_TOKEN_MAP_PROPERTY_NAME = "__registrationTokenMap__";

using v8::Array;
using v8::String;
using v8::Value;
using v8::Boolean;
using v8::Integer;
using v8::FunctionTemplate;
using v8::Object;
using v8::Local;
using v8::Function;
using v8::Date;
using v8::Number;
using v8::PropertyAttribute;
using v8::Primitive;
using Nan::HandleScope;
using Nan::Persistent;
using Nan::Undefined;
using Nan::True;
using Nan::False;
using Nan::Null;
using Nan::MaybeLocal;
using Nan::EscapableHandleScope;
using Nan::HandleScope;
using Nan::TryCatch;
using namespace concurrency;

namespace NodeRT { namespace Windows { namespace Security { namespace Isolation { 
  v8::Local<v8::Value> WrapIsolatedWindowsEnvironment(::Windows::Security::Isolation::IsolatedWindowsEnvironment^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsEnvironment^ UnwrapIsolatedWindowsEnvironment(Local<Value> value);
  
  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentCreateResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^ UnwrapIsolatedWindowsEnvironmentCreateResult(Local<Value> value);
  
  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentFile(::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^ UnwrapIsolatedWindowsEnvironmentFile(Local<Value> value);
  
  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentHost(::Windows::Security::Isolation::IsolatedWindowsEnvironmentHost^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentHost^ UnwrapIsolatedWindowsEnvironmentHost(Local<Value> value);
  
  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentLaunchFileResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^ UnwrapIsolatedWindowsEnvironmentLaunchFileResult(Local<Value> value);
  
  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentOptions(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^ UnwrapIsolatedWindowsEnvironmentOptions(Local<Value> value);
  
  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentOwnerRegistration(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistration^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistration^ UnwrapIsolatedWindowsEnvironmentOwnerRegistration(Local<Value> value);
  
  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentOwnerRegistrationData(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^ UnwrapIsolatedWindowsEnvironmentOwnerRegistrationData(Local<Value> value);
  
  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentOwnerRegistrationResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationResult^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationResult^ UnwrapIsolatedWindowsEnvironmentOwnerRegistrationResult(Local<Value> value);
  
  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentPostMessageResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageResult^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageResult^ UnwrapIsolatedWindowsEnvironmentPostMessageResult(Local<Value> value);
  
  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentProcess(::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^ UnwrapIsolatedWindowsEnvironmentProcess(Local<Value> value);
  
  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentShareFileRequestOptions(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^ UnwrapIsolatedWindowsEnvironmentShareFileRequestOptions(Local<Value> value);
  
  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentShareFileResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^ UnwrapIsolatedWindowsEnvironmentShareFileResult(Local<Value> value);
  
  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentShareFolderRequestOptions(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^ UnwrapIsolatedWindowsEnvironmentShareFolderRequestOptions(Local<Value> value);
  
  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentShareFolderResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderResult^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderResult^ UnwrapIsolatedWindowsEnvironmentShareFolderResult(Local<Value> value);
  
  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentStartProcessResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^ UnwrapIsolatedWindowsEnvironmentStartProcessResult(Local<Value> value);
  
  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentTelemetryParameters(::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^ UnwrapIsolatedWindowsEnvironmentTelemetryParameters(Local<Value> value);
  
  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentUserInfo(::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^ UnwrapIsolatedWindowsEnvironmentUserInfo(Local<Value> value);
  
  v8::Local<v8::Value> WrapIsolatedWindowsHostMessenger(::Windows::Security::Isolation::IsolatedWindowsHostMessenger^ wintRtInstance);
  ::Windows::Security::Isolation::IsolatedWindowsHostMessenger^ UnwrapIsolatedWindowsHostMessenger(Local<Value> value);
  



  static void InitIsolatedWindowsEnvironmentActivatorEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentActivator").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("system").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentActivator::System)));
    Nan::Set(enumObject, Nan::New<String>("user").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentActivator::User)));
  }

  static void InitIsolatedWindowsEnvironmentAllowedClipboardFormatsEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentAllowedClipboardFormats").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("none").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentAllowedClipboardFormats::None)));
    Nan::Set(enumObject, Nan::New<String>("text").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentAllowedClipboardFormats::Text)));
    Nan::Set(enumObject, Nan::New<String>("image").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentAllowedClipboardFormats::Image)));
    Nan::Set(enumObject, Nan::New<String>("rtf").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentAllowedClipboardFormats::Rtf)));
  }

  static void InitIsolatedWindowsEnvironmentAvailablePrintersEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentAvailablePrinters").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("none").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentAvailablePrinters::None)));
    Nan::Set(enumObject, Nan::New<String>("local").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentAvailablePrinters::Local)));
    Nan::Set(enumObject, Nan::New<String>("network").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentAvailablePrinters::Network)));
    Nan::Set(enumObject, Nan::New<String>("systemPrintToPdf").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentAvailablePrinters::SystemPrintToPdf)));
    Nan::Set(enumObject, Nan::New<String>("systemPrintToXps").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentAvailablePrinters::SystemPrintToXps)));
  }

  static void InitIsolatedWindowsEnvironmentClipboardCopyPasteDirectionsEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentClipboardCopyPasteDirections").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("none").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentClipboardCopyPasteDirections::None)));
    Nan::Set(enumObject, Nan::New<String>("hostToIsolatedWindowsEnvironment").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentClipboardCopyPasteDirections::HostToIsolatedWindowsEnvironment)));
    Nan::Set(enumObject, Nan::New<String>("isolatedWindowsEnvironmentToHost").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentClipboardCopyPasteDirections::IsolatedWindowsEnvironmentToHost)));
  }

  static void InitIsolatedWindowsEnvironmentCreateStatusEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentCreateStatus").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("success").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateStatus::Success)));
    Nan::Set(enumObject, Nan::New<String>("failureByPolicy").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateStatus::FailureByPolicy)));
    Nan::Set(enumObject, Nan::New<String>("unknownFailure").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateStatus::UnknownFailure)));
  }

  static void InitIsolatedWindowsEnvironmentCreationPriorityEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentCreationPriority").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("low").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreationPriority::Low)));
    Nan::Set(enumObject, Nan::New<String>("normal").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreationPriority::Normal)));
  }

  static void InitIsolatedWindowsEnvironmentHostErrorEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentHostError").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("adminPolicyIsDisabledOrNotPresent").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentHostError::AdminPolicyIsDisabledOrNotPresent)));
    Nan::Set(enumObject, Nan::New<String>("featureNotInstalled").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentHostError::FeatureNotInstalled)));
    Nan::Set(enumObject, Nan::New<String>("hardwareRequirementsNotMet").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentHostError::HardwareRequirementsNotMet)));
    Nan::Set(enumObject, Nan::New<String>("rebootRequired").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentHostError::RebootRequired)));
    Nan::Set(enumObject, Nan::New<String>("unknownError").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentHostError::UnknownError)));
  }

  static void InitIsolatedWindowsEnvironmentLaunchFileStatusEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentLaunchFileStatus").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("success").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileStatus::Success)));
    Nan::Set(enumObject, Nan::New<String>("unknownFailure").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileStatus::UnknownFailure)));
    Nan::Set(enumObject, Nan::New<String>("environmentUnavailable").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileStatus::EnvironmentUnavailable)));
    Nan::Set(enumObject, Nan::New<String>("fileNotFound").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileStatus::FileNotFound)));
    Nan::Set(enumObject, Nan::New<String>("timedOut").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileStatus::TimedOut)));
    Nan::Set(enumObject, Nan::New<String>("alreadySharedWithConflictingOptions").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileStatus::AlreadySharedWithConflictingOptions)));
  }

  static void InitIsolatedWindowsEnvironmentOwnerRegistrationStatusEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentOwnerRegistrationStatus").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("success").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationStatus::Success)));
    Nan::Set(enumObject, Nan::New<String>("invalidArgument").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationStatus::InvalidArgument)));
    Nan::Set(enumObject, Nan::New<String>("accessDenied").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationStatus::AccessDenied)));
    Nan::Set(enumObject, Nan::New<String>("insufficientMemory").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationStatus::InsufficientMemory)));
    Nan::Set(enumObject, Nan::New<String>("unknownFailure").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationStatus::UnknownFailure)));
  }

  static void InitIsolatedWindowsEnvironmentPostMessageStatusEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentPostMessageStatus").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("success").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageStatus::Success)));
    Nan::Set(enumObject, Nan::New<String>("unknownFailure").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageStatus::UnknownFailure)));
    Nan::Set(enumObject, Nan::New<String>("environmentUnavailable").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageStatus::EnvironmentUnavailable)));
  }

  static void InitIsolatedWindowsEnvironmentProcessStateEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentProcessState").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("running").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcessState::Running)));
    Nan::Set(enumObject, Nan::New<String>("aborted").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcessState::Aborted)));
    Nan::Set(enumObject, Nan::New<String>("completed").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcessState::Completed)));
  }

  static void InitIsolatedWindowsEnvironmentProgressStateEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentProgressState").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("queued").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentProgressState::Queued)));
    Nan::Set(enumObject, Nan::New<String>("processing").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentProgressState::Processing)));
    Nan::Set(enumObject, Nan::New<String>("completed").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentProgressState::Completed)));
    Nan::Set(enumObject, Nan::New<String>("creating").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentProgressState::Creating)));
    Nan::Set(enumObject, Nan::New<String>("retrying").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentProgressState::Retrying)));
    Nan::Set(enumObject, Nan::New<String>("starting").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentProgressState::Starting)));
    Nan::Set(enumObject, Nan::New<String>("finalizing").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentProgressState::Finalizing)));
  }

  static void InitIsolatedWindowsEnvironmentShareFileStatusEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentShareFileStatus").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("success").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileStatus::Success)));
    Nan::Set(enumObject, Nan::New<String>("unknownFailure").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileStatus::UnknownFailure)));
    Nan::Set(enumObject, Nan::New<String>("environmentUnavailable").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileStatus::EnvironmentUnavailable)));
    Nan::Set(enumObject, Nan::New<String>("alreadySharedWithConflictingOptions").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileStatus::AlreadySharedWithConflictingOptions)));
    Nan::Set(enumObject, Nan::New<String>("fileNotFound").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileStatus::FileNotFound)));
    Nan::Set(enumObject, Nan::New<String>("accessDenied").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileStatus::AccessDenied)));
  }

  static void InitIsolatedWindowsEnvironmentShareFolderStatusEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentShareFolderStatus").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("success").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderStatus::Success)));
    Nan::Set(enumObject, Nan::New<String>("unknownFailure").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderStatus::UnknownFailure)));
    Nan::Set(enumObject, Nan::New<String>("environmentUnavailable").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderStatus::EnvironmentUnavailable)));
    Nan::Set(enumObject, Nan::New<String>("folderNotFound").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderStatus::FolderNotFound)));
    Nan::Set(enumObject, Nan::New<String>("accessDenied").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderStatus::AccessDenied)));
  }

  static void InitIsolatedWindowsEnvironmentSignInProgressEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentSignInProgress").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("connecting").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentSignInProgress::Connecting)));
    Nan::Set(enumObject, Nan::New<String>("connected").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentSignInProgress::Connected)));
    Nan::Set(enumObject, Nan::New<String>("authenticating").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentSignInProgress::Authenticating)));
    Nan::Set(enumObject, Nan::New<String>("settingUpAccount").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentSignInProgress::SettingUpAccount)));
    Nan::Set(enumObject, Nan::New<String>("finalizing").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentSignInProgress::Finalizing)));
    Nan::Set(enumObject, Nan::New<String>("completed").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentSignInProgress::Completed)));
  }

  static void InitIsolatedWindowsEnvironmentStartProcessStatusEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentStartProcessStatus").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("success").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessStatus::Success)));
    Nan::Set(enumObject, Nan::New<String>("unknownFailure").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessStatus::UnknownFailure)));
    Nan::Set(enumObject, Nan::New<String>("environmentUnavailable").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessStatus::EnvironmentUnavailable)));
    Nan::Set(enumObject, Nan::New<String>("fileNotFound").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessStatus::FileNotFound)));
    Nan::Set(enumObject, Nan::New<String>("appNotRegistered").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessStatus::AppNotRegistered)));
  }

  static bool IsIsolatedWindowsEnvironmentContractJsObject(Local<Value> value) {
    if (!value->IsObject()) {
      return false;
    }

    Local<String> symbol;
    Local<Object> obj = Nan::To<Object>(value).ToLocalChecked();

    return true;
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentContract IsolatedWindowsEnvironmentContractFromJsObject(Local<Value> value) {
    HandleScope scope;
    ::Windows::Security::Isolation::IsolatedWindowsEnvironmentContract returnValue;

    if (!value->IsObject()) {
      Nan::ThrowError(Nan::TypeError(NodeRT::Utils::NewString(L"Unexpected type, expected an object")));
      return returnValue;
    }

    Local<Object> obj = Nan::To<Object>(value).ToLocalChecked();
    Local<String> symbol;

    return returnValue;
  }

  Local<Value> IsolatedWindowsEnvironmentContractToJsObject(::Windows::Security::Isolation::IsolatedWindowsEnvironmentContract value) {
    EscapableHandleScope scope;

    Local<Object> obj = Nan::New<Object>();


    return scope.Escape(obj);
  }
  static bool IsIsolatedWindowsEnvironmentCreateProgressJsObject(Local<Value> value) {
    if (!value->IsObject()) {
      return false;
    }

    Local<String> symbol;
    Local<Object> obj = Nan::To<Object>(value).ToLocalChecked();

    symbol = Nan::New<String>("state").ToLocalChecked();
    if (Nan::Has(obj, symbol).FromMaybe(false)) {
      if (!Nan::Get(obj,symbol).ToLocalChecked()->IsInt32()) {
        return false;
      }
    }
    
    symbol = Nan::New<String>("percentComplete").ToLocalChecked();
    if (Nan::Has(obj, symbol).FromMaybe(false)) {
      if (!Nan::Get(obj,symbol).ToLocalChecked()->IsUint32()) {
        return false;
      }
    }
    
    return true;
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateProgress IsolatedWindowsEnvironmentCreateProgressFromJsObject(Local<Value> value) {
    HandleScope scope;
    ::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateProgress returnValue;

    if (!value->IsObject()) {
      Nan::ThrowError(Nan::TypeError(NodeRT::Utils::NewString(L"Unexpected type, expected an object")));
      return returnValue;
    }

    Local<Object> obj = Nan::To<Object>(value).ToLocalChecked();
    Local<String> symbol;

    symbol = Nan::New<String>("state").ToLocalChecked();
    if (Nan::Has(obj, symbol).FromMaybe(false)) {
      returnValue.State = static_cast<::Windows::Security::Isolation::IsolatedWindowsEnvironmentProgressState>(Nan::To<int32_t>(Nan::Get(obj,symbol).ToLocalChecked()).FromMaybe(0));
    }
    
    symbol = Nan::New<String>("percentComplete").ToLocalChecked();
    if (Nan::Has(obj, symbol).FromMaybe(false)) {
      returnValue.PercentComplete = static_cast<unsigned int>(Nan::To<uint32_t>(Nan::Get(obj,symbol).ToLocalChecked()).FromMaybe(0));
    }
    
    return returnValue;
  }

  Local<Value> IsolatedWindowsEnvironmentCreateProgressToJsObject(::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateProgress value) {
    EscapableHandleScope scope;

    Local<Object> obj = Nan::New<Object>();

    Nan::Set(obj, Nan::New<String>("state").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(value.State)));
    Nan::Set(obj, Nan::New<String>("percentComplete").ToLocalChecked(), Nan::New<Integer>(value.PercentComplete));

    return scope.Escape(obj);
  }


  class IsolatedWindowsEnvironment : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsEnvironment").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);

        Local<Function> func;
        Local<FunctionTemplate> funcTemplate;

          
            Nan::SetPrototypeMethod(localRef, "registerMessageReceiver", RegisterMessageReceiver);
            Nan::SetPrototypeMethod(localRef, "unregisterMessageReceiver", UnregisterMessageReceiver);
            Nan::SetPrototypeMethod(localRef, "getUserInfo", GetUserInfo);
            Nan::SetPrototypeMethod(localRef, "changePriority", ChangePriority);
          

          
            Nan::SetPrototypeMethod(localRef, "startProcessSilentlyAsync", StartProcessSilentlyAsync);
            Nan::SetPrototypeMethod(localRef, "shareFolderAsync", ShareFolderAsync);
            Nan::SetPrototypeMethod(localRef, "launchFileWithUIAsync", LaunchFileWithUIAsync);
            Nan::SetPrototypeMethod(localRef, "terminateAsync", TerminateAsync);
            Nan::SetPrototypeMethod(localRef, "postMessageToReceiverAsync", PostMessageToReceiverAsync);
            Nan::SetPrototypeMethod(localRef, "shareFileAsync", ShareFileAsync);
          


          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("id").ToLocalChecked(), IdGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);

        Nan::SetMethod(constructor, "getById", GetById);
        Nan::SetMethod(constructor, "findByOwnerId", FindByOwnerId);
        func = Nan::GetFunction(Nan::New<FunctionTemplate>(CreateAsync)).ToLocalChecked();
        Nan::Set(constructor, Nan::New<String>("createAsync").ToLocalChecked(), func);


        Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironment").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsEnvironment(::Windows::Security::Isolation::IsolatedWindowsEnvironment^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironment^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironment^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironment^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsEnvironment *wrapperInstance = new IsolatedWindowsEnvironment(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironment^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironment^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironment^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsEnvironment(winRtInstance));
    }

    static void StartProcessSilentlyAsync(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironment^>(info.This())) {
        return;
      }

      if (info.Length() == 0 || !info[info.Length() -1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
        return;
      }

      IsolatedWindowsEnvironment *wrapper = IsolatedWindowsEnvironment::Unwrap<IsolatedWindowsEnvironment>(info.This());

      ::Windows::Foundation::IAsyncOperation<::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^>^ op;


      if (info.Length() == 4
        && info[0]->IsString()
        && info[1]->IsString()
        && info[2]->IsInt32())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          Platform::String^ arg1 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[1])));
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentActivator arg2 = static_cast<::Windows::Security::Isolation::IsolatedWindowsEnvironmentActivator>(Nan::To<int32_t>(info[2]).FromMaybe(0));
          
          op = wrapper->_instance->StartProcessSilentlyAsync(arg0,arg1,arg2);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 5
        && info[0]->IsString()
        && info[1]->IsString()
        && info[2]->IsInt32()
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^>(info[3]))
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          Platform::String^ arg1 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[1])));
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentActivator arg2 = static_cast<::Windows::Security::Isolation::IsolatedWindowsEnvironmentActivator>(Nan::To<int32_t>(info[2]).FromMaybe(0));
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^ arg3 = UnwrapIsolatedWindowsEnvironmentTelemetryParameters(info[3]);
          
          op = wrapper->_instance->StartProcessSilentlyAsync(arg0,arg1,arg2,arg3);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }

      auto opTask = create_task(op);
      uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());

      opTask.then( [asyncToken] (task<::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^> t) {
        try {
          auto result = t.get();
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {


            Local<Value> error;
            Local<Value> arg1;
            {
              TryCatch tryCatch;
              arg1 = WrapIsolatedWindowsEnvironmentStartProcessResult(result);
              if (tryCatch.HasCaught())
              {
                error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
              }
              else
              {
                error = Undefined();
              }
              if (arg1.IsEmpty()) arg1 = Undefined();
            }
            Local<Value> args[] = {error, arg1};


            invokeCallback(_countof(args), args);
          });
        } catch (Platform::Exception^ exception) {
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
            Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);

            Local<Value> args[] = {error};
            invokeCallback(_countof(args), args);
          });
        }
      });
    }
    static void ShareFolderAsync(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironment^>(info.This())) {
        return;
      }

      if (info.Length() == 0 || !info[info.Length() -1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
        return;
      }

      IsolatedWindowsEnvironment *wrapper = IsolatedWindowsEnvironment::Unwrap<IsolatedWindowsEnvironment>(info.This());

      ::Windows::Foundation::IAsyncOperation<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderResult^>^ op;


      if (info.Length() == 3
        && info[0]->IsString()
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^>(info[1]))
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^ arg1 = UnwrapIsolatedWindowsEnvironmentShareFolderRequestOptions(info[1]);
          
          op = wrapper->_instance->ShareFolderAsync(arg0,arg1);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 4
        && info[0]->IsString()
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^>(info[1])
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^>(info[2]))
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^ arg1 = UnwrapIsolatedWindowsEnvironmentShareFolderRequestOptions(info[1]);
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^ arg2 = UnwrapIsolatedWindowsEnvironmentTelemetryParameters(info[2]);
          
          op = wrapper->_instance->ShareFolderAsync(arg0,arg1,arg2);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }

      auto opTask = create_task(op);
      uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());

      opTask.then( [asyncToken] (task<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderResult^> t) {
        try {
          auto result = t.get();
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {


            Local<Value> error;
            Local<Value> arg1;
            {
              TryCatch tryCatch;
              arg1 = WrapIsolatedWindowsEnvironmentShareFolderResult(result);
              if (tryCatch.HasCaught())
              {
                error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
              }
              else
              {
                error = Undefined();
              }
              if (arg1.IsEmpty()) arg1 = Undefined();
            }
            Local<Value> args[] = {error, arg1};


            invokeCallback(_countof(args), args);
          });
        } catch (Platform::Exception^ exception) {
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
            Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);

            Local<Value> args[] = {error};
            invokeCallback(_countof(args), args);
          });
        }
      });
    }
    static void LaunchFileWithUIAsync(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironment^>(info.This())) {
        return;
      }

      if (info.Length() == 0 || !info[info.Length() -1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
        return;
      }

      IsolatedWindowsEnvironment *wrapper = IsolatedWindowsEnvironment::Unwrap<IsolatedWindowsEnvironment>(info.This());

      ::Windows::Foundation::IAsyncOperation<::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^>^ op;


      if (info.Length() == 4
        && info[0]->IsString()
        && info[1]->IsString()
        && info[2]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          Platform::String^ arg1 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[1])));
          Platform::String^ arg2 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[2])));
          
          op = wrapper->_instance->LaunchFileWithUIAsync(arg0,arg1,arg2);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 5
        && info[0]->IsString()
        && info[1]->IsString()
        && info[2]->IsString()
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^>(info[3]))
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          Platform::String^ arg1 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[1])));
          Platform::String^ arg2 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[2])));
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^ arg3 = UnwrapIsolatedWindowsEnvironmentTelemetryParameters(info[3]);
          
          op = wrapper->_instance->LaunchFileWithUIAsync(arg0,arg1,arg2,arg3);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }

      auto opTask = create_task(op);
      uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());

      opTask.then( [asyncToken] (task<::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^> t) {
        try {
          auto result = t.get();
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {


            Local<Value> error;
            Local<Value> arg1;
            {
              TryCatch tryCatch;
              arg1 = WrapIsolatedWindowsEnvironmentLaunchFileResult(result);
              if (tryCatch.HasCaught())
              {
                error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
              }
              else
              {
                error = Undefined();
              }
              if (arg1.IsEmpty()) arg1 = Undefined();
            }
            Local<Value> args[] = {error, arg1};


            invokeCallback(_countof(args), args);
          });
        } catch (Platform::Exception^ exception) {
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
            Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);

            Local<Value> args[] = {error};
            invokeCallback(_countof(args), args);
          });
        }
      });
    }
    static void TerminateAsync(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironment^>(info.This())) {
        return;
      }

      if (info.Length() == 0 || !info[info.Length() -1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
        return;
      }

      IsolatedWindowsEnvironment *wrapper = IsolatedWindowsEnvironment::Unwrap<IsolatedWindowsEnvironment>(info.This());

      ::Windows::Foundation::IAsyncAction^ op;


      if (info.Length() == 1)
      {
        try
        {
          op = wrapper->_instance->TerminateAsync();
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 2
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^>(info[0]))
      {
        try
        {
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^ arg0 = UnwrapIsolatedWindowsEnvironmentTelemetryParameters(info[0]);
          
          op = wrapper->_instance->TerminateAsync(arg0);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }

      auto opTask = create_task(op);
      uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());

      opTask.then( [asyncToken] (task<void> t) {
        try {
          t.get();
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [](NodeUtils::InvokeCallbackDelegate invokeCallback) {


            Local<Value> args[] = {Undefined()};


            invokeCallback(_countof(args), args);
          });
        } catch (Platform::Exception^ exception) {
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
            Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);

            Local<Value> args[] = {error};
            invokeCallback(_countof(args), args);
          });
        }
      });
    }
    static void PostMessageToReceiverAsync(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironment^>(info.This())) {
        return;
      }

      if (info.Length() == 0 || !info[info.Length() -1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
        return;
      }

      IsolatedWindowsEnvironment *wrapper = IsolatedWindowsEnvironment::Unwrap<IsolatedWindowsEnvironment>(info.This());

      ::Windows::Foundation::IAsyncOperation<::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageResult^>^ op;


      if (info.Length() == 3
        && NodeRT::Utils::IsGuid(info[0])
        && (NodeRT::Utils::IsWinRtWrapperOf<::Windows::Foundation::Collections::IIterable<::Platform::Object^>^>(info[1]) || info[1]->IsArray()))
      {
        try
        {
          ::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
          ::Windows::Foundation::Collections::IIterable<::Platform::Object^>^ arg1 = 
            [] (v8::Local<v8::Value> value) -> ::Windows::Foundation::Collections::IIterable<::Platform::Object^>^
            {
              if (value->IsArray())
              {
                return NodeRT::Collections::JsArrayToWinrtVector<::Platform::Object^>(value.As<Array>(), 
                 [](Local<Value> value) -> bool {
                   return NodeRT::Utils::IsWinRtWrapperOf<::Platform::Object^>(value);
                 },
                 [](Local<Value> value) -> ::Platform::Object^ {
                   return dynamic_cast<::Platform::Object^>(NodeRT::Utils::GetObjectInstance(value));
                 }
                );
              }
              else
              {
                return dynamic_cast<::Windows::Foundation::Collections::IIterable<::Platform::Object^>^>(NodeRT::Utils::GetObjectInstance(value));
              }
            } (info[1]);
          
          op = wrapper->_instance->PostMessageToReceiverAsync(arg0,arg1);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 4
        && NodeRT::Utils::IsGuid(info[0])
        && (NodeRT::Utils::IsWinRtWrapperOf<::Windows::Foundation::Collections::IIterable<::Platform::Object^>^>(info[1]) || info[1]->IsArray())
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^>(info[2]))
      {
        try
        {
          ::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
          ::Windows::Foundation::Collections::IIterable<::Platform::Object^>^ arg1 = 
            [] (v8::Local<v8::Value> value) -> ::Windows::Foundation::Collections::IIterable<::Platform::Object^>^
            {
              if (value->IsArray())
              {
                return NodeRT::Collections::JsArrayToWinrtVector<::Platform::Object^>(value.As<Array>(), 
                 [](Local<Value> value) -> bool {
                   return NodeRT::Utils::IsWinRtWrapperOf<::Platform::Object^>(value);
                 },
                 [](Local<Value> value) -> ::Platform::Object^ {
                   return dynamic_cast<::Platform::Object^>(NodeRT::Utils::GetObjectInstance(value));
                 }
                );
              }
              else
              {
                return dynamic_cast<::Windows::Foundation::Collections::IIterable<::Platform::Object^>^>(NodeRT::Utils::GetObjectInstance(value));
              }
            } (info[1]);
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^ arg2 = UnwrapIsolatedWindowsEnvironmentTelemetryParameters(info[2]);
          
          op = wrapper->_instance->PostMessageToReceiverAsync(arg0,arg1,arg2);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }

      auto opTask = create_task(op);
      uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());

      opTask.then( [asyncToken] (task<::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageResult^> t) {
        try {
          auto result = t.get();
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {


            Local<Value> error;
            Local<Value> arg1;
            {
              TryCatch tryCatch;
              arg1 = WrapIsolatedWindowsEnvironmentPostMessageResult(result);
              if (tryCatch.HasCaught())
              {
                error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
              }
              else
              {
                error = Undefined();
              }
              if (arg1.IsEmpty()) arg1 = Undefined();
            }
            Local<Value> args[] = {error, arg1};


            invokeCallback(_countof(args), args);
          });
        } catch (Platform::Exception^ exception) {
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
            Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);

            Local<Value> args[] = {error};
            invokeCallback(_countof(args), args);
          });
        }
      });
    }
    static void ShareFileAsync(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironment^>(info.This())) {
        return;
      }

      if (info.Length() == 0 || !info[info.Length() -1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
        return;
      }

      IsolatedWindowsEnvironment *wrapper = IsolatedWindowsEnvironment::Unwrap<IsolatedWindowsEnvironment>(info.This());

      ::Windows::Foundation::IAsyncOperation<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^>^ op;


      if (info.Length() == 3
        && info[0]->IsString()
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^>(info[1]))
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^ arg1 = UnwrapIsolatedWindowsEnvironmentShareFileRequestOptions(info[1]);
          
          op = wrapper->_instance->ShareFileAsync(arg0,arg1);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 4
        && info[0]->IsString()
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^>(info[1])
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^>(info[2]))
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^ arg1 = UnwrapIsolatedWindowsEnvironmentShareFileRequestOptions(info[1]);
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^ arg2 = UnwrapIsolatedWindowsEnvironmentTelemetryParameters(info[2]);
          
          op = wrapper->_instance->ShareFileAsync(arg0,arg1,arg2);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }

      auto opTask = create_task(op);
      uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());

      opTask.then( [asyncToken] (task<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^> t) {
        try {
          auto result = t.get();
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {


            Local<Value> error;
            Local<Value> arg1;
            {
              TryCatch tryCatch;
              arg1 = WrapIsolatedWindowsEnvironmentShareFileResult(result);
              if (tryCatch.HasCaught())
              {
                error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
              }
              else
              {
                error = Undefined();
              }
              if (arg1.IsEmpty()) arg1 = Undefined();
            }
            Local<Value> args[] = {error, arg1};


            invokeCallback(_countof(args), args);
          });
        } catch (Platform::Exception^ exception) {
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
            Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);

            Local<Value> args[] = {error};
            invokeCallback(_countof(args), args);
          });
        }
      });
    }

    static void RegisterMessageReceiver(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironment^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironment *wrapper = IsolatedWindowsEnvironment::Unwrap<IsolatedWindowsEnvironment>(info.This());

      if (info.Length() == 2
        && NodeRT::Utils::IsGuid(info[0])
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::MessageReceivedCallback^>(info[1]))
      {
        try
        {
          ::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
          ::Windows::Security::Isolation::MessageReceivedCallback^ arg1 = dynamic_cast<::Windows::Security::Isolation::MessageReceivedCallback^>(NodeRT::Utils::GetObjectInstance(info[1]));
          
          wrapper->_instance->RegisterMessageReceiver(arg0, arg1);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }
    static void UnregisterMessageReceiver(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironment^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironment *wrapper = IsolatedWindowsEnvironment::Unwrap<IsolatedWindowsEnvironment>(info.This());

      if (info.Length() == 1
        && NodeRT::Utils::IsGuid(info[0]))
      {
        try
        {
          ::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
          
          wrapper->_instance->UnregisterMessageReceiver(arg0);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }
    static void GetUserInfo(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironment^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironment *wrapper = IsolatedWindowsEnvironment::Unwrap<IsolatedWindowsEnvironment>(info.This());

      if (info.Length() == 0)
      {
        try
        {
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^ result;
          result = wrapper->_instance->GetUserInfo();
          info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentUserInfo(result));
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }
    static void ChangePriority(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironment^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironment *wrapper = IsolatedWindowsEnvironment::Unwrap<IsolatedWindowsEnvironment>(info.This());

      if (info.Length() == 1
        && info[0]->IsInt32())
      {
        try
        {
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreationPriority arg0 = static_cast<::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreationPriority>(Nan::To<int32_t>(info[0]).FromMaybe(0));
          
          wrapper->_instance->ChangePriority(arg0);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }


    static void CreateAsync(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 0 || !info[info.Length() -1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
        return;
      }

      ::Windows::Foundation::IAsyncOperationWithProgress<::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^, ::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateProgress>^ op;


      if (info.Length() == 2
          && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info[0]))
      {
        try
        {
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^ arg0 = UnwrapIsolatedWindowsEnvironmentOptions(info[0]);
            
          op = ::Windows::Security::Isolation::IsolatedWindowsEnvironment::CreateAsync(arg0);
        } catch (Platform::Exception ^exception) {
            NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
            return;
        }
      }
      else if (info.Length() == 3
          && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info[0])
          && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^>(info[1]))
      {
        try
        {
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^ arg0 = UnwrapIsolatedWindowsEnvironmentOptions(info[0]);
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^ arg1 = UnwrapIsolatedWindowsEnvironmentTelemetryParameters(info[1]);
            
          op = ::Windows::Security::Isolation::IsolatedWindowsEnvironment::CreateAsync(arg0,arg1);
        } catch (Platform::Exception ^exception) {
            NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
            return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }

      auto opTask = create_task(op);
      uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());

      opTask.then( [asyncToken] (task<::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^> t)
      {
        try {
          auto result = t.get();
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {


            Local<Value> error;
            Local<Value> arg1;
            {
              TryCatch tryCatch;
              arg1 = WrapIsolatedWindowsEnvironmentCreateResult(result);
              if (tryCatch.HasCaught())
              {
                error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
              }
              else
              {
                error = Undefined();
              }
              if (arg1.IsEmpty()) arg1 = Undefined();
            }
            Local<Value> args[] = {error, arg1};


            invokeCallback(_countof(args), args);
          });
        }
        catch (Platform::Exception^ exception)
        {
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {

            Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);

            Local<Value> args[] = {error};
            invokeCallback(_countof(args), args);
          });
        }
      });
    }


    static void GetById(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 1
        && info[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          
          ::Windows::Security::Isolation::IsolatedWindowsEnvironment^ result;
          result = ::Windows::Security::Isolation::IsolatedWindowsEnvironment::GetById(arg0);
          info.GetReturnValue().Set(WrapIsolatedWindowsEnvironment(result));
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else  {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }

    static void FindByOwnerId(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 1
        && info[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          
          ::Windows::Foundation::Collections::IVectorView<::Windows::Security::Isolation::IsolatedWindowsEnvironment^>^ result;
          result = ::Windows::Security::Isolation::IsolatedWindowsEnvironment::FindByOwnerId(arg0);
          info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Security::Isolation::IsolatedWindowsEnvironment^>::CreateVectorViewWrapper(result, 
            [](::Windows::Security::Isolation::IsolatedWindowsEnvironment^ val) -> Local<Value> {
              return WrapIsolatedWindowsEnvironment(val);
            },
            [](Local<Value> value) -> bool {
              return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironment^>(value);
            },
            [](Local<Value> value) -> ::Windows::Security::Isolation::IsolatedWindowsEnvironment^ {
              return UnwrapIsolatedWindowsEnvironment(value);
            }
          ));
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else  {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }

    static void IdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironment^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironment *wrapper = IsolatedWindowsEnvironment::Unwrap<IsolatedWindowsEnvironment>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->Id;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Security::Isolation::IsolatedWindowsEnvironment^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsEnvironment(::Windows::Security::Isolation::IsolatedWindowsEnvironment^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsEnvironment^ UnwrapIsolatedWindowsEnvironment(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsEnvironment::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsEnvironment(::Windows::Security::Isolation::IsolatedWindowsEnvironment^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsEnvironment::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironment^ UnwrapIsolatedWindowsEnvironment(Local<Value> value) {
     return IsolatedWindowsEnvironment::Unwrap<IsolatedWindowsEnvironment>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsEnvironment(Local<Object> exports) {
    IsolatedWindowsEnvironment::Init(exports);
  }

  class IsolatedWindowsEnvironmentCreateResult : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsEnvironmentCreateResult").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);


          
            Nan::SetPrototypeMethod(localRef, "changeCreationPriority", ChangeCreationPriority);
          



          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("environment").ToLocalChecked(), EnvironmentGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("extendedError").ToLocalChecked(), ExtendedErrorGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("status").ToLocalChecked(), StatusGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentCreateResult").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsEnvironmentCreateResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsEnvironmentCreateResult *wrapperInstance = new IsolatedWindowsEnvironmentCreateResult(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentCreateResult(winRtInstance));
    }


    static void ChangeCreationPriority(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentCreateResult *wrapper = IsolatedWindowsEnvironmentCreateResult::Unwrap<IsolatedWindowsEnvironmentCreateResult>(info.This());

      if (info.Length() == 1
        && info[0]->IsInt32())
      {
        try
        {
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreationPriority arg0 = static_cast<::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreationPriority>(Nan::To<int32_t>(info[0]).FromMaybe(0));
          
          wrapper->_instance->ChangeCreationPriority(arg0);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    static void EnvironmentGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentCreateResult *wrapper = IsolatedWindowsEnvironmentCreateResult::Unwrap<IsolatedWindowsEnvironmentCreateResult>(info.This());

      try  {
        ::Windows::Security::Isolation::IsolatedWindowsEnvironment^ result = wrapper->_instance->Environment;
        info.GetReturnValue().Set(WrapIsolatedWindowsEnvironment(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void ExtendedErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentCreateResult *wrapper = IsolatedWindowsEnvironmentCreateResult::Unwrap<IsolatedWindowsEnvironmentCreateResult>(info.This());

      try  {
        ::Windows::Foundation::HResult result = wrapper->_instance->ExtendedError;
        info.GetReturnValue().Set(Nan::New<Integer>(result.Value));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void StatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentCreateResult *wrapper = IsolatedWindowsEnvironmentCreateResult::Unwrap<IsolatedWindowsEnvironmentCreateResult>(info.This());

      try  {
        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateStatus result = wrapper->_instance->Status;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentCreateResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^ UnwrapIsolatedWindowsEnvironmentCreateResult(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsEnvironmentCreateResult::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentCreateResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsEnvironmentCreateResult::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreateResult^ UnwrapIsolatedWindowsEnvironmentCreateResult(Local<Value> value) {
     return IsolatedWindowsEnvironmentCreateResult::Unwrap<IsolatedWindowsEnvironmentCreateResult>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsEnvironmentCreateResult(Local<Object> exports) {
    IsolatedWindowsEnvironmentCreateResult::Init(exports);
  }

  class IsolatedWindowsEnvironmentFile : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsEnvironmentFile").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);


          
            Nan::SetPrototypeMethod(localRef, "close", Close);
          



          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("hostPath").ToLocalChecked(), HostPathGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("id").ToLocalChecked(), IdGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("guestPath").ToLocalChecked(), GuestPathGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("isReadOnly").ToLocalChecked(), IsReadOnlyGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentFile").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsEnvironmentFile(::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsEnvironmentFile *wrapperInstance = new IsolatedWindowsEnvironmentFile(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentFile(winRtInstance));
    }


    static void Close(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentFile *wrapper = IsolatedWindowsEnvironmentFile::Unwrap<IsolatedWindowsEnvironmentFile>(info.This());

      if (info.Length() == 0)
      {
        try
        {
          wrapper->_instance->Close();
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    static void HostPathGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentFile *wrapper = IsolatedWindowsEnvironmentFile::Unwrap<IsolatedWindowsEnvironmentFile>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->HostPath;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void IdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentFile *wrapper = IsolatedWindowsEnvironmentFile::Unwrap<IsolatedWindowsEnvironmentFile>(info.This());

      try  {
        ::Platform::Guid result = wrapper->_instance->Id;
        info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void GuestPathGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentFile *wrapper = IsolatedWindowsEnvironmentFile::Unwrap<IsolatedWindowsEnvironmentFile>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->GuestPath;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void IsReadOnlyGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentFile *wrapper = IsolatedWindowsEnvironmentFile::Unwrap<IsolatedWindowsEnvironmentFile>(info.This());

      try  {
        bool result = wrapper->_instance->IsReadOnly;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentFile(::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^ UnwrapIsolatedWindowsEnvironmentFile(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsEnvironmentFile::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentFile(::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsEnvironmentFile::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^ UnwrapIsolatedWindowsEnvironmentFile(Local<Value> value) {
     return IsolatedWindowsEnvironmentFile::Unwrap<IsolatedWindowsEnvironmentFile>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsEnvironmentFile(Local<Object> exports) {
    IsolatedWindowsEnvironmentFile::Init(exports);
  }

  class IsolatedWindowsEnvironmentHost : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsEnvironmentHost").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);

        Nan::SetAccessor(constructor, Nan::New<String>("hostErrors").ToLocalChecked(), HostErrorsGetter);
        Nan::SetAccessor(constructor, Nan::New<String>("isReady").ToLocalChecked(), IsReadyGetter);


        Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentHost").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsEnvironmentHost(::Windows::Security::Isolation::IsolatedWindowsEnvironmentHost^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentHost^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentHost^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentHost^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsEnvironmentHost *wrapperInstance = new IsolatedWindowsEnvironmentHost(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentHost^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentHost^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentHost^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentHost(winRtInstance));
    }







    static void HostErrorsGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      try
      {
        ::Windows::Foundation::Collections::IVectorView<::Windows::Security::Isolation::IsolatedWindowsEnvironmentHostError>^ result = ::Windows::Security::Isolation::IsolatedWindowsEnvironmentHost::HostErrors;
        info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Security::Isolation::IsolatedWindowsEnvironmentHostError>::CreateVectorViewWrapper(result, 
            [](::Windows::Security::Isolation::IsolatedWindowsEnvironmentHostError val) -> Local<Value> {
              return Nan::New<Integer>(static_cast<int>(val));
            },
            [](Local<Value> value) -> bool {
              return value->IsInt32();
            },
            [](Local<Value> value) -> ::Windows::Security::Isolation::IsolatedWindowsEnvironmentHostError {
              return static_cast<::Windows::Security::Isolation::IsolatedWindowsEnvironmentHostError>(Nan::To<int32_t>(value).FromMaybe(0));
            }
          ));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      

    static void IsReadyGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      try
      {
        bool result = ::Windows::Security::Isolation::IsolatedWindowsEnvironmentHost::IsReady;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      

    private:
      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentHost^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentHost(::Windows::Security::Isolation::IsolatedWindowsEnvironmentHost^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsEnvironmentHost^ UnwrapIsolatedWindowsEnvironmentHost(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsEnvironmentHost::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentHost(::Windows::Security::Isolation::IsolatedWindowsEnvironmentHost^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsEnvironmentHost::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentHost^ UnwrapIsolatedWindowsEnvironmentHost(Local<Value> value) {
     return IsolatedWindowsEnvironmentHost::Unwrap<IsolatedWindowsEnvironmentHost>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsEnvironmentHost(Local<Object> exports) {
    IsolatedWindowsEnvironmentHost::Init(exports);
  }

  class IsolatedWindowsEnvironmentLaunchFileResult : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsEnvironmentLaunchFileResult").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("extendedError").ToLocalChecked(), ExtendedErrorGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("file").ToLocalChecked(), FileGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("status").ToLocalChecked(), StatusGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentLaunchFileResult").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsEnvironmentLaunchFileResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsEnvironmentLaunchFileResult *wrapperInstance = new IsolatedWindowsEnvironmentLaunchFileResult(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentLaunchFileResult(winRtInstance));
    }





    static void ExtendedErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentLaunchFileResult *wrapper = IsolatedWindowsEnvironmentLaunchFileResult::Unwrap<IsolatedWindowsEnvironmentLaunchFileResult>(info.This());

      try  {
        ::Windows::Foundation::HResult result = wrapper->_instance->ExtendedError;
        info.GetReturnValue().Set(Nan::New<Integer>(result.Value));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void FileGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentLaunchFileResult *wrapper = IsolatedWindowsEnvironmentLaunchFileResult::Unwrap<IsolatedWindowsEnvironmentLaunchFileResult>(info.This());

      try  {
        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^ result = wrapper->_instance->File;
        info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentFile(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void StatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentLaunchFileResult *wrapper = IsolatedWindowsEnvironmentLaunchFileResult::Unwrap<IsolatedWindowsEnvironmentLaunchFileResult>(info.This());

      try  {
        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileStatus result = wrapper->_instance->Status;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentLaunchFileResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^ UnwrapIsolatedWindowsEnvironmentLaunchFileResult(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsEnvironmentLaunchFileResult::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentLaunchFileResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsEnvironmentLaunchFileResult::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentLaunchFileResult^ UnwrapIsolatedWindowsEnvironmentLaunchFileResult(Local<Value> value) {
     return IsolatedWindowsEnvironmentLaunchFileResult::Unwrap<IsolatedWindowsEnvironmentLaunchFileResult>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsEnvironmentLaunchFileResult(Local<Object> exports) {
    IsolatedWindowsEnvironmentLaunchFileResult::Init(exports);
  }

  class IsolatedWindowsEnvironmentOptions : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsEnvironmentOptions").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);


          
            Nan::SetPrototypeMethod(localRef, "shareHostFolderForUntrustedItems", ShareHostFolderForUntrustedItems);
          



          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("persistUserProfile").ToLocalChecked(), PersistUserProfileGetter, PersistUserProfileSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("environmentOwnerId").ToLocalChecked(), EnvironmentOwnerIdGetter, EnvironmentOwnerIdSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("clipboardCopyPasteDirections").ToLocalChecked(), ClipboardCopyPasteDirectionsGetter, ClipboardCopyPasteDirectionsSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("availablePrinters").ToLocalChecked(), AvailablePrintersGetter, AvailablePrintersSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("allowedClipboardFormats").ToLocalChecked(), AllowedClipboardFormatsGetter, AllowedClipboardFormatsSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("allowGraphicsHardwareAcceleration").ToLocalChecked(), AllowGraphicsHardwareAccelerationGetter, AllowGraphicsHardwareAccelerationSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("allowCameraAndMicrophoneAccess").ToLocalChecked(), AllowCameraAndMicrophoneAccessGetter, AllowCameraAndMicrophoneAccessSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("sharedFolderNameInEnvironment").ToLocalChecked(), SharedFolderNameInEnvironmentGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("sharedHostFolderPath").ToLocalChecked(), SharedHostFolderPathGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("windowAnnotationOverride").ToLocalChecked(), WindowAnnotationOverrideGetter, WindowAnnotationOverrideSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("creationPriority").ToLocalChecked(), CreationPriorityGetter, CreationPrioritySetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("allowedClipboardFormatsToHost").ToLocalChecked(), AllowedClipboardFormatsToHostGetter, AllowedClipboardFormatsToHostSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("allowedClipboardFormatsToEnvironment").ToLocalChecked(), AllowedClipboardFormatsToEnvironmentGetter, AllowedClipboardFormatsToEnvironmentSetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentOptions").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsEnvironmentOptions(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsEnvironmentOptions *wrapperInstance = new IsolatedWindowsEnvironmentOptions(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentOptions(winRtInstance));
    }


    static void ShareHostFolderForUntrustedItems(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      if (info.Length() == 2
        && info[0]->IsString()
        && info[1]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          Platform::String^ arg1 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[1])));
          
          wrapper->_instance->ShareHostFolderForUntrustedItems(arg0, arg1);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    static void PersistUserProfileGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try  {
        bool result = wrapper->_instance->PersistUserProfile;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void PersistUserProfileSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsBoolean()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try {

        bool winRtValue = Nan::To<bool>(value).FromMaybe(false);

        wrapper->_instance->PersistUserProfile = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void EnvironmentOwnerIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->EnvironmentOwnerId;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void EnvironmentOwnerIdSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsString()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try {

        Platform::String^ winRtValue = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), value)));

        wrapper->_instance->EnvironmentOwnerId = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void ClipboardCopyPasteDirectionsGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try  {
        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentClipboardCopyPasteDirections result = wrapper->_instance->ClipboardCopyPasteDirections;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void ClipboardCopyPasteDirectionsSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsInt32()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try {

        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentClipboardCopyPasteDirections winRtValue = static_cast<::Windows::Security::Isolation::IsolatedWindowsEnvironmentClipboardCopyPasteDirections>(Nan::To<int32_t>(value).FromMaybe(0));

        wrapper->_instance->ClipboardCopyPasteDirections = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void AvailablePrintersGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try  {
        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentAvailablePrinters result = wrapper->_instance->AvailablePrinters;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void AvailablePrintersSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsInt32()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try {

        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentAvailablePrinters winRtValue = static_cast<::Windows::Security::Isolation::IsolatedWindowsEnvironmentAvailablePrinters>(Nan::To<int32_t>(value).FromMaybe(0));

        wrapper->_instance->AvailablePrinters = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void AllowedClipboardFormatsGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try  {
        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentAllowedClipboardFormats result = wrapper->_instance->AllowedClipboardFormats;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void AllowedClipboardFormatsSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsInt32()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try {

        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentAllowedClipboardFormats winRtValue = static_cast<::Windows::Security::Isolation::IsolatedWindowsEnvironmentAllowedClipboardFormats>(Nan::To<int32_t>(value).FromMaybe(0));

        wrapper->_instance->AllowedClipboardFormats = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void AllowGraphicsHardwareAccelerationGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try  {
        bool result = wrapper->_instance->AllowGraphicsHardwareAcceleration;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void AllowGraphicsHardwareAccelerationSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsBoolean()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try {

        bool winRtValue = Nan::To<bool>(value).FromMaybe(false);

        wrapper->_instance->AllowGraphicsHardwareAcceleration = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void AllowCameraAndMicrophoneAccessGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try  {
        bool result = wrapper->_instance->AllowCameraAndMicrophoneAccess;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void AllowCameraAndMicrophoneAccessSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsBoolean()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try {

        bool winRtValue = Nan::To<bool>(value).FromMaybe(false);

        wrapper->_instance->AllowCameraAndMicrophoneAccess = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void SharedFolderNameInEnvironmentGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->SharedFolderNameInEnvironment;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void SharedHostFolderPathGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->SharedHostFolderPath;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void WindowAnnotationOverrideGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->WindowAnnotationOverride;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void WindowAnnotationOverrideSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsString()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try {

        Platform::String^ winRtValue = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), value)));

        wrapper->_instance->WindowAnnotationOverride = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void CreationPriorityGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try  {
        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreationPriority result = wrapper->_instance->CreationPriority;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void CreationPrioritySetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsInt32()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try {

        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreationPriority winRtValue = static_cast<::Windows::Security::Isolation::IsolatedWindowsEnvironmentCreationPriority>(Nan::To<int32_t>(value).FromMaybe(0));

        wrapper->_instance->CreationPriority = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void AllowedClipboardFormatsToHostGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try  {
        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentAllowedClipboardFormats result = wrapper->_instance->AllowedClipboardFormatsToHost;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void AllowedClipboardFormatsToHostSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsInt32()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try {

        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentAllowedClipboardFormats winRtValue = static_cast<::Windows::Security::Isolation::IsolatedWindowsEnvironmentAllowedClipboardFormats>(Nan::To<int32_t>(value).FromMaybe(0));

        wrapper->_instance->AllowedClipboardFormatsToHost = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void AllowedClipboardFormatsToEnvironmentGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try  {
        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentAllowedClipboardFormats result = wrapper->_instance->AllowedClipboardFormatsToEnvironment;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void AllowedClipboardFormatsToEnvironmentSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsInt32()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOptions *wrapper = IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(info.This());

      try {

        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentAllowedClipboardFormats winRtValue = static_cast<::Windows::Security::Isolation::IsolatedWindowsEnvironmentAllowedClipboardFormats>(Nan::To<int32_t>(value).FromMaybe(0));

        wrapper->_instance->AllowedClipboardFormatsToEnvironment = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      


    private:
      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentOptions(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^ UnwrapIsolatedWindowsEnvironmentOptions(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsEnvironmentOptions::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentOptions(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsEnvironmentOptions::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOptions^ UnwrapIsolatedWindowsEnvironmentOptions(Local<Value> value) {
     return IsolatedWindowsEnvironmentOptions::Unwrap<IsolatedWindowsEnvironmentOptions>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsEnvironmentOptions(Local<Object> exports) {
    IsolatedWindowsEnvironmentOptions::Init(exports);
  }

  class IsolatedWindowsEnvironmentOwnerRegistration : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsEnvironmentOwnerRegistration").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);

        Nan::SetMethod(constructor, "register", Register);
        Nan::SetMethod(constructor, "unregister", Unregister);


        Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentOwnerRegistration").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsEnvironmentOwnerRegistration(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistration^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistration^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistration^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistration^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsEnvironmentOwnerRegistration *wrapperInstance = new IsolatedWindowsEnvironmentOwnerRegistration(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistration^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistration^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistration^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentOwnerRegistration(winRtInstance));
    }





    static void Register(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 2
        && info[0]->IsString()
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^>(info[1]))
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^ arg1 = UnwrapIsolatedWindowsEnvironmentOwnerRegistrationData(info[1]);
          
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationResult^ result;
          result = ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistration::Register(arg0, arg1);
          info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentOwnerRegistrationResult(result));
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else  {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }

    static void Unregister(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 1
        && info[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          
          ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistration::Unregister(arg0);
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else  {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    private:
      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistration^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentOwnerRegistration(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistration^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistration^ UnwrapIsolatedWindowsEnvironmentOwnerRegistration(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsEnvironmentOwnerRegistration::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentOwnerRegistration(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistration^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsEnvironmentOwnerRegistration::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistration^ UnwrapIsolatedWindowsEnvironmentOwnerRegistration(Local<Value> value) {
     return IsolatedWindowsEnvironmentOwnerRegistration::Unwrap<IsolatedWindowsEnvironmentOwnerRegistration>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsEnvironmentOwnerRegistration(Local<Object> exports) {
    IsolatedWindowsEnvironmentOwnerRegistration::Init(exports);
  }

  class IsolatedWindowsEnvironmentOwnerRegistrationData : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsEnvironmentOwnerRegistrationData").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("activationFileExtensions").ToLocalChecked(), ActivationFileExtensionsGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("processesRunnableAsSystem").ToLocalChecked(), ProcessesRunnableAsSystemGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("processesRunnableAsUser").ToLocalChecked(), ProcessesRunnableAsUserGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("shareableFolders").ToLocalChecked(), ShareableFoldersGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentOwnerRegistrationData").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsEnvironmentOwnerRegistrationData(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsEnvironmentOwnerRegistrationData *wrapperInstance = new IsolatedWindowsEnvironmentOwnerRegistrationData(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentOwnerRegistrationData(winRtInstance));
    }





    static void ActivationFileExtensionsGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOwnerRegistrationData *wrapper = IsolatedWindowsEnvironmentOwnerRegistrationData::Unwrap<IsolatedWindowsEnvironmentOwnerRegistrationData>(info.This());

      try  {
        ::Windows::Foundation::Collections::IVector<::Platform::String^>^ result = wrapper->_instance->ActivationFileExtensions;
        info.GetReturnValue().Set(NodeRT::Collections::VectorWrapper<::Platform::String^>::CreateVectorWrapper(result, 
            [](::Platform::String^ val) -> Local<Value> {
              return NodeRT::Utils::NewString(val->Data());
            },
            [](Local<Value> value) -> bool {
              return value->IsString();
            },
            [](Local<Value> value) -> ::Platform::String^ {
              return ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), value)));
            }
          ));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void ProcessesRunnableAsSystemGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOwnerRegistrationData *wrapper = IsolatedWindowsEnvironmentOwnerRegistrationData::Unwrap<IsolatedWindowsEnvironmentOwnerRegistrationData>(info.This());

      try  {
        ::Windows::Foundation::Collections::IVector<::Platform::String^>^ result = wrapper->_instance->ProcessesRunnableAsSystem;
        info.GetReturnValue().Set(NodeRT::Collections::VectorWrapper<::Platform::String^>::CreateVectorWrapper(result, 
            [](::Platform::String^ val) -> Local<Value> {
              return NodeRT::Utils::NewString(val->Data());
            },
            [](Local<Value> value) -> bool {
              return value->IsString();
            },
            [](Local<Value> value) -> ::Platform::String^ {
              return ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), value)));
            }
          ));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void ProcessesRunnableAsUserGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOwnerRegistrationData *wrapper = IsolatedWindowsEnvironmentOwnerRegistrationData::Unwrap<IsolatedWindowsEnvironmentOwnerRegistrationData>(info.This());

      try  {
        ::Windows::Foundation::Collections::IVector<::Platform::String^>^ result = wrapper->_instance->ProcessesRunnableAsUser;
        info.GetReturnValue().Set(NodeRT::Collections::VectorWrapper<::Platform::String^>::CreateVectorWrapper(result, 
            [](::Platform::String^ val) -> Local<Value> {
              return NodeRT::Utils::NewString(val->Data());
            },
            [](Local<Value> value) -> bool {
              return value->IsString();
            },
            [](Local<Value> value) -> ::Platform::String^ {
              return ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), value)));
            }
          ));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void ShareableFoldersGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOwnerRegistrationData *wrapper = IsolatedWindowsEnvironmentOwnerRegistrationData::Unwrap<IsolatedWindowsEnvironmentOwnerRegistrationData>(info.This());

      try  {
        ::Windows::Foundation::Collections::IVector<::Platform::String^>^ result = wrapper->_instance->ShareableFolders;
        info.GetReturnValue().Set(NodeRT::Collections::VectorWrapper<::Platform::String^>::CreateVectorWrapper(result, 
            [](::Platform::String^ val) -> Local<Value> {
              return NodeRT::Utils::NewString(val->Data());
            },
            [](Local<Value> value) -> bool {
              return value->IsString();
            },
            [](Local<Value> value) -> ::Platform::String^ {
              return ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), value)));
            }
          ));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentOwnerRegistrationData(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^ UnwrapIsolatedWindowsEnvironmentOwnerRegistrationData(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsEnvironmentOwnerRegistrationData::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentOwnerRegistrationData(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsEnvironmentOwnerRegistrationData::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationData^ UnwrapIsolatedWindowsEnvironmentOwnerRegistrationData(Local<Value> value) {
     return IsolatedWindowsEnvironmentOwnerRegistrationData::Unwrap<IsolatedWindowsEnvironmentOwnerRegistrationData>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsEnvironmentOwnerRegistrationData(Local<Object> exports) {
    IsolatedWindowsEnvironmentOwnerRegistrationData::Init(exports);
  }

  class IsolatedWindowsEnvironmentOwnerRegistrationResult : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsEnvironmentOwnerRegistrationResult").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("extendedError").ToLocalChecked(), ExtendedErrorGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("status").ToLocalChecked(), StatusGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentOwnerRegistrationResult").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsEnvironmentOwnerRegistrationResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationResult^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationResult^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationResult^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationResult^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsEnvironmentOwnerRegistrationResult *wrapperInstance = new IsolatedWindowsEnvironmentOwnerRegistrationResult(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationResult^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationResult^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationResult^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentOwnerRegistrationResult(winRtInstance));
    }





    static void ExtendedErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOwnerRegistrationResult *wrapper = IsolatedWindowsEnvironmentOwnerRegistrationResult::Unwrap<IsolatedWindowsEnvironmentOwnerRegistrationResult>(info.This());

      try  {
        ::Windows::Foundation::HResult result = wrapper->_instance->ExtendedError;
        info.GetReturnValue().Set(Nan::New<Integer>(result.Value));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void StatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentOwnerRegistrationResult *wrapper = IsolatedWindowsEnvironmentOwnerRegistrationResult::Unwrap<IsolatedWindowsEnvironmentOwnerRegistrationResult>(info.This());

      try  {
        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationStatus result = wrapper->_instance->Status;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationResult^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentOwnerRegistrationResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationResult^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationResult^ UnwrapIsolatedWindowsEnvironmentOwnerRegistrationResult(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsEnvironmentOwnerRegistrationResult::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentOwnerRegistrationResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationResult^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsEnvironmentOwnerRegistrationResult::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentOwnerRegistrationResult^ UnwrapIsolatedWindowsEnvironmentOwnerRegistrationResult(Local<Value> value) {
     return IsolatedWindowsEnvironmentOwnerRegistrationResult::Unwrap<IsolatedWindowsEnvironmentOwnerRegistrationResult>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsEnvironmentOwnerRegistrationResult(Local<Object> exports) {
    IsolatedWindowsEnvironmentOwnerRegistrationResult::Init(exports);
  }

  class IsolatedWindowsEnvironmentPostMessageResult : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsEnvironmentPostMessageResult").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("extendedError").ToLocalChecked(), ExtendedErrorGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("status").ToLocalChecked(), StatusGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentPostMessageResult").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsEnvironmentPostMessageResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageResult^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageResult^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageResult^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageResult^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsEnvironmentPostMessageResult *wrapperInstance = new IsolatedWindowsEnvironmentPostMessageResult(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageResult^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageResult^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageResult^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentPostMessageResult(winRtInstance));
    }





    static void ExtendedErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentPostMessageResult *wrapper = IsolatedWindowsEnvironmentPostMessageResult::Unwrap<IsolatedWindowsEnvironmentPostMessageResult>(info.This());

      try  {
        ::Windows::Foundation::HResult result = wrapper->_instance->ExtendedError;
        info.GetReturnValue().Set(Nan::New<Integer>(result.Value));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void StatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentPostMessageResult *wrapper = IsolatedWindowsEnvironmentPostMessageResult::Unwrap<IsolatedWindowsEnvironmentPostMessageResult>(info.This());

      try  {
        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageStatus result = wrapper->_instance->Status;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageResult^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentPostMessageResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageResult^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageResult^ UnwrapIsolatedWindowsEnvironmentPostMessageResult(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsEnvironmentPostMessageResult::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentPostMessageResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageResult^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsEnvironmentPostMessageResult::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentPostMessageResult^ UnwrapIsolatedWindowsEnvironmentPostMessageResult(Local<Value> value) {
     return IsolatedWindowsEnvironmentPostMessageResult::Unwrap<IsolatedWindowsEnvironmentPostMessageResult>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsEnvironmentPostMessageResult(Local<Object> exports) {
    IsolatedWindowsEnvironmentPostMessageResult::Init(exports);
  }

  class IsolatedWindowsEnvironmentProcess : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsEnvironmentProcess").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);

        Local<Function> func;
        Local<FunctionTemplate> funcTemplate;

          
            Nan::SetPrototypeMethod(localRef, "waitForExit", WaitForExit);
            Nan::SetPrototypeMethod(localRef, "waitForExitWithTimeout", WaitForExitWithTimeout);
          

          
            Nan::SetPrototypeMethod(localRef, "waitForExitAsync", WaitForExitAsync);
          


          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("exitCode").ToLocalChecked(), ExitCodeGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("state").ToLocalChecked(), StateGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentProcess").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsEnvironmentProcess(::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsEnvironmentProcess *wrapperInstance = new IsolatedWindowsEnvironmentProcess(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentProcess(winRtInstance));
    }

    static void WaitForExitAsync(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^>(info.This())) {
        return;
      }

      if (info.Length() == 0 || !info[info.Length() -1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
        return;
      }

      IsolatedWindowsEnvironmentProcess *wrapper = IsolatedWindowsEnvironmentProcess::Unwrap<IsolatedWindowsEnvironmentProcess>(info.This());

      ::Windows::Foundation::IAsyncAction^ op;


      if (info.Length() == 1)
      {
        try
        {
          op = wrapper->_instance->WaitForExitAsync();
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }

      auto opTask = create_task(op);
      uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());

      opTask.then( [asyncToken] (task<void> t) {
        try {
          t.get();
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [](NodeUtils::InvokeCallbackDelegate invokeCallback) {


            Local<Value> args[] = {Undefined()};


            invokeCallback(_countof(args), args);
          });
        } catch (Platform::Exception^ exception) {
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
            Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);

            Local<Value> args[] = {error};
            invokeCallback(_countof(args), args);
          });
        }
      });
    }

    static void WaitForExit(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentProcess *wrapper = IsolatedWindowsEnvironmentProcess::Unwrap<IsolatedWindowsEnvironmentProcess>(info.This());

      if (info.Length() == 0)
      {
        try
        {
          wrapper->_instance->WaitForExit();
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }
    static void WaitForExitWithTimeout(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentProcess *wrapper = IsolatedWindowsEnvironmentProcess::Unwrap<IsolatedWindowsEnvironmentProcess>(info.This());

      if (info.Length() == 1
        && info[0]->IsUint32())
      {
        try
        {
          unsigned int arg0 = static_cast<unsigned int>(Nan::To<uint32_t>(info[0]).FromMaybe(0));
          
          wrapper->_instance->WaitForExitWithTimeout(arg0);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    static void ExitCodeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentProcess *wrapper = IsolatedWindowsEnvironmentProcess::Unwrap<IsolatedWindowsEnvironmentProcess>(info.This());

      try  {
        unsigned int result = wrapper->_instance->ExitCode;
        info.GetReturnValue().Set(Nan::New<Integer>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void StateGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentProcess *wrapper = IsolatedWindowsEnvironmentProcess::Unwrap<IsolatedWindowsEnvironmentProcess>(info.This());

      try  {
        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcessState result = wrapper->_instance->State;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentProcess(::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^ UnwrapIsolatedWindowsEnvironmentProcess(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsEnvironmentProcess::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentProcess(::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsEnvironmentProcess::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^ UnwrapIsolatedWindowsEnvironmentProcess(Local<Value> value) {
     return IsolatedWindowsEnvironmentProcess::Unwrap<IsolatedWindowsEnvironmentProcess>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsEnvironmentProcess(Local<Object> exports) {
    IsolatedWindowsEnvironmentProcess::Init(exports);
  }

  class IsolatedWindowsEnvironmentShareFileRequestOptions : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsEnvironmentShareFileRequestOptions").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("allowWrite").ToLocalChecked(), AllowWriteGetter, AllowWriteSetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentShareFileRequestOptions").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsEnvironmentShareFileRequestOptions(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsEnvironmentShareFileRequestOptions *wrapperInstance = new IsolatedWindowsEnvironmentShareFileRequestOptions(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentShareFileRequestOptions(winRtInstance));
    }





    static void AllowWriteGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentShareFileRequestOptions *wrapper = IsolatedWindowsEnvironmentShareFileRequestOptions::Unwrap<IsolatedWindowsEnvironmentShareFileRequestOptions>(info.This());

      try  {
        bool result = wrapper->_instance->AllowWrite;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void AllowWriteSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsBoolean()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentShareFileRequestOptions *wrapper = IsolatedWindowsEnvironmentShareFileRequestOptions::Unwrap<IsolatedWindowsEnvironmentShareFileRequestOptions>(info.This());

      try {

        bool winRtValue = Nan::To<bool>(value).FromMaybe(false);

        wrapper->_instance->AllowWrite = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      


    private:
      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentShareFileRequestOptions(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^ UnwrapIsolatedWindowsEnvironmentShareFileRequestOptions(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsEnvironmentShareFileRequestOptions::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentShareFileRequestOptions(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsEnvironmentShareFileRequestOptions::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileRequestOptions^ UnwrapIsolatedWindowsEnvironmentShareFileRequestOptions(Local<Value> value) {
     return IsolatedWindowsEnvironmentShareFileRequestOptions::Unwrap<IsolatedWindowsEnvironmentShareFileRequestOptions>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsEnvironmentShareFileRequestOptions(Local<Object> exports) {
    IsolatedWindowsEnvironmentShareFileRequestOptions::Init(exports);
  }

  class IsolatedWindowsEnvironmentShareFileResult : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsEnvironmentShareFileResult").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("extendedError").ToLocalChecked(), ExtendedErrorGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("file").ToLocalChecked(), FileGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("status").ToLocalChecked(), StatusGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentShareFileResult").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsEnvironmentShareFileResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsEnvironmentShareFileResult *wrapperInstance = new IsolatedWindowsEnvironmentShareFileResult(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentShareFileResult(winRtInstance));
    }





    static void ExtendedErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentShareFileResult *wrapper = IsolatedWindowsEnvironmentShareFileResult::Unwrap<IsolatedWindowsEnvironmentShareFileResult>(info.This());

      try  {
        ::Windows::Foundation::HResult result = wrapper->_instance->ExtendedError;
        info.GetReturnValue().Set(Nan::New<Integer>(result.Value));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void FileGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentShareFileResult *wrapper = IsolatedWindowsEnvironmentShareFileResult::Unwrap<IsolatedWindowsEnvironmentShareFileResult>(info.This());

      try  {
        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentFile^ result = wrapper->_instance->File;
        info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentFile(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void StatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentShareFileResult *wrapper = IsolatedWindowsEnvironmentShareFileResult::Unwrap<IsolatedWindowsEnvironmentShareFileResult>(info.This());

      try  {
        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileStatus result = wrapper->_instance->Status;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentShareFileResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^ UnwrapIsolatedWindowsEnvironmentShareFileResult(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsEnvironmentShareFileResult::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentShareFileResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsEnvironmentShareFileResult::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFileResult^ UnwrapIsolatedWindowsEnvironmentShareFileResult(Local<Value> value) {
     return IsolatedWindowsEnvironmentShareFileResult::Unwrap<IsolatedWindowsEnvironmentShareFileResult>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsEnvironmentShareFileResult(Local<Object> exports) {
    IsolatedWindowsEnvironmentShareFileResult::Init(exports);
  }

  class IsolatedWindowsEnvironmentShareFolderRequestOptions : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsEnvironmentShareFolderRequestOptions").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("allowWrite").ToLocalChecked(), AllowWriteGetter, AllowWriteSetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentShareFolderRequestOptions").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsEnvironmentShareFolderRequestOptions(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsEnvironmentShareFolderRequestOptions *wrapperInstance = new IsolatedWindowsEnvironmentShareFolderRequestOptions(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentShareFolderRequestOptions(winRtInstance));
    }





    static void AllowWriteGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentShareFolderRequestOptions *wrapper = IsolatedWindowsEnvironmentShareFolderRequestOptions::Unwrap<IsolatedWindowsEnvironmentShareFolderRequestOptions>(info.This());

      try  {
        bool result = wrapper->_instance->AllowWrite;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void AllowWriteSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsBoolean()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentShareFolderRequestOptions *wrapper = IsolatedWindowsEnvironmentShareFolderRequestOptions::Unwrap<IsolatedWindowsEnvironmentShareFolderRequestOptions>(info.This());

      try {

        bool winRtValue = Nan::To<bool>(value).FromMaybe(false);

        wrapper->_instance->AllowWrite = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      


    private:
      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentShareFolderRequestOptions(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^ UnwrapIsolatedWindowsEnvironmentShareFolderRequestOptions(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsEnvironmentShareFolderRequestOptions::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentShareFolderRequestOptions(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsEnvironmentShareFolderRequestOptions::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderRequestOptions^ UnwrapIsolatedWindowsEnvironmentShareFolderRequestOptions(Local<Value> value) {
     return IsolatedWindowsEnvironmentShareFolderRequestOptions::Unwrap<IsolatedWindowsEnvironmentShareFolderRequestOptions>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsEnvironmentShareFolderRequestOptions(Local<Object> exports) {
    IsolatedWindowsEnvironmentShareFolderRequestOptions::Init(exports);
  }

  class IsolatedWindowsEnvironmentShareFolderResult : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsEnvironmentShareFolderResult").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("extendedError").ToLocalChecked(), ExtendedErrorGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("status").ToLocalChecked(), StatusGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentShareFolderResult").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsEnvironmentShareFolderResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderResult^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderResult^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderResult^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderResult^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsEnvironmentShareFolderResult *wrapperInstance = new IsolatedWindowsEnvironmentShareFolderResult(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderResult^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderResult^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderResult^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentShareFolderResult(winRtInstance));
    }





    static void ExtendedErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentShareFolderResult *wrapper = IsolatedWindowsEnvironmentShareFolderResult::Unwrap<IsolatedWindowsEnvironmentShareFolderResult>(info.This());

      try  {
        ::Windows::Foundation::HResult result = wrapper->_instance->ExtendedError;
        info.GetReturnValue().Set(Nan::New<Integer>(result.Value));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void StatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentShareFolderResult *wrapper = IsolatedWindowsEnvironmentShareFolderResult::Unwrap<IsolatedWindowsEnvironmentShareFolderResult>(info.This());

      try  {
        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderStatus result = wrapper->_instance->Status;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderResult^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentShareFolderResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderResult^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderResult^ UnwrapIsolatedWindowsEnvironmentShareFolderResult(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsEnvironmentShareFolderResult::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentShareFolderResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderResult^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsEnvironmentShareFolderResult::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentShareFolderResult^ UnwrapIsolatedWindowsEnvironmentShareFolderResult(Local<Value> value) {
     return IsolatedWindowsEnvironmentShareFolderResult::Unwrap<IsolatedWindowsEnvironmentShareFolderResult>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsEnvironmentShareFolderResult(Local<Object> exports) {
    IsolatedWindowsEnvironmentShareFolderResult::Init(exports);
  }

  class IsolatedWindowsEnvironmentStartProcessResult : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsEnvironmentStartProcessResult").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("extendedError").ToLocalChecked(), ExtendedErrorGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("process").ToLocalChecked(), ProcessGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("status").ToLocalChecked(), StatusGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentStartProcessResult").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsEnvironmentStartProcessResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsEnvironmentStartProcessResult *wrapperInstance = new IsolatedWindowsEnvironmentStartProcessResult(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentStartProcessResult(winRtInstance));
    }





    static void ExtendedErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentStartProcessResult *wrapper = IsolatedWindowsEnvironmentStartProcessResult::Unwrap<IsolatedWindowsEnvironmentStartProcessResult>(info.This());

      try  {
        ::Windows::Foundation::HResult result = wrapper->_instance->ExtendedError;
        info.GetReturnValue().Set(Nan::New<Integer>(result.Value));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void ProcessGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentStartProcessResult *wrapper = IsolatedWindowsEnvironmentStartProcessResult::Unwrap<IsolatedWindowsEnvironmentStartProcessResult>(info.This());

      try  {
        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentProcess^ result = wrapper->_instance->Process;
        info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentProcess(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void StatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentStartProcessResult *wrapper = IsolatedWindowsEnvironmentStartProcessResult::Unwrap<IsolatedWindowsEnvironmentStartProcessResult>(info.This());

      try  {
        ::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessStatus result = wrapper->_instance->Status;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentStartProcessResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^ UnwrapIsolatedWindowsEnvironmentStartProcessResult(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsEnvironmentStartProcessResult::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentStartProcessResult(::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsEnvironmentStartProcessResult::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentStartProcessResult^ UnwrapIsolatedWindowsEnvironmentStartProcessResult(Local<Value> value) {
     return IsolatedWindowsEnvironmentStartProcessResult::Unwrap<IsolatedWindowsEnvironmentStartProcessResult>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsEnvironmentStartProcessResult(Local<Object> exports) {
    IsolatedWindowsEnvironmentStartProcessResult::Init(exports);
  }

  class IsolatedWindowsEnvironmentTelemetryParameters : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsEnvironmentTelemetryParameters").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("correlationId").ToLocalChecked(), CorrelationIdGetter, CorrelationIdSetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentTelemetryParameters").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsEnvironmentTelemetryParameters(::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsEnvironmentTelemetryParameters *wrapperInstance = new IsolatedWindowsEnvironmentTelemetryParameters(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentTelemetryParameters(winRtInstance));
    }





    static void CorrelationIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentTelemetryParameters *wrapper = IsolatedWindowsEnvironmentTelemetryParameters::Unwrap<IsolatedWindowsEnvironmentTelemetryParameters>(info.This());

      try  {
        ::Platform::Guid result = wrapper->_instance->CorrelationId;
        info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void CorrelationIdSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsGuid(value)) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentTelemetryParameters *wrapper = IsolatedWindowsEnvironmentTelemetryParameters::Unwrap<IsolatedWindowsEnvironmentTelemetryParameters>(info.This());

      try {

        ::Platform::Guid winRtValue = NodeRT::Utils::GuidFromJs(value);

        wrapper->_instance->CorrelationId = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      


    private:
      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentTelemetryParameters(::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^ UnwrapIsolatedWindowsEnvironmentTelemetryParameters(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsEnvironmentTelemetryParameters::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentTelemetryParameters(::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsEnvironmentTelemetryParameters::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentTelemetryParameters^ UnwrapIsolatedWindowsEnvironmentTelemetryParameters(Local<Value> value) {
     return IsolatedWindowsEnvironmentTelemetryParameters::Unwrap<IsolatedWindowsEnvironmentTelemetryParameters>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsEnvironmentTelemetryParameters(Local<Object> exports) {
    IsolatedWindowsEnvironmentTelemetryParameters::Init(exports);
  }

  class IsolatedWindowsEnvironmentUserInfo : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsEnvironmentUserInfo").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);

        Local<Function> func;
        Local<FunctionTemplate> funcTemplate;


          
            Nan::SetPrototypeMethod(localRef, "tryWaitForSignInAsync", TryWaitForSignInAsync);
            Nan::SetPrototypeMethod(localRef, "tryWaitForSignInWithProgressAsync", TryWaitForSignInWithProgressAsync);
          


          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("environmentUserName").ToLocalChecked(), EnvironmentUserNameGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("environmentUserSid").ToLocalChecked(), EnvironmentUserSidGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IsolatedWindowsEnvironmentUserInfo").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsEnvironmentUserInfo(::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsEnvironmentUserInfo *wrapperInstance = new IsolatedWindowsEnvironmentUserInfo(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsEnvironmentUserInfo(winRtInstance));
    }

    static void TryWaitForSignInAsync(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^>(info.This())) {
        return;
      }

      if (info.Length() == 0 || !info[info.Length() -1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
        return;
      }

      IsolatedWindowsEnvironmentUserInfo *wrapper = IsolatedWindowsEnvironmentUserInfo::Unwrap<IsolatedWindowsEnvironmentUserInfo>(info.This());

      ::Windows::Foundation::IAsyncOperation<bool>^ op;


      if (info.Length() == 1)
      {
        try
        {
          op = wrapper->_instance->TryWaitForSignInAsync();
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }

      auto opTask = create_task(op);
      uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());

      opTask.then( [asyncToken] (task<bool> t) {
        try {
          auto result = t.get();
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {


            Local<Value> error;
            Local<Value> arg1;
            {
              TryCatch tryCatch;
              arg1 = Nan::New<Boolean>(result);
              if (tryCatch.HasCaught())
              {
                error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
              }
              else
              {
                error = Undefined();
              }
              if (arg1.IsEmpty()) arg1 = Undefined();
            }
            Local<Value> args[] = {error, arg1};


            invokeCallback(_countof(args), args);
          });
        } catch (Platform::Exception^ exception) {
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
            Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);

            Local<Value> args[] = {error};
            invokeCallback(_countof(args), args);
          });
        }
      });
    }
    static void TryWaitForSignInWithProgressAsync(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^>(info.This())) {
        return;
      }

      if (info.Length() == 0 || !info[info.Length() -1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
        return;
      }

      IsolatedWindowsEnvironmentUserInfo *wrapper = IsolatedWindowsEnvironmentUserInfo::Unwrap<IsolatedWindowsEnvironmentUserInfo>(info.This());

      ::Windows::Foundation::IAsyncOperationWithProgress<bool, ::Windows::Security::Isolation::IsolatedWindowsEnvironmentSignInProgress>^ op;


      if (info.Length() == 1)
      {
        try
        {
          op = wrapper->_instance->TryWaitForSignInWithProgressAsync();
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }

      auto opTask = create_task(op);
      uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());

      opTask.then( [asyncToken] (task<bool> t) {
        try {
          auto result = t.get();
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {


            Local<Value> error;
            Local<Value> arg1;
            {
              TryCatch tryCatch;
              arg1 = Nan::New<Boolean>(result);
              if (tryCatch.HasCaught())
              {
                error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
              }
              else
              {
                error = Undefined();
              }
              if (arg1.IsEmpty()) arg1 = Undefined();
            }
            Local<Value> args[] = {error, arg1};


            invokeCallback(_countof(args), args);
          });
        } catch (Platform::Exception^ exception) {
          NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
            Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);

            Local<Value> args[] = {error};
            invokeCallback(_countof(args), args);
          });
        }
      });
    }




    static void EnvironmentUserNameGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentUserInfo *wrapper = IsolatedWindowsEnvironmentUserInfo::Unwrap<IsolatedWindowsEnvironmentUserInfo>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->EnvironmentUserName;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void EnvironmentUserSidGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^>(info.This())) {
        return;
      }

      IsolatedWindowsEnvironmentUserInfo *wrapper = IsolatedWindowsEnvironmentUserInfo::Unwrap<IsolatedWindowsEnvironmentUserInfo>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->EnvironmentUserSid;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentUserInfo(::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^ UnwrapIsolatedWindowsEnvironmentUserInfo(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsEnvironmentUserInfo::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsEnvironmentUserInfo(::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsEnvironmentUserInfo::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsEnvironmentUserInfo^ UnwrapIsolatedWindowsEnvironmentUserInfo(Local<Value> value) {
     return IsolatedWindowsEnvironmentUserInfo::Unwrap<IsolatedWindowsEnvironmentUserInfo>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsEnvironmentUserInfo(Local<Object> exports) {
    IsolatedWindowsEnvironmentUserInfo::Init(exports);
  }

  class IsolatedWindowsHostMessenger : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IsolatedWindowsHostMessenger").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);

        Nan::SetMethod(constructor, "registerHostMessageReceiver", RegisterHostMessageReceiver);
        Nan::SetMethod(constructor, "unregisterHostMessageReceiver", UnregisterHostMessageReceiver);
        Nan::SetMethod(constructor, "postMessageToReceiver", PostMessageToReceiver);
        Nan::SetMethod(constructor, "getFileId", GetFileId);


        Nan::Set(exports, Nan::New<String>("IsolatedWindowsHostMessenger").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IsolatedWindowsHostMessenger(::Windows::Security::Isolation::IsolatedWindowsHostMessenger^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Security::Isolation::IsolatedWindowsHostMessenger^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsHostMessenger^>(info[0])) {
        try {
          winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsHostMessenger^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IsolatedWindowsHostMessenger *wrapperInstance = new IsolatedWindowsHostMessenger(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::IsolatedWindowsHostMessenger^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Security::Isolation::IsolatedWindowsHostMessenger^ winRtInstance;
      try {
        winRtInstance = (::Windows::Security::Isolation::IsolatedWindowsHostMessenger^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIsolatedWindowsHostMessenger(winRtInstance));
    }





    static void RegisterHostMessageReceiver(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 2
        && NodeRT::Utils::IsGuid(info[0])
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Security::Isolation::HostMessageReceivedCallback^>(info[1]))
      {
        try
        {
          ::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
          ::Windows::Security::Isolation::HostMessageReceivedCallback^ arg1 = dynamic_cast<::Windows::Security::Isolation::HostMessageReceivedCallback^>(NodeRT::Utils::GetObjectInstance(info[1]));
          
          ::Windows::Security::Isolation::IsolatedWindowsHostMessenger::RegisterHostMessageReceiver(arg0, arg1);
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else  {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }

    static void UnregisterHostMessageReceiver(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 1
        && NodeRT::Utils::IsGuid(info[0]))
      {
        try
        {
          ::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
          
          ::Windows::Security::Isolation::IsolatedWindowsHostMessenger::UnregisterHostMessageReceiver(arg0);
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else  {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }

    static void PostMessageToReceiver(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 2
        && NodeRT::Utils::IsGuid(info[0])
        && (NodeRT::Utils::IsWinRtWrapperOf<::Windows::Foundation::Collections::IVectorView<::Platform::Object^>^>(info[1]) || info[1]->IsArray()))
      {
        try
        {
          ::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
          ::Windows::Foundation::Collections::IVectorView<::Platform::Object^>^ arg1 = 
            [] (v8::Local<v8::Value> value) -> ::Windows::Foundation::Collections::IVectorView<::Platform::Object^>^
            {
              if (value->IsArray())
              {
                return NodeRT::Collections::JsArrayToWinrtVectorView<::Platform::Object^>(value.As<Array>(), 
                 [](Local<Value> value) -> bool {
                   return NodeRT::Utils::IsWinRtWrapperOf<::Platform::Object^>(value);
                 },
                 [](Local<Value> value) -> ::Platform::Object^ {
                   return dynamic_cast<::Platform::Object^>(NodeRT::Utils::GetObjectInstance(value));
                 }
                );
              }
              else
              {
                return dynamic_cast<::Windows::Foundation::Collections::IVectorView<::Platform::Object^>^>(NodeRT::Utils::GetObjectInstance(value));
              }
            } (info[1]);
          
          ::Windows::Security::Isolation::IsolatedWindowsHostMessenger::PostMessageToReceiver(arg0, arg1);
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else  {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }

    static void GetFileId(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 1
        && info[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          
          ::Platform::Guid result;
          result = ::Windows::Security::Isolation::IsolatedWindowsHostMessenger::GetFileId(arg0);
          info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else  {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    private:
      ::Windows::Security::Isolation::IsolatedWindowsHostMessenger^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIsolatedWindowsHostMessenger(::Windows::Security::Isolation::IsolatedWindowsHostMessenger^ wintRtInstance);
      friend ::Windows::Security::Isolation::IsolatedWindowsHostMessenger^ UnwrapIsolatedWindowsHostMessenger(Local<Value> value);
  };

  Persistent<FunctionTemplate> IsolatedWindowsHostMessenger::s_constructorTemplate;

  v8::Local<v8::Value> WrapIsolatedWindowsHostMessenger(::Windows::Security::Isolation::IsolatedWindowsHostMessenger^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IsolatedWindowsHostMessenger::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Security::Isolation::IsolatedWindowsHostMessenger^ UnwrapIsolatedWindowsHostMessenger(Local<Value> value) {
     return IsolatedWindowsHostMessenger::Unwrap<IsolatedWindowsHostMessenger>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIsolatedWindowsHostMessenger(Local<Object> exports) {
    IsolatedWindowsHostMessenger::Init(exports);
  }


} } } } 

NAN_MODULE_INIT(init) {
  // We ignore failures for now since it probably means that
  // the initialization already happened for STA, and that's cool

  CoInitializeEx(nullptr, COINIT_MULTITHREADED);

  /*
  if (FAILED(CoInitializeEx(nullptr, COINIT_MULTITHREADED))) {
    Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"error in CoInitializeEx()")));
    return;
  }
  */

      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentActivatorEnum(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentAllowedClipboardFormatsEnum(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentAvailablePrintersEnum(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentClipboardCopyPasteDirectionsEnum(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentCreateStatusEnum(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentCreationPriorityEnum(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentHostErrorEnum(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentLaunchFileStatusEnum(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentOwnerRegistrationStatusEnum(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentPostMessageStatusEnum(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentProcessStateEnum(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentProgressStateEnum(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentShareFileStatusEnum(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentShareFolderStatusEnum(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentSignInProgressEnum(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentStartProcessStatusEnum(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironment(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentCreateResult(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentFile(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentHost(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentLaunchFileResult(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentOptions(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentOwnerRegistration(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentOwnerRegistrationData(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentOwnerRegistrationResult(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentPostMessageResult(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentProcess(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentShareFileRequestOptions(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentShareFileResult(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentShareFolderRequestOptions(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentShareFolderResult(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentStartProcessResult(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentTelemetryParameters(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsEnvironmentUserInfo(target);
      NodeRT::Windows::Security::Isolation::InitIsolatedWindowsHostMessenger(target);


  NodeRT::Utils::RegisterNameSpace("Windows.Security.Isolation", target);
}



NODE_MODULE(binding, init)
