📄 ctrlthread.c
字号:
{
fg = 0;
sprintf( szOutPath, "%s", gVar.ImLogPath[ k ] );
iOutPathSize = strlen(szOutPath);
if( szOutPath[ iOutPathSize - 1 ] != '\\' )
{
szOutPath[ iOutPathSize ] = '\\';
szOutPath[ iOutPathSize + 1 ] = '\0';
iOutPathSize++;
}
memset( szCreateDirBuf, 0, sizeof(szCreateDirBuf) );
for( i = 4; i < iOutPathSize; i ++ )
{
if( szOutPath[ i ] == '\\' )
{
if(fg)
{
//ImLog
memcpy( szCreateDirBuf, szOutPath, i );
mkdir( szCreateDirBuf, 755 );
}
else
{
fg = 1;
}
}
}
}
}
void HttpUrlConfig()
{
char szOutPath[_MAX_DIR_LENGTH];
char szCreateDirBuf[_MAX_DIR_LENGTH];
char configPath[_MAX_DIR_LENGTH];
char keyword[_MAX_DIR_LENGTH];
int k,count=0;
int iOutPathSize;
int i,fg=0;
memset( configPath, 0, _MAX_DIR_LENGTH );
memset( szOutPath, 0, sizeof(szOutPath) );
sprintf( configPath, "%s", CONFIGURE_FILE );
GetProfileString( "HttpUrlPath", "count", "1", szOutPath,
sizeof(szOutPath) - 1, configPath );
sscanf( szOutPath, "%d", &count );
if( count < 1 )
count = 1;
count = count > _FILEPATH_NUMBER ? _FILEPATH_NUMBER : count;
gVar.HttpUrlPathNumber = count;
gVar.iHttpUrlPathNumber= 0;
for( k=0; k<count; k++ )
{
sprintf( keyword, "outpath%d", k + 1 );
GetProfileString( "HttpUrlPath", keyword, "\\??\\d:\\HttpUrl\\",
gVar.HttpUrlPath[ k ], _MAX_DIR_LENGTH, configPath );
}
for( k=0; k<count; k++ )
{
fg = 0;
sprintf( szOutPath, "%s", gVar.HttpUrlPath[ k ] );
iOutPathSize = strlen( szOutPath );
if( szOutPath[ iOutPathSize - 1 ] != '\\' )
{
szOutPath[ iOutPathSize ] = '\\';
szOutPath[ iOutPathSize + 1 ] = '\0';
iOutPathSize ++;
}
memset(szCreateDirBuf,0,sizeof(szCreateDirBuf));
for( i = 4; i < iOutPathSize; i ++ )
{
if( szOutPath[ i ] =='/' )
{
if( fg )
{
//ImLog
memcpy( szCreateDirBuf, szOutPath, i );
mkdir( szCreateDirBuf, 755 );
}
else
{
fg = 1;
}
}
}
}
}
void FtpConfig()
{
char szOutPath[_MAX_DIR_LENGTH];
char szCreateDirBuf[_MAX_DIR_LENGTH];
char configPath[_MAX_DIR_LENGTH];
char keyword[_MAX_DIR_LENGTH];
int k,count=0;
int iOutPathSize;
int i,fg=0;
memset( configPath, 0, _MAX_DIR_LENGTH);
memset( szOutPath, 0, sizeof(szOutPath) );
sprintf( configPath, "%s", CONFIGURE_FILE );
GetProfileString( "FtpPath", "count", "1",
szOutPath, sizeof(szOutPath) - 1, configPath );
sscanf( szOutPath, "%d", &count );
if( count < 1 )
count = 1;
count = count > _FILEPATH_NUMBER ? _FILEPATH_NUMBER : count;
gVar.FtpPathNumber = count;
gVar.iFtpPathNumber= 0;
for( k = 0; k < count; k ++ )
{
sprintf( keyword, "outpath%d", k + 1 );
GetProfileString( "FtpPath", keyword, "\\??\\d:\\Ftp\\",
gVar.FtpPath[ k ], _MAX_DIR_LENGTH, configPath );
}
for( k = 0; k < count; k ++ )
{
fg = 0;
sprintf( szOutPath, "%s", gVar.FtpPath[ k ] );
iOutPathSize = strlen( szOutPath );
if( szOutPath[ iOutPathSize - 1 ] != '\\' )
{
szOutPath[ iOutPathSize ] = '\\';
szOutPath[ iOutPathSize + 1 ] = '\0';
iOutPathSize ++;
}
memset( szCreateDirBuf, 0, sizeof(szCreateDirBuf) );
for(i=4;i<iOutPathSize;i++)
{
if(szOutPath[i]=='\\')
{
if(fg)
{
//ImLog
memcpy( szCreateDirBuf, szOutPath, i );
mkdir( szCreateDirBuf, 755 );
}
else
{
fg=1;
}
}
}
}
}
void TelnetConfig()
{
char szOutPath[_MAX_DIR_LENGTH];
char szCreateDirBuf[_MAX_DIR_LENGTH];
char configPath[_MAX_DIR_LENGTH];
char keyword[_MAX_DIR_LENGTH];
int k,count=0;
int iOutPathSize;
int i,fg=0;
memset( configPath, 0, _MAX_DIR_LENGTH);
memset(szOutPath,0,sizeof(szOutPath));
sprintf( configPath, "%s", CONFIGURE_FILE );
GetProfileString( "TelnetPath", "count", "1", szOutPath,
sizeof(szOutPath) - 1, configPath );
sscanf( szOutPath, "%d", &count );
if( count < 1 )
count = 1;
count = count >_FILEPATH_NUMBER ? _FILEPATH_NUMBER : count;
gVar.TelnetPathNumber = count;
gVar.iTelnetPathNumber = 0;
for( k = 0; k < count; k ++ )
{
sprintf( keyword, "outpath%d", k + 1 );
GetProfileString( "TelnetPath", keyword, "\\??\\d:\\Telnet\\",
gVar.TelnetPath[ k ], _MAX_DIR_LENGTH, configPath );
}
for( k=0; k<count; k++ )
{
fg = 0;
sprintf( szOutPath, "%s", gVar.TelnetPath[ k ] );
iOutPathSize = strlen(szOutPath);
if( szOutPath[ iOutPathSize - 1 ] != '\\' )
{
szOutPath[ iOutPathSize ] = '\\';
szOutPath[ iOutPathSize + 1 ] = '\0';
iOutPathSize++;
}
memset(szCreateDirBuf,0,sizeof(szCreateDirBuf));
for( i = 4; i < iOutPathSize; i ++ )
{
if( szOutPath[ i ] == '\\' )
{
if( fg )
{
//ImLog
memcpy( szCreateDirBuf, szOutPath, i );
mkdir( szCreateDirBuf, 755 );
}
else
{
fg = 1;
}
}
}
}
}
void IcqConfig()
{
char szOutPath[_MAX_DIR_LENGTH];
char szCreateDirBuf[_MAX_DIR_LENGTH];
char configPath[_MAX_DIR_LENGTH];
char keyword[_MAX_DIR_LENGTH];
int k,count=0;
int iOutPathSize;
int i,fg=0;
// char* pDirBuf = szCreateDirBuf;
memset( configPath, 0, _MAX_DIR_LENGTH);
memset(szOutPath,0,sizeof(szOutPath));
sprintf( configPath, "%s", CONFIGURE_FILE);
GetProfileString( "IcqPath", "count", "1", szOutPath,
sizeof(szOutPath) - 1, configPath );
sscanf( szOutPath, "%d", &count );
if( count < 1 )
count = 1;
count = count>_FILEPATH_NUMBER? _FILEPATH_NUMBER: count;
gVar.IcqPathNumber = count;
gVar.iIcqPathNumber= 0;
for( k=0; k<count; k++ )
{
sprintf( keyword, "outpath%d", k + 1 );
GetProfileString( "IcqPath", keyword, "\\??\\d:\\Icq\\",
gVar.IcqPath[ k ], _MAX_DIR_LENGTH, configPath );
}
for( k = 0; k < count; k ++ )
{
fg = 0;
sprintf( szOutPath, "%s", gVar.IcqPath[ k ] );
iOutPathSize = strlen(szOutPath);
if( szOutPath[ iOutPathSize - 1 ] != '\\' )
{
szOutPath[ iOutPathSize ] = '\\';
szOutPath[ iOutPathSize + 1 ] = '\0';
iOutPathSize++;
}
memset(szCreateDirBuf,0,sizeof(szCreateDirBuf));
for( i = 4; i < iOutPathSize; i ++ )
{
if( szOutPath[ i ] == '\\' )
{
if( fg )
{
//ImLog
memcpy( szCreateDirBuf, szOutPath, i );
mkdir( szCreateDirBuf, 755 );
}
else
{
fg=1;
}
}
}
}
}
void YahooConfig()
{
char szOutPath[_MAX_DIR_LENGTH];
char szCreateDirBuf[_MAX_DIR_LENGTH];
char configPath[_MAX_DIR_LENGTH];
char keyword[_MAX_DIR_LENGTH];
int k,count=0;
int iOutPathSize;
int i,fg=0;
// char* pDirBuf = szCreateDirBuf;
memset( configPath, 0, _MAX_DIR_LENGTH );
memset( szOutPath, 0, sizeof(szOutPath) );
sprintf( configPath, "%s", CONFIGURE_FILE );
GetProfileString( "YahooPath", "count", "1", szOutPath,
sizeof(szOutPath) - 1, configPath );
sscanf( szOutPath, "%d", &count );
if( count < 1 )
count = 1;
count = count > _FILEPATH_NUMBER ? _FILEPATH_NUMBER : count;
gVar.YahooPathNumber = count;
gVar.iYahooPathNumber= 0;
for( k = 0; k < count; k ++ )
{
sprintf( keyword, "outpath%d", k + 1 );
GetProfileString( "YahooPath", keyword, "\\??\\d:\\Yahoo\\",
gVar.YahooPath[ k ], _MAX_DIR_LENGTH, configPath );
}
for( k = 0; k < count; k ++ )
{
fg = 0;
sprintf( szOutPath, "%s", gVar.YahooPath[k] );
iOutPathSize = strlen( szOutPath );
if( szOutPath[ iOutPathSize - 1 ] != '\\' )
{
szOutPath[ iOutPathSize ] = '\\';
szOutPath[ iOutPathSize + 1 ] = '\0';
iOutPathSize ++;
}
memset(szCreateDirBuf,0,sizeof(szCreateDirBuf));
for( i = 4; i < iOutPathSize; i ++ )
{
if( szOutPath[ i ] == '\\' )
{
if( fg )
{
//ImLog
memcpy( szCreateDirBuf, szOutPath, i );
mkdir( szCreateDirBuf, 755 );
}
else
{
fg = 1;
}
}
}
}
}
UINT GetProfileString( char* lpAppName, char* lpKeyName, char* lpDefault,
char* lpReturnedString, UINT nSize, char* lpFileName )
{
char* szFileData;
int step, nReturn;
unsigned int i,idx;
char AppName[ 64 ];
char KeyName[ 64 ];
ULONG uReadBytes;
struct file* file;
mm_segment_t old_fs;
step = 0;
idx = 0;
uReadBytes = 0;
szFileData = NULL;
szFileData = kmalloc( 1024 * 2, GFP_ATOMIC );
if( !szFileData )
{
printk( "Allocate buffer failed!\r\n" );
return 0;
}
file = NULL;
file = filp_open( lpFileName, O_RDWR | O_APPEND | O_CREAT, 0644 );
if( file == NULL )
{
printk( "Open the Configure file error!\r\n" );
return 0;
}
old_fs = get_fs();
set_fs(KERNEL_DS);
nReturn = generic_file_read( file, szFileData, 2 * 1024, &file->f_pos );
set_fs(old_fs);
filp_close( file, NULL );
for( i = 0; i < nReturn; i ++ )
{
switch(szFileData[i])
{
case '[':
step = 1;
idx = i + 1;
break;
case ']':
if( step == 1 )
{
// char str1[ 64 ], str2[ 64 ];
memset( AppName, 0, sizeof(AppName) );
memcpy( AppName, &szFileData[ idx ], i - idx );
for( idx = i - idx - 1; idx > 0; idx -- )
{
if( AppName[ idx ] == ' ' )
AppName[ idx ] = 0;
if( AppName[ idx ] == '\t' )
AppName[ idx ] = 0;
}
if( 0 == strcmp( AppName, lpAppName ) )
step=2;
else
step=0;
}
break;
default:
switch(step)
{
case -1:
if( szFileData[ i ] == '\r'
&& szFileData[ i + 1 ] == '\n' )
{
step=2;
}
break;
case 2:
if( szFileData[ i ] == '\r' )
continue;
if( szFileData[ i ] == '\n' )
continue;
if( szFileData[ i ] == '\t' )
continue;
if( szFileData[ i ] == ' ' )
continue;
idx=i;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -