Skip to content

Commit 11e6d01

Browse files
committed
fix path creation for some files, fix getting the user buffer in read
1 parent f90fe61 commit 11e6d01

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

README

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
Linux Filesystem driver for WINDOWS
22

3-
3+
To build LklVfs you'll need LKL and Mingw.
4+
To test it you need mount tools by Matt Wu (http://ext2fsd.sourceforge.net/resources/resources.htm)
5+
or the filedisk tool (http://www.acc.umu.se/~bosse/) if you want to mount a image that contains a Linux filesystem.
6+
To see a list of bugs ( fixed or not): http://bugs.launchpad.net/lklvfs/

src/misc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ PSTR VfsCopyUnicodeStringToZcharUnixPath(PSTR root_path, USHORT root_path_len,
8989

9090
root_path_len = root_path_len + length;
9191

92-
if(dest[root_path_len-1] != '/') {
92+
if(dest[root_path_len-1] != '/' && name_length != 0) {
9393
dest[root_path_len] = '/';
9494
root_path_len++;
9595
}

src/read.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ NTSTATUS CommonRead(PIRPCONTEXT irp_context, PIRP irp)
123123
CHECK_OUT(ccb->id.type != CCB || ccb->id.size !=sizeof(LKLCCB), STATUS_INVALID_PARAMETER);
124124

125125
DbgPrint("READ");
126-
// BUG! BUG! BUG!
127-
TRY_RETURN(STATUS_INVALID_PARAMETER);
128126
// Obtain any resources that are appropriate to ensure consistency of data.
129127
if (!pagingIo) {
130128
ExAcquireResourceSharedLite(&fcb->fcb_resource, TRUE);
@@ -143,7 +141,7 @@ NTSTATUS CommonRead(PIRPCONTEXT irp_context, PIRP irp)
143141
}
144142
length = (ULONG)(fcb->common_header.FileSize.QuadPart - byte_offset.QuadPart);
145143
}
146-
144+
userBuffer = GetUserBuffer(irp);
147145
if (!nonBufferedIo) {
148146
// If this is a buffered I/O request and caching has not yet been initiated on the
149147
// FCB, invoke CcInitializeCacheMap to initiate caching at this time.
@@ -159,7 +157,6 @@ NTSTATUS CommonRead(PIRPCONTEXT irp_context, PIRP irp)
159157
} else {
160158
// If this is a buffered non-MDL I/O request, forward the request
161159
// on to the NT Cache Manager via an invocation to CcCopyRead
162-
userBuffer = GetUserBuffer(irp);
163160
CcCopyRead(file, &(byte_offset), length, TRUE, userBuffer, &(irp->IoStatus));
164161
// We have the data
165162
status = irp->IoStatus.Status;

src/sys_wrappers.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,11 @@ LONG sys_lseek_wrapper(UINT fd, off_t offset, UINT origin)
7878
LONG sys_newfstat_wrapper(UINT fd, OUT PSTATS stat_buff)
7979
{
8080
LONG rc;
81+
8182
ExAcquireResourceExclusiveLite(&barier, TRUE);
8283
rc = sys_newfstat(fd, stat_buff);
8384
RELEASE(&barier);
85+
8486
return rc;
8587
}
8688

@@ -230,7 +232,7 @@ LONG sys_unmount_wrapper(PLINDEV ldev)
230232
if(!ldev)
231233
return -1;
232234

233-
rc = sys_umount(ldev->mnt, 0x00000002);
235+
rc = sys_umount(ldev->mnt, 0);
234236
if(rc <0)
235237
return rc;
236238

0 commit comments

Comments
 (0)