PATCH: Arla Windows driver

Bo Brantén bosse at acc.umu.se
Tue Apr 21 20:55:28 CEST 2009


Hello,

as have discussed earlier the current Arla Windows driver is to be 
compiled with the Windows 2000 DDK and Visual C++ 6.0 that nobody has 
anymore so here is a patch to compile it with the latest DDK (ver 
3790.1830) or WDK (ver 6001.18001), it compiles both in 32-bit and 64-bit 
however I have not run the 64-bit version only checked that it passes the 
compiler. If using the DDK you also need my GNU ntifs.h but in the WDK 
Microsoft includes it.

Bo Branten
-------------- next part --------------
diff -uprN c:\src\arla-0.37.orig\nnpfs\winnt\inc\nnpfs_locl.h c:\src\arla-0.37\nnpfs\winnt\inc\nnpfs_locl.h

--- c:\src\arla-0.37.orig\nnpfs\winnt\inc\nnpfs_locl.h	Sun Jun 13 17:07:06 2004

+++ c:\src\arla-0.37\nnpfs\winnt\inc\nnpfs_locl.h	Tue Apr 21 20:33:34 2009

@@ -35,7 +35,6 @@

 #define _NNPFS_NNPFS_LOCL_H

 

 #include <stdio.h>

-#include <ntddk.h>

 #include <ntifs.h>

 #include <stdarg.h>

 

