Example #1
0
EndPoint::EndPoint(const char *const name, const char *const location, const Parameters /*params*/) :
  mName(name),
  mLocation(location),
  mContext(0),
  mNameMap(),
  mMessageFactory(),
  mNetworkThread(),
  mRunning(false),
  mStarted(false),
  mNetworkLock(),
  mConnectQueue(),
  mSendQueue()
{
    THERON_ASSERT_MSG(!mName.IsNull(), "Must supply a unique, non-null name for each endpoint");
    THERON_ASSERT_MSG(!mLocation.IsNull(), "Must supply a valid port address for each endpoint");

    // Initialize the per-process context.
    mContext = InitializeContext();

    // Don't start the network thread if networking isn't enabled.
    if (mContext->Enabled())
    {
        // Start the network thread.
        mRunning = true;
        mNetworkThread.Start(NetworkThreadEntryPoint, this);

        // Wait for the network thread to start.
        uint32_t backoff(0);
        while (!mStarted)
        {
            Detail::Utils::Backoff(backoff);
        }
    }
}
/*{{{  PcmTranscoder_InitTransformer*/
static MME_ERROR PcmTranscoder_InitTransformer (MME_UINT ParamsSize, MME_GenericParams_t Params, void** ContextPointer)
{
    struct PcmContext_s*                        PcmContext;
    MME_LxAudioDecoderInitParams_t*             InitParams      = (MME_LxAudioDecoderInitParams_t*)Params;
    MME_LxAudioDecoderGlobalParams_t*           GlobalParams    = &InitParams->GlobalParams;
    MME_LxPcmAudioConfig_t*                     Config          = (MME_LxPcmAudioConfig_t*)GlobalParams->DecConfig;
    MME_ERROR                                   Status;

    *ContextPointer             = NULL;
    PcmContext                  = kmalloc (sizeof (struct PcmContext_s), GFP_KERNEL);
    if (PcmContext == NULL)
    {
        PCM_ERROR("Unable to allocate memory for context\n");
        return MME_NOMEM;
    }

    Status                      = InitializeContext (PcmContext, Config);
    if (Status == MME_SUCCESS)
        *ContextPointer         = PcmContext;
    else
    {
        kfree (PcmContext);
        PCM_ERROR("Failed to initialize decode context\n");
    }

    return Status;
}
/*++

Routine Description:

    This function is executed when a Start command is sent to the
    service by the SCM or when the operating system starts (for a service
    that starts automatically). It specifies actions to take when the
    service starts. In this code sample, OnStart logs a service-start
    message to the Application log, and queues the main service function for
    execution in a thread pool worker thread.

    NOTE: A service application is designed to be long running. Therefore,
          it usually polls or monitors something in the system. The monitoring is
          set up in the OnStart method. However, OnStart does not actually do the
          monitoring. The OnStart method must return to the operating system after
          the service's operation has begun. It must not loop forever or block. To
          set up a simple monitoring mechanism, one general solution is to create
          a timer in OnStart. The timer would then raise events in your code
          periodically, at which time your service could do its monitoring. The
          other solution is to spawn a new thread to perform the main service
          functions, which is demonstrated in this code sample.

Arguments:

    Argc - The number of command line arguments

    Argv - The array of command line arguments

Return Value:

    VOID

--*/
VOID
CSampleService::OnStart(
    DWORD  Argc,
    PWSTR *Argv
    )
{
	__debugbreak();

    //
    // Log a service start message to the Application log.
    //
    WriteToEventLog(L"SampleService in OnStart", 
                    EVENTLOG_INFORMATION_TYPE);

    //
    // Set up any variables the service needs.
    //
    SetVariables();

    //
    // Set up the context, and register for notifications.
    //
    InitializeContext(&m_Context);

    //
    // Queue the main service function for execution in a worker thread.
    //
    CThreadPool::QueueUserWorkItem(&CSampleService::ServiceWorkerThread, this);
}
Example #4
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCmdLine, int nCmdShow)
{
	g_hInstance = hInstance;

	InitializeContext();
	InitializeWindow();

	g_VkSwapchain.Initialize();
	g_VkSwapchain.InitializeSwapchain(kScreenWidth, kScreenHeight, false);

	InitializeRenderSettings();

	while (true)
	{
		PollEvents();

		if (g_CloseRequest)
		{
			break;
		}

		DrawScene();
	}

	DestroyRenderSettings();
	g_VkSwapchain.Destroy();
	DestroyWindow();
	DestroyContext();
	return 0;
}
Example #5
0
bool szHelpController::AddBook(const wxString& book)
{
    bool retval = wxHtmlHelpControllerEx::AddBook(book); 

    if (retval) 
	return InitializeContext(book.BeforeLast('.') + _T(".map"));
    return FALSE;
}
NTSTATUS AndroidUsbFileObject::Initialize() {
  ASSERT_IRQL_LOW();
  ASSERT(NULL != wdf_file());
  if (NULL == wdf_file())
    return STATUS_INTERNAL_ERROR;
  
  // Register context for this file object
  return InitializeContext();
}
Example #7
0
	AssetsFoldersTree::AssetsFoldersTree(const AssetsFoldersTree& other):
		Widget(other)
	{
		mFoldersTree = FindChildByType<Tree>();
		RemoveChild(FindChildByType<ContextMenu>());

		InitializeContext();

		RetargetStatesAnimations();
		SetLayoutDirty();
	}
