Ejemplo n.º 1
0
//----------------------------------------------------------------------------
// initPageActions
//  Called to initialize page actions for a certain browser / tab
HRESULT Proxy::initPageActions(HWND aHwndBrowser, INT aTabId)
{
  if (!aHwndBrowser || !::IsWindow(aHwndBrowser)) {
    return E_INVALIDARG;
  }
  mIEMainWindow = aHwndBrowser;

  // Get install paths for 32 and 64bit from registry
  if (mInstallPath32.IsEmpty()) {
    if (!GetInstallDir(mInstallPath32.GetBuffer(MAX_PATH), MAX_PATH, FALSE)) {
      return E_FAIL;
    }
    mInstallPath32.ReleaseBuffer();
  }

  if (mInstallPath64.IsEmpty()) {
    // do we also have a 64 bit installation?
    if (!GetInstallDir(mInstallPath64.GetBuffer(MAX_PATH), MAX_PATH, TRUE)) {
      mInstallPath64 = mInstallPath32;
    }
    mInstallPath64.ReleaseBuffer();
  }

  // get process ID from window handle
  DWORD ieMainProcessID = 0;
  if (!::GetWindowThreadProcessId(aHwndBrowser, &ieMainProcessID)) {
    return E_FAIL;
  }

  // prepare and start injection
  return writeHandleAndInject(ieMainProcessID);
}
Ejemplo n.º 2
0
void CPBXClientApp::SetLanguage(CString lang) {		
#ifdef _UNICODE
    gettext_putenv(CStringA("LANG="+lang));
    bindtextdomain (GETTEXT_DOMAIN, CStringA(GetInstallDir()+"\\lang"));	
	bind_textdomain_codeset(GETTEXT_DOMAIN, "UCS-2LE");
	/*char *ch = ConvertFromUnicodeToMB(CString("LANG=")+lang);
	if (ch) {
		gettext_putenv(ch);
        free(ch);
	} else {
		return;
	}		
	ch = ConvertFromUnicodeToMB(GetInstallDir()+"\\lang");
	if (ch) {
		bindtextdomain (GETTEXT_DOMAIN, ch);
		free(ch);
	} else {
        return;
	}*/
#else
	gettext_putenv(CString("LANG=")+lang);
    bindtextdomain (GETTEXT_DOMAIN, GetInstallDir()+"\\lang");
#endif
	//setlocale(LC_ALL, "DECIMAL");
	textdomain (GETTEXT_DOMAIN);	
}
Ejemplo n.º 3
0
wxString clStandardPaths::GetPluginsDirectory() const
{
#ifdef __WXGTK__
    wxString pluginsDir = PLUGINS_DIR;
#else
#ifdef USE_POSIX_LAYOUT
    wxFileName path(GetInstallDir() + wxT(PLUGINS_DIR), "");
#else
    wxFileName path(GetDataDir(), "");
    path.AppendDir("plugins");
#endif
    wxString pluginsDir = path.GetPath();
#endif
    return pluginsDir;
}
Ejemplo n.º 4
0
/*!
 * \brief Create all header amd make files.
 *
 * \return true on success, otherwise false.
 */
