mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
correct some arguments for CreateFile
svn path=/trunk/; revision=1569
This commit is contained in:
parent
98414449d5
commit
12e9069480
1 changed files with 16 additions and 17 deletions
|
@ -13,6 +13,7 @@
|
||||||
// possibly store extra information at the handle
|
// possibly store extra information at the handle
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include <crtdll/io.h>
|
#include <crtdll/io.h>
|
||||||
#include <crtdll/fcntl.h>
|
#include <crtdll/fcntl.h>
|
||||||
#include <crtdll/sys/stat.h>
|
#include <crtdll/sys/stat.h>
|
||||||
|
@ -50,15 +51,17 @@ int _open(const char *_path, int _oflag,...)
|
||||||
{
|
{
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
DWORD dwDesiredAccess = 0;
|
DWORD dwDesiredAccess = 0;
|
||||||
DWORD dwShareMode = 0;
|
DWORD dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
||||||
DWORD dwCreationDistribution = 0;
|
DWORD dwCreationDistribution = 0;
|
||||||
DWORD dwFlagsAndAttributes = 0;
|
DWORD dwFlagsAndAttributes = 0;
|
||||||
|
int mode;
|
||||||
|
va_list arg;
|
||||||
|
|
||||||
if (( _oflag & S_IREAD ) == S_IREAD)
|
va_start (arg, _oflag);
|
||||||
dwShareMode = FILE_SHARE_READ;
|
mode = va_arg(arg,int);
|
||||||
else if ( ( _oflag & S_IWRITE) == S_IWRITE ) {
|
va_end (arg);
|
||||||
dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
if ( (mode == S_IWRITE) || (mode == 0) )
|
||||||
}
|
dwFlagsAndAttributes = FILE_ATTRIBUTE_READONLY;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
@ -68,16 +71,10 @@ int _open(const char *_path, int _oflag,...)
|
||||||
*/
|
*/
|
||||||
if (( _oflag & _O_RDWR ) == _O_RDWR )
|
if (( _oflag & _O_RDWR ) == _O_RDWR )
|
||||||
dwDesiredAccess |= GENERIC_WRITE|GENERIC_READ ;
|
dwDesiredAccess |= GENERIC_WRITE|GENERIC_READ ;
|
||||||
else if (( _oflag & O_RDONLY ) == O_RDONLY )
|
|
||||||
dwDesiredAccess |= GENERIC_READ ;
|
|
||||||
else if (( _oflag & _O_WRONLY ) == _O_WRONLY )
|
else if (( _oflag & _O_WRONLY ) == _O_WRONLY )
|
||||||
dwDesiredAccess |= GENERIC_WRITE ;
|
dwDesiredAccess |= GENERIC_WRITE ;
|
||||||
|
else
|
||||||
if (( _oflag & S_IREAD ) == S_IREAD )
|
dwDesiredAccess |= GENERIC_READ ;
|
||||||
dwShareMode |= FILE_SHARE_READ;
|
|
||||||
|
|
||||||
if (( _oflag & S_IWRITE ) == S_IWRITE )
|
|
||||||
dwShareMode |= FILE_SHARE_WRITE;
|
|
||||||
|
|
||||||
if (( _oflag & (_O_CREAT | _O_EXCL ) ) == (_O_CREAT | _O_EXCL) )
|
if (( _oflag & (_O_CREAT | _O_EXCL ) ) == (_O_CREAT | _O_EXCL) )
|
||||||
dwCreationDistribution |= CREATE_NEW;
|
dwCreationDistribution |= CREATE_NEW;
|
||||||
|
@ -152,9 +149,11 @@ __fileno_alloc(HANDLE hFile, int mode)
|
||||||
maxfno += 255;
|
maxfno += 255;
|
||||||
fileno_modes = (fileno_modes_type *)malloc(maxfno * sizeof(fileno_modes_type));
|
fileno_modes = (fileno_modes_type *)malloc(maxfno * sizeof(fileno_modes_type));
|
||||||
if ( old_fileno_modes != NULL )
|
if ( old_fileno_modes != NULL )
|
||||||
|
{
|
||||||
memcpy(fileno_modes, old_fileno_modes, oldcount * sizeof(fileno_modes_type));
|
memcpy(fileno_modes, old_fileno_modes, oldcount * sizeof(fileno_modes_type));
|
||||||
memset(fileno_modes + oldcount, 0, (maxfno-oldcount)*sizeof(fileno_modes));
|
|
||||||
free ( old_fileno_modes );
|
free ( old_fileno_modes );
|
||||||
|
}
|
||||||
|
memset(fileno_modes + oldcount, 0, (maxfno-oldcount)*sizeof(fileno_modes));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue