ReactOS  r76032
io.c File Reference
#include "vfatlib.h"
#include <debug.h>
Include dependency graph for io.c:

Go to the source code of this file.

Classes

struct  _change
 

Macros

#define NDEBUG
 
#define FSCTL_IS_VOLUME_DIRTY   CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 30, METHOD_BUFFERED, FILE_ANY_ACCESS)
 
#define close   WIN32close
 
#define read   WIN32read
 
#define write   WIN32write
 
#define lseek   WIN32lseek
 

Typedefs

typedef struct _change CHANGE
 

Functions

static int WIN32close (HANDLE FileHandle)
 
static int WIN32read (HANDLE FileHandle, void *buf, unsigned int len)
 
static int WIN32write (HANDLE FileHandle, void *buf, unsigned int len)
 
static off_t WIN32lseek (HANDLE fd, off_t offset, int whence)
 
void fs_open (PUNICODE_STRING DriveRoot, int read_write)
 
BOOLEAN fs_isdirty (void)
 
NTSTATUS fs_lock (BOOLEAN LockVolume)
 
void fs_dismount (void)
 
void fs_read (off_t pos, int size, void *data)
 
int fs_test (off_t pos, int size)
 
void fs_write (off_t pos, int size, void *data)
 
static void fs_flush (void)
 
int fs_close (int write)
 
int fs_changed (void)
 

Variables

static CHANGEchanges
 
static CHANGElast
 
static int did_change = 0
 
static HANDLE fd
 
static LARGE_INTEGER CurrentOffset
 

Macro Definition Documentation

#define close   WIN32close

Definition at line 67 of file io.c.

Referenced by fs_close(), FTPGetOneF(), and FTPPutOneF().

Definition at line 44 of file io.c.

Referenced by fs_isdirty().

#define lseek   WIN32lseek

Definition at line 157 of file io.c.

Referenced by fs_flush(), fs_read(), fs_test(), and fs_write().

#define NDEBUG

Definition at line 40 of file io.c.

#define read   WIN32read

Definition at line 92 of file io.c.

Referenced by fs_read(), fs_test(), and fs_write().

#define write   WIN32write

Definition at line 117 of file io.c.

Referenced by fs_flush(), fs_write(), FTPGetOneF(), FTPList(), and FTPPutOneF().

Typedef Documentation

Function Documentation

int fs_changed ( void  )

Definition at line 482 of file io.c.

483 {
484  return !!changes || did_change;
485 }
static CHANGE * changes
Definition: io.c:53
static int did_change
Definition: io.c:54
int fs_close ( int  write)

Definition at line 462 of file io.c.

Referenced by VfatChkdsk().

463 {
464  CHANGE *next;
465  int changed;
466 
467  changed = !!changes;
468  if (write)
469  fs_flush();
470  else
471  while (changes) {
472  next = changes->next;
473  free(changes->data);
474  free(changes);
475  changes = next;
476  }
477  if (close(fd) < 0)
478  pdie("closing filesystem");
479  return changed || did_change;
480 }
static CHANGE * changes
Definition: io.c:53
#define free
Definition: debug_ros.c:5
void * data
Definition: io.c:47
#define write
Definition: io.c:117
static int did_change
Definition: io.c:54
#define pdie(msg,...)
Definition: common.h:43
static void fs_flush(void)
Definition: io.c:407
#define close
Definition: io.c:67
static HANDLE fd
Definition: io.c:55
static unsigned __int64 next
Definition: rand_nt.c:6
struct _change * next
Definition: io.c:50
Definition: io.c:46
void fs_dismount ( void  )

Definition at line 239 of file io.c.

Referenced by VfatChkdsk().

