Questions tagged [createfile]

The Windows CreateFile API function

The Windows CreateFile API function.

Use this tag only in conjunction with the windows-specific API. Do not use this tag if you intend to refer to the generic concept of referring to a file.

474 questions
2
votes
2 answers

When error 1224: ERROR_USER_MAPPED_FILE occurs?

I want to really understand when the ERROR_USER_MAPPED_FILE occurs. So I wrote some snippets. To reproduce the error. But it did not work. Please help me fix my code Process 1: HANDLE hFile = CreateFile("C:\\test\\full.exe", GENERIC_READ |…
Venkatesh
  • 1,537
  • 15
  • 28
2
votes
1 answer

Question about a valid file path

I am using the following code to create a file, but it always failed with error code 123 (the path syntax is not valid). The strange thing is: path_ok is always ok, but path_err always failed with 123. And after the failure, the buffer that path_err…
smwikipedia
  • 61,609
  • 92
  • 309
  • 482
2
votes
2 answers

Creating a memory file

I want to create a temporary file in memory, without it writing to disk, that can be opened for reading using CreateFile from other processes as if it was a normal file. Is this possible or do I have to write it to the disk?
man
  • 145
  • 2
  • 11
2
votes
2 answers

How to create a .wav file after a record - Android Studio

I try to make a simple recorder and when I start the operation i get fileNotFoundException. How do i create a .wav file in a specific folder, let's say on the external card, so i can access that folder later for listening the records stored there.…
Copacel
  • 1,328
  • 15
  • 25
2
votes
0 answers

Android OTG Marshmallow create a file in USB drive

I'm trying to create folder in USB drive mounted using OTG. Works fine in Lollipop but I'm struggle with Marshmallow. All permissions are given. I know SAF is the way to go about it. And I've been trying to write custom DocumentProvider to mkdir.…
2
votes
1 answer

Opening a handle to flash drive gives me an "Access Denied" error code

I would like to know why when I try to create a handle to a USB flash drive, I receive a path not found error. HANDLE aFile = CreateFile(_T("\\\\.\\F:\\"), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (aFile ==…
ffrstar777
  • 75
  • 2
  • 10
2
votes
1 answer

How does FILE_FLAG_NO_BUFFERING interact with handles opened to communication devices?

Just as the title says, I am writing a networking program where I open a handle to a network driver using CreateFile, and I have been experimenting with the NO_BUFFERING flag. Most documentation won't even mention this being used with communication…
JoshuaN
  • 23
  • 4
2
votes
1 answer

open and write 2 files

I need create one script for open one file (Server.txt → content all servers names) and create logfile with ServerName (example: Server1.txt). After that I need WriteLine in this logfile result of the script retrieve registry values. I have one…
2
votes
2 answers

Create a file in java whish the directory is inside a textfile

I've a textfile called backUp.dat. That file contains a directory path, so I created a simple method to read that file: public static String readFileAsString(String filename) { BufferedReader reader; try { reader = new…
2
votes
1 answer

VBScript can create text file but can't delete file (permission denied)?

I create a .vbs file (that can: creat text file -> Open notepad.exe -> delete the file above) like this: ' Create a new file Dim objFS, objFile Set objFS = CreateObject("Scripting.FileSystemObject") Set objFile =…
Baeb
  • 21
  • 1
  • 1
  • 2
2
votes
1 answer

Why .Net code version hangs, but C++ not?

Why does the same code in .Net (C#) hangs, but in C++ it isn't? The really problem is in System.IO.FileStream, but I reduced it down to CreateFile, nevertheless it still hangs in .Net (while being almost 100% analogue to C++ code): using…
frtnum
  • 177
  • 14
2
votes
2 answers

Using CreateFile To Access a Drive Partition

I have admin rights and have no problem getting a valid handle and ultimately reading an entire hard drive via: IntPtr handle = CreateFile(@"\\.\PHYSICALDRIVE1", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); I can also get a valid handle…
user4437649
2
votes
2 answers

CreateFile fails on opening fs driver

i'm trying to communicate with my filesystem driver. I can start the driver with OpenSCManager, CreateService and OpenService but when i'm trying to use "CreateFile", it always says Errorcode 2 (I think it's file not found etc.). This is the whole…
T D
  • 115
  • 3
  • 5
  • 17
2
votes
3 answers

create a file in the script using python

I am new to python. I wanted to know if I could create a text file in the script itself before writing into. I do not want to create a text file using the command prompt. I have written this script to write the result into the file with…
user3256847
  • 41
  • 1
  • 1
  • 6
2
votes
2 answers

SetupComm, SetCommState, SetCommTimeouts fail with USB device

i am opening a USB device: for communication using CreateFile: HANDLE hUsb = CreateFile("\\.\LCLD9", GENERIC_READ | GENERIC_WRITE, 0, null, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); The call succeeds (i.e.…
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219