how to OSX capture screen at pre-login session

I want to dev a daemon which will capture screen of my OSX at pre login session

I have try by using Quazt display service (stream) and core graphic framework but it still unavailable

my code using Quartz service

m_isExit = FALSE;
m_display = kCGDirectMainDisplay; // 1
m_displayMode = CGDisplayCopyDisplayMode(m_display);
if (m_display == NULL)
{
  throw Exception("OSX-Quart service Can not get Display mode ",VF_ERR_SCREEN_MONITOR_OSX_QUART_CREATE);
}

m_height = CGDisplayModeGetHeight(m_displayMode);
m_width = CGDisplayModeGetWidth(m_displayMode);


m_stream = CGDisplayStreamCreate(m_display,m_width,m_height,'BGRA',NULL,VncStreamFrameAvailableHandler);
if (m_stream == NULL)
{
  throw Exception("OSX-Quart service Can not create Stream",VF_ERR_SCREEN_MONITOR_OSX_QUART_CREATE);
}

it's always through exception. Another code using Core Graphic framework

m_mainDisplay = kCGDirectMainDisplay;
m_oriImage = CGDisplayCreateImage(m_mainDisplay);
if (m_oriImage == NULL)
{
  throw Exception ("Core Graphic Can not Create original Image from display",VF_ERR_SCREEN_MONITOR_OSX_CG_CREATE);
}
ScreenGetConfigure(m_oriImage);
screenData.m_oriImage = m_oriImage;
m_oriPixelDataRef = CGDataProviderCopyData(CGImageGetDataProvider(m_oriImage));

if (m_oriPixelDataRef == NULL)
{
  throw Exception ("Core Graphic Can not get pixel data ref",VF_ERR_SCREEN_MONITOR_OSX_CG_CREATE);
}

Both code is not working at pre-login session.

Hope somebody can help me to fix the issue

MacBook, OS X El Capitan (10.11)

I wonder if you were able to resolve it?

A daemon cannot reliable connect to the window server. For an in-depth discussion as to why, see Technote 2083 Daemons and Agents.

To capture the pre-login screen, you must use a pre-login agent. However, it’s likely that you’ll run into the problem (r. 5636091) described in the read me of the PreLoginAgents sample code.

It may be possible to work around that but that’s not something I can go into here on DevForums. If you really need a solution, I recommend that you open a DTS tech support incident and we can pick things up in that context.

IMPORTANT Make sure to reference this DevForums thread.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

how to OSX capture screen at pre-login session
 
 
Q