bool CNutConfDoc::GenerateBuildTree()
{
    CSettings *cfg = wxGetApp().GetSettings();

    wxBusyCursor wait;

    wxLogMessage(wxT("Creating Makefiles for %s in %s"), cfg->m_platform.c_str(), cfg->m_buildpath.c_str());
    if(CreateMakeFiles(m_repository, m_root, cfg->m_buildpath.mb_str(), cfg->m_source_dir.mb_str(),
                       cfg->m_platform.mb_str(), cfg->m_firstidir.mb_str(), cfg->m_lastidir.mb_str(),
                       GetInstallDir().mb_str())) {
        return false;
    }

    wxLogMessage(wxT("Creating header files in %s"), cfg->m_buildpath.c_str());
    if(CreateHeaderFiles(m_repository, m_root, cfg->m_buildpath.mb_str())) {
        return false;
    }
    wxLogMessage(wxT("OK"));
    return true;
}
Ejemplo n.º 5
0
bool CNutConfDoc::GenerateApplicationTree()
{
    CSettings *cfg = wxGetApp().GetSettings();

    wxBusyCursor wait;

    wxString src_dir = cfg->m_source_dir + wxT("/app");
    wxString cfg_inc = cfg->m_firstidir;

    wxLogMessage(wxT("Copying samples from %s to %s"), src_dir.c_str(), cfg->m_app_dir.c_str());
    CDirCopyTraverser traverser(src_dir, cfg->m_app_dir);
    wxDir dir(src_dir);
    dir.Traverse(traverser);

#ifdef _WIN32
    src_dir = cfg->m_source_dir + wxT("/appicc");
    wxLogMessage(wxT("Translating ICCAVR projects from %s to %s"), src_dir.c_str(), cfg->m_app_dir.c_str());
    CDirIccAvrProjectTraverser icc_traverser(src_dir, cfg->m_app_dir);
    wxDir icc_dir(src_dir);
    icc_dir.Traverse(icc_traverser);
#endif
#if 0
    src_dir = cfg->m_source_dir + wxT("/appeclipse");
    wxLogMessage(wxT("Translating Eclipse projects from %s to %s"), src_dir.c_str(), cfg->m_app_dir.c_str());
    CDirEclipseProjectTraverser eclipse_traverser(src_dir, cfg->m_app_dir);
    wxDir eclipse_dir(src_dir);
    eclipse_dir.Traverse(eclipse_traverser);
#endif
    wxLogMessage(wxT("Creating Makefiles for %s in %s"), cfg->m_platform.c_str(), cfg->m_app_dir.c_str());
    if(CreateSampleDirectory(m_repository, m_root, cfg->m_buildpath.mb_str(), cfg->m_app_dir.mb_str(), 
                             cfg->m_source_dir.mb_str(), GetInstallDir().mb_str(), cfg->m_platform.mb_str(), 
                             cfg->m_programmer.mb_str(), cfg->m_firstidir.mb_str(), cfg->m_lastidir.mb_str())) {
        return false;
    }
    wxLogMessage(wxT("OK"));
    return true;
}
Ejemplo n.º 6
0
BOOL GetSetting(char* pszGameName, char* pszName, VARIANT *pVal)
{
	if ( !pszName && !*pszName )
		return FALSE;

	if ( (pszGameName && IsGlobalSetting(pszName)) || IgnoreSetting(pszName) )
		return FALSE;

	struct rc_option *option;
	if(!(option = rc_get_option2(opts, pszName)))
		return FALSE;
	
	HKEY hKey = 0;
	char szKey[MAX_PATH];
	lstrcpy(szKey, REG_BASEKEY);
	lstrcat(szKey, "\\");

	if ( !pszGameName )
		lstrcat(szKey, REG_GLOBALS);
	else
		lstrcat(szKey, REG_DEFAULT);

	if ( RegOpenKeyEx(HKEY_CURRENT_USER, szKey, 0, KEY_QUERY_VALUE, &hKey)!=ERROR_SUCCESS )
		hKey = 0;

	HKEY hGameKey = 0;
	if ( pszGameName && *pszGameName ) {
		char szGameKey[MAX_PATH];
		lstrcpy(szGameKey, REG_BASEKEY);
		lstrcat(szGameKey, "\\");
		lstrcat(szGameKey, pszGameName);
		if ( RegOpenKeyEx(HKEY_CURRENT_USER, szGameKey, 0, KEY_QUERY_VALUE, &hGameKey)!=ERROR_SUCCESS )
			hGameKey = 0;
	}

	char szValue[4096];

	char szHelp[4096];
	lstrcpy(szHelp, "");
	if ( IsPathOrFile(option->name) ) {
		GetInstallDir(szHelp, sizeof szHelp);
		lstrcat(szHelp, "\\");
	}
	lstrcat(szHelp, option->deflt);

	char szDefault[4096];
	RegLoadOpts(hKey, option, szHelp, szDefault);
	RegLoadOpts(hGameKey, option, szDefault, szValue);
	CComVariant vValue(szValue);

	switch ( option->type ) {
	case rc_int:
		VariantChangeType(&vValue, &vValue, 0, VT_I4);
		break;

	case rc_bool:
		VariantChangeType(&vValue, &vValue, 0, VT_BOOL);
		break;

	case rc_float:
		VariantChangeType(&vValue, &vValue, 0, VT_R4);
		break;
	}

	if ( hGameKey )
		RegCloseKey(hGameKey);

	if ( hKey )
		RegCloseKey(hKey);

	vValue.Detach(pVal);

	return TRUE;
}
Ejemplo n.º 7
0
void LoadGlobalSettings()
{
	bool fNew = false;

	char szInstallDir[MAX_PATH];
	GetInstallDir(szInstallDir, sizeof szInstallDir);
	lstrcat(szInstallDir, "\\");

	char szKey[MAX_PATH];
	lstrcpy(szKey, REG_BASEKEY);
	lstrcat(szKey, "\\");
	lstrcat(szKey, REG_GLOBALS);

	HKEY hKey = 0;
	if ( RegOpenKeyEx(HKEY_CURRENT_USER, szKey, 0, KEY_QUERY_VALUE, &hKey)!=ERROR_SUCCESS )
		hKey = 0;

	rc_option* opts[10];
	int sp = 0;

	char szValue[4096];

	opts[sp] = ::opts;
	while ( sp>=0 ) {
		switch ( opts[sp]->type ) {
			case rc_bool:
			case rc_string:
			case rc_int:
			case rc_float:
				if ( !IsGlobalSetting(opts[sp]->name) || IgnoreSetting(opts[sp]->name) )
					break;

				char szDefault[512];
				lstrcpy(szDefault, "");
				if ( IsPathOrFile(opts[sp]->name) )
					lstrcpy(szDefault, szInstallDir);
				
				lstrcat(szDefault, opts[sp]->deflt);

				fNew |= RegLoadOpts(hKey, opts[sp], szDefault, szValue);
				rc_set_option3(opts[sp], szValue, 0);
				break;

			case rc_end:
				sp--;
				continue;

			case rc_link:
				opts[sp+1] = (rc_option*) opts[sp]->dest;
				opts[sp]++;
				sp++;
				continue;
		}
		opts[sp]++;
	}

	if ( hKey )
		RegCloseKey(hKey);

	if ( fNew )
		SaveGlobalSettings();
}
Ejemplo n.º 8
0
DWORD WINAPI DoUninstall(LPVOID lpParam)
{
  InstData *idata;
  HANDLE fin;
  HWND delstat;
  bstr *str;
  char *startmenu, *desktop, *installdir;

  installdir = GetInstallDir(product);

  if (!SetCurrentDirectory(installdir)) {
    str = bstr_new();
    bstr_assign(str, "Could not access install directory ");
    bstr_append(str, installdir);
    DisplayError(str->text, TRUE, TRUE);
    /* Pointless to try to free the bstr, since DisplayError ends the
     * process */
  }

  fin = CreateFile("install.log", GENERIC_READ, 0, NULL,
                   OPEN_EXISTING, 0, NULL);

  if (fin) {
    idata = ReadOldInstData(fin, product, installdir);
    CloseHandle(fin);
    DeleteFile("install.log");

    RemoveService(idata->service);

    delstat = GetDlgItem(mainDlg, ST_DELSTAT);
    DeleteFileList(idata->instfiles, delstat, NULL);
    DeleteFileList(idata->extrafiles, delstat, NULL);

    startmenu = GetStartMenuDir(idata->flags & IF_ALLUSERS, idata);
    desktop = GetDesktopDir();
    DeleteLinkList(startmenu, idata->startmenu, delstat);
    DeleteLinkList(desktop, idata->desktop, delstat);

    RemoveUninstall(startmenu, product, TRUE);

    SetCurrentDirectory(desktop);       /* Just make sure we're not in the 
                                         * install directory any more */

    str = bstr_new();
    if (!RemoveWholeDirectory(installdir)) {
      bstr_assign(str, "Could not remove install directory:\n");
      bstr_append(str, installdir);
      bstr_append(str, "\nYou may wish to manually remove it later.");
      DisplayError(str->text, FALSE, FALSE);
    }

    if (!RemoveWholeDirectory(startmenu)) {
      bstr_assign(str, "Could not remove Start Menu directory:\n");
      bstr_append(str, startmenu);
      bstr_append(str, "\nYou may wish to manually remove it later.");
      DisplayError(str->text, FALSE, FALSE);
    }

    bstr_assign(str, UninstallKey);
    bstr_appendpath(str, product);
    RegDeleteKey(HKEY_LOCAL_MACHINE, str->text);
    bstr_free(str, TRUE);

    bfree(startmenu);
    bfree(desktop);
    FreeInstData(idata, TRUE);
  } else {
    bfree(product);
    bfree(installdir);          /* Normally FreeInstData frees these */
    str = bstr_new();
    bstr_assign(str, "Could not read install.log from ");
    bstr_append(str, installdir);
    DisplayError(str->text, TRUE, TRUE);
    /* Pointless to try to free the bstr, since DisplayError ends the
     * process */
  }
  ShowWindow(GetDlgItem(mainDlg, ST_DELDONE), SW_SHOW);
  EnableWindow(GetDlgItem(mainDlg, BT_DELOK), TRUE);
  SetFocus(GetDlgItem(mainDlg, BT_DELOK));
  return 0;
}
Ejemplo n.º 9
0
// Get the dir where startup code, intrinsics and lib reside.
std::string GetStdLibsDir() {
  return GetInstallDir() + "lib";
}
Ejemplo n.º 10
0
// Get the dir where the linker scripts reside.
std::string GetStdLinkerScriptsDir() {
  return GetInstallDir() + "lkr";
}
Ejemplo n.º 11
0
// Get the dir where the assembler header files reside.
std::string GetStdAsmHeadersDir() {
  return GetInstallDir() + "inc";
}
Ejemplo n.º 12
0
// Get the dir where the c16 header files reside.
std::string GetStdHeadersDir() {
  return GetInstallDir() + "include";
}
Ejemplo n.º 13
0
/*
 * EXPORTED FUNCTIONS _________________________________________________________
 *
 */