/*initalizes all needed objects for opencl
OCLHandle - Datastructure containg the opencl objects
*/
bool SetupOpenCLEnvironment( OpenCLData * OCLHandle)
{
	InitializePlatform(OCLHandle);
	InitializeDevice(OCLHandle);
	InitializeContext(OCLHandle);
	InitializeProgram(OCLHandle);
	InitializeKernels(OCLHandle);
	InitializeQueue(OCLHandle);

	return true;
}
/*{{{  PcmTranscoder_SetGlobalParams*/
static MME_ERROR PcmTranscoder_SetGlobalParams(void* Context, MME_Command_t* Command)
{
    struct PcmContext_s*                PcmContext      = (struct PcmContext_s*)Context;
    MME_LxAudioDecoderGlobalParams_t*   GlobalParams    = Command->Param_p;
    MME_CommandStatus_t*                CommandStatus   = &Command->CmdStatus;
    MME_LxPcmAudioConfig_t*             Config          = (MME_LxPcmAudioConfig_t*)GlobalParams->DecConfig;

    CommandStatus->Error        = InitializeContext (PcmContext, Config);
    CommandStatus->State        = MME_COMMAND_COMPLETED;

    return CommandStatus->Error;
}
Example #10
0
	void AssetsFoldersTree::CopyData(const Actor& otherActor)
	{
		const AssetsFoldersTree& other = dynamic_cast<const AssetsFoldersTree&>(otherActor);

		Widget::CopyData(other);

		mFoldersTree = FindChildByType<Tree>();
		RemoveChild(FindChildByType<ContextMenu>());

		InitializeContext();

		RetargetStatesAnimations();
		SetLayoutDirty();
	}
