createfile

How to get the actual path of a file in Vista with UAC ?

I am calling CreateFile() to create a file in the Program Data directory. I'm using SHGetSpecialFolderPath() to get the dir name. I have a user with Vista for whom CreateFile() is returning error 5 (Access Denied). It would help if I knew where CreateFile() was actually attempting to create the file so we can check his folder permissio...

Open a socket using CreateFile

We've got some old serial code which checks whether a serial port is available simply by opening it and then closing it. Now we are adding network support to the app I want to reuse the function by supplying the ip address as a string. /** * So far I have tried: * A passed in portPath normally looks like: \\?\acpi#pnp0501#1#1#{GUID} ...

SharePoint through Web Client Service (webclnt.dll). CreateFile fails

I have an application that creates and edits documents. I need to integrate it with SharePoint, so that users can edit files on SharePoint servers using my application. My environment is Visual C++, non-MFC Windows application. I'm trying out the Web Client service (webclnt.dll) to see if I can get my app to work with a minimum of co...

What is the default buffer size of CreateFile in Windows?

When CreateFile Function is called without the flag FILE_FLAG_NO_BUFFERING, what is the size of the inner buffer of operating system? If my buffer size is larger than the inner buffer of Windows, can I fully use up the throughput of disk? ...

CreateFile error in Windows7

I've noticed that if the path parameter to the CreateFile function targets \Windows\System32\ the call is failing with the following error code ERROR_PATH_NOT_FOUND. The file path is correct, I'm the owner of the folder, so the question is why is the call failing? Did MS add special policy forbidding the folder from being accessed? Sam...

saving file to network

I have a file that's about 7 MB that saves to my local share in a matter of seconds. However, saving that file to a network location takes minutes. I'm wondering what I can do to speed this up. Here are my current options: Save the data to a temporary file on the local machine, then copy the temporary file over to the network path. ...

Create files using list of filenames and add content to each

I need to make a bunch of redirect pages as I've recently updated my web site which previously used .html files and now all the files are .aspx. I have a tab-delimited file containing a list of original filenames and the corresponding new filename. It seems like there should be a language out there that I should be able to create a file...

Java: Proper Way of Making Directories

Directories some_folder, some_folder_1, some_folder_2, and some_folder_3 don't exist initially. File folder1 = new File("some_folder/some_folder_1"); File folder2 = new File("some_folder/some_folder_2"); File folder3 = new File("some_folder/some_folder_3"); if(!folder1.exists()) { folder1.mkdirs(); } if(!folder2.exists()) { ...

How can I check if a directory can be renamed in VB.NET?

My thought is to use CreateFile from kernel32 and check for sharing violations. I believe this will work because I watched the file system activity with Process Monitor while issuing a rename command from CMD that I knew would fail and the last activity was a failed CreateFile call that resulted in a sharing violation. This is the Proce...

NSFileManager works fine on simulator but not on device

Hi, I have problem creating directories and files with NSFileManager on the iPhone device. My code, shown below, works fine on the simulator, but not on the device, could you please help me? Gimme some directions where the problem may be, thanks for every reply.. I'm first creating directories this way: NSFileManager *fileMgr = [NSFile...

Setting the last-modified-time of a directory opened for ReadDirectoryChangesW

I hava a Java program that needs to monitor a directory tree for changes. I have JNI code that uses ReadDirectoryChangesW(). The directory is opened like: HANDLE dirHandle = CreateFile( path, FILE_LIST_DIRECTORY, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL ); and then I pass dirH...

Closing and immediately re-opening a COM port fails: Why?

I'm trying to do 'pre-flight checks' by testing a COM port's 'openability' before launching a dialog window which allows the user to do com-porty things. Here's the code sequence, in outline: handle = CreateFile("\\\\.\\COM4:", GENERIC_READ | GENERIC_WRITE, 0,NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED,NULL); if (handle != INVALID_HANDL...

Java - open existing file or create one if doesn't exist using IO streams

I was following instructions from a Java website (http://java.sun.com/docs/books/tutorial/essential/io/file.html#createStream) on creating or writing a file using an IO stream. However, the code it provides seems to be broken in multiple places: import static java.nio.file.StandardOpenOption.*; Path logfile = ...; //Convert the string...

Reading ASCII File TAB is Replaced with NULL

Hello. I'm using CreateFileA and ReadFile in Visual C++ 2008 to open and read an ASCII text file into memory. This works okay (I can view its contents in memory), but with one exception. For some reason the TAB characters (0x09) are being changed to NULLs (0x00). Needless to say, this is wreaking havoc when I try to parse the file. ...

Why does .NET not clear errors internally?

I am running the following scenerio: SafeFileHandle handle = Win32API.CreateFile((deviceName + "\\" + pipeName), DesiredAccess.GENERIC_WRITE | DesiredAccess.GENERIC_READ, ShareMode.FILE_SHARE_WRITE | ShareMode.FILE_SHARE_READ, IntPtr.Zero, ...

Python CreateFile Cannot Find PhysicalMemory

I am trying to access the Physical Memory of a Windows 2000 system (trying to do this without a memory dumping tool). My understanding is that I need to do this using the CreateFile function to create a handle. I have used an older version of win32dd to help me through this. Other documentation on the web points me to using either "\D...

Can CreateFile() Open one file at the same time in two different thread

Can CreateFile() Open one file at the same time in two different thread void new_function(void * what) { HANDLE h = CreateFile("c:\\tmp", GENERIC_ALL,FILE_SHARE_WRITE | FILE_SHARE_READ , NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (h == INVALID_HANDLE_VALUE) { DWORD d = GetLastError(); return ; }...

::CreateFile with the FILE_FLAG_DELETE_ON_CLOSE flag.

Before I describe my problem, here is a description of the program (IHExplorer.exe) I'm writting: This is a C++ application. The IHExplorer application is to look as much like a Windows Explorer window as possible. With one exception, and that is that launching files from within this Explorer window will decrypt them first to the user'...

Calling CreateFile on a physical device path in a loop

I have some C# code that is calling CreateFile on a different physical device path each time through a loop(ie \.\PhysicalDrive1, then \.\PhysicalDrive2, ...) via pInvoke and then using the returned handle do some other low level windows stuff. At the end of the loop it calls CloseHandle on the handle. While debugging I noticed that th...

How to create a super-huge file with pure c or linux-shell or dos-commands?

My os and drive is OS: Windows XP sp2 or Linux SUSE 9 or Cygwin Compiler: Visual C++ 2003 or Gcc or Cygwin PC and os are both 32 bits So, How can I create a super-huge file in secs I was told to use MappingFile functions. I failed to create files over 2G So... Your warm responses will be all appreciated thanks ...