Exemple #1
0
void ConfigTreeCtrl::OnSelChanged(wxTreeEvent& event)
{
  wxTreeItemId ItemID = GetSelection();
  ACE_Configuration_Section_Key Key;
  ResolveKey(ItemID, Key);
  m_pListCtrl->DisplaySection(Key);
}
Exemple #2
0
LSTATUS APIENTRY RegTree::RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
{	
	Console::GetInstance().Print(L"RegOpenKeyExW: %.8X, %s\n", hKey, lpSubKey);
	
	RegPath path;
	if (ResolveKey(hKey, lpSubKey, path))
	{
		RegNode *node = OpenKey(path);
		if (node != NULL)
		{
			HKEY resultKey = node->AsKey();
			if (IsVirtualKey(resultKey))
			{
				*phkResult = resultKey;
				return ERROR_SUCCESS;
			}
			else
				return Real_RegOpenKeyExW(resultKey, NULL, ulOptions, samDesired, phkResult);
		}
		else
			return ERROR_NOT_FOUND;
	}
	else
		return Real_RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, phkResult);
}
Exemple #3
0
LSTATUS APIENTRY RegTree::RegSetValueExW(HKEY hKey, LPCWSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE* lpData, DWORD cbData)
{
	RegPath path;
	ResolveKey(hKey,  path);
	Console::GetInstance().Print(L"SetValueEx: %s, %s\n", path.ToString().c_str(), lpValueName);
	
	return Real_RegSetValueExW(hKey, lpValueName, Reserved, dwType, lpData, cbData);
}
Exemple #4
0
LSTATUS APIENTRY RegTree::RegQueryValueExW(HKEY hKey, LPCWSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData)
{
	RegPath path;
	ResolveKey(hKey, path);
	Console::GetInstance().Print(L"QueryValueEx: %s, %s\n", path.ToString().c_str(), lpValueName);
	
	return Real_RegQueryValueExW(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData);
}
Exemple #5
0
LSTATUS APIENTRY RegTree::RegSaveKeyExW(HKEY hKey, LPCWSTR lpFile, CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD Flags)
{
	RegPath path;
	ResolveKey(hKey, path);
	Console::GetInstance().Print(L"SaveKeyEx: %s\n", path.ToString().c_str());
	
	return Real_RegSaveKeyExW(hKey, lpFile, lpSecurityAttributes, Flags);
}
Exemple #6
0
LSTATUS APIENTRY RegTree::RegSetKeySecurity(HKEY hKey, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor)
{
	RegPath path;
	ResolveKey(hKey, path);
	Console::GetInstance().Print(L"SetKeySecurity: %s\n", path.ToString().c_str());
	
	return Real_RegSetKeySecurity(hKey, SecurityInformation, pSecurityDescriptor);
}
Exemple #7
0
LSTATUS APIENTRY RegTree::RegReplaceKeyW(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpNewFile, LPCWSTR lpOldFile)
{
	RegPath path;
	ResolveKey(hKey, lpSubKey, path);
	Console::GetInstance().Print(L"ReplaceKey: %s\n", path.ToString().c_str());
	
	return Real_RegReplaceKeyW(hKey, lpSubKey, lpNewFile, lpOldFile);
}
Exemple #8
0
LSTATUS APIENTRY RegTree::RegRestoreKeyW(HKEY hKey, LPCWSTR lpFile, DWORD dwFlags)
{
	RegPath path;
	ResolveKey(hKey,  path);
	Console::GetInstance().Print(L"RestoreKey: %s\n", path.ToString().c_str());
	
	return Real_RegRestoreKeyW(hKey, lpFile, dwFlags);
}
Exemple #9
0
LSTATUS APIENTRY RegTree::RegQueryMultipleValuesW(HKEY hKey, PVALENTW val_list, DWORD num_vals, LPWSTR lpValueBuf, LPDWORD ldwTotsize)
{
	RegPath path;
	ResolveKey(hKey, path);
	Console::GetInstance().Print(L"QueryMultipleValues: %s\n", path.ToString().c_str());
	
	return Real_RegQueryMultipleValuesW(hKey, val_list, num_vals, lpValueBuf, ldwTotsize);
}
Exemple #10
0
LSTATUS APIENTRY RegTree::RegUnLoadKeyW(HKEY hKey, LPCWSTR lpSubKey)
{
	RegPath path;
	ResolveKey(hKey, lpSubKey, path);
	Console::GetInstance().Print(L"UnLoadKey: %s\n", path.ToString().c_str());
	
	return Real_RegUnLoadKeyW(hKey, lpSubKey);
}
Exemple #11
0
LSTATUS APIENTRY RegTree::RegOverridePredefKey(HKEY hKey, HKEY hNewHKey)
{
	RegPath path;
	ResolveKey(hKey, path);
	Console::GetInstance().Print(L"OverridePredefKey: %s\n", path.ToString().c_str());
	
	return Real_RegOverridePredefKey(hKey, hNewHKey);
}
Exemple #12
0
LSTATUS APIENTRY RegTree::RegNotifyChangeKeyValue(HKEY hKey, BOOL bWatchSubtree, DWORD dwNotifyFilter, HANDLE hEvent, BOOL fAsynchronous)
{
	RegPath path;
	ResolveKey(hKey, path);
	Console::GetInstance().Print(L"NotifyChangeKeyValue: %s\n", path.ToString().c_str());
	
	return Real_RegNotifyChangeKeyValue(hKey, bWatchSubtree, dwNotifyFilter, hEvent, fAsynchronous);
}
Exemple #13
0
LSTATUS APIENTRY RegTree::RegFlushKey(HKEY hKey)
{
	RegPath path;
	ResolveKey(hKey, path);
	Console::GetInstance().Print(L"FlushKey: %s\n", path.ToString().c_str());

	return Real_RegFlushKey(hKey);
}
Exemple #14
0
LSTATUS APIENTRY RegTree::RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
{
	RegPath path;
	ResolveKey(hKey, path);
	Console::GetInstance().Print(L"DeleteValue: %s\n", path.ToString().c_str());
	
	return Real_RegDeleteValueW(hKey, lpValueName);
}
Exemple #15
0
bool RegTree::ResolveKey( HKEY key, const wstring &subKey, RegPath &path )
{
	RegPath result;
	if (!ResolveKey(key, result))
		return false;
	path = result;
	String::Split(subKey, L"\\", path.m_segments);
	return true;
}
Exemple #16
0
void RegTree::InitPrefixs( void )
{
	HKEY key;
	wstring path;

	RegOpenCurrentUser(KEY_READ, &key);
	ResolveKey(key, path);
	m_currentUserPrefix = path;

	Real_RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Classes", 0, KEY_READ, &key);
	ResolveKey(key, path);
	m_classesRootPrefix = path;

	Real_RegOpenKeyExW(HKEY_CURRENT_CONFIG, L"Software", 0, KEY_READ, &key);
	ResolveKey(key, path);
	m_currentConfigSoftwarePrefix = path;

	Real_RegOpenKeyExW(HKEY_CURRENT_CONFIG, L"System", 0, KEY_READ, &key);
	ResolveKey(key, path);
	m_currentConfigSystemPrefix = path;
}
Exemple #17
0
void ConfigTreeCtrl::OnDelete(wxCommandEvent& event)
{
  wxTreeItemId ItemID = GetSelection();
  wxTreeItemId Parent = GetParent(ItemID);
  ACE_Configuration_Section_Key Key;
  ResolveKey(Parent, Key);
  wxMessageDialog Dlg(this, "Are you sure you want to delete this section?", "Confirm Section Delete", wxYES_NO | wxICON_EXCLAMATION );
  if(Dlg.ShowModal() != wxID_YES)
  {
    return;
  }
  wxString Text = GetItemText(ItemID);
  m_pConfig->remove_section(Key, Text, 1);
  // Reload parent
  Delete(ItemID);
}
Exemple #18
0
LSTATUS APIENTRY RegTree::RegCreateKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD Reserved, LPWSTR lpClass, DWORD dwOptions, REGSAM samDesired, LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD lpdwDisposition)
{
	RegPath path;
	if (ResolveKey(hKey, lpSubKey, path))
	{
		RegNode *node = CreateKey(path, lpdwDisposition);
		if (node != NULL)
		{
			*phkResult = node->AsKey();
			return ERROR_SUCCESS;
		}
		else
			return ERROR_ACCESS_DENIED;
	}
	else
		return Real_RegCreateKeyExW(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, phkResult, lpdwDisposition);
}
Exemple #19
0
void ConfigTreeCtrl::OnNewUINT(wxCommandEvent& event)
{
  ValueDlg Dlg(this, false);
  if(Dlg.ShowModal() != wxID_OK)
  {
    return;
  }

  u_int Value = Dlg.GetUINTValue();
  ACE_TString Name = Dlg.GetName();

  // Get the key for this node
  wxTreeItemId ItemID = GetSelection();
  ACE_Configuration_Section_Key Key;
  ResolveKey(ItemID, Key);
  m_pConfig->set_integer_value(Key, Name.fast_rep(), Value);
  m_pListCtrl->DisplaySection(Key);
}
Exemple #20
0
void ConfigTreeCtrl::OnNewKey(wxCommandEvent& event)
{
  wxTextEntryDialog Dlg(this, "Test", "Key Name");
  if(Dlg.ShowModal() != wxID_OK)
  {
    return;
  }

  wxString Value = Dlg.GetValue();

  // Get the key for this node
  wxTreeItemId ItemID = GetSelection();
  ACE_Configuration_Section_Key Key, NewKey;
  ResolveKey(ItemID, Key);
  m_pConfig->open_section(Key, Value, 1, NewKey);
  wxTreeItemId NewItemID = AppendItem(ItemID, Value);
  EnsureVisible(NewItemID);
}
Exemple #21
0
void CItemPicker::FillList(int restype, CListBox &list)
{
  POSITION pos;
  CString key;
  loc_entry fileloc;
  int idx;
  
  list.ResetContent();
  idx=determinetype(restype);
  if(!idx)
  {
    MessageBox("Internal error (no method for filling listbox)","Error",MB_OK);
    return;
  }
  else pos=resources[idx]->GetStartPosition();
  while(pos)
  {
    resources[idx]->GetNextAssoc(pos,key,fileloc);
    ResolveKey(key,fileloc,restype);
    list.AddString(key);
  }
}
Exemple #22
0
bool RegTree::ResolveKey( HKEY key, RegPath &path )
{
	if ((int)key & 0x80000000)
	{
		path.m_rootKey = key;
		path.m_segments.clear();
	}
	else if ((int)key & 0x40000000)
	{
		RegNode *node = (RegNode*)((int)key & ~0x40000000);
		path.m_rootKey = node->m_rootKey;
		path.m_segments.clear();
		node->GetSubKey(path.m_segments);
	}
	else 
	{
		wstring keyPath;
		if (!ResolveKey(key, keyPath))
			return false;
		
		// ½âÎöRoot
		size_t sepPos = keyPath.find(L'\\');
		wstring rootName = keyPath.substr(0, sepPos);
		wstring subKey;
		if (rootName == L"USER")
		{
			if (istarts_with(keyPath, m_classesRootPrefix))
			{
				path.m_rootKey = HKEY_CLASSES_ROOT;
				subKey = keyPath.substr(m_classesRootPrefix.length());
				if (starts_with(subKey, L"\\"))
					subKey = subKey.substr(1);
			}
			else if (istarts_with(keyPath, m_currentUserPrefix))
			{
				path.m_rootKey = HKEY_CURRENT_USER;
				subKey = keyPath.substr(m_currentUserPrefix.length());
				if (starts_with(subKey, L"\\"))
					subKey = subKey.substr(1);
			}
			else
			{
				path.m_rootKey = HKEY_USERS;
				subKey = keyPath.substr(sepPos + 1);
			}
		}
		else if (rootName == L"MACHINE")
		{
			path.m_rootKey = HKEY_LOCAL_MACHINE;
			if (istarts_with(keyPath, m_currentConfigSoftwarePrefix))
			{
				subKey = keyPath.substr(m_currentConfigSoftwarePrefix.length());
				if (starts_with(subKey, L"\\"))
					subKey = subKey.substr(1);
			}
			else if (istarts_with(keyPath, m_currentConfigSystemPrefix))
			{
				subKey = keyPath.substr(m_currentConfigSystemPrefix.length());
				if (starts_with(subKey, L"\\"))
					subKey = subKey.substr(1);
			}
			else
				subKey = keyPath.substr(sepPos + 1);
		}
		else
			return false;
		// ·Ö¸îSubKey
		path.m_segments.clear();
		String::Split(subKey, L"\\", path.m_segments);
	}

	return true;
}