You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
117 lines
2.9 KiB
117 lines
2.9 KiB
//+---------------------------------------------------------------------------
|
|
//
|
|
// Microsoft Windows
|
|
// Copyright (C) Microsoft Corporation 1996-2001.
|
|
//
|
|
// File: lchoice.cpp
|
|
//
|
|
// Contents: implementation of CLocalPolChoice
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#include "stdafx.h"
|
|
#include "wsecmgr.h"
|
|
#include "snapmgr.h"
|
|
#include "attr.h"
|
|
#include "LChoice.h"
|
|
#include "util.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CLocalPolChoice dialog
|
|
|
|
|
|
CLocalPolChoice::CLocalPolChoice()
|
|
: CConfigChoice(IDD)
|
|
{
|
|
//{{AFX_DATA_INIT(CLocalPolChoice)
|
|
//}}AFX_DATA_INIT
|
|
m_pHelpIDs = (DWORD_PTR)a235HelpIDs;
|
|
m_uTemplateResID = IDD;
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CLocalPolChoice message handlers
|
|
|
|
BOOL CLocalPolChoice::OnInitDialog()
|
|
{
|
|
CConfigChoice::OnInitDialog();
|
|
|
|
PSCE_REGISTRY_VALUE_INFO prv = (PSCE_REGISTRY_VALUE_INFO)(m_pData->GetBase());
|
|
if (!prv ) //Raid 372939, 4/20/2001
|
|
{
|
|
m_cbChoices.SetCurSel(-1);
|
|
}
|
|
else //Raid #457885, Yang Gao, 8/21/2001
|
|
{
|
|
if( prv->Value == NULL )
|
|
{
|
|
m_cbChoices.SetCurSel(-1);
|
|
m_bConfigure = TRUE;
|
|
UpdateData(FALSE); //Raid #480375, Yanggao, 10/12/2001
|
|
EnableUserControls(m_bConfigure);
|
|
}
|
|
}
|
|
OnSelchangeChoices();
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CLocalPolChoice::OnApply()
|
|
{
|
|
if ( !m_bReadOnly )
|
|
{
|
|
DWORD dw = 0;
|
|
int nIndex = 0;
|
|
|
|
UpdateData(TRUE);
|
|
if (m_bConfigure)
|
|
{
|
|
nIndex = m_cbChoices.GetCurSel();
|
|
if (CB_ERR != nIndex)
|
|
dw = (DWORD) m_cbChoices.GetItemData(nIndex);
|
|
|
|
PSCE_REGISTRY_VALUE_INFO prv=(PSCE_REGISTRY_VALUE_INFO)(m_pData->GetBase());
|
|
|
|
//
|
|
// this address should never be NULL
|
|
//
|
|
if ( prv )
|
|
{
|
|
PWSTR pTmp=NULL;
|
|
|
|
if ( dw != SCE_NO_VALUE )
|
|
{
|
|
CString strTmp;
|
|
// allocate buffer
|
|
strTmp.Format(TEXT("%d"), dw);
|
|
pTmp = (PWSTR)LocalAlloc(0, (strTmp.GetLength()+1)*sizeof(TCHAR));
|
|
|
|
if ( pTmp )
|
|
//This may not be a safe usage. using WCHAR instead of TCHAR. Consider fix.
|
|
wcscpy(pTmp,(LPCTSTR)strTmp);
|
|
else
|
|
{
|
|
// can't allocate buffer, error!!
|
|
return FALSE;
|
|
}
|
|
}
|
|
|
|
if ( prv->Value )
|
|
LocalFree(prv->Value);
|
|
|
|
prv->Value = pTmp;
|
|
|
|
m_pSnapin->UpdateLocalPolRegValue(m_pData);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Class hieirarchy is bad - call CAttribute base method directly
|
|
return CAttribute::OnApply();
|
|
}
|
|
|