240 {
242  IO_STATUS_BLOCK IoSb;
243 
244  /* Check if volume is dirty */
245  Status = NtFsControlFile(fd,
246  NULL, NULL, NULL, &IoSb,
248  NULL, 0, NULL, 0);
249 
250  if (!NT_SUCCESS(Status))
251  {
252  DPRINT1("NtFsControlFile() failed with Status 0x%08x\n", Status);
253  }
254 }
NTSYSCALLAPI NTSTATUS NTAPI NtFsControlFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG FsControlCode, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength)
smooth NULL
Definition: ftsmooth.c:557
#define FSCTL_DISMOUNT_VOLUME
Definition: nt_native.h:834
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
Status
Definition: gdiplustypes.h:24
static HANDLE fd
Definition: io.c:55
LONG NTSTATUS
Definition: DriverTester.h:11
#define DPRINT1
Definition: precomp.h:8
static void fs_flush ( void  )
static

Definition at line 407 of file io.c.

Referenced by fs_close().

408 {
409 #if 1
410 
411  CHANGE *this;
412  int old_write_immed = (FsCheckFlags & FSCHECK_IMMEDIATE_WRITE);
413 
414  /* Disable writes to the list now */
416 
417  while (changes) {
418  this = changes;
419  changes = changes->next;
420 
421  fs_write(this->pos, this->size, this->data);
422 
423  free(this->data);
424  free(this);
425  }
426 
427  /* Restore values */
428  if (!old_write_immed) FsCheckFlags ^= FSCHECK_IMMEDIATE_WRITE;
429 
430 #else
431 
432  CHANGE *this;
433  int size;
434 
435  while (changes) {
436  this = changes;
437  changes = changes->next;
438  if (lseek(fd, this->pos, 0) != this->pos)
439  {
440  // printf("Seek to %lld failed: %s\n Did not write %d bytes.\n",
441  // (long long)this->pos, strerror(errno), this->size);
442  printf("Seek to %lld failed\n Did not write %d bytes.\n",
443  (long long)this->pos, this->size);
444  }
445  else if ((size = write(fd, this->data, this->size)) < 0)
446  {
447  // printf("Writing %d bytes at %lld failed: %s\n", this->size,
448  // (long long)this->pos, strerror(errno));
449  printf("Writing %d bytes at %lld failed\n",
450  this->size, (long long)this->pos);
451  }
452  else if (size != this->size)
453  printf("Wrote %d bytes instead of %d bytes at %lld.\n",
454  size, this->size, (long long)this->pos);
455  free(this->data);
456  free(this);
457  }
458 
459 #endif
460 }
#define lseek
Definition: io.c:157
static CHANGE * changes
Definition: io.c:53
#define free
Definition: debug_ros.c:5
#define write
Definition: io.c:117
void fs_write(off_t pos, int size, void *data)
Definition: io.c:338
ULONG FsCheckFlags
Definition: vfatlib.c:44
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static HANDLE fd
Definition: io.c:55
GLsizeiptr size
Definition: glext.h:5919
#define FSCHECK_IMMEDIATE_WRITE
Definition: rosglue.h:28
struct _change * next
Definition: io.c:50
#define printf
Definition: config.h:203
Definition: io.c:46
BOOLEAN fs_isdirty ( void  )

Definition at line 197 of file io.c.

Referenced by VfatChkdsk().

198 {
200  ULONG DirtyMask = 0;
201  IO_STATUS_BLOCK IoSb;
202 
203  /* Check if volume is dirty */
204  Status = NtFsControlFile(fd,
205  NULL, NULL, NULL, &IoSb,
207  NULL, 0, &DirtyMask, sizeof(DirtyMask));
208 
209  if (!NT_SUCCESS(Status))
210  {
211  DPRINT1("NtFsControlFile() failed with Status 0x%08x\n", Status);
212  return FALSE;
213  }
214 
215  /* Convert Dirty mask to a boolean value */
216  return (DirtyMask & 1);
217 }
NTSYSCALLAPI NTSTATUS NTAPI NtFsControlFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG FsControlCode, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength)
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:557
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
Status
Definition: gdiplustypes.h:24
#define FSCTL_IS_VOLUME_DIRTY
Definition: io.c:44
static HANDLE fd
Definition: io.c:55
LONG NTSTATUS
Definition: DriverTester.h:11
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS fs_lock ( BOOLEAN  LockVolume)

