Exemple #1
0
BOOL SelfElevate(const std::string& my_path, const std::string& params)
{
	if (IsElevated())
		return FALSE;

	SHELLEXECUTEINFO shExecInfo = { 0 };
	shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
	shExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
	shExecInfo.hwnd = NULL;
	shExecInfo.lpVerb = "runas";
	shExecInfo.lpFile = my_path.c_str();
	shExecInfo.lpParameters = params.c_str();
	shExecInfo.lpDirectory = NULL;
	shExecInfo.nShow = SW_SHOW;
	shExecInfo.hInstApp = NULL;

	if (!ShellExecuteEx(&shExecInfo))
		return FALSE;

	// Loiter in the background to make scripting easier
	printer::inst()->print_msg(L0, "This window has been opened because xmr-stak needed to run as administrator.  It can be safely closed now.");
	WaitForSingleObject(shExecInfo.hProcess, INFINITE);
	std::exit(0);

	return TRUE;
}
Exemple #2
0
int main(int argc, char* argv[]) {
    LOG("Is Run As Admin: %d", IsRunAsAdmin());
    LOG("Is Elevated: %d", IsElevated());
    init(argc, argv);
    startup();
    cleanup();
    return 0;
}
void Elevate(HWND hWnd,int cmd)
{
	if(IsElevated())
		return;
	char path[MAX_PATH];
	GetModuleFileNameA(NULL,path,sizeof(path));
	char param[16];
	sprintf(param,"%d",cmd);
	ShellExecute(hWnd, "runas", path, param, 0, SW_SHOWNORMAL);
	ExitProcess(0);
}
Exemple #4
0
VOID RequestElevation()
{
	if(IsElevated())
		return;

	if(!xmrstak::params::inst().allowUAC)
	{
		printer::inst()->print_msg(L0, "The miner needs to run as administrator, but you passed --noUAC option. Please remove it or set use_slow_memory to always.");
		win_exit();
		return;
	}

	SelfElevate(xmrstak::params::inst().minerArg0, xmrstak::params::inst().minerArgs);
}
Exemple #5
0
int main()
{
	config = new Configuration("test.ini"); // Create the object and parsing the .ini file

	// Settings the options according to the ones in the Config File
	speed_low = config->GetSpeedStage(SPEED_LOW);
	speed_med = config->GetSpeedStage(SPEED_MED);
	speed_high = config->GetSpeedStage(SPEED_HIGH);
	printf("\t\tSpeed Stages\n\nSpeed Low\tSpeed Medium\tSpeed High\n%f\t%f\t%f\n\n", speed_low, speed_med, speed_high);
	
	SetConsoleTitle( TEXT( "Gopher v0.97" ) );
	Controller = new CXBOXController(1);

	system("Color 1D");


	//MessageBox(NULL,L"You'll need to run Gopher as an administrator if you intend use the on-screen keyboard. Otherwise, Windows will ignore attempted keystrokes. If not, carry on!",L"Gopher", MB_OK | MB_ICONINFORMATION);
	//Add admin rights checker. If none, display this?

	printf("Welcome to Gopher/Gopher360 - a lightweight controller->keyboard & mouse tool.\nSee the GitHub repository at bit.ly/1syAhMT for more info. Copyleft 2014.\n\n-------------------------\n\n");
	printf("Gopher is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n");
	printf("\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.\n\n-------------------------\n\n");
	printf("Verify controller and wait 8 seconds to begin...\n\n\n");

	Sleep(8000);

	//getchar(); //press enter

	if(!IsElevated())
	{
		printf("Tip - Gopher isn't being ran as an administrator.\nWindows won't let you use the on-screen keyboard or games without it.\nLaunching in 3 seconds...\n\n");
		Beep(1400,100);
		Sleep(3000);
	}


	printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nBeginning read sequence at ~62.5 loops per second. Prepare for main loop!\n");
	Sleep(1000);

	Beep(1400,100);
	Beep(1400,100);
	Beep(1400,100);

	while(true){
		gopherLoop();
	}
}
Exemple #6
0
int _tmain(int argc, TCHAR* argv[])
{
    int result;

    ENSURE_DEBUGGER();

    if (argc == 1 || (argc == 2 && !_tcsicmp(*(argv + 1), _T("/?"))))
        return PRINT_USAGE(VER_FULLVERSION, COPYRIGHT_INFO);

    // TODO:
    // /r (raw) do not interpret internal cmd commands as cmd /d /c command
    // /n do not copy env vars

    SetUp();
    result = (!IsVistaOrAbove() || IsElevated()) ? ExecuteProgram() : ExecuteStub();
    return CleanUp(result);
}
LRESULT CUpdateDlg::OnClickedOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	if (!m_bUpdateFinished)
	{
		// Begin Update Process
		CString pid = IntToStr(GetCurrentProcessId());

		BOOL elev = false;
		bool isVista = IsVista();
		if (isVista)
			IsElevated(&elev);
		bool CanWrite = IsDirectory(WinUtils::GetAppFolder() + _T("Data"));

		bool NeedElevation = m_UpdateManager.AreCoreUpdates() && isVista && !elev && !CmdLine.IsOption(_T("update"));
		NeedElevation |= isVista && !elev && !CanWrite;
		//	&& !CanWriteToFolder(IU_GetDataFolder());
		if (NeedElevation)
		{
			IU_RunElevated(CString(_T("/update ")) + _T("/waitforpid=") + pid);
			m_bClose = 2;

			return 0;
		}
		Start();
	}
	else
	{
		// Closing and reexecuting image uploader
		CString pid = IntToStr(GetCurrentProcessId());
		if (!CmdLine.IsOption(_T("update")))
			IULaunchCopy(_T("/afterupdate /waitforpid=") + pid);  // executing new IU copy with the same command line params
		else
			IULaunchCopy(_T("/afterupdate /waitforpid=") + pid, CAtlArray<CString>());

		m_bClose = 2;
		return 0;
	}

	return 0;
}
void CSettings::Uninstall() {
	BOOL b;
	if (IsVista() && IsElevated(&b) != S_OK) {
		RunIuElevated("/uninstall");
		return;
	}
	AutoStartup = false;
	SendToContextMenu  = false;
	RegisterShellExtension(false);
	EnableAutostartup(false);
	CRegistry Reg;
	Reg.SetRootKey(HKEY_CURRENT_USER);
	Reg.DeleteWithSubkeys("Software\\Zenden.ws\\Image Uploader\\ContextMenuItems");
	Reg.DeleteKey( "Software\\Zenden.ws\\Image Uploader" );
	Reg.DeleteKey( "Software\\Zenden.ws" ); // Will not delete if contains subkeys
	Reg.SetRootKey( HKEY_LOCAL_MACHINE );
	Reg.DeleteKey( "Software\\Zenden.ws\\Image Uploader" );
	Reg.DeleteKey( "Software\\Zenden.ws" ); // Will not delete if contains subkeys
	WinUtils::RemoveBrowserKey();

	CString ShortcutName = GetSendToPath() + _T("\\Image Uploader.lnk");
	DeleteFile(ShortcutName);
}
void RegisterShellExtension(bool Register) {
	CString moduleName = Settings.getShellExtensionFileName();
	if ( !FileExists( moduleName ) ) {
		return;
	}

	CRegistry Reg;
	Reg.SetRootKey( HKEY_LOCAL_MACHINE );

	bool canCreateRegistryKey = Register;
	
	if ( Reg.SetKey( "Software\\Zenden.ws\\Image Uploader", canCreateRegistryKey ) ) {
		Reg.WriteBool( "ExplorerContextMenu", Register );
	}

	SHELLEXECUTEINFO TempInfo = {0};
	CString s = WinUtils::GetAppFolder();
	TempInfo.cbSize = sizeof(SHELLEXECUTEINFOA);
	TempInfo.fMask  = SEE_MASK_NOCLOSEPROCESS;
	TempInfo.hwnd   = NULL;
	BOOL b = FALSE;
	IsElevated( &b );
	if ( IsVista() && !b ) {
		TempInfo.lpVerb = _T("runas");
	} else {
		TempInfo.lpVerb = _T("open");
	}
	TempInfo.lpFile       = _T("regsvr32");
	TempInfo.lpParameters = CString((Register ? _T("") : _T("/u "))) + _T("/s \"") + moduleName + _T("\"");
	TempInfo.lpDirectory  = s;
	TempInfo.nShow        = SW_NORMAL;
	//MessageBox(0,TempInfo.lpParameters,0,0);
	::ShellExecuteEx(&TempInfo);
	WaitForSingleObject( TempInfo.hProcess, INFINITE );
	CloseHandle( TempInfo.hProcess );
}
Exemple #10
0
	bool CSettings::SaveSettings()
	{
		SimpleXml xml;
		mgr_.saveToXmlNode(xml.getRoot("ImageUploader").GetChild("Settings"));
#if !defined(IU_SERVERLISTTOOL) && !defined  (IU_CLI) && !defined(IU_SHELLEXT)
		SaveConvertProfiles(xml.getRoot("ImageUploader").GetChild("Settings").GetChild("Image").GetChild("Profiles"));
		SaveServerProfiles( xml.getRoot("ImageUploader").GetChild("Settings").GetChild("Uploading").GetChild("ServerProfiles") );
#endif
		SaveAccounts(xml.getRoot("ImageUploader").GetChild("Settings").GetChild("ServersParams"));
		//std::cerr << "Saving setting to "<< IuCoreUtils::WstringToUtf8((LPCTSTR)fileName_);
		xml.SaveToFile(fileName_);

#if !defined(IU_SERVERLISTTOOL) && !defined(IU_CLI)
		CRegistry Reg;
		Reg.SetRootKey(HKEY_CURRENT_USER);
		// if(ExplorerContextMenu)
		{
			bool canCreateRegistryKey = ( ExplorerContextMenu );
			if ( Reg.SetKey("Software\\Zenden.ws\\Image Uploader", canCreateRegistryKey ) ) {
				if ( ExplorerContextMenu ) {
					Reg.WriteBool( "ExplorerCascadedMenu", ExplorerCascadedMenu );
					Reg.WriteBool("ExplorerContextMenu", ExplorerContextMenu);
					Reg.WriteBool( "ExplorerVideoContextMenu", ExplorerVideoContextMenu );
					Reg.WriteString( "Language", Language );
				} else {
					Reg.DeleteValue("ExplorerCascadedMenu");
					Reg.DeleteValue("ExplorerContextMenu");
					Reg.DeleteValue("ExplorerVideoContextMenu");
					Reg.DeleteValue("Language");
				}
			}
		}
		/*else
		{
		   //Reg.DeleteKey("Software\\Zenden.ws\\Image Uploader");
		}*/
		EnableAutostartup(AutoStartup);

		if (SendToContextMenu_changed   || ExplorerContextMenu_changed) {
			AutoStartup_changed = false;
			BOOL b;
			if ( IsVista() && IsElevated(&b) != S_OK ) {
				// Start new elevated process 
				ApplyRegistrySettings();
			} else {
				// Process has already admin rights
				ApplyRegSettingsRightNow();
			}
		}

		ExplorerContextMenu_changed = false;
		SendToContextMenu_changed = false;

		if (ShowTrayIcon_changed)
		{
			ShowTrayIcon_changed = false;
			if (ShowTrayIcon)
			{
				if (!IsRunningFloatingWnd())
				{
					CmdLine.AddParam(_T("/tray"));
					floatWnd.CreateTrayIcon();
				}
			}
			else
			{
				HWND TrayWnd = FindWindow(0, _T("ImageUploader_TrayWnd"));
				if (TrayWnd) {
					::SendMessage( TrayWnd, WM_CLOSETRAYWND, 0, 0 );
				}
			}
		}
		else if (ShowTrayIcon)
		{
			HWND TrayWnd = FindWindow(0, _T("ImageUploader_TrayWnd"));
			if (TrayWnd)
				SendMessage(TrayWnd, WM_RELOADSETTINGS,  (floatWnd.m_hWnd) ? 1 : 0, (Settings.Hotkeys_changed) ? 0 : 1);
		}

		Settings.Hotkeys_changed  = false;
#endif
		return true;
	}