Example #11
0
static void InitializeHyperloopVM() 
#endif
{
    globalContextGroupRef = JSContextGroupCreate();
#ifdef USE_TIJSCORE
    globalContextRef = ctx;
#else
    JSContextGroupRetain(globalContextGroupRef);
    globalContextRef = JSGlobalContextCreateInGroup(globalContextGroupRef,nullptr);
#endif

    // initialize
    InitializeContext(globalContextRef);

    // retain it
    JSGlobalContextRetain(globalContextRef);
}
Example #12
0
File: dem.c Project: GYGit/reactos
VOID DosBootsectorInitialize(VOID)
{
    /* We write the bootsector at 0000:7C00 */
    ULONG_PTR StartAddress = (ULONG_PTR)SEG_OFF_TO_PTR(0x0000, 0x7C00);
    ULONG_PTR Address = StartAddress;
    CHAR DosKernelFileName[] = ""; // No DOS BIOS file name, therefore we will load DOS32

    DPRINT("DosBootsectorInitialize\n");

    /* Write the "bootsector" */
    RtlCopyMemory((PVOID)Address, Bootsector1, sizeof(Bootsector1));
    Address += sizeof(Bootsector1);
    RtlCopyMemory((PVOID)Address, DosKernelFileName, sizeof(DosKernelFileName));
    Address += sizeof(DosKernelFileName);
    RtlCopyMemory((PVOID)Address, Bootsector2, sizeof(Bootsector2));
    Address += sizeof(Bootsector2);

    /* Initialize the callback context */
    InitializeContext(&DosContext, 0x0000,
                      (ULONG_PTR)MEM_ALIGN_UP(0x7C00 + Address - StartAddress, sizeof(WORD)));

    /* Register the DOS Loading BOP */
    RegisterBop(BOP_LOAD_DOS, DosInitialize);
}
Example #13
0
	AssetsFoldersTree::AssetsFoldersTree():
		Widget()
	{
		if (!UIManager::IsSingletonInitialzed())
			return;

		mFoldersTree = o2UI.CreateWidget<Tree>("folders");
		*mFoldersTree->layout = WidgetLayout::BothStretch();

		mFoldersTree->SetRearrangeType(Tree::RearrangeType::OnlyReparent);
		mFoldersTree->SetMultipleSelectionAvailable(false);

		mFoldersTree->getObjectParentDelegate = THIS_FUNC(GetFoldersTreeNodeParent);
		mFoldersTree->getObjectChildrenDelegate = THIS_FUNC(GetFoldersTreeNodeChilds);
		mFoldersTree->fillNodeDataByObjectDelegate = THIS_FUNC(SetupFoldersTreeNode);
		mFoldersTree->onNodeDoubleClicked = THIS_FUNC(OnFoldersTreeNodeDblClick);
		mFoldersTree->onObjectsSelectionChanged = THIS_FUNC(OnFoldersTreeSelect);
		mFoldersTree->onNodeRightButtonClicked = THIS_FUNC(OnFoldersTreeRightClick);
		mFoldersTree->UpdateNodesView();

		AddChild(mFoldersTree);

		InitializeContext();
	}
Example #14
0
/**
 * return a new global context initialized with Hyperloop global objects
 */
