C++ - Recursive file listing

void MyLib::countFilesInDir(wstring* dirn, int *fileCounter)
{
	wstring *dirnPath = new wstring;
	*dirnPath = *dirn + L"\\*";

	WIN32_FIND_DATA *f = new WIN32_FIND_DATA;
	HANDLE *h = new HANDLE;
	*h = FindFirstFile((*dirnPath).c_str(), f);

	if (*h == INVALID_HANDLE_VALUE) { return; }

	do
	{
		wstring *name = new wstring;
		*name = (*f).cFileName;

		if (*name == L"." || *name == L"..") { continue; }

		wstring *filePath = new wstring;
		*filePath = *dirn + L"\\" + *name;

		if ((*f).dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
		{
			countFilesInDir(filePath, fileCounter);
		}
		else {
			*fileCounter = *fileCounter + 1;
		}

		delete filePath;
		delete name;

	} while (FindNextFile(*h, f));
	FindClose(*h);

	delete dirnPath;
	delete f;
	delete h;
}


Source: http://www.sockfd.net/content/recursive-file-listing-choosing-folder-c-windows