Definition at line 219 of file io.c.

Referenced by fs_open(), and VfatChkdsk().

220 {
222  IO_STATUS_BLOCK IoSb;
223 
224  /* Check if volume is dirty */
225  Status = NtFsControlFile(fd,
226  NULL, NULL, NULL, &IoSb,
227  LockVolume ? FSCTL_LOCK_VOLUME
229  NULL, 0, NULL, 0);
230 
231  if (!NT_SUCCESS(Status))
232  {
233  DPRINT1("NtFsControlFile() failed with Status 0x%08x\n", Status);
234  }
235 
236  return Status;
237 }
#define FSCTL_UNLOCK_VOLUME
Definition: nt_native.h:833
NTSYSCALLAPI NTSTATUS NTAPI NtFsControlFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG FsControlCode, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength)
smooth NULL
Definition: ftsmooth.c:557
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
Status
Definition: gdiplustypes.h:24
static HANDLE fd
Definition: io.c:55
LONG NTSTATUS
Definition: DriverTester.h:11
#define DPRINT1
Definition: precomp.h:8
#define FSCTL_LOCK_VOLUME
Definition: nt_native.h:832
void fs_open ( PUNICODE_STRING  DriveRoot,
int  read_write 
)

Definition at line 162 of file io.c.

Referenced by VfatChkdsk().