extern "C" LONG APIENTRY CPlApplet(HWND hwndCPl, UINT uMsg, LONG lParam1, LONG lParam2)
{
    int i;
    LPNEWCPLINFO lpNewCPlInfo;
	HICON hIcon;
	static char szAppName[64];
	static char szAppPath[MAX_PATH];


    i = (int)lParam1;

    switch (uMsg) {
        case CPL_INIT:      /* first message, sent once  */
            hinst = GetModuleHandle("afsserver.cpl");
            hinstResources = TaLocale_LoadCorrespondingModule (hinst);
			strcpy(szAppName, LoadResString(IDS_APP_NAME));
			sprintf(szAppPath, "%s%s", GetInstallDir(), APP_EXE_PATH);
			return (hinst != 0);

        case CPL_GETCOUNT:  /* second message, sent once */
            return 1;
            break;

        case CPL_NEWINQUIRE: /* third message, sent once per app */
            lpNewCPlInfo = (LPNEWCPLINFO) lParam2;

            lpNewCPlInfo->dwSize = (DWORD) sizeof(NEWCPLINFO);
            lpNewCPlInfo->dwFlags = 0;
            lpNewCPlInfo->dwHelpContext = 0;
            lpNewCPlInfo->lData = 0;
            hIcon = TaLocale_LoadIcon(IDI_AFSD);
			if (hIcon == 0)
				MessageBox(0, LoadResString(IDS_ERROR_LOADING_ICON), szAppName, MB_ICONEXCLAMATION);
			lpNewCPlInfo->hIcon = hIcon;
            lpNewCPlInfo->szHelpFile[0] = '\0';
			strcpy(lpNewCPlInfo->szName, szAppName);
			strcpy(lpNewCPlInfo->szInfo, LoadResString(IDS_CPA_TITLE));
            break;

        case CPL_SELECT:		/* applet icon selected */
            break;

        case CPL_DBLCLK:		/* applet icon double-clicked */
			if (WinExec(szAppPath, SW_SHOW) < 32)
				MessageBox(0, LoadResString(IDS_EXECUTION_ERROR), szAppName, MB_ICONSTOP);
            break;

        case CPL_STOP:      /* sent once per app. before CPL_EXIT */
            break;

        case CPL_EXIT:    /* sent once before FreeLibrary called */
            if (hinstResources)
                FreeLibrary (hinstResources);
            break;

        default:
            break;
    }

    return 0;
}
Ejemplo n.º 14
-1
void CPBXClientApp::IntegrateIntoOutlook() {
	CRegKey regKey;
	DWORD value;

	// Check if Outlook is installed when OutCALL runs for the first time, and if so
	// write the appropriate registry keys

	if (regKey.Open(HKEY_CURRENT_USER, APP_REG_KEY)==ERROR_SUCCESS) {
		if (regKey.QueryValue(value, _T("TryOutlookIntegration"))!=ERROR_SUCCESS) {
			regKey.SetValue((DWORD)0, _T("TryOutlookIntegration"));
			regKey.Close();

			TCHAR path[256];			

			//WIN32_FIND_DATA FindFileData;
			//HANDLE hFind;

			SHGetFolderPath(NULL,CSIDL_LOCAL_APPDATA,NULL,0,path);
			//
			//hFind = FindFirstFile(CString(path) + "\\Microsoft\\Outlook\\outlook.pst", &FindFileData);
			//if (hFind == INVALID_HANDLE_VALUE) {
   //             AfxGetApp()->WriteProfileInt("Settings", "OutlookFeatures", 0);
			//	return; // outlook is not installed                    
			//} else {
   //             FindClose(hFind);
			//}

			if (regKey.Open(HKEY_CURRENT_USER, _T("SOFTWARE\\Microsoft\\Office\\Outlook"))!=ERROR_SUCCESS) {
                ::theApp.WriteProfileInt("Settings", "OutlookFeatures", 0);
				return; // outlook is not installed                    
			} else {
				regKey.Close();
			}

			try {
				CFile::Remove(CString(path) + "\\Microsoft\\Outlook\\extend.dat"); //this will refresh outlook cache for plugins (addins)
			} catch (...) {
			}

			CString addinPath = GetInstallDir() + "\\" + CString(APP_NAME) + ".dll";
			CString szAddinValue = "4.0;" + addinPath + ";1;11111111111111;1111111";

			if (regKey.Open(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Exchange\\Client\\Extensions"))==0) {
				regKey.SetValue(szAddinValue, CString(APP_NAME));					
				regKey.Close();
			}	

			::theApp.WriteProfileInt("Settings", "OutlookFeatures", 1);
		} else {
			regKey.Close();			
		}
	}
}