Exemple #11
0
CSettings::CSettings()
{
#if !defined(IU_CLI) && !defined(IU_SERVERLISTTOOL)
	IsPortable = false;
	FindDataFolder();
	if (!IsDirectory(DataFolder))
	{
		CreateDirectory(DataFolder, 0);
	}
	if (!IsDirectory(IuCoreUtils::Utf8ToWstring(SettingsFolder).c_str()))
	{
		CreateDirectory(IuCoreUtils::Utf8ToWstring(SettingsFolder).c_str(), 0);
	}
	BOOL isElevated = false;
	IsElevated(&isElevated);
	if ( isElevated  || CmdLine.IsOption(L"afterupdate")) {
		WinUtils::MakeDirectoryWritable(DataFolder);
	}
#endif
#if !defined(IU_CLI) && !defined(IU_SERVERLISTTOOL)
	CString copyFrom = WinUtils::GetAppFolder() + SETTINGS_FILE_NAME;
	CString copyTo = DataFolder + SETTINGS_FILE_NAME;
	if (FileExists(copyFrom) && !FileExists(copyTo))
	{
		MoveFile(copyFrom, copyTo);
	}

	
		
	// Default values of settings
	ExplorerCascadedMenu = true;
	ConnectionSettings.UseProxy =  FALSE;
	ConnectionSettings.ProxyPort = 0;
	ConnectionSettings.NeedsAuth = false;
	ConnectionSettings.ProxyType = 0;
	#endif
	LastUpdateTime = 0;
	UploadBufferSize = /*65536*/1024*1024;
	FileRetryLimit = 3;
	ActionRetryLimit = 2;
#if !defined(IU_SHELLEXT) && !defined(IU_CLI) && !defined(IU_SERVERLISTTOOL)
	if ( !IsFFmpegAvailable() ){
		VideoSettings.Engine = VideoEngineDirectshow;
	}
	
	WatchClipboard = true;
	ShowTrayIcon = false;
	ShowTrayIcon_changed = false;
	*m_Directory = 0;
	UseTxtTemplate = false;
	UseDirectLinks = true;
	CodeLang = 0;
	ConfirmOnExit = 1;
	ExplorerContextMenu = false;
	ExplorerVideoContextMenu = true;
	ExplorerContextMenu_changed = false;
	ThumbsPerLine = 4;
	SendToContextMenu_changed = false;
	SendToContextMenu = 0;
	QuickUpload = 1;
	ParseSubDirs = 1;
	UseNewIcon = false;
	RememberImageServer = true;
    RememberFileServer = true;
	
	ShowUploadErrorDialog = true;

	ImageEditorPath = _T("mspaint.exe \"%1\"");
	AutoCopyToClipboard = false;
	AutoShowLog = true;
	

//	StringToFont(_T("Tahoma,7,b,204"), &ThumbSettings.ThumbFont);
	StringToFont(_T("Tahoma,8,,204"), &VideoSettings.Font);

	/*ThumbSettings.CreateThumbs = true;
	ThumbSettings.ThumbWidth = 180;
	ThumbSettings.ThumbHeight = 140;
	ThumbSettings.DrawFrame = true;
	ThumbSettings.ThumbAddImageSize  = true;
	ThumbSettings.FrameColor = RGB( 0, 74, 111);
	ThumbSettings.BackgroundColor = RGB( 255, 255, 255);f
	ThumbSettings.ThumbColor1 =  RGB( 13, 86, 125);
	ThumbSettings.ThumbColor2 = RGB( 6, 174, 255);
	ThumbSettings.UseServerThumbs = false;
	ThumbSettings.ScaleByHeight = false;
	ThumbSettings.ThumbTextColor = RGB( 255, 255, 255);
	ThumbSettings.ThumbAlpha = 120;
	ThumbSettings.Text = _T("%width%x%height% (%size%)");
	ThumbSettings.Format = ThumbCreatingParams::tfJPEG;
	ThumbSettings.FileName = "default";
	ThumbSettings.Quality = 85;*/

	VideoSettings.Columns = 3;
	VideoSettings.TileWidth =  200;
	VideoSettings.GapWidth = 5;
	VideoSettings.GapHeight = 7;
	VideoSettings.NumOfFrames = 8;
	VideoSettings.JPEGQuality =  100;
	VideoSettings.UseAviInfo = TRUE;
	VideoSettings.ShowMediaInfo = TRUE;
	VideoSettings.TextColor = RGB(0, 0, 0);
	VideoSettings.SnapshotsFolder = IuCoreUtils::Utf8ToWstring(Settings.SettingsFolder).c_str() + CString(_T("Snapshots"));
	VideoSettings.SnapshotFileTemplate = _T("%f%_%cx%_%cy%_%uid%\\grab_%i%.png");
	
	VideoSettings.Engine = IsFFmpegAvailable() ? VideoEngineAuto : VideoEngineDirectshow;
	

	ScreenshotSettings.Format =  1;
	ScreenshotSettings.Quality = 85;
	ScreenshotSettings.WindowHidingDelay = 450;
	ScreenshotSettings.Delay = 1;
	ScreenshotSettings.brushColor = RGB(255, 0, 0);
	ScreenshotSettings.ShowForeground = false;
	ScreenshotSettings.FilenameTemplate = _T("screenshot %y-%m-%d %i");
	ScreenshotSettings.CopyToClipboard = false;
	ScreenshotSettings.RemoveCorners = !WinUtils::IsWindows8orLater();
	ScreenshotSettings.AddShadow = false;
	ScreenshotSettings.RemoveBackground = false;
	ScreenshotSettings.OpenInEditor = true;
	ScreenshotSettings.UseOldRegionScreenshotMethod = false;

	TrayIconSettings.LeftClickCommand = 0; // without action
	TrayIconSettings.LeftDoubleClickCommand = 12; 

	TrayIconSettings.RightClickCommand = 1; // context menu
	TrayIconSettings.MiddleClickCommand = 7; // region screenshot
	TrayIconSettings.DontLaunchCopy = FALSE;
	TrayIconSettings.ShortenLinks = FALSE;
	TrayIconSettings.TrayScreenshotAction = TRAY_SCREENSHOT_OPENINEDITOR;

	ImageEditorSettings.BackgroundColor = Gdiplus::Color(255,255,255);
	ImageEditorSettings.ForegroundColor = Gdiplus::Color(255,0,0);
	ImageEditorSettings.PenSize = 12;
	ImageEditorSettings.RoundingRadius = ImageEditorSettings.PenSize;
	StringToFont(_T("Arial,12,b,204"), &ImageEditorSettings.Font);



	ImageReuploaderSettings.PasteHtmlOnCtrlV = true;
	Hotkeys_changed = false;
#endif
	
	/* binding settings */
	SettingsNode& general = mgr_["General"];
		general.n_bind(LastUpdateTime);
#if !defined(IU_CLI) && !defined(IU_SERVERLISTTOOL)
		general.n_bind(Language);
		general.n_bind(ExplorerContextMenu);
		/*general.n_bind(ExplorerVideoContextMenu);
		general.n_bind(ExplorerCascadedMenu);*/
#endif
		#if !defined(IU_SHELLEXT) && !defined(IU_CLI) && !defined(IU_SERVERLISTTOOL)
	


	general.n_bind(ConfirmOnExit);
	general.n_bind(SendToContextMenu);
	general.n_bind(ParseSubDirs);
	general.n_bind(ImageEditorPath);
	//general.n_bind(AutoStartup);
	general.n_bind(ShowTrayIcon);
	general.n_bind(AutoCopyToClipboard);
	general.n_bind(AutoShowLog);
	general.n_bind(ImagesFolder);
	general.n_bind(VideoFolder);
	general.n_bind(WatchClipboard);
	general.n_bind(UseNewIcon);
	general.n_bind(RememberFileServer);
	general.n_bind(RememberImageServer);
	#ifndef IU_SERVERLISTTOOL
	general.n_bind(Hotkeys);
	#endif
	SettingsNode& screenshot = mgr_["Screenshot"];
	screenshot.nm_bind(ScreenshotSettings, Delay);
	screenshot.nm_bind(ScreenshotSettings, Format);
	screenshot.nm_bind(ScreenshotSettings, Quality);
	screenshot.nm_bind(ScreenshotSettings, ShowForeground);
	screenshot.nm_bind(ScreenshotSettings, FilenameTemplate);
	screenshot.nm_bind(ScreenshotSettings, Folder);
	screenshot.nm_bind(ScreenshotSettings, AddShadow);
	screenshot.nm_bind(ScreenshotSettings, RemoveBackground);
	screenshot.nm_bind(ScreenshotSettings, RemoveCorners);
	screenshot.nm_bind(ScreenshotSettings, CopyToClipboard);
	screenshot.nm_bind(ScreenshotSettings, brushColor);
	screenshot.nm_bind(ScreenshotSettings, WindowHidingDelay);
	screenshot.nm_bind(ScreenshotSettings, OpenInEditor);
	screenshot.nm_bind(ScreenshotSettings, UseOldRegionScreenshotMethod);

	SettingsNode& imageEditor = mgr_["ImageEditor"];
	imageEditor.nm_bind(ImageEditorSettings, ForegroundColor);
	imageEditor.nm_bind(ImageEditorSettings, BackgroundColor);
	imageEditor.nm_bind(ImageEditorSettings, PenSize);
	imageEditor.nm_bind(ImageEditorSettings, RoundingRadius);
	imageEditor.nm_bind(ImageEditorSettings, Font);

	SettingsNode& image = mgr_["Image"];
	image["CurrentProfile"].bind(CurrentConvertProfileName);
	image.nm_bind(UploadProfile, KeepAsIs);

	/*SettingsNode& thumbnails = mgr_["Thumbnails"];
	thumbnails.nm_bind(ThumbSettings, FileName);
	thumbnails.nm_bind(ThumbSettings, CreateThumbs);
	thumbnails.nm_bind(ThumbSettings, ThumbWidth);
	thumbnails.nm_bind(ThumbSettings, ThumbHeight);
	thumbnails.nm_bind(ThumbSettings, ScaleByHeight);
	thumbnails.nm_bind(ThumbSettings, FrameColor);
	thumbnails.nm_bind(ThumbSettings, ThumbColor1);
	thumbnails.nm_bind(ThumbSettings, ThumbColor2);
	thumbnails.nm_bind(ThumbSettings, UseServerThumbs);
	thumbnails.nm_bind(ThumbSettings, ThumbAddImageSize);
	thumbnails.nm_bind(ThumbSettings, DrawFrame);
	thumbnails.nm_bind(ThumbSettings, Quality);
	thumbnails.nm_bind(ThumbSettings, Format);
	thumbnails.nm_bind(ThumbSettings, Text);
	thumbnails["Text"]["@Color"].bind(ThumbSettings.ThumbTextColor);
	thumbnails["Text"]["@Font"].bind(ThumbSettings.ThumbFont);
	thumbnails["Text"]["@TextOverThumb"].bind(ThumbSettings.TextOverThumb);
	thumbnails["Text"]["@ThumbAlpha"].bind(ThumbSettings.ThumbAlpha);*/

	SettingsNode& video = mgr_["VideoGrabber"];
	video.nm_bind(VideoSettings, Columns);
	video.nm_bind(VideoSettings, TileWidth);
	video.nm_bind(VideoSettings, GapWidth);
	video.nm_bind(VideoSettings, GapHeight);
	video.nm_bind(VideoSettings, NumOfFrames);
	video.nm_bind(VideoSettings, JPEGQuality);
	video.nm_bind(VideoSettings, ShowMediaInfo);
	video.nm_bind(VideoSettings, TextColor);
	video.nm_bind(VideoSettings, Font);
	video.nm_bind(VideoSettings, Engine);
	video.nm_bind(VideoSettings, SnapshotsFolder);
	video.nm_bind(VideoSettings, SnapshotFileTemplate);

	SettingsNode& tray = mgr_["TrayIcon"];
	tray.nm_bind(TrayIconSettings, LeftDoubleClickCommand);
	tray.nm_bind(TrayIconSettings, LeftClickCommand);
	tray.nm_bind(TrayIconSettings, RightClickCommand);
	tray.nm_bind(TrayIconSettings, MiddleClickCommand);
	tray.nm_bind(TrayIconSettings, DontLaunchCopy);
	tray.nm_bind(TrayIconSettings, ShortenLinks);
	tray.nm_bind(TrayIconSettings, TrayScreenshotAction);

	SettingsNode& history = mgr_["History"];
	history.nm_bind(HistorySettings, EnableDownloading);



	SettingsNode& imageReuploader = mgr_["ImageReuploader"];
	imageReuploader.nm_bind(ImageReuploaderSettings, PasteHtmlOnCtrlV);
	#endif

	SettingsNode& upload = mgr_["Uploading"];
#if !defined(IU_CLI) && !defined(IU_SERVERLISTTOOL)
	upload.n_bind(ServerName);
	upload.n_bind(FileServerName);
//	upload.n_bind(UrlShorteningServer);
	upload.n_bind(QuickUpload);
	upload.n_bind(QuickServerName);
	upload.n_bind(CodeLang);
	upload.n_bind(ThumbsPerLine);
	upload.n_bind(UseDirectLinks);
	upload.n_bind(UseTxtTemplate);
	upload.n_bind(CodeType);
	upload.n_bind(ShowUploadErrorDialog);
	
	imageServer.bind(upload["Server"]);
	fileServer.bind(upload["FileServer"]);
	quickScreenshotServer.bind(upload["QuickScreenshotServer"]);
	contextMenuServer.bind(upload["ContextMenuServer"]);
	urlShorteningServer.bind(upload["UrlShorteningServer"]);


	ConvertProfiles["Default"] = ImageConvertingParams();
	CurrentConvertProfileName = "Default";
#endif
	upload.n_bind(UploadBufferSize);
	upload.n_bind(FileRetryLimit);

	upload.n_bind(ActionRetryLimit);
#if  !defined  (IU_CLI) && !defined(IU_SHELLEXT) && !defined(IU_SERVERLISTTOOL)
	SettingsNode& proxy = upload["Proxy"];
	proxy["@UseProxy"].bind(ConnectionSettings.UseProxy);
	proxy["@NeedsAuth"].bind(ConnectionSettings.NeedsAuth);
	proxy.nm_bind(ConnectionSettings, ServerAddress);
	proxy.nm_bind(ConnectionSettings, ProxyPort);
	proxy.nm_bind(ConnectionSettings, ProxyType);
	proxy.nm_bind(ConnectionSettings, ProxyUser);
	proxy.nm_bind(ConnectionSettings, ProxyPassword);;
#endif
}
// Message handler for about box.
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	UNREFERENCED_PARAMETER(lParam);
	switch (message)
	{
	case WM_INITDIALOG:
		{
			HWND hwndOwner = GetDesktopWindow(); 
			RECT rc, rcDlg, rcOwner; 

			GetWindowRect(hwndOwner, &rcOwner); 
			GetWindowRect(hDlg, &rcDlg); 
			CopyRect(&rc, &rcOwner); 

			SetWindowTextA(GetDlgItem(hDlg,IDC_INSTRUCTIONS),"DropboxFilter is a program that hooks into dropbox and adds filter capabilities.\n\nThere is two ways to install it.\n\n1. AppInit Dll's\n\tThis method is a bit intrusive, anal virus scanners might detect this as a threat. But, it will not disappear when Dropbox is automatically updated.\n\n2. Piggyback start up launching.\n\tThis method will replace the dropbox system start with its own. When dropbox is automatically updated it might remove this and thereby disabling DropboxFilter without you noticing.\n\nAppInit method is recommended.");
			if(!IsElevated()) {
				Button_SetElevationRequiredState(GetDlgItem(hDlg,IDC_INSTALL_APPINIT),TRUE);
				Button_SetElevationRequiredState(GetDlgItem(hDlg,IDC_INSTALL_PIGGYBACK),TRUE);
				Button_SetElevationRequiredState(GetDlgItem(hDlg,IDC_UNINSTALL),TRUE);
			}
			// Offset the owner and dialog box rectangles so that right and bottom 
			// values represent the width and height, and then offset the owner again 
			// to discard space taken up by the dialog box. 

			OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top); 
			OffsetRect(&rc, -rc.left, -rc.top); 
			OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom); 

			// The new position is the sum of half the remaining space and the owner's 
			// original position. 

			SetWindowPos(hDlg, 
				HWND_TOP, 
				rcOwner.left + (rc.right / 2), 
				rcOwner.top + (rc.bottom / 2), 
				0, 0,          // Ignores size arguments. 
				SWP_NOSIZE);
			if(lParam) {
				if(IsElevated()) {
					PostMessage(hDlg,WM_COMMAND,lParam,0);
				} else {
					MessageBox(NULL,"Could not elevate process rights. Your user needs to have admin rights to install this program","Cant elevate",MB_OK);
				}
			}
		}
		return (INT_PTR)TRUE;

	case WM_COMMAND:
		switch(LOWORD(wParam)) {
		case ID_CLOSE:
		case IDCANCEL:
			EndDialog(hDlg, LOWORD(wParam));
			return (INT_PTR)TRUE;
		case IDC_INSTALL_APPINIT:
			Elevate(hDlg,IDC_INSTALL_APPINIT);
			if(!Install()) {
				return TRUE;
			}
			if(!InstallAppInit()) {
				return TRUE;
			}
			MessageBoxA(NULL,"Install done.\n\nStart dropbox manualy from the start menu.","Installed",MB_OK);
			return TRUE;
		case IDC_INSTALL_PIGGYBACK:
			Elevate(hDlg,IDC_INSTALL_PIGGYBACK);
			if(!Install()) {
				return TRUE;
			}
			if(!InstallPiggyback()) {
				return TRUE;
			}
			MessageBoxA(NULL,"Install done.\n\nStart dropbox manualy from the startup folder on the start menu.","Installed",MB_OK);
			return TRUE;
		case IDC_UNINSTALL:
			Elevate(hDlg,IDC_INSTALL_PIGGYBACK);
			UnInstall();
			UnInstallPiggyback();
			UnInstallAppInit();
			MessageBoxA(NULL,"UnInstall done.\n\nStart dropbox manualy from the start menu.","UnInstalled",MB_OK);
			return TRUE;
		case IDC_EDIT_CONFIG:
			EditConfig();
			return TRUE;
		}
		break;
	}
	return (INT_PTR)FALSE;
}