[Fwd: file inheritance]
eric pouech
eric.pouech at wanadoo.fr
Sat Oct 13 13:05:45 CDT 2001
this patch hasn't been committed yet
is there any issue Alexandre ?
A+
-------- Original Message --------
Subject: file inheritance
Date: Mon, 08 Oct 2001 20:15:52 +0200
From: eric pouech <eric.pouech at wanadoo.fr>
To: Wine Patches <wine-patches at winehq.com>
Mike MacCormack noticed that inheritance attribute from security
descriptor
wasn't used for comm port handles
this patch makes use of it most the following types of handle:
- comm port
- DOS NULL and CON
- devices
I'm not sure of the last two ones, so if someone doesn't agree that's
easy to change. Otherwise...
A+
--
---------------
Eric Pouech (http://perso.wanadoo.fr/eric.pouech/)
"The future will be better tomorrow", Vice President Dan Quayle
-------------- next part --------------
Name: file_inh
ChangeLog: passed security attributes for DOSFS creation
GenDate: 2001/10/08 05:59:04 UTC
ModifiedFiles: include/file.h files/file.c files/dos_fs.c
AddedFiles:
===================================================================
RCS file: /usr/share/cvs/cvsroot/wine/wine/include/file.h,v
retrieving revision 1.29
diff -u -u -r1.29 file.h
--- include/file.h 2001/08/24 21:13:02 1.29
+++ include/file.h 2001/10/08 05:50:34
@@ -98,7 +98,7 @@
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 );
+extern HANDLE DOSFS_OpenDevice( const char *name, DWORD access, LPSECURITY_ATTRIBUTES sa);
extern BOOL DOSFS_FindUnixName( LPCSTR path, LPCSTR name, LPSTR long_buf,
INT long_len, LPSTR short_buf,
BOOL ignore_case );
Index: files/file.c
===================================================================
RCS file: /usr/share/cvs/cvsroot/wine/wine/files/file.c,v
retrieving revision 1.112
diff -u -u -r1.112 file.c
--- files/file.c 2001/10/04 16:18:15 1.112
+++ files/file.c 2001/10/08 05:55:31
@@ -488,7 +488,7 @@
{
TRACE("opening device '%s'\n", filename );
- if (!(ret = DOSFS_OpenDevice( filename, access )))
+ if (!(ret = DOSFS_OpenDevice( filename, access, sa )))
{
/* Do not silence this please. It is a critical error. -MM */
ERR("Couldn't open device '%s'!\n",filename);
Index: files/dos_fs.c
===================================================================
RCS file: /usr/share/cvs/cvsroot/wine/wine/files/dos_fs.c,v
retrieving revision 1.93
diff -u -u -r1.93 dos_fs.c
--- files/dos_fs.c 2001/09/19 22:34:38 1.93
+++ files/dos_fs.c 2001/10/08 05:58:40
@@ -705,7 +705,7 @@
/**************************************************************************
* DOSFS_CreateCommPort
*/
-static HANDLE DOSFS_CreateCommPort(LPCSTR name, DWORD access)
+static HANDLE DOSFS_CreateCommPort(LPCSTR name, DWORD access, LPSECURITY_ATTRIBUTES sa)
{
HANDLE ret;
char devname[40];
@@ -723,7 +723,7 @@
SERVER_START_VAR_REQ( create_serial, len )
{
req->access = access;
- req->inherit = 0; /*FIXME*/
+ req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
req->sharing = FILE_SHARE_READ|FILE_SHARE_WRITE;
memcpy( server_data_ptr(req), devname, len );
SetLastError(0);
@@ -745,7 +745,7 @@
* 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 )
+HANDLE DOSFS_OpenDevice( const char *name, DWORD access, LPSECURITY_ATTRIBUTES sa )
{
int i;
const char *p;
@@ -764,7 +764,7 @@
/* 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;
@@ -780,17 +780,19 @@
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)) )
+ if( (handle=DOSFS_CreateCommPort(DOSFS_Devices[i].name,access,sa)) )
return handle;
FIXME("device open %s not supported (yet)\n",DOSFS_Devices[i].name);
return 0;
More information about the wine-patches
mailing list