From - Tue Sep 16 11:14:14 1997 Path: news.mitre.org!blanket.mitre.org!news.tufts.edu!cam-news-feed5.bbnplanet.com!cam-news-hub1.bbnplanet.com!news.bbnplanet.com!news.maxwell.syr.edu!pumpkin.pangea.ca!news.mira.net.au!inquo!news.seinf.abb.se!erinews.ericsson.se!news.emw.ericsson.se!not-for-mail From: Gunnar.E.Nilsson@emw.ericsson.se Newsgroups: comp.os.ms-windows.programmer.nt.kernel-mode Subject: Re: ZwCreateFile cannot file the file Date: Tue, 16 Sep 1997 15:33:26 +0200 Organization: Ericsson Microwave Systems AB Lines: 55 Message-ID: <341E8AA6.59C1@emw.ericsson.se> References: <341860e7.283552051@news.connectnet.com> NNTP-Posting-Host: nt068mo.mo.emw.ericsson.se Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: infomania.emw.ericsson.se 874416998 19668 (None) 136.225.229.79 X-Complaints-To: newsmaster@emw.ericsson.se X-Mailer: Mozilla 3.02C (WinNT; I) fdebaca@getntds.com wrote: > > Ok! I give up. > How do I setup the filename for ZwCreateFile > I've tried, > "c:\\pathname\\filename.bin" > "\\pathname\\filename.bin" > "c:\\filename.bin", > "\\filename.bin", > "\\DosDevices\\c:\\filename.bin", > "\\DosDevices\\filename.bin". > I did the InitialializeObjectAttribute before I did the ZwCreatFile(). > Filename.bin was in the above directories. > > All I want to do Is allow the application to tell the driver, "here's > the file I want you to load into the Gate Array of the device". > > John Vasquez - my direct e-mail is jvasquez@getntds.com Hi here is how I create and WRITE a file: file->File is like: "\\DosDevices\\c:\\temp\\file.bin" HANDLE FileHandle; OBJECT_ATTRIBUTES ObjectAttributes; CUString ObjectName(file->File); IO_STATUS_BLOCK IoStatus; // KdPrint( ("ZwCF: Attempting to open %wZ\n", &ObjectName.m_String)); InitializeObjectAttributes( &ObjectAttributes, &ObjectName.m_String, OBJ_CASE_INSENSITIVE, NULL, NULL); LARGE_INTEGER size; size = RtlConvertLongToLargeInteger(BytesToGet[i]); status = ZwCreateFile( &FileHandle, GENERIC_WRITE | GENERIC_READ, &ObjectAttributes, &IoStatus, &size, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ, FILE_OVERWRITE_IF, FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT, NULL, // eabuffer 0 ); // ealength if (!NT_SUCCESS(status)) { KdPrint( ("ZwCreateFile problem: %8X", status) ); ZwClose( FileHandle ); return status; };