163 {
167 
168  InitializeObjectAttributes(&ObjectAttributes,
169  DriveRoot,
170  0,
171  NULL,
172  NULL);
173 
174  Status = NtOpenFile(&fd,
176  &ObjectAttributes,
177  &Iosb,
180  if (!NT_SUCCESS(Status))
181  {
182  DPRINT1("NtOpenFile() failed with status 0x%.08x\n", Status);
183  return;
184  }
185 
186  // If read_write is specified, then the volume should be exclusively locked
187  if (read_write) fs_lock(TRUE);
188 
189  // Query geometry and partition info, to have bytes per sector, etc
190 
192 
193  changes = last = NULL;
194  did_change = 0;
195 }
#define FILE_GENERIC_READ
Definition: nt_native.h:653
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define TRUE
Definition: types.h:120
static CHANGE * changes
Definition: io.c:53
#define LL
Definition: tui.h:72
static const struct @1427 read_write[]
#define FILE_SHARE_READ
Definition: compat.h:125
_Must_inspect_result_ _Out_ PIO_STATUS_BLOCK Iosb
Definition: fltkernel.h:1761
static int did_change
Definition: io.c:54
#define FILE_SYNCHRONOUS_IO_ALERT
Definition: from_kernel.h:30
smooth NULL
Definition: ftsmooth.c:557
NTSTATUS fs_lock(BOOLEAN LockVolume)
Definition: io.c:219
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3508
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
Status
Definition: gdiplustypes.h:24
#define FILE_GENERIC_WRITE
Definition: nt_native.h:660
static HANDLE fd
Definition: io.c:55
LONG NTSTATUS
Definition: DriverTester.h:11
static CHANGE * last
Definition: io.c:53
#define DPRINT1
Definition: precomp.h:8
static LARGE_INTEGER CurrentOffset
Definition: io.c:56
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
LONGLONG QuadPart
Definition: typedefs.h:112
void fs_read ( off_t  pos,
int  size,
void data 
)

Read data from the partition, accounting for any pending updates that are queued for writing.

Parameters
[in]posByte offset, relative to the beginning of the partition, at which to read
[in]sizeNumber of bytes to read
[out]dataWhere to put the data read

Definition at line 265 of file io.c.

Referenced by add_file(), alloc_rootdir_entry(), check_backup_boot(), read_boot(), read_fat(), and read_fsinfo().

266 {
267  CHANGE *walk;
268  int got;
269 
270 #if 1 // TMN
271 
272  const size_t readsize_aligned = (size % 512) ? (size + (512 - (size % 512))) : size;
273  const off_t seekpos_aligned = pos - (pos % 512);
274  const size_t seek_delta = (size_t)(pos - seekpos_aligned);
275 #if DBG
276  const size_t readsize = (size_t)(pos - seekpos_aligned) + readsize_aligned;
277 #endif
278  char* tmpBuf = alloc(readsize_aligned);
279  if (lseek(fd, seekpos_aligned, 0) != seekpos_aligned) pdie("Seek to %lld",pos);
280  if ((got = read(fd, tmpBuf, readsize_aligned)) < 0) pdie("Read %d bytes at %lld",size,pos);
281  assert(got >= size);
282  got = size;
283  assert(seek_delta + size <= readsize);
284  memcpy(data, tmpBuf+seek_delta, size);
285  free(tmpBuf);
286 
287 #else // TMN:
288 
289  if (lseek(fd, pos, 0) != pos)
290  pdie("Seek to %lld", pos);
291  if ((got = read(fd, data, size)) < 0)
292  pdie("Read %d bytes at %lld", size, pos);
293 
294 #endif // TMN:
295 
296  if (got != size)
297  die("Got %d bytes instead of %d at %lld", got, size, pos);
298  for (walk = changes; walk; walk = walk->next) {
299  if (walk->pos < pos + size && walk->pos + walk->size > pos) {
300  if (walk->pos < pos)
301  memcpy(data, (char *)walk->data + pos - walk->pos,
302  min(size, walk->size - pos + walk->pos));
303  else
304  memcpy((char *)data + walk->pos - pos, walk->data,
305  min(walk->size, size + pos - walk->pos));
306  }
307  }
308 }
#define lseek
Definition: io.c:157
static CHANGE * changes
Definition: io.c:53
#define free
Definition: debug_ros.c:5
__kernel_off_t off_t
Definition: linux.h:201
void * data
Definition: io.c:47
#define assert(x)
Definition: debug.h:53
#define read
Definition: io.c:92
#define pdie(msg,...)
Definition: common.h:43
off_t pos
Definition: io.c:48
__kernel_size_t size_t
Definition: linux.h:237
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static HANDLE fd
Definition: io.c:55
GLsizeiptr size
Definition: glext.h:5919
#define min(a, b)
Definition: monoChain.cc:55
#define alloc
Definition: rosglue.h:13
int size
Definition: io.c:49
#define die(str)
Definition: mkdosfs.c:347
struct _change * next
Definition: io.c:50
Definition: io.c:46
int fs_test ( off_t  pos,
int  size 
)

Definition at line 311 of file io.c.

Referenced by fix_bad(), read_boot(), and test_file().

312 {
313  void *scratch;
314  int okay;
315 
316 #if 1 // TMN
317 
318  const size_t readsize_aligned = (size % 512) ? (size + (512 - (size % 512))) : size; // TMN:
319  const off_t seekpos_aligned = pos - (pos % 512); // TMN:
320  scratch = alloc(readsize_aligned);
321  if (lseek(fd, seekpos_aligned, 0) != seekpos_aligned) pdie("Seek to %lld",pos);
322  okay = read(fd, scratch, readsize_aligned) == (int)readsize_aligned;
323  free(scratch);
324 
325 #else // TMN:
326 
327  if (lseek(fd, pos, 0) != pos)
328  pdie("Seek to %lld", pos);
329  scratch = alloc(size);
330  okay = read(fd, scratch, size) == size;
331  free(scratch);
332 
333 #endif // TMN:
334  return okay;
335 }
#define lseek
Definition: io.c:157
#define free
Definition: debug_ros.c:5
__kernel_off_t off_t
Definition: linux.h:201
#define read
Definition: io.c:92
#define pdie(msg,...)
Definition: common.h:43
static HANDLE fd
Definition: io.c:55
GLsizeiptr size
Definition: glext.h:5919
#define alloc
Definition: rosglue.h:13
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:29
void fs_write ( off_t  pos,
int  size,
void data 
)

Definition at line 338 of file io.c.

Referenced by add_file(), alloc_rootdir_entry(), auto_rename(), check_backup_boot(), check_fat_state_bit(), clear_lfn_slots(), fs_flush(), lfn_add_slot(), lfn_fix_checksum(), lfn_get(), lfn_remove(), read_fat(), read_fsinfo(), reclaim_file(), rename_file(), set_fat(), and update_free().

339 {
340  CHANGE *new;
341  int did;
342 
343 #if 1 //SAE
344 
346  void *scratch;
347  const size_t readsize_aligned = (size % 512) ? (size + (512 - (size % 512))) : size;
348  const off_t seekpos_aligned = pos - (pos % 512);
349  const size_t seek_delta = (size_t)(pos - seekpos_aligned);
350  BOOLEAN use_read = (seek_delta != 0) || ((readsize_aligned-size) != 0);
351 
352  /* Aloc temp buffer if write is not aligned */
353  if (use_read)
354  scratch = alloc(readsize_aligned);
355  else
356  scratch = data;
357 
358  did_change = 1;
359  if (lseek(fd, seekpos_aligned, 0) != seekpos_aligned) pdie("Seek to %lld",seekpos_aligned);
360 
361  if (use_read)
362  {
363  /* Read aligned data */
364  if (read(fd, scratch, readsize_aligned) < 0) pdie("Read %d bytes at %lld",size,pos);
365 
366  /* Patch data in memory */
367  memcpy((char *)scratch + seek_delta, data, size);
368  }
369 
370  /* Write it back */
371  if ((did = write(fd, scratch, readsize_aligned)) == (int)readsize_aligned)
372  {
373  if (use_read) free(scratch);
374  return;
375  }
376  if (did < 0) pdie("Write %d bytes at %lld", size, pos);
377  die("Wrote %d bytes instead of %d at %lld", did, size, pos);
378  }
379 
380 #else //SAE
381 
382  if (write_immed) {
383  did_change = 1;
384  if (lseek(fd, pos, 0) != pos)
385  pdie("Seek to %lld", pos);
386  if ((did = write(fd, data, size)) == size)
387  return;
388  if (did < 0)
389  pdie("Write %d bytes at %lld", size, pos);
390  die("Wrote %d bytes instead of %d at %lld", did, size, pos);
391  }
392 
393 #endif //SAE
394 
395  new = alloc(sizeof(CHANGE));
396  new->pos = pos;
397  memcpy(new->data = alloc(new->size = size), data, size);
398  new->next = NULL;
399  if (last)
400  last->next = new;
401  else
402  changes = new;
403  last = new;
404 }
#define lseek
Definition: io.c:157
static CHANGE * changes
Definition: io.c:53
#define free
Definition: debug_ros.c:5
__kernel_off_t off_t
Definition: linux.h:201
#define read
Definition: io.c:92
#define write
Definition: io.c:117
static int did_change
Definition: io.c:54
ULONG FsCheckFlags
Definition: vfatlib.c:44
smooth NULL
Definition: ftsmooth.c:557
#define pdie(msg,...)
Definition: common.h:43
__kernel_size_t size_t
Definition: linux.h:237
unsigned char BOOLEAN
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define write_immed
Definition: rosglue.h:39
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static HANDLE fd
Definition: io.c:55
static CHANGE * last
Definition: io.c:53
GLsizeiptr size
Definition: glext.h:5919
#define alloc
Definition: rosglue.h:13
#define FSCHECK_IMMEDIATE_WRITE
Definition: rosglue.h:28
#define die(str)
Definition: mkdosfs.c:347
struct _change * next
Definition: io.c:50
Definition: io.c:46
static int WIN32close ( HANDLE  FileHandle)
static