@@ -178,7 +177,7 @@ struct nnpfs_node {

     /* XXX pointer instead of copy? */

     nnpfs_cred      writemapper;       /* creds of the last write mmap */

 

-    ETHREAD	    *lazy_writer;

+    void	    *lazy_writer;

 } NNPFS_FCB, nnpfs_node;

 

 /*

diff -uprN c:\src\arla-0.37.orig\nnpfs\winnt\inc\nnpfs_type.h c:\src\arla-0.37\nnpfs\winnt\inc\nnpfs_type.h

--- c:\src\arla-0.37.orig\nnpfs\winnt\inc\nnpfs_type.h	Sat Sep 07 12:49:12 2002

+++ c:\src\arla-0.37\nnpfs\winnt\inc\nnpfs_type.h	Tue Apr 21 20:04:25 2009

@@ -35,7 +35,7 @@

 #ifndef __NNPFS_TYPE_H

 #define __NNPFS_TYPE_H

 

-#ifdef	_X86_

+#if defined(_X86_) || defined(_IA64_) || defined(_AMD64_)

 typedef unsigned char   u_char;

 typedef	char		int8_t;

 typedef	short		int16_t;

diff -uprN c:\src\arla-0.37.orig\nnpfs\winnt\src\makefile c:\src\arla-0.37\nnpfs\winnt\src\makefile

--- c:\src\arla-0.37.orig\nnpfs\winnt\src\makefile	Sat Sep 07 12:49:16 2002

+++ c:\src\arla-0.37\nnpfs\winnt\src\makefile	Sat Aug 16 14:40:34 2008

@@ -1,18 +1,7 @@

 #

-# $Id: makefile,v 1.4 2002/09/07 10:49:16 lha Exp $

-#

 # DO NOT EDIT THIS FILE!!!  Edit .\sources. if you want to add a new source

 # file to this component.  This file merely indirects to the real make file

 # that is shared by all the driver components of the Windows NT DDK

 #

 

-# Autoconf....

-

-!IF EXIST(C:\ntddk\bin\makefile.def)

-!INCLUDE C:\ntddk\bin\makefile.def

-!ELSE

-!INCLUDE C:\ddk\bin\makefile.def

-!ENDIF

-

-install: obj/i386/nnpfs.sys

-	copy /b obj\i386\nnpfs.sys C:\winnt\system32\drivers\nnpfs.sys

+!INCLUDE $(NTMAKEENV)\makefile.def

diff -uprN c:\src\arla-0.37.orig\nnpfs\winnt\src\nnpfs_dev.c c:\src\arla-0.37\nnpfs\winnt\src\nnpfs_dev.c

--- c:\src\arla-0.37.orig\nnpfs\winnt\src\nnpfs_dev.c	Sun Jun 13 17:07:12 2004

+++ c:\src\arla-0.37\nnpfs\winnt\src\nnpfs_dev.c	Tue Apr 21 19:59:24 2009

@@ -84,7 +84,7 @@ nnpfs_opcode_valid(char *buf, unsigned l

 			"nnpfs_opcode_valid: opcode %x, msg->size %x, len %x\n",

 			msg->opcode, msg->size, len);

 	if (msg->opcode >= NNPFS_MSG_COUNT

-	    || msg->opcode < 0

+	    || ((int32_t) msg->opcode) < 0

 	    || msg->size > NNPFS_MAX_MSG_SIZE) {

 	    nnpfs_debug(XDEBDEV, "nnpfs_opcode_valid: FALSE\n");

 	    return FALSE;

@@ -806,7 +806,7 @@ nnpfs_pioctl (nnpfs_channel *chan,

     char *path;

 

     if (args->insize > NNPFS_MSG_MAX_DATASIZE

-	|| args->insize < 0

+	|| ((int32_t) args->insize) < 0

 	||(u_int)

 	(&args->msg[args->insize + args->pathsize] - (char *)args) > inlength

 	|| args->outsize > *outlength) {

diff -uprN c:\src\arla-0.37.orig\nnpfs\winnt\src\nnpfs_fastio.c c:\src\arla-0.37\nnpfs\winnt\src\nnpfs_fastio.c

--- c:\src\arla-0.37.orig\nnpfs\winnt\src\nnpfs_fastio.c	Tue Jul 01 16:12:14 2003

+++ c:\src\arla-0.37\nnpfs\winnt\src\nnpfs_fastio.c	Tue Apr 21 20:25:53 2009

@@ -427,7 +427,7 @@ BOOLEAN

 nnpfs_lazywrite_acq(void *context, BOOLEAN waitp)

 {

     nnpfs_node *node = context;

-    ETHREAD *current_thread = PsGetCurrentThread();

+    void *current_thread = PsGetCurrentThread();

 

     nnpfs_debug(XDEBVNOPS, "nnpfs_lazywrite_acq(%X) wait %x\n",

 		node, waitp);

diff -uprN c:\src\arla-0.37.orig\nnpfs\winnt\src\nnpfs_vops.c c:\src\arla-0.37\nnpfs\winnt\src\nnpfs_vops.c

--- c:\src\arla-0.37.orig\nnpfs\winnt\src\nnpfs_vops.c	Tue Jul 01 16:21:50 2003

+++ c:\src\arla-0.37\nnpfs\winnt\src\nnpfs_vops.c	Tue Apr 21 20:41:12 2009

@@ -496,7 +496,7 @@ nnpfs_new_entry(nnpfs_node *dir,

     if (options & FILE_DIRECTORY_FILE

 	&& options & FILE_NON_DIRECTORY_FILE)

 	return STATUS_INVALID_PARAMETER;

-    if (options & (FILE_DIRECTORY_FILE | FILE_NON_DIRECTORY_FILE) == 0)

+    if ((options & (FILE_DIRECTORY_FILE | FILE_NON_DIRECTORY_FILE)) == 0)

 	return STATUS_INVALID_PARAMETER;

 	    

     if (options & FILE_DIRECTORY_FILE) {

@@ -791,7 +791,7 @@ nnpfs_path_winify(char *path) {

 	if (*p == '/')

 	    *p = '\\';

 

-    len = p - path;

+    len = ((int)(p - path));

 

     /* XXX this mapping should be in the registry */

     /* translate /afs to <nothing> */

