Пример #1
0
void showResults( List* resultsList, Item* resultsLevel )
{
    // Display header
    wprintf_s( TEXT( "    %19s %47s %12s %s\n" ),
        TEXT( "Date Modified" ),
        TEXT( "Coords" ),
        TEXT( "Size" ),
        TEXT( "Name" ) );

    wprintf_s( TEXT( "    %19s %47s %12s %s\n" ),
        TEXT( "-------------------" ),
        TEXT( "-----------------------------------------------" ),
        TEXT( "------------" ),
        TEXT( "--------------------------------" ) );

    // Display founded entries
    Traverse( resultsList, showItem );

    // Display totals
    wprintf_s( TEXT( "    %19s %47s %12s %s\n" ),
        TEXT( "-------------------" ),
        TEXT( "-----------------------------------------------" ),
        TEXT( "------------" ),
        TEXT( "--------------------------------" ) );

    showItem( resultsLevel );
}
Пример #2
0
void BadParameters()
{
	wprintf_s(L"Program have to run with one of these pamateres: \n");
	wprintf_s(L" -l list of current process with name and ID \n");
	wprintf_s(L" -d details about own process \n");
	wprintf_s(L" -k application creates child process and terminate it");
}
Пример #3
0
BOOL DumpSectionHeaders(IMAGE_NT_HEADERS *pNTHeaders)
{
    ASSERT(pNTHeaders != NULL);

    PIMAGE_SECTION_HEADER pFirstSecHeader = (PIMAGE_SECTION_HEADER)((DWORD)pNTHeaders +
        (DWORD)sizeof(pNTHeaders->Signature) +
        (DWORD)IMAGE_SIZEOF_FILE_HEADER +
        (DWORD)pNTHeaders->FileHeader.SizeOfOptionalHeader);

#ifdef _DEBUG
    PIMAGE_SECTION_HEADER pFirstSecHeader_Verify = IMAGE_FIRST_SECTION(pNTHeaders);

    if (!(pFirstSecHeader == pFirstSecHeader_Verify))
    {
        wprintf_s(L"Error calculating address of first section header.\n");
        return FALSE;
    }
#endif

    PIMAGE_SECTION_HEADER pCurSecHeader = pFirstSecHeader;

    // 
    wprintf_s(L"\n* IMAGE_SECTION_HEADER *\n");
    wprintf_s(L"%-8s  %10s  %10s  %11s  %8s\n", L"Name", L"VirtAddr", L"PtrRawData", L"RawDataSize", L"VirtSize");
    for (DWORD i = 0; i < pNTHeaders->FileHeader.NumberOfSections; ++i, ++pCurSecHeader)
    {
        wprintf_s(L"%-8S  0x%08x  0x%08x  0x%08x  0x%08x\n", pCurSecHeader->Name, pCurSecHeader->VirtualAddress,
            pCurSecHeader->PointerToRawData, pCurSecHeader->SizeOfRawData, pCurSecHeader->Misc.VirtualSize);
    }// for i

    return TRUE;
}// DumpSectionHeaders()
///////////////////////////////////////////////////////////////////////////////
//
// CSensorManagerEvents::GetSensorProperty
//
// Description of function/method:
//        Retrieves sensor properties to be stored for future reference
//
// Parameters:
//        SENSOR_ID SensorID:	Unique ID for sensor used as Key to std::MAP 
//		  ISensor* pSensor:		Sensor to be queried 
//		  REFPROPERTYKEY pk:	Property to be set, currently only Name is stored
//
// Return Values:
//        S_OK on success, else an error
//
///////////////////////////////////////////////////////////////////////////////
HRESULT CSensorManagerEvents::GetSensorProperty(SENSOR_ID SensorID, ISensor* pSensor, REFPROPERTYKEY pk)
{

    HRESULT hr = S_OK;

    PROPVARIANT pv = {};
    hr = pSensor->GetProperty(pk, &pv);

    if(SUCCEEDED(hr))
    {
        if(pv.vt == VT_UI4)  // Number
        {
            wprintf_s(L"\nSensor integer value: %u\n", pv.ulVal);
        }
        else if(pv.vt == VT_LPWSTR)  // String
        {
			if(pk == SENSOR_PROPERTY_FRIENDLY_NAME)
			{
				int size = (int)wcslen(pv.pwszVal)+1;
				m_Properties[SensorID].m_Name = (WCHAR*)malloc(size*sizeof(WCHAR));
				wsprintf(m_Properties[SensorID].m_Name,L"%s",pv.pwszVal);
			}
        }
        else  // Interface or vector
        {
            wprintf_s(L"\nSensor property is a compound type. Unable to print value.");
        }
    }

    PropVariantClear(&pv);
    return hr;    
}
Пример #5
0
int wmain(int argc, wchar_t* argv[])
{
    argc;
    argv;

    float c1[3] = { -1.f, 0.f, 0.f };
    float c2[3] = { 1.f,  0.f, 0.f };
    float r1 = 1.f;
    float r2 = 1.f;

    if (lib3d_basic_sphere_sphere(c1, r1, c2, r2))
    {
        wprintf_s(L"spheres overlap.\n");
    }

    float start[3] = { 0, 0, 0 };
    float dir[3] = { 0, 0, 1 };

    float centers[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, };
    float radius[] = { 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, };

    if (lib3d_basic_ray_spheres(start, dir, centers, radius, 9))
    {
        wprintf_s(L"ray hit a sphere.\n");
    }

    return 0;
}
Пример #6
0
void BenchmarkStdSort( int pLength )
{
	T *pArray = new T[pLength];
	for ( int i = 0; i < pLength; i++ )
		pArray[i] = rand( );

	std::vector<T> vec( pArray, pArray + pLength );

	wprintf_s( L"std::sort\n" );

	Timer t;
	t.Start( );
	std::sort( vec.begin( ), vec.end( ), std::less<T>( ) );
	t.Stop( );
	wprintf_s( L"Ascending  (random):            %0.2fms\n", t.GetTimeElapsed( ) );

	t.Start( );
	std::sort( vec.begin( ), vec.end( ), std::less<T>( ) );
	t.Stop( );
	wprintf_s( L"Ascending  (presorted):         %0.2fms\n", t.GetTimeElapsed( ) );

	t.Start( );
	std::sort( vec.begin( ), vec.end( ), std::greater<T>( ) );
	t.Stop( );
	wprintf_s( L"Ascending  (reverse presorted): %0.2fms\n\n", t.GetTimeElapsed( ) );

	delete[] pArray;
}
Пример #7
0
//Catch Control-C exception from keyboard.
BOOL WINAPI CtrlHandler(
	_In_ const DWORD fdwCtrlType)
{
//Print to screen.
	if (GlobalRunningStatus.Console)
	{
		switch (fdwCtrlType)
		{
			case CTRL_C_EVENT: //Handle the CTRL-C signal.
			{
				wprintf_s(L"Get Control-C.\n");
			}break;
			case CTRL_BREAK_EVENT: //Handle the CTRL-Break signal.
			{
				wprintf_s(L"Get Control-Break.\n");
			}break;
			default: //Handle other signals.
			{
				wprintf_s(L"Get closing signal.\n");
			}break;
		}
	}

	return FALSE;
}
Пример #8
0
int NiashLibUsbOpen(char const * const pszName, EScannerModel* const peModel)
{
	//Open a handle to the device (FILE_FLAG_OVERLAPPED for WinUSB)
	
	s_hDevice = CreateFileA(pszName, GENERIC_READ|GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, NULL);
	if(s_hDevice == INVALID_HANDLE_VALUE)
	{
		wprintf_s(L"CreateFile: %s\n", _com_error(GetLastError()).ErrorMessage());
		return -1;
	}

	DEVICE_DESCRIPTOR dd;
	DWORD dwBytesReturned;
	if(!DeviceIoControl(s_hDevice,static_cast<DWORD>(IOCTL_GET_DEVICE_DESCRIPTOR),nullptr,0,&dd,sizeof(dd),&dwBytesReturned,nullptr))
	{
		wprintf_s(L"DeviceIoControl: %s\n", _com_error(GetLastError()).ErrorMessage());
		return -1;
	}

	//Report device to niash
	TScannerModel* pModel;
	MatchUsbDevice(dd.usVendorId,dd.usProductId,&pModel);
	*peModel = pModel->eModel;

	return 1;
}
Пример #9
0
void NiashLibUsbWriteBulk(const int iHandle, SANE_Byte* const pabData, const int iSize)
{
	assert(iHandle==1);
	assert(s_hWinUSB);
	assert(s_Pipes.BulkOut);

	//Send setup packet
	SANE_Byte abSetup[8] = { 0x01, 0x01, 0x00, 0x00, (iSize) & 0xFF, (iSize >> 8) & 0xFF, 0x00, 0x00 };
	WINUSB_SETUP_PACKET Packet;
	Packet.RequestType = BMREQUEST_HOST_TO_DEVICE<<7|BMREQUEST_VENDOR<<5; //Vendor type request, PC to device
	Packet.Request = 0x04; //Send multiple bytes
	Packet.Value = static_cast<USHORT>(USB_SETUP);
	Packet.Index = 0x00;	
	Packet.Length = 0x08;
	SendControlTransfer(Packet,abSetup);

	ULONG LengthTransferred;
	if(!WinUsb_WritePipe(s_hWinUSB, s_Pipes.BulkOut, pabData, iSize, &LengthTransferred, nullptr))
	{
		wprintf_s(L"WinUsb_WritePipe: %s\n", _com_error(GetLastError()).ErrorMessage());		
		return;
	}
}