Definition at line 61 of file io.c.

62 {
64  return -1;
65  return 0;
66 }
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3392
static HANDLE FileHandle
Definition: cabinet.c:47
static off_t WIN32lseek ( HANDLE  fd,
off_t  offset,
int  whence 
)
static

Definition at line 119 of file io.c.

120 {
122  Offset.QuadPart = (LONGLONG)offset;
123 
124  switch (whence)
125  {
126  case SEEK_SET:
127  break;
128 
129  case SEEK_CUR:
130  Offset.QuadPart += CurrentOffset.QuadPart;
131  break;
132 
133  // case SEEK_END:
134  // Offset.QuadPart += FileSize.QuadPart;
135  // break;
136 
137  default:
138  // errno = EINVAL;
139  return (off_t)-1;
140  }
141 
142  if (Offset.QuadPart < 0LL)
143  {
144  // errno = EINVAL;
145  return (off_t)-1;
146  }
147  // if (Offset.QuadPart > FileSize.QuadPart)
148  // {
149  // // errno = EINVAL;
150  // return (off_t)-1;
151  // }
152 
154 
155  return CurrentOffset.QuadPart;
156 }
#define SEEK_CUR
Definition: util.h:63
#define LL
Definition: tui.h:72
__kernel_off_t off_t
Definition: linux.h:201
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define SEEK_SET
Definition: jmemansi.c:26
int64_t LONGLONG
Definition: typedefs.h:66
static LARGE_INTEGER CurrentOffset
Definition: io.c:56
LONGLONG QuadPart
Definition: typedefs.h:112
GLintptr offset
Definition: glext.h:5920
static int WIN32read ( HANDLE  FileHandle,
void buf,
unsigned int  len 
)
static