EXPORTAPI JSGlobalContextRef HyperloopNewGlobalContext()
{
    auto ctx = JSGlobalContextCreate(nullptr);
    InitializeContext(ctx);
    return ctx;
}
Example #15
0
int main(int argc, char *args[])
{
#if _WIN32
	// NOTE(nathan): Set the windows schedular granularity to 1ms
	// so that our SDL_Delay() and be more granular

	// SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); 
	// NOTE(nathan): This seems to give a more consistant result than above
	timeBeginPeriod(1);
#if _DEBUG
	HWND console = GetConsoleWindow();
	if(console != 0)
	MoveWindow(console, -900, 100, 700, 800, TRUE);
#endif
#endif
	SDL_Init(SDL_INIT_EVERYTHING);

	// NOTE(nathan): This also initializes the window_with and window_height
	WindowData window_data = { };
	window_data.target_width = 1920;
	window_data.target_height = 1080;

	FixViewport(1280, 720, &window_data);

	SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 32);
	SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
	//SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
	//SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 4);

	SDL_Window *window = SDL_CreateWindow(
		"Banana",
		SDL_WINDOWPOS_CENTERED,
		SDL_WINDOWPOS_CENTERED,
		window_data.width, window_data.height,
		SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL);

	// ToggleFullScreen(window);
	SDL_ShowCursor(SDL_DISABLE);
	// OutputSystemInfo();
	SDL_GLContext glContext = SDL_GL_CreateContext(window);
	glewExperimental = GL_TRUE;
	if (glewInit() != GLEW_OK) Error("glewInit");

	// Goes stuttery if we turn on vsync
	SDL_GL_SetSwapInterval((int)window_data.vsync);
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glEnable(GL_CULL_FACE);
	glCullFace(GL_BACK);
	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

	bool running = true;
	SDL_Event e;

	uint32 gameUpdateHz = 60;
	float32 targetSecondsPerFrame = 1.0f / (float32)gameUpdateHz;

	perfCountFreq = SDL_GetPerformanceFrequency();
	uint64 lastCounter = GetWallClock();

	GameMemory game_memory = { 0 };
	game_memory.size = Megabytes(64);
	game_memory.memory = SDL_malloc(game_memory.size);

	EditorMemory editor_memory = { 0 };
	editor_memory.size = Megabytes(64);
	editor_memory.memory = SDL_malloc(editor_memory.size);

	RenderContext render_context = {};
	render_context.diffuse = CreateShader("assets/shaders/diffuse.vert", "assets/shaders/diffuse.frag");
	InitializeContext(&render_context);

	VoxelRenderContext voxel_render_context = {};
	voxel_render_context.diffuse = CreateShader("assets/shaders/voxels.vert", "assets/shaders/voxels.frag");
	InitializeVoxelContext(&voxel_render_context);

	InputData input = { };
	input.window = window;

	UIContext ui_context = { 0 };
	ui_context.input = &input;
	ui_context.render_context = &render_context;

	Mode mode = MODE_GAME;

	bool game_paused = false;

	while (running)
	{
		while (SDL_PollEvent(&e))
		{
			if (e.type == SDL_QUIT)
				running = false;
			if (e.type == SDL_WINDOWEVENT)
			{
				if (e.window.event == SDL_WINDOWEVENT_RESIZED)
				{
					FixViewport((int)e.window.data1, (int)e.window.data2, &window_data);
				}
			}
			if (e.type == SDL_KEYDOWN)
			{
				SDL_Scancode key = e.key.keysym.scancode;
				input.keyboard_state[key] = true;
				if (key == SDL_SCANCODE_ESCAPE)
					running = false;
				if (key == SDL_SCANCODE_F12)
					window_data.vsync = !window_data.vsync;
				if (key == SDL_SCANCODE_F11)
					ToggleFullScreen(window, &window_data);
				if (key == SDL_SCANCODE_F10)
				{
					if (mode == MODE_GAME)
					{
						game_paused = true;
						mode = MODE_EDITOR;
					}
					else
					{
						mode = MODE_GAME;
						game_paused = false;
					}
				}
			}
			if (e.type == SDL_KEYUP)
			{
				SDL_Scancode key = e.key.keysym.scancode;
				input.keyboard_state[key] = false;
			}
			if (e.type == SDL_MOUSEMOTION)
			{
				input.mouse_pos.x = (((float)window_data.target_width / (float)window_data.vp_width) 
					* ((float)e.motion.x - window_data.vp_x));
				input.mouse_pos.y = (((float)window_data.target_height / (float)window_data.vp_height) 
					* ((float)e.motion.y - window_data.vp_y));
			}
			if (e.type == SDL_MOUSEBUTTONDOWN)
			{
				if (e.button.button == SDL_BUTTON_LEFT)
					input.mb_left = true;
				if (e.button.button == SDL_BUTTON_RIGHT)
					input.mb_right = true;
				if (e.button.button == SDL_BUTTON_MIDDLE)
					input.mb_middle = true;
			}
			if (e.type == SDL_MOUSEBUTTONUP)
			{
				if (e.button.button == SDL_BUTTON_LEFT)
					input.mb_left = false;
				if (e.button.button == SDL_BUTTON_RIGHT)
					input.mb_right = false;
				if (e.button.button == SDL_BUTTON_MIDDLE)
					input.mb_middle = false;
			}
		}

		float32 delta = 1.0f / (float32)gameUpdateHz;

		GameUpdateAndRender(&game_memory, &input, &render_context, &voxel_render_context, 
			&window_data, game_paused, delta);

		uint64 workCounter = GetWallClock();
		float32 workSecondsElapsed = GetSecondsElapsed(lastCounter, workCounter);
		// Dont include this in frametime
		if (mode == MODE_EDITOR)
			EditorUpdateAndRender(&editor_memory, &input, &render_context, &ui_context, delta);

		float32 secondsElapsedForFrame = workSecondsElapsed;
		if (secondsElapsedForFrame < targetSecondsPerFrame)
		{
			uint32 sleepMS = (uint32)((1000.0f * (targetSecondsPerFrame - secondsElapsedForFrame)) - 1);
			if (sleepMS > 0)
				SDL_Delay(sleepMS);
			while (secondsElapsedForFrame < targetSecondsPerFrame)
			{
				secondsElapsedForFrame = GetSecondsElapsed(lastCounter, GetWallClock());
			}
		}
		else
		{
			// Error("Missed Frame Rate");
		}

		uint64 endCounter = GetWallClock();
		float64 msPerFrame = 1000.0f * GetSecondsElapsed(lastCounter, endCounter);
		lastCounter = endCounter;

		// Debug Render
		BeginRenderer(&render_context);

		std::string s = "FRAMETIME " + std::to_string(msPerFrame) + " VSYNC " + std::to_string(window_data.vsync);
		RenderString(&render_context, 40.0f, 40.0f, s.c_str(), 0.0f);


		EndRenderer();

		SDL_GL_SwapWindow(window);
		input.prev_keyboard_state = input.keyboard_state;
		input.mb_left_prev = input.mb_left;
		input.mb_right_prev = input.mb_right;
		input.mb_middle_prev = input.mb_middle;
	}
	UnloadContext(&render_context);
	UnloadVoxelContext(&voxel_render_context);
	SDL_free(game_memory.memory);

	SDL_GL_DeleteContext(glContext);
	SDL_DestroyWindow(window);
	SDL_Quit();
	return(0);
}
Example #16
0
File: dem.c Project: GYGit/reactos
static VOID WINAPI DosStart(LPWORD Stack)
{
    BOOLEAN Success;
    DWORD Result;
#ifndef STANDALONE
    INT i;
#endif

    DPRINT("DosStart\n");

    /*
     * We succeeded, deregister the DOS Starting BOP
     * so that no app will be able to call us back.
     */
    RegisterBop(BOP_START_DOS, NULL);

    /* Initialize the callback context */
    InitializeContext(&DosContext, BIOS_CODE_SEGMENT, 0x0010);

    Success  = DosBIOSInitialize();
//  Success &= DosKRNLInitialize();
    if (!Success)
    {
        BiosDisplayMessage("DOS32 loading failed (Error: %u). The VDM will shut down.\n", GetLastError());
        EmulatorTerminate();
        return;
    }

    /* Load the mouse driver */
    DosMouseInitialize();

#ifndef STANDALONE

    /* Parse the command line arguments */
    for (i = 1; i < NtVdmArgc; i++)
    {
        if (wcsncmp(NtVdmArgv[i], L"-i", 2) == 0)
        {
            /* This is the session ID (hex format) */
            SessionId = wcstoul(NtVdmArgv[i] + 2, NULL, 16);
        }
    }

    /* Initialize Win32-VDM environment */
    Env = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, EnvSize);
    if (Env == NULL)
    {
        DosDisplayMessage("Failed to initialize the global environment (Error: %u). The VDM will shut down.\n", GetLastError());
        EmulatorTerminate();
        return;
    }

    /* Clear the structure */
    RtlZeroMemory(&CommandInfo, sizeof(CommandInfo));

    /* Get the initial information */
    CommandInfo.TaskId = SessionId;
    CommandInfo.VDMState = VDM_GET_FIRST_COMMAND | VDM_FLAG_DOS;
    GetNextVDMCommand(&CommandInfo);

