src/Cedar/SW.c
// Check the directory name planned to be created newly

Check the directory name planned to be created newly
Check the directory name planned to be created newly
bool SwCheckNewDirName(wchar_t* name)
{
	char tmp[MAX_SIZE];
	UCHAR rand[16];
	wchar_t testname[MAX_SIZE];
	IO* io;
	bool new_dir;
	if (name == NULL)
	{
		return false;
	}
	new_dir = MakeDirExW(name);
	Rand(rand, sizeof(rand));
	BinToStr(tmp, sizeof(tmp), rand, sizeof(rand));
	UniFormat(testname, sizeof(testname), L"%s\\%S.dat", name, tmp);
	io = FileCreateW(testname);
	if (io == NULL)
	{
		return false;
	}
	FileClose(io);
	FileDeleteW(testname);
	if (new_dir)
	{
		DeleteDirW(name);
	}
	return true;
}
bool SwCheckNewDirName ( wchar_t * name ) { char tmp [ MAX_SIZE ] ; UCHAR rand [ 16 ] ; wchar_t testname [ MAX_SIZE ] ; IO * io ; bool new_dir ; if ( name == NULL ) { return false ; } new_dir = MakeDirExW ( name ) ; Rand ( rand , sizeof ( rand ) ) ; BinToStr ( tmp , sizeof ( tmp ) , rand , sizeof ( rand ) ) ; UniFormat ( testname , sizeof ( testname ) , L" \\ " , name , tmp ) ; io = FileCreateW ( testname ) ; if ( io == NULL ) { return false ; } FileClose ( io ) ; FileDeleteW ( testname ) ; if ( new_dir ) { DeleteDirW ( name ) ; } return true ; }
Check the directory name planned to be created newly
Check the directory name planned to be created newly
// Validate arguments
 // Create a directory
 // Writes the appropriate files
