阅读:2674回复:2
一个调用ZwOpenSymbolicLinkObject时的问题??
下面的代码是我放在文件隐藏中的代码:
UNICODE_STRING *pFullPath=NULL; ..... pFullPath = (UNICODE_STRING *)ExAllocatePool(PagedPool,1024); RtlZeroMemory(pFullPath,1024); pFullPath->Length=1024; pFullPath->MaximumLength = 1024; rc = ObQueryNameString(pFileObject,pFullPath,1024,&ActualLength); if(rc != STATUS_SUCCESS) { ExFreePool(&pFullPath); ObDereferenceObject(pFileObject); return rc; } DbgPrint("OK.Query Full Dir = %ws\n",pFullPath->Buffer); InitializeObjectAttributes(&ObjectAttributes,pFullPath,OBJ_CASE_INSENSITIVE,NULL,NULL); rc=ZwOpenSymbolicLinkObject(&TestLink,GENERIC_READ,&ObjectAttributes); if(rc != STATUS_SUCCESS) { return rc; } 在DbgPrint时内容正确"\Device\HarddiskVolumel1",可是运行到ZwOpenSymbolicLinkObject当我打开c盘时系统就会提示“句柄无效 c:” |
|
沙发#
发布于:2004-02-03 09:53
运行下面的代码时,系统就会重起。
UNICODE_STRING *pFullPath=NULL; ..... pFullPath->Buffer = (WCHAR*)ExAllocatePool(PagedPool,1024); RtlZeroMemory(pFullPath->Buffer,1024); pFullPath->Length=1024; pFullPath->MaximumLength = 1024; rc = ObQueryNameString(pFileObject,pFullPath,1024,&ActualLength); if(rc != STATUS_SUCCESS) { ExFreePool(&pFullPath); ObDereferenceObject(pFileObject); return rc; } DbgPrint("OK.Query Full Dir = %wsn",pFullPath->Buffer); InitializeObjectAttributes(&ObjectAttributes,pFullPath,OBJ_CASE_INSENSITIVE,NULL,NULL); rc=ZwOpenSymbolicLinkObject(&TestLink,GENERIC_READ,&ObjectAttributes); if(rc != STATUS_SUCCESS) { return rc; } |
|
板凳#
发布于:2004-02-03 17:36
各位有没有人帮帮我呀!!
|
|