#else

    /* Retrieve the command to start */
    if (NtVdmArgc >= 2)
    {
        WideCharToMultiByte(CP_ACP, 0, NtVdmArgv[1], -1, AppName, sizeof(AppName), NULL, NULL);

        if (NtVdmArgc >= 3)
            WideCharToMultiByte(CP_ACP, 0, NtVdmArgv[2], -1, CmdLine, sizeof(CmdLine), NULL, NULL);
        else
            strcpy(CmdLine, "");
    }
    else
    {
        DosDisplayMessage("Invalid DOS command line\n");
        EmulatorTerminate();
        return;
    }

#endif

    /*
     * At this point, CS:IP points to the DOS BIOS exit code. If the
     * root command interpreter fails to start (or if it exits), DOS
     * exits and the VDM terminates.
     */

    /* Start the root command interpreter */
    // TODO: Really interpret the 'SHELL=' line of CONFIG.NT, and use it!

    /*
     * Prepare the stack for DosStartComSpec:
     * push Flags, CS and IP, and an extra WORD.
     */
    setSP(getSP() - sizeof(WORD));
    *((LPWORD)SEG_OFF_TO_PTR(getSS(), getSP())) = (WORD)getEFLAGS();
    setSP(getSP() - sizeof(WORD));
    *((LPWORD)SEG_OFF_TO_PTR(getSS(), getSP())) = getCS();
    setSP(getSP() - sizeof(WORD));
    *((LPWORD)SEG_OFF_TO_PTR(getSS(), getSP())) = getIP();
    setSP(getSP() - sizeof(WORD));

    Result = DosStartComSpec(TRUE, SEG_OFF_TO_PTR(SYSTEM_ENV_BLOCK, 0),
                             MAKELONG(getIP(), getCS()),
#ifndef STANDALONE
                             &RootCmd.ComSpecPsp
#else
                             NULL
#endif
                             );
    if (Result != ERROR_SUCCESS)
    {
        /* Unprepare the stack for DosStartComSpec */
        setSP(getSP() + 4*sizeof(WORD));

        DosDisplayMessage("Failed to start the Command Interpreter (Error: %u). The VDM will shut down.\n", Result);
        EmulatorTerminate();
        return;
    }