void NiashLibUsbReadBulk (const int iHandle, SANE_Byte* const pabData, const int iSize)
{
	assert(iHandle==1);
	assert(s_hWinUSB);
	assert(s_Pipes.BulkIn);

	//Send setup packet
	SANE_Byte abSetup[8] = { 0x00, 0x00, 0x00, 0x00, (iSize) & 0xFF, (iSize >> 8) & 0xFF, 0x00, 0x00 };
	WINUSB_SETUP_PACKET Packet;
	Packet.RequestType = BMREQUEST_HOST_TO_DEVICE<<7|BMREQUEST_VENDOR<<5; //Vendor type request, PC to device
	Packet.Request = 0x04; //Send multiple bytes
	Packet.Value = static_cast<USHORT>(USB_SETUP);
	Packet.Index = 0x00;	
	Packet.Length = 0x08;
	SendControlTransfer(Packet,abSetup);

	ULONG LengthTransferred;
	if(!WinUsb_ReadPipe(s_hWinUSB, s_Pipes.BulkIn, pabData, iSize, &LengthTransferred, nullptr))
	{
		wprintf_s(L"WinUsb_WritePipe: %s\n", _com_error(GetLastError()).ErrorMessage());		
		return;
	}
}

void NiashLibUsbWaitForInterrupt()
{
	assert(s_hWinUSB);
	assert(s_Pipes.Interrupt);
	BYTE buf[1];
	ULONG LengthTransferred;
	if(!WinUsb_ReadPipe(s_hWinUSB,s_Pipes.Interrupt,buf,_countof(buf),&LengthTransferred,nullptr))
	{
		wprintf_s(L"WinUsb_ReadPipe: %s\n", _com_error(GetLastError()).ErrorMessage());		
		return;
	}
}
Пример #10
0
//MailSlot of flush DNS cache sender
bool WINAPI FlushDNSMailSlotSender(
	void)
{
//Create mailslot.
	HANDLE hFile = CreateFileW(MAILSLOT_NAME, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
	if (hFile == INVALID_HANDLE_VALUE)
	{
		wprintf_s(L"Create mailslot error, error code is %lu.\n", GetLastError());
		return false;
	}

//Write into mailslot.
	DWORD cbWritten = 0;
	if (!WriteFile(hFile, MAILSLOT_MESSAGE_FLUSH_DNS, (DWORD)(lstrlenW(MAILSLOT_MESSAGE_FLUSH_DNS) + 1U) * sizeof(wchar_t), &cbWritten, nullptr))
	{
		wprintf_s(L"MailSlot write messages error, error code is %lu.\n", GetLastError());

		CloseHandle(hFile);
		return false;
	}

	CloseHandle(hFile);
	wprintf_s(L"Flush DNS cache message was sent successfully.\n");
	return true;
}
Пример #11
0
void BenchmarkSort( SortBase<T> *pSort, int pLength )
{
	T *pArray = new T[pLength];
	for ( int i = 0; i < pLength; i++ )
		pArray[i] = rand( );

	wprintf_s( L"%ls\n", pSort->GetName( ) );

	Timer t;
	t.Start( );
	pSort->DoSort( pArray, SD_ASCENDING, 0, pLength - 1 );
	t.Stop( );
	wprintf_s( L"Ascending  (random):            %0.2fms\n", t.GetTimeElapsed( ) );

	t.Start( );
	pSort->DoSort( pArray, SD_ASCENDING, 0, pLength - 1 );
	t.Stop( );
	wprintf_s( L"Ascending  (presorted):         %0.2fms\n", t.GetTimeElapsed( ) );

	t.Start( );
	pSort->DoSort( pArray, SD_DESCENDING, 0, pLength - 1 );
	t.Stop( );
	wprintf_s( L"Descending (reverse presorted): %0.2fms\n\n", t.GetTimeElapsed( ) );

	delete[] pArray;
}
Пример #12
0
int NiashLibUsbOpen(char const * const pszName, EScannerModel* const peModel)
{
	//Open a handle to the device (FILE_FLAG_OVERLAPPED for WinUSB)
	s_hDevice = CreateFileA(pszName, GENERIC_READ|GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
	//s_hDevice = CreateFileA("\\\\.\\Usbscan0", GENERIC_READ|GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
	if(s_hDevice == INVALID_HANDLE_VALUE)
	{
		wprintf_s(L"CreateFile: %s\n", _com_error(GetLastError()).ErrorMessage());
		return -1;
	}

	//Open a WinUSB handle
	if(!WinUsb_Initialize(s_hDevice,&s_hWinUSB))
	{		
		wprintf_s(L"WinUsb_Initialize: %s\n", _com_error(GetLastError()).ErrorMessage());
		return -1;
	}

	//Get interface descriptor
	USB_INTERFACE_DESCRIPTOR USBInterfaceDescriptor;
	if(!WinUsb_QueryInterfaceSettings(s_hWinUSB,0,&USBInterfaceDescriptor))
	{
		wprintf_s(L"WinUsb_QueryInterfaceSettings: %s\n", _com_error(GetLastError()).ErrorMessage());
		return -1;
	}

	//Find pipes
	for(UCHAR i = 0;i < USBInterfaceDescriptor.bNumEndpoints;i++)
	{
		WINUSB_PIPE_INFORMATION Pipe;
		WinUsb_QueryPipe(s_hWinUSB,0,i,&Pipe);
		if(Pipe.PipeType == UsbdPipeTypeInterrupt)
		{
			s_Pipes.Interrupt = Pipe.PipeId;
		}
		else if(Pipe.PipeType == UsbdPipeTypeBulk)
		{
			if(USB_ENDPOINT_DIRECTION_IN(Pipe.PipeId))
			{
				s_Pipes.BulkIn = Pipe.PipeId;
			}
			else
			{
				s_Pipes.BulkOut = Pipe.PipeId;				
			}
		}
	}

	if(!s_Pipes.Interrupt || !s_Pipes.BulkIn || !s_Pipes.BulkOut)
	{
		puts("Not all required pipes found.");
		return -1;
	}

	assert(s_pScannerModel);
	*peModel = s_pScannerModel->eModel;

	return 1;
}
Пример #13
0
/****************************************************************************

Function:   ModifyMyString

Parameters: pStr : Pointer to pointer to UNICODE string

Returns:    none

Purpose:    Display the string passed in, modify it, and return

Comments:   This sample is meant to demonstrate a typical use of the
            represent_as attribute:  The client and server have different
            local views of the data, although the IDL file describes the
            wire contract.

****************************************************************************/
void ModifyMyString(IN RPC_BINDING_HANDLE hBinding,
					WCHAR_STRING * pStr)
{
    wprintf_s(L"\nModifyMyString: received UNICODE string:\n%s\n\n", *pStr );
    wcscpy_s(*pStr,wcslen(*pStr), L"This UNICODE string comes back on the wire as ASCII");
    wprintf_s(L"ModifyMyString: sending UNICODE string:\n%s\n\n", *pStr );

}
Пример #14
0
int unpack(const wchar_t* path)
{
    FILE* fp = 0;
    _wfopen_s(&fp, path, L"rb");
    if (fp == 0)
    {
        wprintf_s(L"%s open fail\n", path);
        return 1;
    }
    fseek(fp, 0, SEEK_SET);

    YKCHDR hdr = { 0 };
    fread(&hdr, sizeof(YKCHDR), 1, fp);

    if (memcmp(hdr.signature, "YKC001", 6) != 0)
    {
        wprintf_s(L"%s format error\n", path);
        exit(1);
    }

    char* toc = new char[hdr.toc_length];
    fseek(fp, hdr.toc_offset, SEEK_SET);
    fread(toc, 1, hdr.toc_length, fp);

    YKCENTRY* table = (YKCENTRY*)toc;

    fs::path rawname = path;
    auto outdir = rawname.replace_extension();

    for (unsigned int i = 0; i != hdr.toc_length / sizeof(YKCENTRY); ++i)
    {
        char elefn[200];
        fseek(fp, table[i].filename_offset, SEEK_SET);
        fread(elefn, 1, table[i].filename_length, fp);

        auto outname = outdir;
        outname.append(elefn);

        char* buff = new char[table[i].data_length];
        fseek(fp, table[i].data_offset, SEEK_SET);
        fread(buff, 1, table[i].data_length, fp);

        if (memcmp(buff, "YKG000", 6) == 0)
        {
            write_pic(outname, buff, table[i].data_length);
        }
        else
        {
            write_file(outname, buff, table[i].data_length);
        }

        delete[] buff;
    }
    fclose(fp);
    delete[] toc;

    return 0;
}
Пример #15
0
/*-------------------------------------------
	デバイスの作成
--------------------------------------------*/
HRESULT CreateDevice(void)
{
	HRESULT hr;

	// ハードウェア デバイスを試す
	hr = D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0,
			g_pFeatureLevels, _countof(g_pFeatureLevels), D3D11_SDK_VERSION, &g_pD3DDevice,
			&g_FeatureLevelsSupported, &g_pImmediateContext);
	if (SUCCEEDED(hr)) {
		//「コンピュート シェーダ」「未処理バッファー」「構造化バッファ」のサポート調査
	    D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS hwopts;
	    g_pD3DDevice->CheckFeatureSupport(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &hwopts, sizeof(hwopts));
	    if(hwopts.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x) {
			wprintf_s(L"[D3D_DRIVER_TYPE_HARDWARE]\n");
			return hr;
		}
		SAFE_RELEASE(g_pImmediateContext);
		SAFE_RELEASE(g_pD3DDevice);
	}

	// WARPデバイスを試す
	hr = D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_WARP, NULL, 0,
			g_pFeatureLevels, _countof(g_pFeatureLevels), D3D11_SDK_VERSION, &g_pD3DDevice,
			&g_FeatureLevelsSupported, &g_pImmediateContext);
	if (SUCCEEDED(hr)) {
		//「コンピュート シェーダ」「未処理バッファー」「構造化バッファ」のサポート調査
	    D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS hwopts;
	    g_pD3DDevice->CheckFeatureSupport(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &hwopts, sizeof(hwopts));
	    if(hwopts.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x) {
			wprintf_s(L"[D3D_DRIVER_TYPE_WARP]\n");
			return hr;
		}
		SAFE_RELEASE(g_pImmediateContext);
		SAFE_RELEASE(g_pD3DDevice);
	}

	// リファレンス デバイスを試す
	hr = D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_REFERENCE, NULL, 0,
			g_pFeatureLevels, _countof(g_pFeatureLevels), D3D11_SDK_VERSION, &g_pD3DDevice,
			&g_FeatureLevelsSupported, &g_pImmediateContext);
	if (SUCCEEDED(hr)) {
		//「コンピュート シェーダ」「未処理バッファー」「構造化バッファ」のサポート調査
	    D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS hwopts;
	    g_pD3DDevice->CheckFeatureSupport(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &hwopts, sizeof(hwopts));
	    if(hwopts.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x) {
			wprintf_s(L"[D3D_DRIVER_TYPE_REFERENCE]\n");
			return hr;
		}
		SAFE_RELEASE(g_pImmediateContext);
		SAFE_RELEASE(g_pD3DDevice);
	}

	// 失敗
	return DXTRACE_ERR(L"D3D11CreateDevice", hr);;
}
Пример #16
0
void showItem( Item* pItem )
{
    FILETIME lastWriteFTIME;
    SYSTEMTIME lastWriteSYSTIME;
    LARGE_INTEGER entrySize;
    TCHAR dirsCtStr[ 32 ] = { 0 };
    TCHAR filesCtStr[ 32 ] = { 0 };
    TCHAR sizeStr[ 32 ] = { 0 };

    // Fetch and prepare entry last modification date & time

    // UTC time (FILETIME) to local time (FILETIME)
    FileTimeToLocalFileTime( &pItem->findInfo.ftLastWriteTime,
        &lastWriteFTIME );

    // local time (FILETIME) to local time (SYSTIME)
    FileTimeToSystemTime( &lastWriteFTIME, &lastWriteSYSTIME );

    // Disp entry last modification date & time
    wprintf_s( TEXT( "    %04d-%02d-%02d %02d:%02d:%02d" ),
        lastWriteSYSTIME.wYear,
        lastWriteSYSTIME.wMonth,
        lastWriteSYSTIME.wDay,
        lastWriteSYSTIME.wHour,
        lastWriteSYSTIME.wMinute,
        lastWriteSYSTIME.wSecond );

    // Disp entry type (dir/file)
    if ( pItem->findInfo.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT )
        wprintf_s( TEXT( " %5s" ), TEXT( "<LIN>" ) );
    else if ( pItem->findInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
        wprintf_s( TEXT( " %5s" ), TEXT( "<DIR>" ) );
    else
        wprintf_s( TEXT( " %5s" ), TEXT( "     " ) );

    // Fetch entry size
    entrySize.LowPart = pItem->findInfo.nFileSizeLow;
    entrySize.HighPart = pItem->findInfo.nFileSizeHigh;

    // Convert nums to strings (thousands separated)
    sepThousands( &pItem->dirsCount.QuadPart, dirsCtStr,
        _countof( dirsCtStr ) );
    sepThousands( &pItem->filesCount.QuadPart, filesCtStr,
        _countof( filesCtStr ) );
    sepThousands( &entrySize.QuadPart, sizeStr,
        _countof( sizeStr ) );

    // Disp entry details
    wprintf_s( TEXT( " %10s %10s %18s %s\n" ),
        dirsCtStr,
        filesCtStr,
        sizeStr,
        pItem->findInfo.cFileName );
}
Пример #17
0
void FaceRender::PrintLandmarkData(PXCFaceAnalysis::Landmark *landmark, pxcU32 fid) {

    FaceRender::FaceData& itr=Insert(fid);
    wprintf_s(L"Landmark data fid=%d:\n", fid);
    for (int i=0; i<sizeof(itr.landmark)/sizeof(itr.landmark[0]); i++) {
        PXCFaceAnalysis::Landmark::LandmarkData data;
        pxcStatus sts=landmark->QueryLandmarkData(fid,labels[i],0,&data);
        if (sts<PXC_STATUS_NO_ERROR) continue;
        wprintf_s(L"%S : x=%4.1f, y=%4.1f\n", landmarkLabels[i], data.position.x, data.position.y);
    }
    wprintf_s(L"\n");
}
void printAudioDevice(AudioDevice * device, LPCWSTR outFormat)
{
	wprintf_s(outFormat,
		device->Index,
		device->FriendlyName,
		device->State,
		device->IsDefault,
		device->Description,
		device->InterfaceFriendlyName,
		device->Id
		);
	wprintf_s(_T("\n"));
	fflush(stdout);
}
int wmain(int argc, WCHAR* argv[]) {

	
	
	if (!pipeline.LoopFrames()) wprintf_s(L"Failed to intialize or stream data\n"); 
    return 0;
}
Пример #20
0
HRESULT CTranscoder::Shutdown()
{
    HRESULT hr = S_OK;

    // Shut down the media source
    if (m_pSource)
    {
        hr = m_pSource->Shutdown();
    }

    // Shut down the media session. (Synchronous operation, no events.)
    if (SUCCEEDED(hr))
    {
        if (m_pSession)
        {
            hr = m_pSession->Shutdown();
        }
    }

    if (FAILED(hr))
    {
        wprintf_s(L"Failed to close the session...\n");
    }
    return hr;
}
Пример #21
0
void CameraWorker::configure(CameraWorker* cw)
{
	cw->session = PXCSession::CreateInstance();
	cw->ver = cw->session->QueryVersion();
	wprintf_s(L"SDK Session startet with version %d.%d\n", cw->ver.major, cw->ver.minor);
	cw->senseManager = PXCSenseManager::CreateInstance();
	cw->senseManager->EnableHand();
	cw->senseManager->Init();
	cw->hand = cw->senseManager->QueryHand();
	//handData = hand->CreateOutput();

	cw->config = cw->hand->CreateActiveConfiguration();
	//config->EnableNormalizedJoints(true);
	//config->EnableSegmentationImage(true);
	// Disable initially all gestures
	//config->DisableAllGestures();
	// enable only the needed ones
	cw->config->EnableGesture(L"spreadfingers", true);
	cw->config->EnableGesture(L"two_fingers_pinch_open", true);
	cw->config->EnableGesture(L"wave", true);
	cw->config->EnableAllAlerts();
	cw->config->ApplyChanges();
	//config->Update();
	
}
Пример #22
0
void Player::ResponseLoad(int pid, float x, float y, float z, bool valid, wchar_t* name, wchar_t* comment)
{
	mPlayerId = pid;
	mPosX = x;
	mPosY = y;
	mPosZ = z;
	mIsValid = valid;

	wcscpy_s(mPlayerName, name);
	wcscpy_s(mComment, comment);

	//TODO: 아래는 나중에 로그로...
	wprintf_s(L"PID[%d], X[%f] Y[%f] Z[%f] NAME[%s] COMMENT[%s]\n", mPlayerId, mPosX, mPosY, mPosZ, mPlayerName, mComment);
	
	MyPacket::LoginResult loginResult;
	loginResult.set_playerid(mPlayerId);
	loginResult.set_playername("TEST_LogonSuccess");

	MyPacket::Position* pos = loginResult.mutable_playerpos();
	pos->set_x(mPosX);
	pos->set_y(mPosY);
	pos->set_z(mPosZ);

	mSession->SendRequest(MyPacket::PKT_SC_LOGIN, loginResult);

	DoSyncAfter(HEART_BEAT, &Player::OnTick);
}
Пример #23
0
int CradleGame::BaseUpdate()
{
	m_timer->Update();

	if (m_cInput)
		m_cInput->Update();

	m_total += m_timer->GetDelta();
	m_fps++;

	if (m_total > 1.0f)
	{
		m_total -= 1.0f;
		wprintf_s(L"FPS: %d\n", m_fps);
	
		m_fps = 0;
	}


	// PrePhysicsUpdate();
	Update();
	// PostPhysicsUpdate();

	Render();

	return 0;
}
Пример #24
0
CradleMesh::CradleMesh(std::wstring _name, CradleFileManager* fm, CradleVertexDeclarations::VertexPosTex* verts, int numVerts /* */)
	: CradleResource(_name, fm)
{
	m_vertices = verts;
	m_numVertices = numVerts;

	m_indices = 0;

	wprintf_s(L"Creating Mesh with %d verts\n", numVerts);
	


	D3D11_BUFFER_DESC bufferDesc;
	ZeroMemory(&bufferDesc, sizeof(bufferDesc));
	bufferDesc.Usage = D3D11_USAGE_DEFAULT;
	bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
	bufferDesc.ByteWidth = sizeof(CradleVertexDeclarations::VertexPosTex) * m_numVertices;
	bufferDesc.CPUAccessFlags = 0;
	bufferDesc.MiscFlags = 0;

	D3D11_SUBRESOURCE_DATA subData;
	ZeroMemory(&subData, sizeof(subData));
	subData.pSysMem = m_vertices;

	HRESULT hr = m_fileManager->GetCD3D()->m_d3dDevice->CreateBuffer(&bufferDesc, &subData, &m_vertexBuffer);
	HRPRINT(hr, L"Failed to create vertex buffer\n", L"Vertex buffer created\n");
	
	fm->AddMesh(this);
}
Пример #25
0
int _tmain()
{
	const wchar_t* file_name = L"Diablo III Launcher.exe";
	if (verify_signature(file_name) == true)
	{
		wprintf_s(L"The file \"%s\" is signed and the signature was verified.\n", file_name);

		std::wstring signer = get_signer(file_name);
		wprintf_s(L"%s signer is %s\n", file_name, signer.c_str());
	}
	else
	{
		wprintf_s(L"The file \"%s\" is not trusted.\n", file_name);
	}

	return 0;
}
Пример #26
0
        STDMETHODIMP ArchiveExtractCallback::SetOperationResult(Int32 operationResult)
        {
            if (m_overwriteMode == OverwriteMode::kRollBack && operationResult != S_OK)
            {
                _ASSERT_EXPR(FALSE,L"begin rollback");
                bool succ = ProcessRollBack(); succ;
                _ASSERT_EXPR(succ, L"rollback error!");
                return E_FAIL;
            }
            

            if (m_absPath.empty())
            {
                wprintf_s(L"AllDone\n");
                if (m_callback)
                    m_callback->OnEnd(m_directory);
                return S_OK;
            }

            if (m_hasModifiedTime || m_hasAccessedTime || m_hasCreatedTime)
            {
                HANDLE fileHandle = CreateFile(m_absPath.c_str(), GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
                if (fileHandle != INVALID_HANDLE_VALUE)
                {
                    SetFileTime(fileHandle,
                        m_hasCreatedTime ? &m_createdTime : NULL,
                        m_hasAccessedTime ? &m_accessedTime : NULL,
                        m_hasModifiedTime ? &m_modifiedTime : NULL);
                    CloseHandle(fileHandle);
                }
            }

            if (m_hasAttrib)
            {
                SetFileAttributes(m_absPath.c_str(), m_attrib);
            }

            wprintf_s(L"FileDone:%s\n", m_absPath.c_str());
            if (m_callback)
            {
                if(!m_callback->OnFileDone(m_absPath, m_newFileSize))
                    return E_FAIL;
                m_callback->OnProgress(m_absPath, m_newFileSize);
            }
            return S_OK;
        }
Пример #27
0
//Catch Control-C exception from keyboard.
BOOL WINAPI CtrlHandler(const DWORD fdwCtrlType)
{
//Print to screen.
	if (Parameter.Console)
	{
	//Handle the CTRL-C signal.
		if (fdwCtrlType == CTRL_C_EVENT)
			wprintf_s(L"Get Control-C.\n");
	//Handle the CTRL-Break signal.
		else if (fdwCtrlType == CTRL_BREAK_EVENT)
			wprintf_s(L"Get Control-Break.\n");
	//Handle other signals.
		else 
			wprintf_s(L"Get closing signal.\n");
	}

	return FALSE;
}
void invalidParameterHandler(const wchar_t* expression,
   const wchar_t* function, 
   const wchar_t* file, 
   unsigned int line, 
   uintptr_t pReserved)
{
   wprintf_s(_T("\nError: Invalid format_str.\n"));
   exit(1);
}
Пример #29
0
        STDMETHODIMP ArchiveExtractCallback::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
        {
#ifdef _DEBUG
            wprintf_s(L"SetRatioInfo:%llu-%llu\n", *inSize, *outSize);
#endif // _DEBUG
            if (m_callback)
                m_callback->OnRadio(*inSize, *outSize);
            return S_OK;
        }
Пример #30
0
static void SendControlTransfer(WINUSB_SETUP_PACKET& Packet, BYTE* pBuf)
{
	assert(s_hWinUSB);
	DWORD dwBytesTransferred;
	if(!WinUsb_ControlTransfer(s_hWinUSB, Packet, pBuf, Packet.Length, &dwBytesTransferred, nullptr))
	{
		wprintf_s(L"WinUsb_ControlTransfer: %s\n", _com_error(GetLastError()).ErrorMessage());		
		return;
	}
}