24 |
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 |
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 |
25 |
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 |
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 |
26 |
#define FILE_ATTRIBUTE_DEVICE 0x00000040 |
#define FILE_ATTRIBUTE_DEVICE 0x00000040 |
27 |
|
#define FILE_ATTRIBUTE_UNKNOWNXXX0 0x00000060 /* ??? ACTION i.e. 0x860 == compress this file ? */ |
28 |
#define FILE_ATTRIBUTE_NORMAL 0x00000080 |
#define FILE_ATTRIBUTE_NORMAL 0x00000080 |
29 |
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 |
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 |
30 |
#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 |
#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 |
34 |
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 |
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 |
35 |
#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000 |
#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000 |
36 |
|
|
37 |
|
#define FILE_FLAG_OPEN_NO_RECALL 0x00100000 |
38 |
|
#define FILE_FLAG_OPEN_REPARSE_POINT 0x00200000 |
39 |
|
#define FILE_FLAG_POSIX_SEMANTICS 0x01000000 |
40 |
|
#define FILE_FLAG_BACKUP_SEMANTICS 0x02000000 /* sometimes used to create a directory */ |
41 |
|
#define FILE_FLAG_DELETE_ON_CLOSE 0x04000000 |
42 |
|
#define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000 |
43 |
|
#define FILE_FLAG_RANDOM_ACCESS 0x10000000 |
44 |
|
#define FILE_FLAG_NO_BUFFERING 0x20000000 |
45 |
|
#define FILE_FLAG_OVERLAPPED 0x40000000 |
46 |
|
#define FILE_FLAG_WRITE_THROUGH 0x80000000 |
47 |
|
|
48 |
|
#define FILE_SHARE_READ 0x01 |
49 |
|
#define FILE_SHARE_WRITE 0x02 |
50 |
|
#define FILE_SHARE_DELETE 0x04 |
51 |
|
|
52 |
#define FILE_BASIC_INFORMATION 0x04 |
#define FILE_BASIC_INFORMATION 0x04 |
53 |
#define FILE_STANDARD_INFORMATION 0x05 |
#define FILE_STANDARD_INFORMATION 0x05 |
54 |
|
|
98 |
#include <fnmatch.h> |
#include <fnmatch.h> |
99 |
#include <errno.h> /* errno */ |
#include <errno.h> /* errno */ |
100 |
|
|
101 |
|
#include <utime.h> |
102 |
|
#include <time.h> /* ctime */ |
103 |
|
|
104 |
|
|
105 |
#if defined(SOLARIS) |
#if defined(SOLARIS) |
106 |
#include <sys/statvfs.h> /* solaris statvfs */ |
#include <sys/statvfs.h> /* solaris statvfs */ |
107 |
#define STATFS_FN(path, buf) (statvfs(path,buf)) |
#define STATFS_FN(path, buf) (statvfs(path,buf)) |
108 |
#define STATFS_T statvfs |
#define STATFS_T statvfs |
109 |
#define F_NAMELEN(buf) ((buf).f_namemax) |
#define F_NAMELEN(buf) ((buf).f_namemax) |
110 |
|
|
111 |
#elif defined(__OpenBSD__) |
#elif (defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)) |
112 |
#include <sys/param.h> |
#include <sys/param.h> |
113 |
#include <sys/mount.h> |
#include <sys/mount.h> |
114 |
#define STATFS_FN(path, buf) (statfs(path,buf)) |
#define STATFS_FN(path, buf) (statfs(path,buf)) |
137 |
} |
} |
138 |
g_fileinfo[MAX_OPEN_FILES]; |
g_fileinfo[MAX_OPEN_FILES]; |
139 |
|
|
140 |
|
|
141 |
|
time_t |
142 |
|
get_create_time(struct stat *st) |
143 |
|
{ |
144 |
|
time_t ret, ret1; |
145 |
|
|
146 |
|
ret = MIN(st->st_ctime, st->st_mtime); |
147 |
|
ret1 = MIN(ret, st->st_atime); |
148 |
|
|
149 |
|
if (ret1 != (time_t) 0) |
150 |
|
return ret1; |
151 |
|
|
152 |
|
return ret; |
153 |
|
} |
154 |
|
|
155 |
/* Convert seconds since 1970 to a filetime */ |
/* Convert seconds since 1970 to a filetime */ |
156 |
void |
void |
157 |
seconds_since_1970_to_filetime(time_t seconds, uint32 * high, uint32 * low) |
seconds_since_1970_to_filetime(time_t seconds, uint32 * high, uint32 * low) |
163 |
*high = (uint32) (ticks >> 32); |
*high = (uint32) (ticks >> 32); |
164 |
} |
} |
165 |
|
|
166 |
|
/* Convert seconds since 1970 back to filetime */ |
167 |
|
time_t |
168 |
|
convert_1970_to_filetime(uint32 high, uint32 low) |
169 |
|
{ |
170 |
|
unsigned long long ticks; |
171 |
|
time_t val; |
172 |
|
|
173 |
|
ticks = low + (((unsigned long long) high) << 32); |
174 |
|
ticks /= 10000000; |
175 |
|
ticks -= 11644473600LL; |
176 |
|
|
177 |
|
val = (time_t) ticks; |
178 |
|
return (val); |
179 |
|
|
180 |
|
} |
181 |
|
|
182 |
|
|
183 |
/* Enumeration of devices from rdesktop.c */ |
/* Enumeration of devices from rdesktop.c */ |
184 |
/* returns numer of units found and initialized. */ |
/* returns numer of units found and initialized. */ |
185 |
/* optarg looks like ':h:=/mnt/floppy,b:=/mnt/usbdevice1' */ |
/* optarg looks like ':h:=/mnt/floppy,b:=/mnt/usbdevice1' */ |
215 |
return count; |
return count; |
216 |
} |
} |
217 |
|
|
218 |
/* Opens of creates a file or directory */ |
/* Opens or creates a file or directory */ |
219 |
NTSTATUS |
NTSTATUS |
220 |
disk_create(uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create_disposition, |
disk_create(uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create_disposition, |
221 |
uint32 flags_and_attributes, char *filename, HANDLE * phandle) |
uint32 flags_and_attributes, char *filename, HANDLE * phandle) |
224 |
DIR *dirp; |
DIR *dirp; |
225 |
int flags, mode; |
int flags, mode; |
226 |
char path[256]; |
char path[256]; |
227 |
|
struct stat filestat; |
228 |
|
|
229 |
handle = 0; |
handle = 0; |
230 |
dirp = NULL; |
dirp = NULL; |
231 |
flags = 0; |
flags = 0; |
232 |
mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; |
mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; |
233 |
|
|
234 |
|
|
235 |
if (filename[strlen(filename) - 1] == '/') |
if (filename[strlen(filename) - 1] == '/') |
236 |
filename[strlen(filename) - 1] = 0; |
filename[strlen(filename) - 1] = 0; |
237 |
sprintf(path, "%s%s", g_rdpdr_device[device_id].local_path, filename); |
sprintf(path, "%s%s", g_rdpdr_device[device_id].local_path, filename); |
|
//printf("Open: %s\n", path); |
|
238 |
|
|
239 |
switch (create_disposition) |
switch (create_disposition) |
240 |
{ |
{ |
269 |
break; |
break; |
270 |
} |
} |
271 |
|
|
272 |
|
//printf("Open: \"%s\" flags: %u, accessmask: %u sharemode: %u create disp: %u\n", path, flags_and_attributes, accessmask, sharemode, create_disposition); |
273 |
|
|
274 |
|
// Get information about file and set that flag ourselfs |
275 |
|
if ((stat(path, &filestat) == 0) && (S_ISDIR(filestat.st_mode))) |
276 |
|
{ |
277 |
|
if (flags_and_attributes & FILE_NON_DIRECTORY_FILE) |
278 |
|
return STATUS_FILE_IS_A_DIRECTORY; |
279 |
|
else |
280 |
|
flags_and_attributes |= FILE_DIRECTORY_FILE; |
281 |
|
} |
282 |
|
|
283 |
if (flags_and_attributes & FILE_DIRECTORY_FILE) |
if (flags_and_attributes & FILE_DIRECTORY_FILE) |
284 |
{ |
{ |
285 |
if (flags & O_CREAT) |
if (flags & O_CREAT) |
310 |
} |
} |
311 |
else |
else |
312 |
{ |
{ |
313 |
|
|
314 |
if (accessmask & GENERIC_ALL |
if (accessmask & GENERIC_ALL |
315 |
|| (accessmask & GENERIC_READ && accessmask & GENERIC_WRITE)) |
|| (accessmask & GENERIC_READ && accessmask & GENERIC_WRITE)) |
316 |
{ |
{ |
330 |
{ |
{ |
331 |
switch (errno) |
switch (errno) |
332 |
{ |
{ |
333 |
|
case EISDIR: |
334 |
|
|
335 |
|
return STATUS_FILE_IS_A_DIRECTORY; |
336 |
|
|
337 |
case EACCES: |
case EACCES: |
338 |
|
|
339 |
return STATUS_ACCESS_DENIED; |
return STATUS_ACCESS_DENIED; |
341 |
case ENOENT: |
case ENOENT: |
342 |
|
|
343 |
return STATUS_NO_SUCH_FILE; |
return STATUS_NO_SUCH_FILE; |
|
|
|
344 |
default: |
default: |
345 |
|
|
346 |
perror("open"); |
perror("open"); |
347 |
return STATUS_NO_SUCH_FILE; |
return STATUS_NO_SUCH_FILE; |
348 |
} |
} |
349 |
} |
} |
350 |
|
|
351 |
|
/* all read and writes of files should be non blocking */ |
352 |
|
if (fcntl(handle, F_SETFL, O_NONBLOCK) == -1) |
353 |
|
perror("fcntl"); |
354 |
} |
} |
355 |
|
|
356 |
if (handle >= MAX_OPEN_FILES) |
if (handle >= MAX_OPEN_FILES) |
395 |
{ |
{ |
396 |
int n; |
int n; |
397 |
|
|
398 |
|
#if 0 |
399 |
|
/* browsing dir ???? */ |
400 |
|
/* each request is 24 bytes */ |
401 |
|
if (g_fileinfo[handle].flags_and_attributes & FILE_DIRECTORY_FILE) |
402 |
|
{ |
403 |
|
*result = 0; |
404 |
|
return STATUS_SUCCESS; |
405 |
|
} |
406 |
|
#endif |
407 |
|
|
408 |
if (offset) |
if (offset) |
409 |
lseek(handle, offset, SEEK_SET); |
lseek(handle, offset, SEEK_SET); |
410 |
n = read(handle, data, length); |
n = read(handle, data, length); |
411 |
|
|
412 |
if (n < 0) |
if (n < 0) |
413 |
{ |
{ |
|
perror("read"); |
|
414 |
*result = 0; |
*result = 0; |
415 |
return STATUS_INVALID_PARAMETER; |
switch (errno) |
416 |
|
{ |
417 |
|
case EISDIR: |
418 |
|
return STATUS_FILE_IS_A_DIRECTORY; |
419 |
|
default: |
420 |
|
perror("read"); |
421 |
|
return STATUS_INVALID_PARAMETER; |
422 |
|
} |
423 |
} |
} |
424 |
|
|
425 |
*result = n; |
*result = n; |
441 |
{ |
{ |
442 |
perror("write"); |
perror("write"); |
443 |
*result = 0; |
*result = 0; |
444 |
return STATUS_ACCESS_DENIED; |
switch (errno) |
445 |
|
{ |
446 |
|
case ENOSPC: |
447 |
|
return STATUS_DISK_FULL; |
448 |
|
default: |
449 |
|
return STATUS_ACCESS_DENIED; |
450 |
|
} |
451 |
} |
} |
452 |
|
|
453 |
*result = n; |
*result = n; |
475 |
// Set file attributes |
// Set file attributes |
476 |
file_attributes = 0; |
file_attributes = 0; |
477 |
if (S_ISDIR(filestat.st_mode)) |
if (S_ISDIR(filestat.st_mode)) |
|
{ |
|
478 |
file_attributes |= FILE_ATTRIBUTE_DIRECTORY; |
file_attributes |= FILE_ATTRIBUTE_DIRECTORY; |
479 |
} |
|
480 |
filename = 1 + strrchr(path, '/'); |
filename = 1 + strrchr(path, '/'); |
481 |
if (filename && filename[0] == '.') |
if (filename && filename[0] == '.') |
|
{ |
|
482 |
file_attributes |= FILE_ATTRIBUTE_HIDDEN; |
file_attributes |= FILE_ATTRIBUTE_HIDDEN; |
483 |
} |
|
484 |
|
if (!file_attributes) |
485 |
|
file_attributes |= FILE_ATTRIBUTE_NORMAL; |
486 |
|
|
487 |
|
if (!(filestat.st_mode & S_IWUSR)) |
488 |
|
file_attributes |= FILE_ATTRIBUTE_READONLY; |
489 |
|
|
490 |
// Return requested data |
// Return requested data |
491 |
switch (info_class) |
switch (info_class) |
492 |
{ |
{ |
493 |
case 4: /* FileBasicInformation */ |
case 4: /* FileBasicInformation */ |
494 |
|
seconds_since_1970_to_filetime(get_create_time(&filestat), &ft_high, |
495 |
out_uint8s(out, 8); //create_time not available; |
&ft_low); |
496 |
|
out_uint32_le(out, ft_low); //create_access_time |
497 |
|
out_uint32_le(out, ft_high); |
498 |
|
|
499 |
seconds_since_1970_to_filetime(filestat.st_atime, &ft_high, &ft_low); |
seconds_since_1970_to_filetime(filestat.st_atime, &ft_high, &ft_low); |
500 |
out_uint32_le(out, ft_low); //last_access_time |
out_uint32_le(out, ft_low); //last_access_time |
504 |
out_uint32_le(out, ft_low); //last_write_time |
out_uint32_le(out, ft_low); //last_write_time |
505 |
out_uint32_le(out, ft_high); |
out_uint32_le(out, ft_high); |
506 |
|
|
507 |
out_uint8s(out, 8); //unknown zero |
seconds_since_1970_to_filetime(filestat.st_ctime, &ft_high, &ft_low); |
508 |
|
out_uint32_le(out, ft_low); //last_change_time |
509 |
|
out_uint32_le(out, ft_high); |
510 |
|
|
511 |
out_uint32_le(out, file_attributes); |
out_uint32_le(out, file_attributes); |
512 |
break; |
break; |
513 |
|
|
543 |
char newname[256], fullpath[256]; |
char newname[256], fullpath[256]; |
544 |
struct fileinfo *pfinfo; |
struct fileinfo *pfinfo; |
545 |
|
|
546 |
|
int mode; |
547 |
|
struct stat filestat; |
548 |
|
time_t write_time, change_time, access_time, mod_time; |
549 |
|
struct utimbuf tvs; |
550 |
|
|
551 |
pfinfo = &(g_fileinfo[handle]); |
pfinfo = &(g_fileinfo[handle]); |
552 |
|
|
553 |
switch (info_class) |
switch (info_class) |
554 |
{ |
{ |
555 |
case 4: /* FileBasicInformation */ |
case 4: /* FileBasicInformation */ |
556 |
|
write_time = change_time = access_time = 0; |
557 |
|
|
558 |
// Probably safe to ignore |
in_uint8s(in, 4); /* Handle of root dir? */ |
559 |
|
in_uint8s(in, 24); /* unknown */ |
560 |
|
|
561 |
|
// CreationTime |
562 |
|
in_uint32_le(in, ft_low); |
563 |
|
in_uint32_le(in, ft_high); |
564 |
|
|
565 |
|
// AccessTime |
566 |
|
in_uint32_le(in, ft_low); |
567 |
|
in_uint32_le(in, ft_high); |
568 |
|
if (ft_low || ft_high) |
569 |
|
access_time = convert_1970_to_filetime(ft_high, ft_low); |
570 |
|
|
571 |
|
// WriteTime |
572 |
|
in_uint32_le(in, ft_low); |
573 |
|
in_uint32_le(in, ft_high); |
574 |
|
if (ft_low || ft_high) |
575 |
|
write_time = convert_1970_to_filetime(ft_high, ft_low); |
576 |
|
|
577 |
|
// ChangeTime |
578 |
|
in_uint32_le(in, ft_low); |
579 |
|
in_uint32_le(in, ft_high); |
580 |
|
if (ft_low || ft_high) |
581 |
|
change_time = convert_1970_to_filetime(ft_high, ft_low); |
582 |
|
|
583 |
|
in_uint32_le(in, file_attributes); |
584 |
|
|
585 |
|
if (fstat(handle, &filestat)) |
586 |
|
return STATUS_ACCESS_DENIED; |
587 |
|
|
588 |
|
tvs.modtime = filestat.st_mtime; |
589 |
|
tvs.actime = filestat.st_atime; |
590 |
|
if (access_time) |
591 |
|
tvs.actime = access_time; |
592 |
|
|
593 |
|
|
594 |
|
if (write_time || change_time) |
595 |
|
mod_time = MIN(write_time, change_time); |
596 |
|
else |
597 |
|
mod_time = write_time ? write_time : change_time; |
598 |
|
|
599 |
|
if (mod_time) |
600 |
|
tvs.modtime = mod_time; |
601 |
|
|
602 |
|
|
603 |
|
if (access_time || write_time || change_time) |
604 |
|
{ |
605 |
|
#if WITH_DEBUG_RDP5 |
606 |
|
printf("FileBasicInformation access time %s", |
607 |
|
ctime(&tvs.actime)); |
608 |
|
printf("FileBasicInformation modification time %s", |
609 |
|
ctime(&tvs.modtime)); |
610 |
|
#endif |
611 |
|
if (utime(pfinfo->path, &tvs)) |
612 |
|
return STATUS_ACCESS_DENIED; |
613 |
|
} |
614 |
|
|
615 |
|
if (!file_attributes) |
616 |
|
break; // not valid |
617 |
|
|
618 |
|
mode = filestat.st_mode; |
619 |
|
|
620 |
|
if (file_attributes & FILE_ATTRIBUTE_READONLY) |
621 |
|
mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH); |
622 |
|
else |
623 |
|
mode |= S_IWUSR; |
624 |
|
|
625 |
|
mode &= 0777; |
626 |
|
#if WITH_DEBUG_RDP5 |
627 |
|
printf("FileBasicInformation set access mode 0%o", mode); |
628 |
|
#endif |
629 |
|
|
630 |
|
if (fchmod(handle, mode)) |
631 |
|
return STATUS_ACCESS_DENIED; |
632 |
break; |
break; |
633 |
|
|
634 |
case 10: /* FileRenameInformation */ |
case 10: /* FileRenameInformation */ |
660 |
case 13: /* FileDispositionInformation */ |
case 13: /* FileDispositionInformation */ |
661 |
|
|
662 |
//unimpl("IRP Set File Information class: FileDispositionInformation\n"); |
//unimpl("IRP Set File Information class: FileDispositionInformation\n"); |
663 |
// in_uint32_le(in, delete_on_close); |
|
664 |
|
//in_uint32_le(in, delete_on_close); |
665 |
// disk_close(handle); |
// disk_close(handle); |
666 |
unlink(pfinfo->path); |
if ((pfinfo->flags_and_attributes & FILE_DIRECTORY_FILE)) // remove a directory |
667 |
|
{ |
668 |
|
if (rmdir(pfinfo->path) < 0) |
669 |
|
return STATUS_ACCESS_DENIED; |
670 |
|
} |
671 |
|
else if (unlink(pfinfo->path) < 0) // unlink a file |
672 |
|
return STATUS_ACCESS_DENIED; |
673 |
|
|
674 |
break; |
break; |
675 |
|
|
676 |
case 19: /* FileAllocationInformation */ |
case 19: /* FileAllocationInformation */ |
679 |
break; |
break; |
680 |
|
|
681 |
case 20: /* FileEndOfFileInformation */ |
case 20: /* FileEndOfFileInformation */ |
682 |
|
in_uint8s(in, 28); /* unknown */ |
683 |
|
in_uint32_le(in, length); /* file size */ |
684 |
|
|
685 |
|
printf("FileEndOfFileInformation length = %d\n", length); |
686 |
|
// ???????????? |
687 |
|
|
688 |
unimpl("IRP Set File Information class: FileEndOfFileInformation\n"); |
unimpl("IRP Set File Information class: FileEndOfFileInformation\n"); |
689 |
break; |
break; |
|
|
|
690 |
default: |
default: |
691 |
|
|
692 |
unimpl("IRP Set File Information class: 0x%x\n", info_class); |
unimpl("IRP Set File Information class: 0x%x\n", info_class); |
706 |
volume = "RDESKTOP"; |
volume = "RDESKTOP"; |
707 |
fs_type = "RDPFS"; |
fs_type = "RDPFS"; |
708 |
|
|
709 |
if (STATFS_FN(pfinfo->path, &stat_fs) != 0) /* FIXME: statfs is not portable */ |
if (STATFS_FN(pfinfo->path, &stat_fs) != 0) |
710 |
{ |
{ |
711 |
perror("statfs"); |
perror("statfs"); |
712 |
return STATUS_ACCESS_DENIED; |
return STATUS_ACCESS_DENIED; |
785 |
// find next dirent matching pattern |
// find next dirent matching pattern |
786 |
pdirent = readdir(pdir); |
pdirent = readdir(pdir); |
787 |
while (pdirent && fnmatch(pfinfo->pattern, pdirent->d_name, 0) != 0) |
while (pdirent && fnmatch(pfinfo->pattern, pdirent->d_name, 0) != 0) |
|
{ |
|
788 |
pdirent = readdir(pdir); |
pdirent = readdir(pdir); |
|
} |
|
789 |
|
|
790 |
if (pdirent == NULL) |
if (pdirent == NULL) |
|
{ |
|
791 |
return STATUS_NO_MORE_FILES; |
return STATUS_NO_MORE_FILES; |
|
} |
|
792 |
|
|
793 |
// Get information for directory entry |
// Get information for directory entry |
794 |
sprintf(fullpath, "%s/%s", dirname, pdirent->d_name); |
sprintf(fullpath, "%s/%s", dirname, pdirent->d_name); |
795 |
/* JIF |
|
796 |
|
/* JIF |
797 |
printf("Stat: %s\n", fullpath); */ |
printf("Stat: %s\n", fullpath); */ |
798 |
if (stat(fullpath, &fstat)) |
if (stat(fullpath, &fstat)) |
799 |
{ |
{ |
806 |
file_attributes |= FILE_ATTRIBUTE_DIRECTORY; |
file_attributes |= FILE_ATTRIBUTE_DIRECTORY; |
807 |
if (pdirent->d_name[0] == '.') |
if (pdirent->d_name[0] == '.') |
808 |
file_attributes |= FILE_ATTRIBUTE_HIDDEN; |
file_attributes |= FILE_ATTRIBUTE_HIDDEN; |
809 |
|
if (!file_attributes) |
810 |
|
file_attributes |= FILE_ATTRIBUTE_NORMAL; |
811 |
|
if (!(fstat.st_mode & S_IWUSR)) |
812 |
|
file_attributes |= FILE_ATTRIBUTE_READONLY; |
813 |
|
|
814 |
// Return requested information |
// Return requested information |
815 |
out_uint8s(out, 8); //unknown zero |
out_uint8s(out, 8); //unknown zero |
816 |
out_uint8s(out, 8); //create_time not available in posix; |
|
817 |
|
seconds_since_1970_to_filetime(get_create_time(&fstat), &ft_high, &ft_low); |
818 |
|
out_uint32_le(out, ft_low); // create time |
819 |
|
out_uint32_le(out, ft_high); |
820 |
|
|
821 |
seconds_since_1970_to_filetime(fstat.st_atime, &ft_high, &ft_low); |
seconds_since_1970_to_filetime(fstat.st_atime, &ft_high, &ft_low); |
822 |
out_uint32_le(out, ft_low); //last_access_time |
out_uint32_le(out, ft_low); //last_access_time |
826 |
out_uint32_le(out, ft_low); //last_write_time |
out_uint32_le(out, ft_low); //last_write_time |
827 |
out_uint32_le(out, ft_high); |
out_uint32_le(out, ft_high); |
828 |
|
|
829 |
out_uint8s(out, 8); //unknown zero |
seconds_since_1970_to_filetime(fstat.st_ctime, &ft_high, &ft_low); |
830 |
|
out_uint32_le(out, ft_low); //change_write_time |
831 |
|
out_uint32_le(out, ft_high); |
832 |
|
|
833 |
out_uint32_le(out, fstat.st_size); //filesize low |
out_uint32_le(out, fstat.st_size); //filesize low |
834 |
out_uint32_le(out, 0); //filesize high |
out_uint32_le(out, 0); //filesize high |
835 |
out_uint32_le(out, fstat.st_size); //filesize low |
out_uint32_le(out, fstat.st_size); //filesize low |
851 |
return STATUS_SUCCESS; |
return STATUS_SUCCESS; |
852 |
} |
} |
853 |
|
|
854 |
|
|
855 |
|
|
856 |
|
static NTSTATUS |
857 |
|
disk_device_control(HANDLE handle, uint32 request, STREAM in, STREAM out) |
858 |
|
{ |
859 |
|
uint32 result; |
860 |
|
|
861 |
|
if (((request >> 16) != 20) || ((request >> 16) != 9)) |
862 |
|
return STATUS_INVALID_PARAMETER; |
863 |
|
|
864 |
|
/* extract operation */ |
865 |
|
request >>= 2; |
866 |
|
request &= 0xfff; |
867 |
|
|
868 |
|
printf("DISK IOCTL %d\n", request); |
869 |
|
|
870 |
|
switch (request) |
871 |
|
{ |
872 |
|
case 25: // ? |
873 |
|
case 42: // ? |
874 |
|
default: |
875 |
|
unimpl("DISK IOCTL %d\n", request); |
876 |
|
return STATUS_INVALID_PARAMETER; |
877 |
|
} |
878 |
|
|
879 |
|
return STATUS_SUCCESS; |
880 |
|
} |
881 |
|
|
882 |
DEVICE_FNS disk_fns = { |
DEVICE_FNS disk_fns = { |
883 |
disk_create, |
disk_create, |
884 |
disk_close, |
disk_close, |
885 |
disk_read, |
disk_read, |
886 |
disk_write, |
disk_write, |
887 |
NULL /* device_control */ |
disk_device_control /* device_control */ |
888 |
}; |
}; |