ReactOS 0.4.16-dev-311-g9382aa2
lfile.c File Reference
#include <k32.h>
#include <debug.h>
Include dependency graph for lfile.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

long WINAPI _hread (HFILE hFile, LPVOID lpBuffer, long lBytes)
 
long WINAPI _hwrite (HFILE hFile, LPCSTR lpBuffer, long lBytes)
 
HFILE WINAPI _lopen (LPCSTR lpPathName, int iReadWrite)
 
HFILE WINAPI _lcreat (LPCSTR lpPathName, int iAttribute)
 
int WINAPI _lclose (HFILE hFile)
 
LONG WINAPI _llseek (HFILE hFile, LONG lOffset, int iOrigin)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file lfile.c.

Function Documentation

◆ _hread()

long WINAPI _hread ( HFILE  hFile,
LPVOID  lpBuffer,
long  lBytes 
)

Definition at line 20 of file lfile.c.

21{
22 DWORD NumberOfBytesRead;
23
26 (DWORD) lBytes,
27 &NumberOfBytesRead,
28 NULL))
29 {
30 return HFILE_ERROR;
31 }
32 return NumberOfBytesRead;
33}
#define LongToHandle(h)
Definition: basetsd.h:82
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
#define NULL
Definition: types.h:112
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ HANDLE hFile
Definition: mswsock.h:90
#define HFILE_ERROR
Definition: winbase.h:112

Referenced by HLPFILE_ReadFileToBuffer(), LZCopy(), test__hread(), test__hwrite(), test__lcreat(), test__llopen(), test__llseek(), and test__lwrite().

◆ _hwrite()

long WINAPI _hwrite ( HFILE  hFile,
LPCSTR  lpBuffer,
long  lBytes 
)

Definition at line 41 of file lfile.c.

42{
43 DWORD NumberOfBytesWritten;
44
45 if (lBytes == 0)
46 {
48 {
49 return HFILE_ERROR;
50 }
51 return 0;
52 }
55 (DWORD) lBytes,
56 &NumberOfBytesWritten,
57 NULL))
58 {
59 return HFILE_ERROR;
60 }
61 return NumberOfBytesWritten;
62}
BOOL WINAPI SetEndOfFile(HANDLE hFile)
Definition: fileinfo.c:1004
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
uint32_t ULONG_PTR
Definition: typedefs.h:65

Referenced by mmioDosIOProc(), test__hread(), test__hwrite(), test__lclose(), test__lcreat(), test__llopen(), test__llseek(), and test__lread().

◆ _lclose()

◆ _lcreat()

HFILE WINAPI _lcreat ( LPCSTR  lpPathName,
int  iAttribute 
)

Definition at line 116 of file lfile.c.

117{
119
121 hFile = CreateFileA(lpPathName,
124 NULL,
126 iAttribute,
127 NULL);
128
129 return HandleToLong(hFile);
130}
#define HandleToLong(h)
Definition: basetsd.h:80
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define GENERIC_READ
Definition: compat.h:135
#define FILE_SHARE_READ
Definition: compat.h:136
#define CREATE_ALWAYS
Definition: disk.h:72
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
#define GENERIC_WRITE
Definition: nt_native.h:90

Referenced by GRPFILE_WriteGroupFile(), test__hread(), test__hwrite(), test__lclose(), test__lcreat(), test__llopen(), test__llseek(), test__lread(), test__lwrite(), test_FindFirstFile_wildcards(), test_FindFirstFileA(), and test_FindFirstFileExA().

◆ _llseek()

LONG WINAPI _llseek ( HFILE  hFile,
LONG  lOffset,
int  iOrigin 
)

Definition at line 149 of file lfile.c.

150{
152 lOffset,
153 NULL,
154 (DWORD) iOrigin);
155}
#define SetFilePointer
Definition: compat.h:743

Referenced by llseek(), LZInit(), LZRead(), LZSeek(), mmioDosIOProc(), read_header(), test__hread(), test__lcreat(), test__llseek(), test__lread(), and test_mmioSeek().

◆ _lopen()

HFILE WINAPI _lopen ( LPCSTR  lpPathName,
int  iReadWrite 
)

Definition at line 70 of file lfile.c.

71{
72 DWORD dwAccess, dwSharing, dwCreation;
73
74 if (iReadWrite & OF_CREATE)
75 {
76 dwCreation = CREATE_ALWAYS;
77 dwAccess = GENERIC_READ | GENERIC_WRITE;
78 }
79 else
80 {
81 dwCreation = OPEN_EXISTING;
82 switch(iReadWrite & 0x03)
83 {
84 case OF_READ: dwAccess = GENERIC_READ; break;
85 case OF_WRITE: dwAccess = GENERIC_WRITE; break;
86 case OF_READWRITE: dwAccess = GENERIC_READ | GENERIC_WRITE; break;
87 default: dwAccess = 0; break;
88 }
89 }
90
91 switch(iReadWrite & 0x70)
92 {
93 case OF_SHARE_EXCLUSIVE: dwSharing = 0; break;
94 case OF_SHARE_DENY_WRITE: dwSharing = FILE_SHARE_READ; break;
95 case OF_SHARE_DENY_READ: dwSharing = FILE_SHARE_WRITE; break;
97 case OF_SHARE_COMPAT:
98 default: dwSharing = FILE_SHARE_READ | FILE_SHARE_WRITE; break;
99 }
100
101 return (HFILE)(ULONG_PTR) CreateFileA(lpPathName,
102 dwAccess,
103 dwSharing,
104 NULL,
105 dwCreation,
107 NULL);
108}
#define OPEN_EXISTING
Definition: compat.h:775
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define ULONG_PTR
Definition: config.h:101
#define OF_SHARE_COMPAT
Definition: winbase.h:120
#define OF_SHARE_DENY_READ
Definition: winbase.h:122
#define OF_READWRITE
Definition: winbase.h:118
#define OF_SHARE_EXCLUSIVE
Definition: winbase.h:124
#define OF_SHARE_DENY_NONE
Definition: winbase.h:121
#define OF_READ
Definition: winbase.h:117
#define OF_CREATE
Definition: winbase.h:126
#define OF_WRITE
Definition: winbase.h:119
#define OF_SHARE_DENY_WRITE
Definition: winbase.h:123
int HFILE
Definition: windef.h:298

Referenced by test__hread(), test__hwrite(), test__llopen(), test__lread(), and test__lwrite().