分割文件全路径中的目录与文件名(C语言,windows内核)

函数定义



//分割目录全路径与文件名
VOID SplitString(PUNICODE_STRING FullPath ,PWCHAR filePath ,WCHAR fileName[])
{
	PWCHAR p = FullPath->Buffer;
	int i = wcslen(p) -1;
	int count = i;
	int j = 0;
	while(p[i] != '\\')
	{
		fileName[j] = p[i];
		i--;
		j++;
	}
	WCHAR tmp ;
	int k = 0;
	int lenght = wcslen(fileName);
	for (j=lenght-1;k

以下是调用


	  WCHAR fileName[260] = {0};
	  WCHAR filePath[260] = {0}; 
	  SplitString(&nameInfo->Name,filePath,fileName); //&nameInfo->Name 是文件全路径信息
	  KdPrint(("&nameInfo->Name = %wZ\n",&nameInfo->Name));

 

你可能感兴趣的:(C/C++,windows驱动,内核字符串处理)