Definition at line 69 of file io.c.

70 {
73 
74  Status = NtReadFile(FileHandle,
75  NULL,
76  NULL,
77  NULL,
78  &IoStatusBlock,
79  buf,
80  len,
82  NULL);
83  if (!NT_SUCCESS(Status))
84  {
85  DPRINT1("NtReadFile() failed (Status %lx)\n", Status);
86  return -1;
87  }
88 
90  return (int)len;
91 }
smooth NULL
Definition: ftsmooth.c:557
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
GLenum GLsizei len
Definition: glext.h:6722
Status
Definition: gdiplustypes.h:24
static HANDLE FileHandle
Definition: cabinet.c:47
LONG NTSTATUS
Definition: DriverTester.h:11
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define DPRINT1
Definition: precomp.h:8
static LARGE_INTEGER CurrentOffset
Definition: io.c:56
NTSTATUS NTAPI NtReadFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key)
LONGLONG QuadPart
Definition: typedefs.h:112
static int WIN32write ( HANDLE  FileHandle,
void buf,
unsigned int  len 
)
static

Definition at line 94 of file io.c.

95 {
98 
99  Status = NtWriteFile(FileHandle,
100  NULL,
101  NULL,
102  NULL,
103  &IoStatusBlock,
104  buf,
105  len,
106  &CurrentOffset,
107  NULL);
108  if (!NT_SUCCESS(Status))
109  {
110  DPRINT1("NtWriteFile() failed (Status %lx)\n", Status);
111  return -1;
112  }
113 
115  return (int)len;
116 }
smooth NULL
Definition: ftsmooth.c:557
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
NTSYSAPI NTSTATUS NTAPI NtWriteFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID WriteBuffer, IN ULONG WriteBufferLength, IN PLARGE_INTEGER FileOffset OPTIONAL, IN PULONG LockOperationKey OPTIONAL)
GLenum GLsizei len
Definition: glext.h:6722
Status
Definition: gdiplustypes.h:24
static HANDLE FileHandle
Definition: cabinet.c:47
LONG NTSTATUS
Definition: DriverTester.h:11
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define DPRINT1
Definition: precomp.h:8
static LARGE_INTEGER CurrentOffset
Definition: io.c:56
LONGLONG QuadPart
Definition: typedefs.h:112

Variable Documentation

CHANGE* changes
static
int did_change = 0
static

Definition at line 54 of file io.c.

Referenced by fs_changed(), fs_close(), fs_open(), and fs_write().

HANDLE fd
static

