コード例 #1
0
ファイル: ProcessHandler.cpp プロジェクト: ultrashot/utask
LONG Process_GetID(LPWSTR name)
{
	HANDLE hProcessSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS | TH32CS_SNAPNOHEAPS, NULL);
	
	if(hProcessSnapshot == INVALID_HANDLE_VALUE)
		return 0;

	LONG result = 0;
	PROCESSENTRY32 processentry32;
	memset(&processentry32, 0, sizeof(PROCESSENTRY32));
	processentry32.dwSize = sizeof(processentry32);

	Process32First(hProcessSnapshot, &processentry32);
	do
	{
		wchar_t *sz = wcslwr(processentry32.szExeFile);
		if(wcsicmp(name, sz) == 0)
		{
			result = processentry32.th32ProcessID;
			break;
		}
	} while(Process32Next(hProcessSnapshot, &processentry32));

	CloseToolhelp32Snapshot(hProcessSnapshot);

	return result;
};
コード例 #2
0
ファイル: cslist.cpp プロジェクト: tweimer/miranda-ng
BOOL CSWindow::itemPassedFilter(ListItem< StatusItem >* li)
{
	wchar_t filter[MAX_PATH];
	GetDlgItemText(m_handle, IDC_FILTER_FIELD, filter, _countof(filter));

	if (mir_wstrlen(filter))
	{
		wchar_t title[EXTRASTATUS_TITLE_LIMIT], message[EXTRASTATUS_MESSAGE_LIMIT];
		mir_wstrcpy(title, li->m_item->m_tszTitle); mir_wstrcpy(message, li->m_item->m_tszMessage);
		if (strpos(wcslwr(title), wcslwr(filter)) == -1)
			if (strpos(wcslwr(message), wcslwr(filter)) == -1)
				return FALSE;
	}

	return TRUE;
}
コード例 #3
0
    const char* getCurrentLocale()
    {
        wchar_t szLang[20];
        int nRes = GetLocaleInfo(LOCALE_USER_DEFAULT,LOCALE_SABBREVLANGNAME , szLang, 20);
        szLang[2] = 0;
        wcslwr(szLang);

        m_strLocale = rho::common::convertToStringA(szLang);
        return m_strLocale.c_str();
    }