@@ -2102,16 +2102,16 @@ nnpfs_fileinfo_all(PIRP irp, nnpfs_node 

     if (!NT_SUCCESS(status))

 	return status;

 

-    len = buflen - ((char *)position_buf - (char *)all_buf);

-    *size = (char *)position_buf - (char *)all_buf;

+    len = buflen - ((int)((char *)position_buf - (char *)all_buf));

+    *size = ((int)((char *)position_buf - (char *)all_buf));

     status = nnpfs_fileinfo_position(irp, node, position_buf, len, &local_size);

     if (!NT_SUCCESS(status))

 	return status;

 

     /* access, mode, alignment are filled in by object manager */

 

-    len = buflen - ((char *)name_buf - (char *)all_buf);

-    *size = (char *)name_buf - (char *)all_buf;

+    len = buflen - ((int)((char *)name_buf - (char *)all_buf));

+    *size = ((int)((char *)name_buf - (char *)all_buf));

     status = nnpfs_fileinfo_name(irp, node, name_buf, len, &local_size);

     *size += local_size;

     

@@ -2461,7 +2461,7 @@ long nnpfs_efilter(EXCEPTION_POINTERS *e

     ecode = e->ExceptionRecord->ExceptionCode;

     

     if ((ecode == STATUS_IN_PAGE_ERROR) && (e->ExceptionRecord->NumberParameters >= 3)) {

-	ecode = e->ExceptionRecord->ExceptionInformation[2];

+	ecode = ((NTSTATUS)e->ExceptionRecord->ExceptionInformation[2]);

     }

 

     if (!(FsRtlIsNtstatusExpected(ecode))) {

@@ -2715,14 +2715,18 @@ nnpfs_dirctl (PDEVICE_OBJECT device, PIR

     NTSTATUS			status = STATUS_SUCCESS;

     unsigned char		*buf = NULL;

     nnpfs_readdir_arg             arg;

+#ifdef _GNU_NTIFS_

     EXTENDED_IO_STACK_LOCATION	*eio_stack;

+#endif

     FILE_OBJECT			*file;

     nnpfs_ccb			*ccb = NULL;

     struct nnpfs_node		*node = NULL;

     

     io_stack = IoGetCurrentIrpStackLocation(irp);

     ASSERT(io_stack);

+#ifdef _GNU_NTIFS_

     eio_stack = (EXTENDED_IO_STACK_LOCATION *) io_stack;

+#endif

     irp->IoStatus.Information = 0;

 

     file = io_stack->FileObject;

@@ -2734,12 +2738,21 @@ nnpfs_dirctl (PDEVICE_OBJECT device, PIR

     try {

 	switch (io_stack->MinorFunction) {

 	case IRP_MN_QUERY_DIRECTORY:

+#ifdef _GNU_NTIFS_

 	    buflen = eio_stack->Parameters.QueryDirectory.Length;

 	    pattern = eio_stack->Parameters.QueryDirectory.FileName;

 	    infoclass =

 		eio_stack->Parameters.QueryDirectory.FileInformationClass;

 	    fileindex = eio_stack->Parameters.QueryDirectory.FileIndex;

 	    flags = eio_stack->Flags;

+#else

+	    buflen = io_stack->Parameters.QueryDirectory.Length;

+	    pattern = io_stack->Parameters.QueryDirectory.FileName;

+	    infoclass =

+		io_stack->Parameters.QueryDirectory.FileInformationClass;

+	    fileindex = io_stack->Parameters.QueryDirectory.FileIndex;

+	    flags = io_stack->Flags;

+#endif

 	    

 	    nnpfs_debug(XDEBVNOPS, "nnpfs_dirctl: "

 			"buflen: %d File_Info: %d flags: %x\n",

@@ -3242,10 +3255,18 @@ FSD_WRAPPER(nnpfs_fscontrol, nnpfs_fsd_f

 NTSTATUS 

 nnpfs_fscontrol (PDEVICE_OBJECT device, PIRP irp)

 { 

+#ifdef _GNU_NTIFS_

     EXTENDED_IO_STACK_LOCATION *io_stack;

+#else

+	IO_STACK_LOCATION *io_stack;

+#endif

     NTSTATUS status = STATUS_NOT_IMPLEMENTED;

 

+#ifdef _GNU_NTIFS_

     io_stack = (PEXTENDED_IO_STACK_LOCATION)IoGetCurrentIrpStackLocation(irp);

+#else

+	io_stack = IoGetCurrentIrpStackLocation(irp);

+#endif

     ASSERT(io_stack);

 

     switch (io_stack->MinorFunction) {

diff -uprN c:\src\arla-0.37.orig\nnpfs\winnt\src\sources c:\src\arla-0.37\nnpfs\winnt\src\sources

--- c:\src\arla-0.37.orig\nnpfs\winnt\src\sources	Tue Oct 29 18:54:28 2002

+++ c:\src\arla-0.37\nnpfs\winnt\src\sources	Tue Apr 21 19:51:05 2009

@@ -27,7 +27,7 @@ TARGETTYPE=DRIVER

 #

 # NOTE: The "fsdk\inc" refers to the Microsoft supplied Installable File Systems

 #       Developers Kit.

-INCLUDES=$(SRC)\inc;C:\ntddk\inc;C:\ntddk\inc\ddk;C:\ddk\inc;C:\fsdk\inc-40;$(SRC)\..\include;$(SRC)\..\..\lib\bufdir

+INCLUDES=..\inc;C:\ntddk\inc;C:\ntddk\inc\ddk;C:\ddk\inc;C:\fsdk\inc-40;..\..\include;..\..\..\lib\bufdir

 

 # The SOURCES variable is defined by the developer.  It is a list of all the

 # source files for this component.  Each source file should be on a separate



More information about the Arla-drinkers mailing list