#ifndef STANDALONE
    RootCmd.Terminated = FALSE;
    InsertComSpecInfo(&RootCmd);
#endif

    /**/
    /* Attach to the console and resume the VM */
    DosProcessConsoleAttach();
    EmulatorResume();
    /**/

    return;
}
Example #17
0
	void InitSSLServer() {
		InitializeContext("", "comb.pem", "", SSLv23_method());
	}
NTSTATUS AndroidUsbDeviceObject::CreateFDODevice(PWDFDEVICE_INIT device_init) {
  ASSERT_IRQL_PASSIVE();

  ASSERT(!IsTaretDeviceCreated());
  if (IsTaretDeviceCreated())
    return STATUS_INTERNAL_ERROR;

  // Initialize our object attributes first
  WDF_OBJECT_ATTRIBUTES device_attr;
  NTSTATUS status = InitObjectAttributes(&device_attr, NULL);
  ASSERT(NT_SUCCESS(status));
  if (!NT_SUCCESS(status))
    return status;

  // Initialize the pnp_power_callbacks structure.  Callback events for PnP
  // and Power are specified here. If we don't supply any callbacks, the
  // KMDF will take appropriate default actions for an FDO device object.
  // EvtDevicePrepareHardware and EvtDeviceReleaseHardware are major entry
  // points for initializing / cleaning up our device. Probably, we can leave
  // the rest to the framework.
  WDF_PNPPOWER_EVENT_CALLBACKS pnp_power_callbacks;
  WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnp_power_callbacks);
  pnp_power_callbacks.EvtDevicePrepareHardware =
    EvtDevicePrepareHardwareEntry;
  pnp_power_callbacks.EvtDeviceReleaseHardware =
    EvtDeviceReleaseHardwareEntry;
  WdfDeviceInitSetPnpPowerEventCallbacks(device_init, &pnp_power_callbacks);

  // Initialize the request attributes to specify the context size and type
  // for every request created by framework for this device.
  WDF_OBJECT_ATTRIBUTES request_attr;
  WDF_OBJECT_ATTRIBUTES_INIT(&request_attr);
  WDF_OBJECT_ATTRIBUTES_SET_CONTEXT_TYPE(&request_attr, AndroidUsbWdfRequestContext);
  WdfDeviceInitSetRequestAttributes(device_init, &request_attr);

  // Initialize WDF_FILEOBJECT_CONFIG_INIT struct to tell the KMDF that we are
  // interested in handling Create requests that get genereated when an
  // application or another kernel component opens a handle through the device.
  // We are not interested in receiving cleanup / close IRPs at this point.
  WDF_FILEOBJECT_CONFIG file_config;
  WDF_OBJECT_ATTRIBUTES file_attr;
  WDF_FILEOBJECT_CONFIG_INIT(&file_config,
                             EvtDeviceFileCreateEntry,
                             WDF_NO_EVENT_CALLBACK,
                             WDF_NO_EVENT_CALLBACK);
  WDF_OBJECT_ATTRIBUTES_INIT(&file_attr);
  WDF_OBJECT_ATTRIBUTES_SET_CONTEXT_TYPE(&file_attr,
                                         AndroidUsbWdfObjectContext);
  file_attr.EvtCleanupCallback = AndroidUsbWdfObject::EvtCleanupCallbackEntry;
  file_attr.EvtDestroyCallback = AndroidUsbWdfObject::EvtDestroyCallbackEntry;
  // We will provide our own synchronization for file access
  file_attr.SynchronizationScope = WdfSynchronizationScopeNone;
  WdfDeviceInitSetFileObjectConfig(device_init, &file_config, &file_attr);

  // I/O type is buffered by default. It could be very inefficient if we have
  // large reads / writes through our device.
  WdfDeviceInitSetIoType(device_init, WdfDeviceIoDirect);

  // DeviceInit is completely initialized. So call the framework
  // to create the device and attach it to the lower stack.
  WDFDEVICE wdf_dev = NULL;
  status = WdfDeviceCreate(&device_init, &device_attr, &wdf_dev);
  ASSERT(NT_SUCCESS(status) && (NULL != wdf_dev));
  if (!NT_SUCCESS(status))
    return status;

  // Save handle to the created device
  set_wdf_object(wdf_dev);

  // Tell the framework to set the SurpriseRemovalOK in the DeviceCaps so
  // that we don't get the popup in usermode (on Win2K) when we surprise
  // remove the device.
  WDF_DEVICE_PNP_CAPABILITIES pnp_caps;
  WDF_DEVICE_PNP_CAPABILITIES_INIT(&pnp_caps);
  pnp_caps.SurpriseRemovalOK = WdfTrue;
  WdfDeviceSetPnpCapabilities(wdf_device(), &pnp_caps);

  // Create our default queue object for this device to start receiving I/O
  status = CreateDefaultQueue();
  ASSERT(NT_SUCCESS(status));
  if (!NT_SUCCESS(status))
    return status;

  // Register a device interface so that app can find our device and talk to it.
  status = WdfDeviceCreateDeviceInterface(wdf_device(), &android_guid, NULL);
  ASSERT(NT_SUCCESS(status));
  if (!NT_SUCCESS(status))
    return status;

  // Initialize our extension to that device. We will do this at the very end
  // so we know that we successfully passed entire device create chain when
  // we are called with other callbacks to that device.
  status = InitializeContext();
  ASSERT(NT_SUCCESS(status));
  if (!NT_SUCCESS(status))
    return status;

  return STATUS_SUCCESS;
}
void StatusSocket::InitSSLServer()
{
	InitializeContext("session_id", "server.pem", "keypwd", SSLv23_method());
}