Definition at line 55 of file io.c.

Referenced by __rpc_nconf2fd(), _dup(), _fstat64(), LocaleTest::_money_put_X_bug(), _open_osfhandle(), _pipe(), _RunRemoteTest(), _sopen(), _tiffCloseProc(), _tiffisCloseProc(), _tiffisReadProc(), _tiffisSeekProc(), _tiffisSizeProc(), _tiffosCloseProc(), _tiffosSeekProc(), _tiffosSizeProc(), _tiffosWriteProc(), _tiffReadProc(), _tiffSeekProc(), _tiffSizeProc(), _tiffStreamOpen(), _tiffWriteProc(), _tutime(), _wfreopen(), _wfsopen(), _wsopen(), add_protocol(), AddWallpapersFromDirectory(), adns__fdevents(), adns__tcp_tryconnect(), adns_beforeselect(), aexpand(), cff_fd_select_get(), check_for_files(), clnt_dg_call(), clnt_dg_create(), clnt_tli_create(), clnt_vc_create(), codeview_snarf_linetab2(), compressStream(), Control_DoWindow(), count_blocks(), create_io_inherit_block(), do_import(), do_searchW(), DriverEnumProc(), exists_path(), ffileread(), file_get_Size(), flush_output_buffer(), flush_output_resources(), FormatTagEnumProc(), fs_close(), fs_dismount(), fs_flush(), fs_isdirty(), fs_lock(), fs_open(), fs_read(), fs_test(), fs_write(), FsVolumeInfo(), FTPGetOneF(), FTPPutOneF(), generate_random(), GetExpandedNameA(), getkeyserv_handle(), getnetid(), CWineTest::GetNextFile(), getpublicandprivatekey(), GetSocketNagleAlgorithm(), gzdopen(), ICreateTypeInfo2_fnAddFuncDesc(), import_certs_from_path(), init_logger_addr(), InitSReadlineInfo(), install_from_unix_file(), InternetCheckConnectionW(), InternetFindNextFileA(), load_licence(), local_rpcb(), LZOpenFileA(), main(), makefd_xprt(), mkstemps(), mpg123_open_fd(), msvcrt_free_fd(), msvcrt_init_fp(), msvcrt_set_fd(), NetBTAstatRemote(), NetBTCall(), NetBTInternalFindName(), OleCreateFontIndirect(), open_stream(), parseAndPrintFile(), poll_isset(), printercache_load_blob(), printercache_save_blob(), pstcache_enumerate(), pstcache_init(), pstcache_load_bitmap(), pstcache_save_bitmap(), pstcache_touch_bitmap(), rd_open_file(), read_importlib(), rpc_broadcast_exp(), rpc_call(), run_ex(), rw(), save_licence(), SearchScreenSavers(), setled(), svc_dg_create(), svc_getreq_common(), svc_getreqset(), svc_vc_create(), test__creat(), test__open_osfhandle(), test_AddRefHfont(), test_bitmap_font_metrics(), test_chsize(), test_FDICopy(), test_FDIIsCabinet(), test_fdopen(), test_file_inherit(), test_file_inherit_child(), test_file_inherit_child_no(), test_fileops(), Test_FindFirstFileA(), Test_FindFirstFileW(), test_get_osfhandle(), test_height_selection_vdmx(), test_ifont_size(), test_IsEqual(), test_MoveFileA(), test_overwrite(), test_persistent_state(), test_pipes_child(), test_readmode(), test_ReleaseHfont(), test_setmode(), test_stat(), test_stdin(), test_VarFormat(), test_write_flush_size(), TIFFClose(), TIFFErrorExt(), TIFFFdOpen(), TIFFOpen(), TIFFOpenW(), TIFFSetFileno(), TIFFWarningExt(), tmpfile(), TruncBatchLog(), uncompressStream(), WaitForRemoteInput(), WaitForRemoteOutput(), WaitResponse(), wexpand(), and wpp_default_lookup().

CHANGE * last
static

Definition at line 53 of file io.c.