Beispiel #1
0
bool
IniFile::WritePassword(char *value)
{
		//WriteInt("UltraVNC", "passwdsize",sizeof(value));
		//vnclog.Print(LL_INTERR, VNCLOG("%s \n"),myInifile);
		return (FALSE != WritePrivateProfileStruct("UltraVNC","passwd", value,8,myInifile));
}
Beispiel #2
0
BOOL CSpecialApp::CleanUltraEdit_Clean(int iType,LPCTSTR lpcszPath)
{	
	CString strPath = lpcszPath;
	g_regClean.ConvetPath(strPath);

	CSimpleArray<CString> vec_String;
	if(SplitCString1(strPath,vec_String,'|')< 3)
	{
		return FALSE;
	}
	
	if (TRUE !=WritePrivateProfileStruct(vec_String[1],vec_String[2], NULL, 0,vec_String[0]))
	{
		DWORD dwErrCode = GetLastError();
		if (dwErrCode == ERROR_FILE_NOT_FOUND)	//系统找不到指定文件
		{
			return TRUE;
		}
		else if (dwErrCode == ERROR_ACCESS_DENIED)
		{	
			g_fnScanFileError(g_pMain,iType,lpcszPath,0,0);	
		}
		else
		{	
			g_fnScanFileError(g_pMain,iType,lpcszPath,0,0);
		}
	}


	return TRUE;
}
Beispiel #3
0
void regSetBinaryValue(const char *key, char *value, int count)
{
  if(regEnabled) {
    LONG res = RegSetValueEx(vbKey,
                             key,
                             NULL,
                             REG_BINARY,
                             (const UCHAR *)value,
                             count);
  } else {
    CString k = key;
    k += "Count";
    wsprintf(buffer, "%u", count);

    WritePrivateProfileString(VBA_PREF,
                              k,
                              buffer,
                              *regVbaPath);

    WritePrivateProfileStruct(VBA_PREF,
                              key,
                              value,
                              count,
                              *regVbaPath);
  }
}
Beispiel #4
0
static void regExportSettingsToINI(HKEY key, const char *section)
{
  char valueName[256];
  int index = 0;
  while(1) {
    DWORD nameSize = 256;
    DWORD size = 2048;
    DWORD type;
    LONG res = RegEnumValue(key,
                            index,
                            valueName,
                            &nameSize,
                            NULL,
                            &type,
                            (LPBYTE)buffer,
                            &size);

    if(res == ERROR_SUCCESS) {
      switch(type) {
      case REG_DWORD:
        {
          char temp[256];
          wsprintf(temp, "%u", *((DWORD *)buffer));
          WritePrivateProfileString(section,
                                    valueName,
                                    temp,
                                    *regVbaPath);
        }
        break;
      case REG_SZ:
        WritePrivateProfileString(section,
                                  valueName,
                                  buffer,
                                  *regVbaPath);
        break;
      case REG_BINARY:
        {
          char temp[256];

          wsprintf(temp, "%u", size);
          CString k = valueName;
          k += "Count";
          WritePrivateProfileString(section,
                                    k,
                                    temp,
                                    *regVbaPath);
          WritePrivateProfileStruct(section,
                                    valueName,
                                    buffer,
                                    size,
                                    *regVbaPath);
        }
        break;
      }
      index++;
    } else
      break;
  }
}
static void idaapi term(void)
{
    msg("LoadMap: Plugin terminate.\n");

    // Write the plugin's options to ini file
    _VERIFY(WritePrivateProfileStruct(g_szLoadMapSection, g_szOptionsKey, &g_options,
                                      sizeof(g_options), g_szIniPath));
}
Beispiel #6
0
void PersistColors()
{
	char str[256];
	sprintf(str, "%d %d", g_crGradStart, g_crGradEnd);
	WritePrivateProfileString(SWS_INI, GRADIENT_COLOR_KEY, str, get_ini_file());
#ifdef _WIN32
	WritePrivateProfileStruct("REAPER", "custcolors", g_custColors, sizeof(g_custColors), get_ini_file());
#else
	SetCustomColors(g_custColors);
#endif
}
Beispiel #7
0
void SaveDefaultConfig(HWND hwndDlg)
{
  char data[1024];
  SinkSaveState(hwndDlg,data);
  int l=SinkGetConfigSize();
  char *desc="raw encoder defaults";
  const char *fn=get_ini_file();
  char buf[64]; 
  sprintf(buf,"%d",l);
  WritePrivateProfileString(desc,"default_size",buf,fn);
  WritePrivateProfileStruct(desc,"default",data,l,fn);
}
long FASTCALL RegSetValueExRecursive( HKEY hKey, LPCTSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE* lpData, DWORD cbData )
{
    TCHAR szBuffer[ 256 ];
    R_ASSERT( lstrlen( lpValueName ) < countof( szBuffer ) );
    (void)lstrcpy( szBuffer, lpValueName );

    LPTSTR pszBuffer = szBuffer;
    LPTSTR pszLast = szBuffer;
    while( *pszBuffer )
    {
        if( *pszBuffer == _T('\\') || *pszBuffer == _T('/') )
        {
            pszLast = pszBuffer;
            lpValueName = pszLast + 1;
        }
        pszBuffer++;
    }

    if(!regEnabled) {
        if(WritePrivateProfileStruct("Viewer",
                                     lpValueName,
                                     (LPVOID)lpData,
                                     cbData,
                                     regGetINIPath())) {
            return ERROR_SUCCESS;
        }
        return -1;
    }

    bool m_bNeedToCloseKey = false;
    if( pszLast != szBuffer )
    {
        *pszLast = _T('\000');
        HKEY hkeyTemp;
        long lRet = RegOpenKey( hKey, szBuffer, &hkeyTemp );
        if( lRet != ERROR_SUCCESS )
        {
            lRet = RegCreateKey( hKey, szBuffer, &hkeyTemp );
            if( lRet != ERROR_SUCCESS )
                return lRet;
        }
        hKey = hkeyTemp;
        m_bNeedToCloseKey = true;
    }

    long lRet = RegSetValueEx( hKey, lpValueName, Reserved, dwType, lpData, cbData );
    if( m_bNeedToCloseKey )
    {
        R_VERIFY( RegCloseKey( hKey ) == ERROR_SUCCESS );
    }
    return lRet;
}
Beispiel #9
0
void regExportSettingsToINI()
{
  char valueName[256];
  
  if(vbKey != NULL) {
    int index = 0;
    while(1) {
      DWORD nameSize = 256;
      DWORD size = 2048;
      DWORD type;
      LONG res = RegEnumValue(vbKey,
                              index,
                              valueName,
                              &nameSize,
                              NULL,
                              &type,
                              (LPBYTE)buffer,
                              &size);
      
      if(res == ERROR_SUCCESS) {
        switch(type) {
        case REG_DWORD:
          {
            char temp[256];
            wsprintf(temp, "%u", *((DWORD *)buffer));
            WritePrivateProfileString(VBA_PREF,
                                      valueName,
                                      temp,
                                      regVbaPath);
          }
          break;
        case REG_SZ:
          WritePrivateProfileString(VBA_PREF,
                                    valueName,
                                    buffer,
                                    regVbaPath);
          break;
        case REG_BINARY:
          WritePrivateProfileStruct(VBA_PREF,
                                    valueName,
                                    buffer,
                                    size,
                                    regVbaPath);
          break;
        }
        index++;
      } else
        break;
    }
  }
}
Beispiel #10
0
// ---------------------------------------------------------------------------
//	iniファイルにデータを書き込む
// ---------------------------------------------------------------------------
int WriteIniFileData( char *vname, char *data, int size, char *sec_name, char *ini_fname )
{
	int		ret;

	if( ini_fname==NULL){
		if(IniFileName[0]==0){
			ini_fname = "default.ini";
		}else{
			ini_fname = IniFileName;
		}
	}
	ret = !WritePrivateProfileStruct( sec_name, vname, data, size, ini_fname );
	return ret;
}
Beispiel #11
0
void regSetBinaryValue(char *key, char *value, int count)
{
  if(regEnabled) {
    LONG res = RegSetValueEx(vbKey,
                             key,
                             NULL,
                             REG_BINARY,
                             (const UCHAR *)value,
                             count);
  } else {
    WritePrivateProfileStruct(VBA_PREF,
                              key,
                              value,
                              count,
                              regVbaPath);
  }
}
Beispiel #12
0
bool //PGM
IniFile::WritePassword2(char *value) //PGM
{ //PGM
		return (FALSE != WritePrivateProfileStruct("UltraVNC","passwd2", value,8,myInifile)); //PGM
} //PGM
Beispiel #13
0
//一键清理方案
BOOL CSpecialApp::CleanUltraEdit(int iType,LPCTSTR lpcszAppPath)
{	
    BOOL retval = FALSE;
	CString strPath = lpcszAppPath;
	g_regClean.ConvetPath(strPath);
	
	WritePrivateProfileSection(_T("Replace History"),NULL,strPath);
	WritePrivateProfileSection(_T("Recent File List"),NULL,strPath);
	WritePrivateProfileSection(_T("Find Hex History"),NULL,strPath);
	WritePrivateProfileSection(_T("Find History"),NULL,strPath);
	

	TCHAR* szBuffer = NULL;
	TCHAR szKey[1024] = {0};
	CString strKey = _T("");
	CString strKeyName = _T("");
	CString strKeyValue = _T("");
    int nBufferSize;

    szBuffer = new TCHAR[65536];
    if (!szBuffer)
        goto clean0;

	nBufferSize = GetPrivateProfileSection(
		_T("Open Files"), 
		szBuffer, 
		65536,
		strPath
		);
	


	for (int n = 0, i = 0; n < nBufferSize; n++)
	{
		if (szBuffer[n] == 0)
		{
			szKey[i] = 0;
			strKey = szKey;

			strKeyName = strKey.Left(strKey.Find('='));
			strKeyValue = strKey.Mid(strKey.Find('=') + 1);
			
			int iLen = (int)wcslen(_T("Open File"));
			if ((-1!=strKeyName.Find(_T("Open File"))&&(strKeyName.GetLength()>iLen)))
			{	

				if ((strKeyName.GetAt(iLen)>='0'&&strKeyName.GetAt(iLen)<='9'))
				{
					WritePrivateProfileStruct(_T("Open Files"),strKeyName, NULL, 0,lpcszAppPath);
				}
			
			}

			i = 0;

		}
		else
		{
			szKey[i] = szBuffer[n];

			i++;
		}

	}

	ZeroMemory(szBuffer, 65536);
	nBufferSize = GetPrivateProfileSection(
		_T("Recent Projects"), 
		szBuffer, 
		65536,
		strPath
		);



	for (int n = 0, i = 0; n < nBufferSize; n++)
	{
		if (szBuffer[n] == 0)
		{
			szKey[i] = 0;
			strKey = szKey;

			strKeyName = strKey.Left(strKey.Find('='));
			strKeyValue = strKey.Mid(strKey.Find('=') + 1);

			int iLen = (int)wcslen(_T("Recent Project "));
			if ((-1!=strKeyName.Find(_T("Recent Project "))&&(strKeyName.GetLength()>iLen)))
			{	

// 				if ((strKeyName.GetAt(iLen)>='0'&&strKeyName.GetAt(iLen)<='9'))
// 				{
					WritePrivateProfileStruct(_T("Open Files"),strKeyName, NULL, 0,lpcszAppPath);
//				}

			}

			i = 0;

		}
		else
		{
			szKey[i] = szBuffer[n];

			i++;
		}

	}
	
    retval = TRUE;

clean0:
    if (szBuffer)
    {
        delete[] szBuffer;
        szBuffer = NULL;
    }

	return retval;
}
Beispiel #14
0
bool CBaseIni::WriteStruct( LPCTSTR lpszAppName, LPCTSTR lpszKeyName, void * pStruct, unsigned int nSizeStruct )
{
	return WritePrivateProfileStruct( lpszAppName, lpszKeyName, pStruct, nSizeStruct, m_strFileName.c_str() ) == TRUE;
}