Пример #1
0
void CUserPatcher::_FillRegInfo( INT nKBID, LPCTSTR szPatchName, LPCTSTR szProductKey, LPCTSTR szPatchKey, LPCTSTR szPatchValue, LPCTSTR szLogfile )
{
	LPCTSTR _key_patch = _T("Patches");
	
	CString strProduct;
	strProduct.Format(_T("Installer\\Products\\%s\\Patches"), szProductKey);
	WriteRegString(HKEY_CLASSES_ROOT, strProduct, szPatchKey, szPatchValue);

	CSimpleArray<CString> ms;
	ReadRegMString(HKEY_CLASSES_ROOT, strProduct, _key_patch, ms);
	if( ms.Find(szPatchKey)==-1 )
	{
		ms.Add( szPatchKey );
		WriteRegMString(HKEY_CLASSES_ROOT, strProduct, _key_patch, ms);
	}

	// HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\CEA540E1AE6DD1D41A6E01E6EF2B271C
	CString strPatchInfo;
	strPatchInfo.Format(_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\%s\\Patches\\%s"), szProductKey, szPatchKey);

	CString strMoreInfoURL;
	FormatKBWebUrl( strMoreInfoURL, nKBID );
	
	CString strDate;
	_GetDateString(strDate);

	WriteRegString(HKEY_LOCAL_MACHINE, strPatchInfo, _T("DisplayName"), szPatchName);
	WriteRegString(HKEY_LOCAL_MACHINE, strPatchInfo, _T("Installed"), strDate);
	WriteRegString(HKEY_LOCAL_MACHINE, strPatchInfo, _T("MoreInfoURL"), strMoreInfoURL);

	WriteRegDWord(HKEY_LOCAL_MACHINE, strPatchInfo, _T("LUAEnabled"),	0);
	WriteRegDWord(HKEY_LOCAL_MACHINE, strPatchInfo, _T("MSI3"),			1);
	WriteRegDWord(HKEY_LOCAL_MACHINE, strPatchInfo, _T("PatchType"),	0);
	WriteRegDWord(HKEY_LOCAL_MACHINE, strPatchInfo, _T("State"),		1);
	WriteRegDWord(HKEY_LOCAL_MACHINE, strPatchInfo, _T("Uninstallable"),0);
}
Пример #2
0
/* #FN#
   Called when the user clicks the OK button */
void
/* #AS#
   Nothing */
CTapeDlg::
OnOK()
{
	char szTapeOld[ FILENAME_MAX ];

	/* There is a problem with messages routing when the dialog is
	   closed with Enter/Alt-O key. KILLFOCUS message arrives
       to late and we have to invoke KillFocus handlers in OnOK
       method by ourselves. That's why we use this member. */
	m_bExitPass = TRUE;

	/* We have to indicate the 'last minute' changes */
	strcpy( szTapeOld, m_szTapeFile );

	/* Unfortunately, edit controls do not lose the focus before
	   handling this when the user uses accelerators */
	ReceiveFocused();

	if( _stricmp( m_szTapeFile, m_szTapeBack ) != 0 ||
		_stricmp( szTapeOld,    m_szTapeFile ) != 0 ||
		/* The tape position was changed, so reattach the tape
		   to allow reading it */
		m_nCurrentBack != cassette_current_block )
	{
		int nCurrentBlock = cassette_current_block;
		/* Always reattach the selected tape */
		PrepareTape( m_szTapeFile );
		/* Restore a tape position */
		cassette_current_block = nCurrentBlock;

		if( _stricmp( m_szTapeFile, m_szTapeBack ) != 0 )
		{
			/* Update the registry */
			WriteRegString( NULL, REG_FILE_TAPE, m_szTapeFile );
		}
	}
	CCommonDlg::OnOK();

} /* #OF# CTapeDlg::OnOK */
/* #FN#
   Called when the user clicks the OK button */
void
/* #AS#
   Nothing */
CKeyboardDlg::
OnOK() 
{
	/* There is a problem with messages routing when the dialog is
	   closed with Enter/Alt-O key. KILLFOCUS message arrives
       to late and we have to invoke KillFocus handlers in OnOK
       method by ourselves. That's why we use this member. */
	m_bExitPass = TRUE;

	/* Unfortunately, edit controls do not lose the focus before
	   handling this when the user uses accelerators */
	ReceiveFocused();

	if( m_nArrowsMode != g_Input.Key.nArrowsMode )
	{
		g_Input.Key.nArrowsMode = m_nArrowsMode;
		WriteRegDWORD( NULL, REG_ARROWS_MODE, g_Input.Key.nArrowsMode );

		Input_SetArrowKeys( g_Input.Key.nArrowsMode );
	}
	/* Always reload the selected template */
	if( !PrepareTemplate( m_szTemplateFile, m_szTemplateDesc ) )
	{
		if( _IsFlagSet( m_ulInputState, IS_KEY_USE_TEMPLATE ) )
		{
			_ClrFlag( m_ulInputState, IS_KEY_USE_TEMPLATE );
			DisplayMessage( GetSafeHwnd(), IDS_ERROR_NO_KEYTEMP, 0, MB_ICONEXCLAMATION | MB_OK, m_szTemplateFile );
		}
	}
	else
		/* Fill the template table */
		CopyMemory( g_Input.Key.anKBTable, s_anKBTable, KEYBOARD_TABLE_SIZE * sizeof(int) );

	if( _stricmp( g_szTemplateDesc, m_szTemplateDesc ) != 0 )
		strcpy( g_szTemplateDesc, m_szTemplateDesc );

	/* Windows NT doesn't like empty strings in Registry */
	if( *m_szTemplateFile == '\0' )
		strcpy( m_szTemplateFile, DEFAULT_A8K );

	if( _stricmp( g_szTemplateFile, m_szTemplateFile ) != 0 )
	{
		strcpy( g_szTemplateFile, m_szTemplateFile );
		WriteRegString( NULL, REG_FILE_TEMPLATE, g_szTemplateFile );
	}
	/* Check the miscellanous states */
	if( m_ulInputState != g_Input.ulState )
	{
		if( g_Input.ulState & IS_CAPTURE_CTRLESC ^
			m_ulInputState & IS_CAPTURE_CTRLESC )
		{
			Input_EnableEscCapture( _IsFlagSet( m_ulInputState, IS_CAPTURE_CTRLESC ) );
		}
		g_Input.ulState = m_ulInputState;
		WriteRegDWORD( NULL, REG_INPUT_STATE, g_Input.ulState);
	}
	CCommonDlg::OnOK();

} /* #OF# CKeyboardDlg::OnOK */