Alexandre Julliard : kernel32: Use NT instead of Unix calls to identify VxD pseudo-files.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Oct 31 15:07:38 CST 2006


Module: wine
Branch: master
Commit: 7472ffd8d26ac21059a476ceae77441dfa3c61c3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7472ffd8d26ac21059a476ceae77441dfa3c61c3

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Oct 31 20:23:56 2006 +0100

kernel32: Use NT instead of Unix calls to identify VxD pseudo-files.

---

 dlls/kernel32/vxd.c |   39 ++++++++++++++-------------------------
 1 files changed, 14 insertions(+), 25 deletions(-)

diff --git a/dlls/kernel32/vxd.c b/dlls/kernel32/vxd.c
index bdb93e4..b08c020 100644
--- a/dlls/kernel32/vxd.c
+++ b/dlls/kernel32/vxd.c
@@ -52,11 +52,10 @@ typedef DWORD (WINAPI *VxDCallProc)(DWOR
 
 struct vxd_module
 {
-    dev_t        dev;
-    ino_t        ino;
-    HANDLE       handle;
-    HMODULE      module;
-    DeviceIoProc proc;
+    LARGE_INTEGER index;
+    HANDLE        handle;
+    HMODULE       module;
+    DeviceIoProc  proc;
 };
 
 struct vxdcall_service
@@ -134,30 +133,24 @@ static HANDLE open_vxd_handle( LPCWSTR n
 /* retrieve the DeviceIoControl function for a Vxd given a file handle */
 static DeviceIoProc get_vxd_proc( HANDLE handle )
 {
-    struct stat st;
     DeviceIoProc ret = NULL;
-    int status, i, fd;
+    int status, i;
+    IO_STATUS_BLOCK io;
+    FILE_INTERNAL_INFORMATION info;
 
-    status = wine_server_handle_to_fd( handle, 0, &fd, NULL );
+    status = NtQueryInformationFile( handle, &io, &info, sizeof(info), FileInternalInformation );
     if (status)
     {
         SetLastError( RtlNtStatusToDosError(status) );
         return NULL;
     }
-    if (fstat( fd, &st ) == -1)
-    {
-        wine_server_release_fd( handle, fd );
-        SetLastError( ERROR_INVALID_HANDLE );
-        return NULL;
-    }
-    wine_server_release_fd( handle, fd );
 
     RtlEnterCriticalSection( &vxd_section );
 
     for (i = 0; i < MAX_VXD_MODULES; i++)
     {
         if (!vxd_modules[i].module) break;
-        if (vxd_modules[i].dev == st.st_dev && vxd_modules[i].ino == st.st_ino)
+        if (vxd_modules[i].index.QuadPart == info.IndexNumber.QuadPart)
         {
             if (!(ret = vxd_modules[i].proc)) SetLastError( ERROR_INVALID_FUNCTION );
             goto done;
@@ -230,8 +223,8 @@ HANDLE VXD_Open( LPCWSTR filenameW, DWOR
         }
         if (!vxd_modules[i].module)  /* new one, register it */
         {
-            struct stat st;
-            int fd;
+            IO_STATUS_BLOCK io;
+            FILE_INTERNAL_INFORMATION info;
 
             /* get a file handle to the dummy file */
             if (!(handle = open_vxd_handle( name )))
@@ -239,16 +232,12 @@ HANDLE VXD_Open( LPCWSTR filenameW, DWOR
                 FreeLibrary( module );
                 goto done;
             }
-            wine_server_handle_to_fd( handle, 0, &fd, NULL );
-            if (fstat( fd, &st ) != -1)
-            {
-                vxd_modules[i].dev = st.st_dev;
-                vxd_modules[i].ino = st.st_ino;
-            }
+            if (!NtQueryInformationFile( handle, &io, &info, sizeof(info), FileInternalInformation ))
+                vxd_modules[i].index = info.IndexNumber;
+
             vxd_modules[i].module = module;
             vxd_modules[i].handle = handle;
             vxd_modules[i].proc = (DeviceIoProc)GetProcAddress( module, "DeviceIoControl" );
-            wine_server_release_fd( handle, fd );
             goto done;
         }
     }




More information about the wine-cvs mailing list