コード例 #4
0
void StringSet::Add(const wchar_t *string)
{
	wchar_t *tmp = wcsdup(string);
	if (!caseCheck)
		wcslwr(tmp);
	strings.push_back(tmp);
	free(tmp);

	std::sort(strings.begin(), strings.end());
}
コード例 #5
0
bool WindowsHttpDownloader::GetIsGZip() throw()
{
	auto c = GetResponseHeader("Content-Encoding");
	if (c == NULL)
		return false;
	wchar_t temp[256] = {};
	wcscpy_s(temp, c);
	wcslwr(temp);
	return wcsstr(temp, L"gzip") != NULL;
}
コード例 #6
0
bool WindowsHttpDownloader::GetIsChunked() throw()
{
	auto c = GetResponseHeader("Transfer-Encoding");
	if (c == NULL)
		return false;
	wchar_t temp[128] = {};
	wcscpy_s(temp, c);
	wcslwr(temp);
	return wcsstr(temp, L"chunked") != NULL;
}
コード例 #7
0
ファイル: UIString.cpp プロジェクト: asdlei00/gtkduilib
void CUIString::MakeLower()
{
#ifdef WIN32
    wcslwr(m_pstr);
#else
    WCHAR *pstr = m_pstr;
    while(*pstr){
        *pstr = (WCHAR)tolower(*pstr);
        pstr ++;
    }
#endif // WIN32
}
コード例 #8
0
ファイル: ffilter.cpp プロジェクト: glookka/pfm
const wchar_t *	Filter_c::GetStringToCompare ( const wchar_t * szFile ) const
{
	int iLen = wcslen ( szFile );
	if ( iLen + 1 < MAX_FILTER_LEN )
	{
		wcscpy ( g_dFilter, szFile );
		wcslwr ( g_dFilter );

		return g_dFilter;
	}

	return NULL;
}
コード例 #9
0
ファイル: ffilter.cpp プロジェクト: glookka/pfm
///////////////////////////////////////////////////////////////////////////////////////////
// extension filter
const wchar_t *	ExtFilter_c::GetStringToCompare ( const wchar_t * szFile ) const
{
	const wchar_t * szStr = GetNameExtFast ( szFile );
	int iLen = wcslen ( szStr );
	if ( iLen < MAX_FILTER_LEN )
	{
		wcscpy ( g_dFilter, szStr );
		wcslwr ( g_dFilter );
		return g_dFilter;
	}

	return NULL;
}
コード例 #10
0
ファイル: hd3.cpp プロジェクト: bodanrenko93/hidedragon
int IsInAutoHideList(wchar_t * pName,int iType /* == 2*/)
{
	DBProcessList::iterator iNode;
	
	iNode = g_DBProcessList.begin();
	while(iNode != g_DBProcessList.end())
	{
		AutoHideItem * pI = *iNode;
		
		int iRet = wcscmp(wcslwr(pI->cProcessName),wcslwr(pName));
		if(iType == 1 && pI->iType == iType && iRet == 0)
		{
			return 1;
		}
		if(iType == 2 && pI->iType == iType && iRet == 0)
		{
			return 1;
		}
		
		iNode ++;
	}

	return 0;
}
コード例 #11
0
void StringSet::Remove(const wchar_t *string)
{
	wchar_t *tmp = wcsdup(string);
	if (!caseCheck)
		wcslwr(tmp);

	for (size_t n=0;n<strings.size();n++)
	{
		if (strings[n] == tmp)
		{
			strings.erase(strings.begin()+n);
			break;
		}
	}

	free(tmp);
	std::sort(strings.begin(), strings.end());
}
コード例 #12
0
ファイル: r3hook.c プロジェクト: hackshields/antivirus
BOOL CheckInstaller()
{
	WCHAR PathBuffer[512];
	DWORD Result;

	Result = GetModuleFileNameW(NULL, PathBuffer, sizeof(PathBuffer));
	if (Result)
	{
		PathStripPathW(PathBuffer);
		wcslwr(PathBuffer);

		if ((wcscmp(L"msiexec.exe", PathBuffer) == 0) ||
			(wcscmp(L"regsvr32.exe", PathBuffer) == 0))
			return TRUE;
	}

	return FALSE;
}
コード例 #13
0
HANDLE
WINAPI
MyCreateFileW(
            LPCWSTR lpFileName,
            DWORD dwDesiredAccess,
            DWORD dwShareMode,
            LPSECURITY_ATTRIBUTES lpSecurityAttributes,
            DWORD dwCreationDisposition,
            DWORD dwFlagsAndAttributes,
            HANDLE hTemplateFile
    )
{
    WCHAR wFileName[MAX_PATH] = { 0 };
    wcscpy(wFileName, lpFileName);
    if ( wcscmp(wcslwr(wFileName), L"g:\\test.txt") == 0 )
    {
        if ( MessageBox(NULL, "是否打开文件", "提示", MB_YESNO) == IDYES )
        {
            return dwCreateFileWAddr(lpFileName,
                            dwDesiredAccess,
                            dwShareMode,
                            lpSecurityAttributes,
                            dwCreationDisposition,
                            dwFlagsAndAttributes,
                            hTemplateFile);
        } 
        else
        {
            return INVALID_HANDLE_VALUE;
        }
    }
    else
    {
        return dwCreateFileWAddr(lpFileName,
            dwDesiredAccess,
            dwShareMode,
            lpSecurityAttributes,
            dwCreationDisposition,
            dwFlagsAndAttributes,
            hTemplateFile);
    }
}
コード例 #14
0
void CMUCHighlight::init()
{
	DBVARIANT dbv = {0};

	if (m_fInitialized)
		cleanup();							// clean up first, if we were already initialized

	m_fInitialized = true;

	if (0 == db_get_ts(0, CHAT_MODULE, "HighlightWords", &dbv)) {
		m_TextPatternString = dbv.ptszVal;
		_wsetlocale(LC_ALL, L"");
		wcslwr(m_TextPatternString);
	}

	if (0 == db_get_ts(0, CHAT_MODULE, "HighlightNames", &dbv))
		m_NickPatternString = dbv.ptszVal;

	m_dwFlags = M.GetByte(CHAT_MODULE, "HighlightEnabled", MATCH_TEXT);
	m_fHighlightMe = (M.GetByte(CHAT_MODULE, "HighlightMe", 1) ? true : false);

	tokenize(m_TextPatternString, m_TextPatterns, m_iTextPatterns);
	tokenize(m_NickPatternString, m_NickPatterns, m_iNickPatterns);
}
コード例 #15
0
ファイル: ffilter.cpp プロジェクト: glookka/pfm
///////////////////////////////////////////////////////////////////////////////////////////
// base filter class
void BaseFilter_c::Set ( const wchar_t * szFilter )
{
	m_dMasks.Clear ();

	int iLen = wcslen ( szFilter );
	if ( ! iLen )
		return;

	int iPrev = 0;
	Mask_t tMask;
	for ( int i = 0; i < iLen; ++i )
		if ( szFilter [i] == L',' || szFilter [i] == L';' )
		{
			if ( szFilter [i+1] == L'-' )
			{
				++i;
				tMask.m_bInvert = true;
			}
			else
				tMask.m_bInvert = false;

			if ( i - iPrev < MAX_FILTER_LEN )
			{
				wcsncpy ( g_dFilter, szFilter + iPrev, i - iPrev );
				g_dFilter [i - iPrev] = L'\0';

				// cut spaces
				wchar_t * szFilterStart = & ( g_dFilter [0] );
				while ( *szFilterStart && iswspace ( *szFilterStart ) )
					++szFilterStart;

				wcslwr ( szFilterStart );
				tMask.m_sMask = szFilterStart;
				iPrev = i+1;
				m_dMasks.Add ( tMask );
			}
		}

	// string has text but there are no masks
	if ( iPrev < iLen )
	{
		tMask.m_bInvert = *szFilter == L'-';
		int iOffset = ( tMask.m_bInvert ? 1 : 0 );

		int iFilterLen = wcslen ( szFilter + iOffset + iPrev );
		if ( iFilterLen < MAX_FILTER_LEN )
		{
			wcsncpy ( g_dFilter, szFilter + iOffset + iPrev, iFilterLen );
			g_dFilter [iFilterLen] = L'\0';

			// cut spaces
			wchar_t * szFilterStart = & ( g_dFilter [0] );
			while ( *szFilterStart && iswspace ( *szFilterStart ) )
				++szFilterStart;

			wcslwr ( szFilterStart );

			tMask.m_sMask = szFilterStart;
			m_dMasks.Add ( tMask );
		}
	}
}
コード例 #16
0
ファイル: os_file.c プロジェクト: DmitrySigaev/gpac-sf
/*enumerate directories*/
GF_EXPORT
GF_Err gf_enum_directory(const char *dir, Bool enum_directory, gf_enum_dir_item enum_dir_fct, void *cbck, const char *filter)
{
	char item_path[GF_MAX_PATH];
	GF_FileEnumInfo file_info;

#if defined(_WIN32_WCE)
	char _path[GF_MAX_PATH];
	unsigned short path[GF_MAX_PATH];
	unsigned short w_filter[GF_MAX_PATH];
	char file[GF_MAX_PATH];
#else
	char path[GF_MAX_PATH], *file;
#endif

#ifdef WIN32
	WIN32_FIND_DATA FindData;
	HANDLE SearchH;
#else
	DIR *the_dir;
	struct dirent* the_file;
	struct stat st;
#endif

	if (!dir || !enum_dir_fct) return GF_BAD_PARAM;

	if (filter && (!strcmp(filter, "*") || !filter[0])) filter=NULL;

	memset(&file_info, 0, sizeof(GF_FileEnumInfo) );

	if (!strcmp(dir, "/")) {
#if defined(WIN32) && !defined(_WIN32_WCE)
		u32 len;
		char *drives, *volume;
		len = GetLogicalDriveStrings(0, NULL);
		drives = gf_malloc(sizeof(char)*(len+1));
		drives[0]=0;
		GetLogicalDriveStrings(len, drives);
		len = (u32) strlen(drives);
		volume = drives;
		file_info.directory = GF_TRUE;
		file_info.drive = GF_TRUE;
		while (len) {
			enum_dir_fct(cbck, volume, "", &file_info);
			volume += len+1;
			len = (u32) strlen(volume);
		}
		gf_free(drives);
		return GF_OK;
#elif defined(__SYMBIAN32__)
		RFs iFs;
		TDriveList aList;
		iFs.Connect();
		iFs.DriveList(aList);
		for (TInt i=0; i<KMaxDrives; i++) {
			if (aList[i]) {
				char szDrive[10];
				TChar aDrive;
				iFs.DriveToChar(i, aDrive);
				sprintf(szDrive, "%c:", (TUint)aDrive);
				enum_dir_fct(cbck, szDrive, "", &file_info);
			}
		}
		iFs.Close();
		FlushItemList();
		return GF_OK;
#endif
	}


#if defined (_WIN32_WCE)
	switch (dir[strlen(dir) - 1]) {
	case '/':
	case '\\':
		sprintf(_path, "%s*", dir);
		break;
	default:
		sprintf(_path, "%s%c*", dir, GF_PATH_SEPARATOR);
		break;
	}
	CE_CharToWide(_path, path);
	CE_CharToWide((char *)filter, w_filter);
#elif defined(WIN32)
	switch (dir[strlen(dir) - 1]) {
	case '/':
	case '\\':
		sprintf(path, "%s*", dir);
		break;
	default:
		sprintf(path, "%s%c*", dir, GF_PATH_SEPARATOR);
		break;
	}
#else
	strcpy(path, dir);
	if (path[strlen(path)-1] != '/') strcat(path, "/");
#endif

#ifdef WIN32
	SearchH= FindFirstFile(path, &FindData);
	if (SearchH == INVALID_HANDLE_VALUE) return GF_IO_ERR;

#if defined (_WIN32_WCE)
	_path[strlen(_path)-1] = 0;
#else
	path[strlen(path)-1] = 0;
#endif

	while (SearchH != INVALID_HANDLE_VALUE) {

#else

	the_dir = opendir(path);
	if (the_dir == NULL) {
		GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[Core] Cannot open directory %s for enumeration\n", path));
		return GF_IO_ERR;
	}
	the_file = readdir(the_dir);
	while (the_file) {

#endif

		memset(&file_info, 0, sizeof(GF_FileEnumInfo) );


#if defined (_WIN32_WCE)
		if (!wcscmp(FindData.cFileName, _T(".") )) goto next;
		if (!wcscmp(FindData.cFileName, _T("..") )) goto next;
#elif defined(WIN32)
		if (!strcmp(FindData.cFileName, ".")) goto next;
		if (!strcmp(FindData.cFileName, "..")) goto next;
#else
		if (!strcmp(the_file->d_name, "..")) goto next;
		if (the_file->d_name[0] == '.') goto next;
#endif

#ifdef WIN32
		file_info.directory = (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? GF_TRUE : GF_FALSE;
		if (!enum_directory && file_info.directory) goto next;
		if (enum_directory && !file_info.directory) goto next;
#endif

		if (filter) {
#if defined (_WIN32_WCE)
			short ext[30];
			short *sep = wcsrchr(FindData.cFileName, (wchar_t) '.');
			if (!sep) goto next;
			wcscpy(ext, sep+1);
			wcslwr(ext);
			if (!wcsstr(w_filter, ext)) goto next;
#elif defined(WIN32)
			char ext[30];
			char *sep = strrchr(FindData.cFileName, '.');
			if (!sep) goto next;
			strcpy(ext, sep+1);
			strlwr(ext);
			if (!strstr(filter, ext)) goto next;
#else
			char ext[30];
			char *sep = strrchr(the_file->d_name, '.');
			if (!sep) goto next;
			strcpy(ext, sep+1);
			strlwr(ext);
			if (!strstr(filter, sep+1)) goto next;
#endif
		}

#if defined(WIN32)
		file_info.hidden = (FindData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) ? 1 : 0;
		file_info.system = (FindData.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) ? 1 : 0;
		file_info.size = MAXDWORD;
		file_info.size += 1;
		file_info.size *= FindData.nFileSizeHigh;
		file_info.size += FindData.nFileSizeLow;
		file_info.last_modified = (u64) ((*(LONGLONG *) &FindData.ftLastWriteTime - TIMESPEC_TO_FILETIME_OFFSET) / 10000000);
#endif

#if defined (_WIN32_WCE)
		CE_WideToChar(FindData.cFileName, file);
		strcpy(item_path, _path);
		strcat(item_path, file);
#elif defined(WIN32)
		strcpy(item_path, path);
		strcat(item_path, FindData.cFileName);
		file = FindData.cFileName;
#else
		strcpy(item_path, path);
		strcat(item_path, the_file->d_name);
		GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Core] Checking file %s for enum\n", item_path));

		if (stat( item_path, &st ) != 0) goto next;

		file_info.directory = ((st.st_mode & S_IFMT) == S_IFDIR) ? GF_TRUE : GF_FALSE;
		if (enum_directory && !file_info.directory) goto next;
		if (!enum_directory && file_info.directory) goto next;

		file_info.size = st.st_size;

		{
			struct tm _t = * gmtime(& st.st_mtime);
			file_info.last_modified = mktime(&_t);
		}
		file = the_file->d_name;
		if (file && file[0]=='.') file_info.hidden = 1;

		if (file_info.directory) {
			char * parent_name = strrchr(item_path, '/');
			if (!parent_name) {
				file_info.drive = GF_TRUE;
			} else {
				struct stat st_parent;
				parent_name[0] = 0;
				if (stat(item_path, &st_parent) == 0)  {
					if ((st.st_dev != st_parent.st_dev) || ((st.st_dev == st_parent.st_dev) && (st.st_ino == st_parent.st_ino))) {
						file_info.drive = GF_TRUE;
					}
				}
				parent_name[0] = '/';
			}
		}
#endif
		if (enum_dir_fct(cbck, file, item_path, &file_info)) {
#ifdef WIN32
			BOOL ret = FindClose(SearchH);
			if (!ret) {
				DWORD err = GetLastError();
				GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[core] FindClose() in gf_enum_directory() returned(1) the following error code: %d\n", err));
			}
#endif
			break;
		}

next:
#ifdef WIN32
		if (!FindNextFile(SearchH, &FindData)) {
			BOOL ret = FindClose(SearchH);
			if (!ret) {
				DWORD err = GetLastError();
				GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[core] FindClose() in gf_enum_directory() returned(2) the following error code: %d\n", err));
			}
			break;
		}
#else
		the_file = readdir(the_dir);
#endif
	}
#ifndef WIN32
	closedir(the_dir);
#endif
	return GF_OK;
}

GF_EXPORT
u64 gf_f64_tell(FILE *fp)
{
#if defined(_WIN32_WCE)
	return (u64) ftell(fp);
#elif defined(GPAC_CONFIG_WIN32)	/* mingw or cygwin */
#if (_FILE_OFFSET_BITS >= 64)
	return (u64) ftello64(fp);
#else
	return (u64) ftell(fp);
#endif
#elif defined(WIN32)
	return (u64) _ftelli64(fp);
#elif defined(GPAC_CONFIG_LINUX) && !defined(GPAC_ANDROID)
	return (u64) ftello64(fp);
#elif (defined(GPAC_CONFIG_FREEBSD) || defined(GPAC_CONFIG_DARWIN))
	return (u64) ftello(fp);
#else
	return (u64) ftell(fp);
#endif
}

GF_EXPORT
u64 gf_f64_seek(FILE *fp, s64 offset, s32 whence)
{
#if defined(_WIN32_WCE)
	return (u64) fseek(fp, (s32) offset, whence);
#elif defined(GPAC_CONFIG_WIN32)	/* mingw or cygwin */
#if (_FILE_OFFSET_BITS >= 64)
	return (u64) fseeko64(fp, offset, whence);
#else
	return (u64) fseek(fp, (s32) offset, whence);
#endif
#elif defined(WIN32)
	return (u64) _fseeki64(fp, offset, whence);
#elif defined(GPAC_CONFIG_LINUX) && !defined(GPAC_ANDROID)
	return fseeko64(fp, (off64_t) offset, whence);
#elif (defined(GPAC_CONFIG_FREEBSD) || defined(GPAC_CONFIG_DARWIN))
	return fseeko(fp, (off_t) offset, whence);
#else
	return fseek(fp, (s32) offset, whence);
#endif
}

GF_EXPORT
FILE *gf_f64_open(const char *file_name, const char *mode)
{
#if defined(WIN32)
	FILE *res = fopen(file_name, mode);
	if (res) return res;
	if (strchr(mode, 'w') || strchr(mode, 'a')) {
		u32 err = GetLastError();
		GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[Win32] system failure for file opening of %s in mode %s: 0x%08x\n", file_name, mode, err));
	}
	return NULL;
#elif defined(GPAC_CONFIG_LINUX) && !defined(GPAC_ANDROID)
	return fopen64(file_name, mode);
#elif (defined(GPAC_CONFIG_FREEBSD) || defined(GPAC_CONFIG_DARWIN))
	return fopen(file_name, mode);
#else
	return fopen(file_name, mode);
#endif
}
コード例 #17
0
ファイル: os_file.c プロジェクト: CCExtractor/ccextractor
/*enumerate directories*/
GF_EXPORT
GF_Err gf_enum_directory(const char *dir, Bool enum_directory, gf_enum_dir_item enum_dir_fct, void *cbck, const char *filter)
{
#ifdef WIN32
	wchar_t item_path[GF_MAX_PATH];
#else
	char item_path[GF_MAX_PATH];
#endif
	GF_FileEnumInfo file_info;

#if defined(_WIN32_WCE)
	char _path[GF_MAX_PATH];
	unsigned short path[GF_MAX_PATH];
	unsigned short w_filter[GF_MAX_PATH];
	char file[GF_MAX_PATH];
#elif defined(WIN32)
	wchar_t path[GF_MAX_PATH], *file;
	wchar_t w_filter[GF_MAX_PATH];
	wchar_t w_dir[GF_MAX_PATH];
	char *mbs_file, *mbs_item_path;
#else
	char path[GF_MAX_PATH], *file;
#endif

#ifdef WIN32
	WIN32_FIND_DATAW FindData;
	HANDLE SearchH;
#else
	DIR *the_dir;
	struct dirent* the_file;
	struct stat st;
#endif

	if (!dir || !enum_dir_fct) return GF_BAD_PARAM;

	if (filter && (!strcmp(filter, "*") || !filter[0])) filter=NULL;

	memset(&file_info, 0, sizeof(GF_FileEnumInfo) );

	if (!strcmp(dir, "/")) {
#if defined(WIN32) && !defined(_WIN32_WCE)
		u32 len;
		char *drives, *volume;
		len = GetLogicalDriveStrings(0, NULL);
		drives = (char*)gf_malloc(sizeof(char)*(len+1));
		drives[0]=0;
		GetLogicalDriveStrings(len, drives);
		len = (u32) strlen(drives);
		volume = drives;
		file_info.directory = GF_TRUE;
		file_info.drive = GF_TRUE;
		while (len) {
			enum_dir_fct(cbck, volume, "", &file_info);
			volume += len+1;
			len = (u32) strlen(volume);
		}
		gf_free(drives);
		return GF_OK;
#elif defined(__SYMBIAN32__)
		RFs iFs;
		TDriveList aList;
		iFs.Connect();
		iFs.DriveList(aList);
		for (TInt i=0; i<KMaxDrives; i++) {
			if (aList[i]) {
				char szDrive[10];
				TChar aDrive;
				iFs.DriveToChar(i, aDrive);
				sprintf(szDrive, "%c:", (TUint)aDrive);
				enum_dir_fct(cbck, szDrive, "", &file_info);
			}
		}
		iFs.Close();
		FlushItemList();
		return GF_OK;
#endif
	}


#if defined (_WIN32_WCE)
	switch (dir[strlen(dir) - 1]) {
	case '/':
	case '\\':
		sprintf(_path, "%s*", dir);
		break;
	default:
		sprintf(_path, "%s%c*", dir, GF_PATH_SEPARATOR);
		break;
	}
	CE_CharToWide(_path, path);
	CE_CharToWide((char *)filter, w_filter);
#elif defined(WIN32)
	{
		const char* tmpdir = dir;
		gf_utf8_mbstowcs(w_dir, sizeof(w_dir), &tmpdir);
	}
	switch (w_dir[wcslen(w_dir) - 1]) {
	case '/':
	case '\\':
		swprintf(path, MAX_PATH, L"%s*", w_dir);
		break;
	default:
		swprintf(path, MAX_PATH, L"%s%c*", w_dir, GF_PATH_SEPARATOR);
		break;
	}
	{
		const char* tmpfilter = filter;
		gf_utf8_mbstowcs(w_filter, sizeof(w_filter), &tmpfilter);
	}
#else
	strcpy(path, dir);
	if (path[strlen(path)-1] != '/') strcat(path, "/");
#endif

#ifdef WIN32
	SearchH= FindFirstFileW(path, &FindData);
	if (SearchH == INVALID_HANDLE_VALUE) return GF_IO_ERR;

#if defined (_WIN32_WCE)
	_path[strlen(_path)-1] = 0;
#else
	path[wcslen(path)-1] = 0;
#endif

	while (SearchH != INVALID_HANDLE_VALUE) {

#else

	the_dir = opendir(path);
	if (the_dir == NULL) {
		GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[Core] Cannot open directory %s for enumeration: %d\n", path, errno));
		return GF_IO_ERR;
	}
	the_file = readdir(the_dir);
	while (the_file) {

#endif

		memset(&file_info, 0, sizeof(GF_FileEnumInfo) );


#if defined (_WIN32_WCE)
		if (!wcscmp(FindData.cFileName, _T(".") )) goto next;
		if (!wcscmp(FindData.cFileName, _T("..") )) goto next;
#elif defined(WIN32)
		if (!wcscmp(FindData.cFileName, L".")) goto next;
		if (!wcscmp(FindData.cFileName, L"..")) goto next;
#else
		if (!strcmp(the_file->d_name, "..")) goto next;
		if (the_file->d_name[0] == '.') goto next;
#endif

#ifdef WIN32
		file_info.directory = (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? GF_TRUE : GF_FALSE;
		if (!enum_directory && file_info.directory) goto next;
		if (enum_directory && !file_info.directory) goto next;
#endif

		if (filter) {
#if defined (_WIN32_WCE)
			short ext[30];
			short *sep = wcsrchr(FindData.cFileName, (wchar_t) '.');
			if (!sep) goto next;
			wcscpy(ext, sep+1);
			wcslwr(ext);
			if (!wcsstr(w_filter, ext)) goto next;
#elif defined(WIN32)
			wchar_t ext[30];
			wchar_t *sep = wcsrchr(FindData.cFileName, L'.');
			if (!sep) goto next;
			wcscpy(ext, sep+1);
			wcslwr(ext);
			if (!wcsstr(w_filter, ext)) goto next;
#else
			char ext[30];
			char *sep = strrchr(the_file->d_name, '.');
			if (!sep) goto next;
			strcpy(ext, sep+1);
			strlwr(ext);
			if (!strstr(filter, sep+1)) goto next;
#endif
		}

#if defined(WIN32)
		file_info.hidden = (FindData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) ? GF_TRUE : GF_FALSE;
		file_info.system = (FindData.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) ? GF_TRUE : GF_FALSE;
		file_info.size = MAXDWORD;
		file_info.size += 1;
		file_info.size *= FindData.nFileSizeHigh;
		file_info.size += FindData.nFileSizeLow;
		file_info.last_modified = (u64) ((*(LONGLONG *) &FindData.ftLastWriteTime - TIMESPEC_TO_FILETIME_OFFSET) / 10000000);
#endif

#if defined (_WIN32_WCE)
		CE_WideToChar(FindData.cFileName, file);
		strcpy(item_path, _path);
		strcat(item_path, file);
#elif defined(WIN32)
		wcscpy(item_path, path);
		wcscat(item_path, FindData.cFileName);
		file = FindData.cFileName;
#else
		strcpy(item_path, path);
		strcat(item_path, the_file->d_name);
		GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Core] Checking file %s for enum\n", item_path));

		if (stat( item_path, &st ) != 0) goto next;

		file_info.directory = ((st.st_mode & S_IFMT) == S_IFDIR) ? GF_TRUE : GF_FALSE;
		if (enum_directory && !file_info.directory) goto next;
		if (!enum_directory && file_info.directory) goto next;

		file_info.size = st.st_size;

		{
			struct tm _t = * gmtime(& st.st_mtime);
			file_info.last_modified = mktime(&_t);
		}
		file = the_file->d_name;
		if (file && file[0]=='.') file_info.hidden = 1;

		if (file_info.directory) {
			char * parent_name = strrchr(item_path, '/');
			if (!parent_name) {
				file_info.drive = GF_TRUE;
			} else {
				struct stat st_parent;
				parent_name[0] = 0;
				if (stat(item_path, &st_parent) == 0)  {
					if ((st.st_dev != st_parent.st_dev) || ((st.st_dev == st_parent.st_dev) && (st.st_ino == st_parent.st_ino))) {
						file_info.drive = GF_TRUE;
					}
				}
				parent_name[0] = '/';
			}
		}
#endif
		
#ifdef WIN32
		mbs_file = wcs_to_utf8(file);
		mbs_item_path = wcs_to_utf8(item_path);
		if (!mbs_file || !mbs_item_path)
		{
			if (mbs_file) gf_free(mbs_file);
			if (mbs_item_path) gf_free(mbs_item_path);
			return GF_IO_ERR;
		}
		if (enum_dir_fct(cbck, mbs_file, mbs_item_path, &file_info)) {
			BOOL ret = FindClose(SearchH);
			if (!ret) {
				DWORD err = GetLastError();
				GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[core] FindClose() in gf_enum_directory() returned(1) the following error code: %d\n", err));
			}
#else
		if (enum_dir_fct(cbck, file, item_path, &file_info)) {
#endif
			break;
		}

#ifdef WIN32
		gf_free(mbs_file);
		gf_free(mbs_item_path);
#endif

next:
#ifdef WIN32
		if (!FindNextFileW(SearchH, &FindData)) {
			BOOL ret = FindClose(SearchH);
			if (!ret) {
				DWORD err = GetLastError();
				GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[core] FindClose() in gf_enum_directory() returned(2) the following error code: %d\n", err));
			}
			break;
		}
#else
		the_file = readdir(the_dir);
#endif
	}
#ifndef WIN32
	closedir(the_dir);
#endif
	return GF_OK;
}

GF_EXPORT
u64 gf_ftell(FILE *fp)
{
#if defined(_WIN32_WCE)
	return (u64) ftell(fp);
#elif defined(GPAC_CONFIG_WIN32) && !defined(__CYGWIN__)	/* mingw or cygwin */
#if (_FILE_OFFSET_BITS >= 64)
	return (u64) ftello64(fp);
#else
	return (u64) ftell(fp);
#endif
#elif defined(WIN32)
	return (u64) _ftelli64(fp);
#elif defined(GPAC_CONFIG_LINUX) && !defined(GPAC_ANDROID)
	return (u64) ftello64(fp);
#elif (defined(GPAC_CONFIG_FREEBSD) || defined(GPAC_CONFIG_DARWIN))
	return (u64) ftello(fp);
#else
	return (u64) ftell(fp);
#endif
}

GF_EXPORT
u64 gf_fseek(FILE *fp, s64 offset, s32 whence)
{
#if defined(_WIN32_WCE)
	return (u64) fseek(fp, (s32) offset, whence);
#elif defined(GPAC_CONFIG_WIN32) && !defined(__CYGWIN__)	/* mingw or cygwin */
#if (_FILE_OFFSET_BITS >= 64)
	return (u64) fseeko64(fp, offset, whence);
#else
	return (u64) fseek(fp, (s32) offset, whence);
#endif
#elif defined(WIN32)
	return (u64) _fseeki64(fp, offset, whence);
#elif defined(GPAC_CONFIG_LINUX) && !defined(GPAC_ANDROID)
	return fseeko64(fp, (off64_t) offset, whence);
#elif (defined(GPAC_CONFIG_FREEBSD) || defined(GPAC_CONFIG_DARWIN))
	return fseeko(fp, (off_t) offset, whence);
#else
	return fseek(fp, (s32) offset, whence);
#endif
}

GF_EXPORT
FILE *gf_fopen(const char *file_name, const char *mode)
{
	FILE *res = NULL;

#if defined(WIN32)
	wchar_t *wname;
	wchar_t *wmode;

	wname = utf8_to_wcs(file_name);
	wmode = utf8_to_wcs(mode);
	if (!wname || !wmode)
	{
		if (wname) gf_free(wname);
		if (wmode) gf_free(wmode);
		return NULL;
	}
	res = _wfsopen(wname, wmode, _SH_DENYNO);
	gf_free(wname);
	gf_free(wmode);
#elif defined(GPAC_CONFIG_LINUX) && !defined(GPAC_ANDROID)
	res = fopen64(file_name, mode);
#elif (defined(GPAC_CONFIG_FREEBSD) || defined(GPAC_CONFIG_DARWIN))
	res = fopen(file_name, mode);
#else
	res = fopen(file_name, mode);
#endif

	if (res) {
		gpac_file_handles++;
		GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Core] file %s opened in mode %s - %d file handles\n", file_name, mode, gpac_file_handles));
	} else {
		if (strchr(mode, 'w') || strchr(mode, 'a')) {
#if defined(WIN32)
			u32 err = GetLastError();
			GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[Core] system failure for file opening of %s in mode %s: 0x%08x\n", file_name, mode, err));
#else
			GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[Core] system failure for file opening of %s in mode %s: %d\n", file_name, mode, errno));
#endif
		}
	}
	return res;
}

GF_EXPORT
s32 gf_fclose(FILE *file)
{
	if (file) {
		assert(gpac_file_handles);
		gpac_file_handles--;
	}
	return fclose(file);
}

#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! defined(_GNU_SOURCE) && !defined(WIN32)
#define HAVE_STRERROR_R 1
#endif

GF_EXPORT
size_t gf_fread(void *ptr, size_t size, size_t nmemb, FILE *stream) {
	return fread(ptr, size, nmemb, stream);
}

GF_EXPORT
size_t gf_fwrite(const void *ptr, size_t size, size_t nmemb,
                 FILE *stream)
{
	size_t result = fwrite(ptr, size, nmemb, stream);
	if (result != nmemb) {
#ifdef _WIN32_WCE
		GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("Error writing data: %d blocks to write but %d blocks written\n", nmemb, result));
#else
#if defined WIN32 && !defined(GPAC_CONFIG_WIN32)
		errno_t errno_save;
		_get_errno(&errno_save);
#else
		int errno_save = errno;
#endif
		//if (errno_save!=0)
		{
#ifdef HAVE_STRERROR_R
#define ERRSTR_BUF_SIZE 256
			char errstr[ERRSTR_BUF_SIZE];
			if(strerror_r(errno_save, errstr, ERRSTR_BUF_SIZE) != 0)
			{
				strerror_r(0, errstr, ERRSTR_BUF_SIZE);
			}
#else
			char *errstr = (char*)strerror(errno_save);
#endif
			GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("Error writing data (%s): %d blocks to write but %d blocks written\n", errstr, nmemb, result));
		}
#endif
	}
	return result;
}
コード例 #18
0
ファイル: CCString.cpp プロジェクト: thenfour/LoveLine
/*
    010509 Carl Corcoran
*/
void CCString::lwr()
{
    wcslwr(this->wszString);
}
コード例 #19
0
ファイル: DialogAbout.cpp プロジェクト: PChou/rainmeter
/*
** Updates the list of measures and values.
**
*/
void CDialogAbout::CTabSkins::UpdateMeasureList(CMeterWindow* meterWindow)
{
    if (!meterWindow)
    {
        // Find selected skin
        HWND item = GetDlgItem(m_Window, IDC_ABOUTSKINS_ITEMS_LISTBOX);
        int selected = (int)SendMessage(item, LB_GETCURSEL, NULL, NULL);

        const std::map<std::wstring, CMeterWindow*>& windows = Rainmeter->GetAllMeterWindows();
        std::map<std::wstring, CMeterWindow*>::const_iterator iter = windows.begin();
        while (selected && iter != windows.end())
        {
            ++iter;
            --selected;
        }

        m_SkinWindow = (*iter).second;
    }
    else if (meterWindow != m_SkinWindow)
    {
        // Called by a skin other than currently visible one, so return
        return;
    }

    HWND item = GetDlgItem(m_Window, IDC_ABOUTSKINS_ITEMS_LISTVIEW);
    SendMessage(item, WM_SETREDRAW, FALSE, 0);
    int count = ListView_GetItemCount(item);

    LVITEM lvi;
    lvi.mask = LVIF_TEXT | LVIF_GROUPID | LVIF_PARAM;
    lvi.iSubItem = 0;
    lvi.iItem = 0;
    lvi.lParam = 0;

    lvi.iGroupId = 0;
    const std::list<CMeasure*>& measures = m_SkinWindow->GetMeasures();
    std::list<CMeasure*>::const_iterator j = measures.begin();
    for ( ; j != measures.end(); ++j)
    {
        lvi.pszText = (WCHAR*)(*j)->GetName();

        if (lvi.iItem < count)
        {
            ListView_SetItem(item, &lvi);
        }
        else
        {
            ListView_InsertItem(item, &lvi);
        }

        WCHAR buffer[256];
        CMeasure::GetScaledValue(AUTOSCALE_ON, 1, (*j)->GetMinValue(), buffer, _countof(buffer));
        std::wstring range = buffer;
        range += L" - ";
        CMeasure::GetScaledValue(AUTOSCALE_ON, 1, (*j)->GetMaxValue(), buffer, _countof(buffer));
        range += buffer;

        ListView_SetItemText(item, lvi.iItem, 1, (WCHAR*)range.c_str());
        ListView_SetItemText(item, lvi.iItem, 2, (WCHAR*)(*j)->GetStringValue(AUTOSCALE_OFF, 1, -1, false));
        ++lvi.iItem;
    }

    lvi.iGroupId = 1;
    const auto& variables = m_SkinWindow->GetParser().GetVariables();
    for (auto iter = variables.cbegin(); iter != variables.cend(); ++iter)
    {
        const WCHAR* name = (*iter).first.c_str();
        lvi.lParam = (LPARAM)name;

        if (wcscmp(name, L"@") == 0)
        {
            // Ignore reserved variables
            continue;
        }

        std::wstring tmpStr = (*iter).first;
        wcslwr(&tmpStr[0]);
        lvi.pszText = (WCHAR*)tmpStr.c_str();

        if (lvi.iItem < count)
        {
            ListView_SetItem(item, &lvi);
        }
        else
        {
            ListView_InsertItem(item, &lvi);
        }

        ListView_SetItemText(item, lvi.iItem, 1, L"");
        ListView_SetItemText(item, lvi.iItem, 2, (WCHAR*)(*iter).second.c_str());
        ++lvi.iItem;
    }

    // Delete unnecessary items
    while (count > lvi.iItem)
    {
        ListView_DeleteItem(item, lvi.iItem);
        --count;
    }

    int selIndex = ListView_GetNextItem(item, -1, LVNI_FOCUSED | LVNI_SELECTED);

    ListView_SortItems(item, ListSortProc, 0);

    if (selIndex != -1)
    {
        // Re-select previously selected item
        ListView_SetItemState(item, selIndex, LVIS_FOCUSED | LVNI_SELECTED, LVIS_FOCUSED | LVNI_SELECTED);
    }

    SendMessage(item, WM_SETREDRAW, TRUE, 0);
}
コード例 #20
0
ファイル: hd3.cpp プロジェクト: bodanrenko93/hidedragon
BOOL CALLBACK EnumWindowsForAU(HWND hwnd,LPARAM lParam)
{
	DWORD lPID;
	WndAndHandle * sBKSel_au = (WndAndHandle*)lParam;
	HANDLE hProcessSnap2_bk = NULL,hProcessSnap2 = NULL;

	if (::GetWindowLong(hwnd,GWL_STYLE) & WS_VISIBLE)
	{
		cBKWndText_au = (wchar_t*)VirtualAlloc(NULL,2048,MEM_RESERVE|MEM_COMMIT,PAGE_READWRITE);
		memset(cBKWndText_au,0,2048 * sizeof(wchar_t));
		GetWindowText(hwnd,cBKWndText_au,2048);
		GetWindowThreadProcessId(hwnd,&lPID);
		if (/*!wcscmp(cBKWndText_au,"")||*/!wcscmp(cBKWndText_au,L"Program Manager"))
		{
			VirtualFree(cBKWndText_au,0,MEM_RELEASE);
			return 1;
		}
		if (hwnd == hMainDialog||::GetParent(hwnd) == hMainDialog)
		{
			VirtualFree(cBKWndText_au,0,MEM_RELEASE);
			return 1;
		}


		hProcessSnap2 = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
		hProcessSnap2_bk = hProcessSnap2;
		pe322_au.dwSize = sizeof(PROCESSENTRY32);
		Process32First((void*)hProcessSnap2,&pe322_au);
		int iFoundFlag_BK = 0;
		while(Process32Next((void*)hProcessSnap2,&pe322_au))
		{
			if(pe322_au.th32ProcessID == lPID)
			{
				iFoundFlag_BK = 1;
				if(wcscmp(wcslwr(pe322_au.szExeFile),L"explorer.exe")==0)
				{
					if (wcscmp(cBKWndText_au,L"") != 0)
					{
						wcscpy(sBKSel_au[iW_Sel_au].cProcessName,pe322_au.szExeFile);
						sBKSel_au[iW_Sel_au].hWnd = hwnd;
						sBKSel_au[iW_Sel_au].lPID = lPID;
						sBKSel_au[iW_Sel_au].Next = NULL;
						GetWindowText(hwnd,sBKSel_au[iW_Sel_au].cWndTitle,2040);

					}
				}
				else
				{
					wcscpy(sBKSel_au[iW_Sel_au].cProcessName,pe322_au.szExeFile);
					sBKSel_au[iW_Sel_au].hWnd = hwnd;
					sBKSel_au[iW_Sel_au].lPID = lPID;
					sBKSel_au[iW_Sel_au].Next = NULL;
					if (wcscmp(cBKWndText_au,L"") == 0)
					{
						wcscpy(sBKSel_au[iW_Sel_au].cWndTitle,pe322_au.szExeFile);
						sBKSel_au[iW_Sel_au].bReserved = 1;
					}
					else
					{
						GetWindowText(hwnd,sBKSel_au[iW_Sel_au].cWndTitle,2040);
					}
					if (IsWindow(GetParent(hwnd)))
					{
						sBKSel_au[iW_Sel_au].iWindowType = 1;
					}
				}
			}
		}
		
		CloseHandle((HANDLE)hProcessSnap2);
		

		VirtualFree(cBKWndText_au,0,MEM_RELEASE);
		cBKWndText_au = NULL;
		if(wcscmp(sBKSel_au[iW_Sel_au].cProcessName,L"itunes.exe") == 0)
		{
			int j = 0;
		}
		if(IsInAutoHideList(sBKSel_au[iW_Sel_au].cProcessName,1) == 1)
		{
			BKCurrentWindow_au(sBKSel_au+iW_Sel_au);
		}
		iW_Sel_au ++;
	}
	return 1;
}
コード例 #21
0
void CUnicodeString::MakeLower()
{
	wcslwr(m_Buffer);
}
コード例 #22
0
ファイル: pal.c プロジェクト: mixtile/xskit
xsWChar *xsWcsLwr(xsWChar *string)
{
	return (xsWChar *)wcslwr(string);
}
コード例 #23
0
ファイル: init.cpp プロジェクト: tweimer/miranda-ng
int CMPlugin::Load()
{
	Clist_GetInterface();
	coreCli = g_clistApi;

	API::onInit();

	memset(&cfg::dat, 0, sizeof(cfg::dat));

	int iCount = db_get_contact_count();

	iCount += 20;
	if (iCount < 300)
		iCount = 300;

	cfg::dat.hMenuNotify = CreatePopupMenu();
	cfg::dat.wNextMenuID = 1;
	cfg::dat.sortTimer = db_get_dw(NULL, "CLC", "SortTimer", 150);
	cfg::dat.avatarBorder = (COLORREF)db_get_dw(NULL, "CLC", "avatarborder", 0);
	cfg::dat.avatarRadius = (COLORREF)db_get_dw(NULL, "CLC", "avatarradius", 4);
	cfg::dat.hBrushAvatarBorder = CreateSolidBrush(cfg::dat.avatarBorder);
	cfg::dat.avatarSize = db_get_w(NULL, "CList", "AvatarSize", 24);
	cfg::dat.dualRowMode = db_get_b(NULL, "CLC", "DualRowMode", 0);
	cfg::dat.avatarPadding = db_get_b(NULL, "CList", "AvatarPadding", 0);
	cfg::dat.isTransparent = db_get_b(NULL, "CList", "Transparent", 0);
	cfg::dat.alpha = db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT);
	cfg::dat.autoalpha = db_get_b(NULL, "CList", "AutoAlpha", SETTING_ALPHA_DEFAULT);
	cfg::dat.fadeinout = db_get_b(NULL, "CLUI", "FadeInOut", 0);
	cfg::dat.autosize = db_get_b(NULL, "CLUI", "AutoSize", 0);
	cfg::dat.bNoOfflineAvatars = db_get_b(NULL, "CList", "NoOfflineAV", 1);
	cfg::dat.bFullTransparent = db_get_b(NULL, "CLUI", "fulltransparent", 0);
	cfg::dat.bDblClkAvatars = db_get_b(NULL, "CLC", "dblclkav", 0);
	cfg::dat.bEqualSections = db_get_b(NULL, "CLUI", "EqualSections", 0);
	cfg::dat.bCenterStatusIcons = db_get_b(NULL, "CLC", "si_centered", 1);
	cfg::dat.boldHideOffline = -1;
	cfg::dat.bSecIMAvail = ServiceExists("SecureIM/IsContactSecured") ? 1 : 0;
	cfg::dat.bNoTrayTips = db_get_b(NULL, "CList", "NoTrayTips", 0);
	cfg::dat.bShowLocalTime = db_get_b(NULL, "CLC", "ShowLocalTime", 1);
	cfg::dat.bShowLocalTimeSelective = db_get_b(NULL, "CLC", "SelectiveLocalTime", 1);
	cfg::dat.bDontSeparateOffline = db_get_b(NULL, "CList", "DontSeparateOffline", 0);
	cfg::dat.bShowXStatusOnSbar = db_get_b(NULL, "CLUI", "xstatus_sbar", 0);
	cfg::dat.bLayeredHack = db_get_b(NULL, "CLUI", "layeredhack", 1);
	cfg::dat.bFirstRun = db_get_b(NULL, "CLUI", "firstrun", 1);
	cfg::dat.langPackCP = Langpack_GetDefaultCodePage();
	cfg::dat.realTimeSaving = db_get_b(NULL, "CLUI", "save_pos_always", 0);

	DWORD sortOrder = db_get_dw(NULL, "CList", "SortOrder", SORTBY_NAME);
	cfg::dat.sortOrder[0] = LOBYTE(LOWORD(sortOrder));
	cfg::dat.sortOrder[1] = HIBYTE(LOWORD(sortOrder));
	cfg::dat.sortOrder[2] = LOBYTE(HIWORD(sortOrder));

	if (cfg::dat.bFirstRun)
		db_set_b(NULL, "CLUI", "firstrun", 0);

	ReloadThemedOptions();
	Reload3dBevelColors();

	cfg::dat.dwFlags = db_get_dw(NULL, "CLUI", "Frameflags", CLUI_FRAME_STATUSICONS | CLUI_FRAME_SHOWBOTTOMBUTTONS | CLUI_FRAME_BUTTONSFLAT | CLUI_FRAME_CLISTSUNKEN);
	cfg::dat.dwFlags |= (db_get_b(NULL, "CLUI", "ShowSBar", 1) ? CLUI_FRAME_SBARSHOW : 0);
	cfg::dat.soundsOff = db_get_b(NULL, "Skin", "UseSound", 1) ? 0 : 1;

	Profile_GetPathW(MAX_PATH, cfg::dat.tszProfilePath);
	wcslwr(cfg::dat.tszProfilePath);

	// get the clist interface
	g_clistApi.hInst = g_plugin.getInst();
	g_clistApi.pfnCluiProtocolStatusChanged = CluiProtocolStatusChanged;
	g_clistApi.pfnCompareContacts = CompareContacts;
	g_clistApi.pfnCreateClcContact = CreateClcContact;
	g_clistApi.pfnDocking_ProcessWindowMessage = Docking_ProcessWindowMessage;
	g_clistApi.pfnGetContactHiddenStatus = CLVM_GetContactHiddenStatus;
	g_clistApi.pfnGetDefaultFontSetting = GetDefaultFontSetting;
	g_clistApi.pfnGetRowBottomY = RowHeight::getItemBottomY;
	g_clistApi.pfnGetRowHeight = RowHeight::getHeight;
	g_clistApi.pfnGetRowTopY = RowHeight::getItemTopY;
	g_clistApi.pfnGetRowTotalHeight = RowHeight::getTotalHeight;
	g_clistApi.pfnGetWindowVisibleState = GetWindowVisibleState;
	g_clistApi.pfnHitTest = HitTest;
	g_clistApi.pfnOnCreateClc = OnCreateClc;
	g_clistApi.pfnPaintClc = PaintClc;
	g_clistApi.pfnRebuildEntireList = RebuildEntireList;
	g_clistApi.pfnRowHitTest = RowHeight::hitTest;
	g_clistApi.pfnScrollTo = ScrollTo;
	g_clistApi.pfnSetHideOffline = SetHideOffline;
	g_clistApi.pfnShowHide = ShowHide;

	g_clistApi.pfnAddContactToGroup = AddContactToGroup;

	g_clistApi.pfnAddEvent = AddEvent;
	g_clistApi.pfnRemoveEvent = RemoveEvent;

	g_clistApi.pfnAddGroup = AddGroup;
	g_clistApi.pfnAddInfoItemToGroup = AddInfoItemToGroup;
	g_clistApi.pfnContactListControlWndProc = ContactListControlWndProc;
	g_clistApi.pfnContactListWndProc = ContactListWndProc;
	g_clistApi.pfnIconFromStatusMode = IconFromStatusMode;
	g_clistApi.pfnLoadClcOptions = LoadClcOptions;
	g_clistApi.pfnProcessExternalMessages = ProcessExternalMessages;
	g_clistApi.pfnRecalcScrollBar = RecalcScrollBar;
	g_clistApi.pfnTrayIconProcessMessage = TrayIconProcessMessage;

	int rc = LoadContactListModule();
	if (rc == 0)
		rc = LoadCLCModule();
	LoadCLUIModule();
	LoadButtonModule();

	HookEvent(ME_SYSTEM_MODULESLOADED, systemModulesLoaded);
	return rc;
}