Pass security attributes for DOSFS creation.

This commit is contained in:
Eric Pouech 2001-10-14 16:08:45 +00:00 committed by Alexandre Julliard
parent 27e179794d
commit 3bbeb72d3f
3 changed files with 11 additions and 9 deletions

View file

@ -705,7 +705,7 @@ const DOS_DEVICE *DOSFS_GetDeviceByHandle( HFILE hFile )
/**************************************************************************
* DOSFS_CreateCommPort
*/
static HANDLE DOSFS_CreateCommPort(LPCSTR name, DWORD access, DWORD attributes)
static HANDLE DOSFS_CreateCommPort(LPCSTR name, DWORD access, DWORD attributes, LPSECURITY_ATTRIBUTES sa)
{
HANDLE ret;
char devname[40];
@ -723,7 +723,7 @@ static HANDLE DOSFS_CreateCommPort(LPCSTR name, DWORD access, DWORD attributes)
SERVER_START_VAR_REQ( create_serial, len )
{
req->access = access;
req->inherit = 0; /*FIXME*/
req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
req->attributes = attributes;
req->sharing = FILE_SHARE_READ|FILE_SHARE_WRITE;
memcpy( server_data_ptr(req), devname, len );
@ -746,7 +746,7 @@ static HANDLE DOSFS_CreateCommPort(LPCSTR name, DWORD access, DWORD attributes)
* Open a DOS device. This might not map 1:1 into the UNIX device concept.
* Returns 0 on failure.
*/
HANDLE DOSFS_OpenDevice( const char *name, DWORD access, DWORD attributes )
HANDLE DOSFS_OpenDevice( const char *name, DWORD access, DWORD attributes, LPSECURITY_ATTRIBUTES sa )
{
int i;
const char *p;
@ -765,7 +765,7 @@ HANDLE DOSFS_OpenDevice( const char *name, DWORD access, DWORD attributes )
/* got it */
if (!strcmp(DOSFS_Devices[i].name,"NUL"))
return FILE_CreateFile( "/dev/null", access,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
FILE_SHARE_READ|FILE_SHARE_WRITE, sa,
OPEN_EXISTING, 0, 0, TRUE );
if (!strcmp(DOSFS_Devices[i].name,"CON")) {
HANDLE to_dup;
@ -781,17 +781,19 @@ HANDLE DOSFS_OpenDevice( const char *name, DWORD access, DWORD attributes )
return 0;
}
if (!DuplicateHandle( GetCurrentProcess(), to_dup, GetCurrentProcess(),
&handle, 0, FALSE, DUPLICATE_SAME_ACCESS ))
&handle, 0,
sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle,
DUPLICATE_SAME_ACCESS ))
handle = 0;
return handle;
}
if (!strcmp(DOSFS_Devices[i].name,"SCSIMGR$") ||
!strcmp(DOSFS_Devices[i].name,"HPSCAN"))
{
return FILE_CreateDevice( i, access, NULL );
return FILE_CreateDevice( i, access, sa );
}
if( (handle=DOSFS_CreateCommPort(DOSFS_Devices[i].name,access,attributes)) )
if( (handle=DOSFS_CreateCommPort(DOSFS_Devices[i].name,access,attributes,sa)) )
return handle;
FIXME("device open %s not supported (yet)\n",DOSFS_Devices[i].name);
return 0;

View file

@ -488,7 +488,7 @@ HANDLE WINAPI CreateFileA( LPCSTR filename, DWORD access, DWORD sharing,
{
TRACE("opening device '%s'\n", filename );
if (!(ret = DOSFS_OpenDevice( filename, access, attributes )))
if (!(ret = DOSFS_OpenDevice( filename, access, attributes, sa )))
{
/* Do not silence this please. It is a critical error. -MM */
ERR("Couldn't open device '%s'!\n",filename);

View file

@ -98,7 +98,7 @@ extern time_t DOSFS_FileTimeToUnixTime( const FILETIME *ft, DWORD *remainder );
extern BOOL DOSFS_ToDosFCBFormat( LPCSTR name, LPSTR buffer );
extern const DOS_DEVICE *DOSFS_GetDevice( const char *name );
extern const DOS_DEVICE *DOSFS_GetDeviceByHandle( HFILE hFile );
extern HANDLE DOSFS_OpenDevice( const char *name, DWORD access, DWORD attributes );
extern HANDLE DOSFS_OpenDevice( const char *name, DWORD access, DWORD attributes, LPSECURITY_ATTRIBUTES sa);
extern BOOL DOSFS_FindUnixName( LPCSTR path, LPCSTR name, LPSTR long_buf,
INT long_len, LPSTR short_buf,
BOOL ignore_case );