Create a file on a mapped network drive

Hi

I have mapped \192.168.2.1\bla (Windows Server 2008) to Z: (XP). Now I would like to create a new file there. If I try to create a file with ??\Z:\test I get c0000034 “object name not found”. Next I checked the if its possible via lanmanredirector. With \Device\LanmanRedirector\192.168.2.1\bla\test I get C0000022 “access denied”. I tried to remove FILE_OPEN_FOR_BACKUP_INTENT but still I get “access denied”.

Here is the code which I’m using:

RtlInitUnicodeString(&UnicodeFileName,FileName);

OBJECT_ATTRIBUTES Attr;

InitializeObjectAttributes(&Attr, &UnicodeFileName, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, NULL, NULL);

// Create and initialise io status block
IO_STATUS_BLOCK IoStatus;

IoStatus.Status = 0;
IoStatus.Information = 0;

// Access to read and write data
ACCESS_MASK AccessMask = SYNCHRONIZE;

AccessMask |= GENERIC_READ;
AccessMask |= GENERIC_WRITE;

// No share until file is closed
ULONG ulShare = FILE_SHARE_READ | FILE_SHARE_WRITE;

NTSTATUS Status;

Status = ZwCreateFile(&m_FileHandle, AccessMask,&Attr, &IoStatus, 0,FILE_ATTRIBUTE_NORMAL, ulShare, FILE_OPEN_IF, FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT | FILE_OPEN_FOR_BACKUP_INTENT, NULL, 0);

Please help.

Cheers

Found it out by myself. Problem was that I tried to create the file inside DriverEntry, so no security context was there.

> I have mapped \192.168.2.1\bla (Windows Server 2008) to Z: (XP). Now I would like to create a new

file there. If I try to create a file with ??\Z:\test I get c0000034 “object name not found”.

Surely, the network drive letters are per-user-session.

Next I checked the if its possible via lanmanredirector. With
\Device\LanmanRedirector\192.168.2.1>\bla\test I get C0000022 “access denied”.

From what thread are you doing this?


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

Hi

Thank you for your answer. I tried to create the file via lanman redirector from the thread which executes the DriverEntry routine.

Cheers