// the module's matching PDB's signature GUID, age, and build path by // fishing them out of the last IMAGE_DEBUG_DIRECTORY of type // IMAGE_DEBUG_TYPE_CODEVIEW. Used when sending the ModuleLoad event // to help profilers find matching PDBs for loaded modules. // // Arguments: // // [in] hOsHandle - OS Handle for module from which to get PDB info // [out] pGuidSignature - PDB's signature GUID to be placed here // [out] pdwAge - PDB's age to be placed here // [out] wszPath - PDB's build path to be placed here // [in] cchPath - Number of wide characters allocated in wszPath, including NULL terminator // // This is a simplification of similar code in desktop CLR's GetCodeViewInfo // in eventtrace.cpp. REDHAWK_PALEXPORT void REDHAWK_PALAPI PalGetPDBInfo(HANDLE hOsHandle, _Out_ GUID * pGuidSignature, _Out_ UInt32 * pdwAge, _Out_writes_z_(cchPath) WCHAR * wszPath, Int32 cchPath) { // Zero-init [out]-params ZeroMemory(pGuidSignature, sizeof(*pGuidSignature)); *pdwAge = 0; if (cchPath <= 0) return; wszPath[0] = L'\0'; BYTE *pbModule = (BYTE*)hOsHandle; IMAGE_NT_HEADERS const * pNtHeaders = (IMAGE_NT_HEADERS*)(pbModule + ((IMAGE_DOS_HEADER*)hOsHandle)->e_lfanew); IMAGE_DATA_DIRECTORY const * rgDataDirectory = NULL; if (pNtHeaders->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC) rgDataDirectory = ((IMAGE_OPTIONAL_HEADER32 const *)&pNtHeaders->OptionalHeader)->DataDirectory; else
LIGHT_ALL_BARS, CLEAR_ALL_BARS, GET_BAR_GRAPH_LIGHT_STATE, GET_SWITCH_STATE, GET_SWITCH_STATE_AS_INTERRUPT_MESSAGE, GET_7_SEGEMENT_STATE, SET_7_SEGEMENT_STATE, RESET_DEVICE, REENUMERATE_DEVICE, } INPUT_FUNCTION; _Success_(return) BOOL GetDevicePath( _In_ LPGUID InterfaceGuid, _Out_writes_z_(BufLen) PWCHAR DevicePath, _In_ size_t BufLen ) { CONFIGRET cr = CR_SUCCESS; PWSTR deviceInterfaceList = NULL; ULONG deviceInterfaceListLength = 0; PWSTR nextInterface; HRESULT hr = E_FAIL; BOOL bRet = TRUE; cr = CM_Get_Device_Interface_List_Size( &deviceInterfaceListLength, InterfaceGuid, NULL, CM_GET_DEVICE_INTERFACE_LIST_PRESENT);
// Open the explorer key key.Open( HKEY_CURRENT_USER, _T( "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer" ), KEY_READ ); // Try to read the REG_BINARY value if ( ERROR_SUCCESS == key.QueryBinaryValue( which, &x, &cbValue ) ) { return x; } return clrDefault; } //COLORREF CDirstatApp::AltEncryptionColor( ) { // return m_altEncryptionColor; // } _Success_( SUCCEEDED( return ) ) HRESULT CDirstatApp::GetCurrentProcessMemoryInfo( _Out_writes_z_( strSize ) PWSTR psz_formatted_usage, _In_range_( 20, 64 ) rsize_t strSize ) { auto workingSetBefore = m_workingSet; UpdateMemoryInfo( ); const rsize_t ramUsageBytesStrBufferSize = 21; wchar_t ramUsageBytesStrBuffer[ ramUsageBytesStrBufferSize ] = { 0 }; //const rsize_t strSize = 34; //wchar_t psz_formatted_usage[ strSize ] = { 0 }; HRESULT res = FormatBytes( m_workingSet, ramUsageBytesStrBuffer, ramUsageBytesStrBufferSize ); if ( !SUCCEEDED( res ) ) { return StringCchPrintfW( psz_formatted_usage, strSize, L"RAM Usage: %s", FormatBytes( m_workingSet ).GetString( ) ); }
); if (INVALID_HANDLE_VALUE == m_hDev) { hr = HRESULT_FROM_WIN32(GetLastError()); m_hDev = nullptr; } } return hr; } // Helper function to get the device path HRESULT CSensorCommunication::GetDevicePath( _In_ LPGUID interfaceGuid, _Out_writes_z_(cchDevicePath) PWCHAR devicePath, _In_ size_t cchDevicePath ) { SP_DEVICE_INTERFACE_DATA deviceInterfaceData = {}; PSP_DEVICE_INTERFACE_DETAIL_DATA deviceInterfaceDetailData = nullptr; ULONG length = 0; ULONG requiredLength = 0; BOOL bResult = FALSE; HRESULT hr = S_OK; SecureZeroMemory(devicePath, cchDevicePath * sizeof(WCHAR)); HDEVINFO hardwareDeviceInfo = SetupDiGetClassDevs( interfaceGuid, nullptr,
// toggle off so we don't save a screenshot again next frame m_bSaveScreenshot = false; } } } /// <summary> /// Get the name of the file where screenshot will be stored. /// </summary> /// <param name="lpszFilePath">string buffer that will receive screenshot file name.</param> /// <param name="nFilePathSize">number of characters in lpszFilePath string buffer.</param> /// <returns> /// S_OK on success, otherwise failure code. /// </returns> HRESULT CBodyBasics::GetScreenshotFileName(_Out_writes_z_(nFilePathSize) LPWSTR lpszFilePath, UINT nFilePathSize) { WCHAR* pszKnownPath = NULL; HRESULT hr = SHGetKnownFolderPath(FOLDERID_Pictures, 0, NULL, &pszKnownPath); if (SUCCEEDED(hr)) { // Get the time WCHAR szTimeString[MAX_PATH]; GetTimeFormatEx(NULL, 0, NULL, L"hh'-'mm'-'ss", szTimeString, _countof(szTimeString)); // File name will be KinectScreenshotColor-HH-MM-SS.bmp StringCchPrintfW(lpszFilePath, nFilePathSize, L"%s\\KinectScreenshot-Color-%s.bmp", pszKnownPath, szTimeString); } if (pszKnownPath)