NulMRx failing - The system cannot find the file specified

I am new to mini-redirector’s. DDK samples documentation doesn’t specify build environment and target operating system for it. I compiled it for Windows 2003 Server 32 bit and followed steps as mentioned in Readme.html. I get follwing error when I try

net use Q: \nulsrv\share

System error 2 has occurred.
The system cannot find the file specified.

Can someone put a light on it ?

When I debug the code I get the I get ConnectionName as “\Device\NullMiniRdr;Q:\nulsrv\share” and ZwCreateFile returned c00000fb - STATUS_REDIRECTOR_NOT_STARTED. But the network redirector driver was started.

HANDLE
GetConnectionHandle(
IN PUNICODE_STRING ConnectionName
)
{

NTSTATUS Status;
HANDLE Handle;
IO_STATUS_BLOCK IoStatusBlock;
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING FileName;

// Connection name should get checked to be certain our device is in the path

InitializeObjectAttributes(
&ObjectAttributes,
ConnectionName,
OBJ_CASE_INSENSITIVE|OBJ_KERNEL_HANDLE,
NULL,
NULL);

Status = ZwCreateFile(
&Handle,
SYNCHRONIZE,
&ObjectAttributes,
&IoStatusBlock,
NULL, // Allocation size
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_OPEN_IF,
FILE_CREATE_TREE_CONNECTION | FILE_SYNCHRONOUS_IO_NONALERT,
NULL, // Ptr to EA Buffer
0); // Length of EA buffer

DbgPrint(“ZwCreateFile returned %lx\n”,Status);

if ( (STATUS_SUCCESS == Status) && (INVALID_HANDLE_VALUE != Handle) ) {
DbgPrint(“ZwCreateFile returned success\n”);
}
else
Handle = INVALID_HANDLE_VALUE;

return Handle;
}

Am I missing something ?

You cannot start mini-redir from DriverEntry() as it is in the NulMrx. It must be done from IOCTL command - take look into SmbMrx. I have reported several problems related to miniredir samples in WDK beta feedback on connect.microsoft.com. Take look on them and vote fro them, so they are fixed.

Bronislav Gabrhelik