Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 08-18-2012, 08:24 AM   #76
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
me@dev ~/BLDS/temp $ tar -c -h --hard-dereference -l -f test.tar ./bin ./etc ./lib ./sbin ./usr
tar: ./sbin/mount.ntfs-3g: File removed before we read it
tar: ./sbin/mkfs.ntfs: File removed before we read it
tar: ./sbin/mount.lowntfs-3g: File removed before we read it
tar: ./test.tar: file is the archive; not dumped
tar: ./etc/resolv.conf: File removed before we read it

creates the tar we need. (with the omissions outlined above) when pointed at an untarred copy of the rootfs.tar. So perhaps an interim 'expand' and recompress stage will be required.

In my experience the growth factor is between 200-250% given the task I am discussing.

: ) Glad we are doing this.

Thanks for the qt tip. I'll go dig. Qt really was my raison d'etre underlying this. it would be sexy to get the new release (when it makes it in) compiled using the super compliant tools. Probably a complete pig to get it to swallow but worth it I would wager.

: )

Last edited by twobob; 08-18-2012 at 08:32 AM.
twobob is offline   Reply With Quote
Old 08-18-2012, 08:31 AM   #77
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
I wasn't clear - in the top level BUILDROOT Makefile, not in the QT Makefile.

There is also an on-going discussion about fixing the webkit build, not yet committed.

Last edited by knc1; 08-18-2012 at 08:41 AM.
knc1 is offline   Reply With Quote
Old 08-18-2012, 08:37 AM   #78
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
as a finger in the air. I think I under estimated the swelling - I just tried it with a large usr/lib dir (from building stuffs)

a 104 MB rootfs.tar become 390MB (since the usr/lib swells so much) possibly hardlinks could be a solution if the file swell does become an issue...

I'll cram a whole load of junk in a build and see what happens.

; ) oh and qt while I'm at it.
twobob is offline   Reply With Quote
Old 08-18-2012, 08:41 AM   #79
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
STUFF THAT WON'T BUILD OOTB

I will add here a list of things that BREAK with the 2006q3 TC OOTB

WHY WOULD YOU BOTHER DOING THIS???

Well, Buildroot allows us to create staged sections to each build, meaning that once I have each of these packages built - I can go back an cherry pick which stage to tweak, what Makefile etc...

Basically I also didnt want anyone else to have to try a package only to find it broken.

So there you go, 16 hours later here's the info.

The Deathlist:

Spoiler:

linphone. because it calls ORTP which won't build. (heh, I made a funny)

libgtk2 dies with a recursion error (that's the theme for many of these fails IIRC)

Webkit because it calls libgtk2
(you can apply this principle to all 'RELIES ON blah' packages)

MPD Will pull Glib2 - that needs testing. Currently elided.

ltp-testsuite - dies with 'CAP_LAST_CAP' undeclared (Symbol issue again)

lttng-modules-2.0.3 - dies with a long string of errors

qt 4.8.2: Dies with futex.h:96: error: 'u32' was not declared in this scope
That's a futex header issue I believe. Input taken on that issue.
I did apply the fix knc1 mentioned first.

rt-tests dies with cyclictest.c:906: error: 'SCHED_BATCH' undeclared (first use in this function) (Symbol issue again probably based on a lack of RT in the kernel. pointless tool anways... Bit bucket methinks)

util-linux 2.20.1 - Dies since UUIDD dies.
Code:
../libblkid/src/.libs/libblkid.so: undefined reference to `fdopendir'
../libblkid/src/.libs/libblkid.so: undefined reference to `faccessat'
collect2: ld returned 1 exit status
make[4]: *** [mkswap] Error 1
U-boot Tools - Dies
Code:
fw_env.c:43:27: error: mtd/mtd-user.h: No such file or directory
possibly an incorrect depend
unionfs 0.25 -
Code:
 unionfs.c:661: error: 'AT_SYMLINK_NOFOLLOW' undeclared (symbols)
mplayer dies:
Code:
 l -rdynamic  -lm  
ffmpeg/libavcodec/libavcodec.a(h264dsp_init_arm.o): In function `ff_h264dsp_init_neon':
host-lua 5.1.5 Building -
Code:
ldebug.o: In function `addinfo':
ldebug.c:(.text+0x1822): undefined reference to `__stack_chk_fail_local'
luajit 2.0.0-beta10
Code:
Building - lj_arch.h:224:2: error: #error "Need at least GCC 4.2 or newer"
(not sure what that error means hmm, so cryptic)

libv4l -
Code:
l.cpp   ivtv-ctl.c: In function 'main':
ivtv-ctl.c:510: error: 'VIDEO_GET_FRAME_COUNT' undeclared
BOOST: A general purpose C++ library
Code:
...failed updating 3 targets...
make[1]: *** [/home/simon/BLDS/buildroot/build/boost-1.49.0/.stamp_staging_installed] Error 1
liburcu 0.7.3
Code:
test_urcu_timing.o: In function `thr_writer':
/home/simon/BLDS/buildroot/build/liburcu-0.7.3/tests/test_urcu_timing.c:159: undefined reference to `__sync_lock_test_and_set_4'
KMOD: handle kernel modules (which is already in the device)
Code:
libkmod/libkmod-config.c:546: error: 'O_CLOEXEC' undeclared

That's actually quite a short list considering the 7 year old toolchain, and much of it revolves around a known issue. Gotta love BR.

----------------------------------------------------------------


Okay onwards. Here is
a complete list of everything I EXCLUDED:

Not built: (implicitly excluding the above stuff that died obviously)

These packages were not included in the build - They either were pointless given the hardware - outdated or duplicated - or relied on something that currently can't build, or for some other ineffable reason I didn't like the cut of their gib.

BUSYBOX
Spoiler:

(Install The) watchdog Daemon Startup Script to Busybox

Packages that are provided by Busybox 1.20.x (I'll go back and see what if any can be replaced)


Audio and video applications
Spoiler:

gstreamer - Selects: BR2_PACKAGE_LIBGLIB2

pulseaudio: not chosen


ALSA utils selection
Spoiler:

amidi, iecset, aplaymidi, arecordmidi, aseqdump, aseqnet,speaker-test all not built

mpd- Selects: BR2_PACKAGE_LIBGLIB2


Debugging, profiling and benchmark
Spoiler:

latencytop - we don't have support in kernel right now (shame)


Development tools
Spoiler:

pkg-config (OUCH) - Selects: BR2_PACKAGE_LIBGLIB2


Graphic libraries and applications (graphic/text)
Spoiler:

various dfbuffer examples and drivers (I am going to see if I can get this support in the kernel via a module perhaps? TBC, the excluded stuff seemed pointless.)

LINUX_FUSION: (err I saw no use in the short term)

SAWMAN: (maybe if we get directfb going)

Gob2 - Selects: BR2_PACKAGE_LIBGLIB2

vala - Selects: BR2_PACKAGE_LIBGLIB2

Enlightenment Foundation libraries (Some other poor souls headache)

QT -(OUCH) - Yeah so I mentioned it twice. Ouch. I will use the prebuilt ones from the games projects for now then.

X.org X Window System, X11R7, release 7.5 - err no.


HARDWARE:
Spoiler:

crdkit

cramfs

dbusglib

dbus-python

e2fsprogs - Selects: BR2_PACKAGE_UTIL_LINUX [=n] && BR2_PACKAGE_UTIL_LINUX_LIBBLKID [=n] && BR2_PACKAGE_UTIL_LINUX_LIBUUID - Two of which currently die.

eeprog - err no - Simple tool to read/write i2c eeprom chips.

fconfig

fis

fmtools

gadgetfs-test

gdisk

genromfs

gpsd

gvfs

hwdata

i2c-tools

input-event-daemon

input tools

iostat

irda-tools

kbd (hmm maybe?)

lcdproc

linux-firmware

lm-sensors - cool - but no.

lvm2 + dev mapper

makedevs

mdadm

memtester

minicom

mtd/jiffs2 utilities

open2300

openocd

parted - Selects: BR2_PACKAGE_LVM2 [=n] && BR2_PACKAGE_READLINE [=y] && BR2_PACKAGE_UTIL_LINUX [=n] && BR2_PACKAGE_UTIL_LINUX_LIBUUID [=n]

pci-utils

picocom - clone again

rng-tools

sane-backends

sdparm

setserial

smartmontools - err no SD doesn't have smart

sredird - no

sshfs - Selects: BR2_PACKAGE_LIBFUSE [=y] && BR2_PACKAGE_LIBGLIB2 [=n] && BR2_PACKAGE_GETTEXT [=n] && BR2_PACKAGE_LIBINTL [=n] && BR2_PACKAGE_LIBICONV [=n] && BR2_PACKAGE_OPENSSH [=y]

statserial - that time has past.

ti-utils

wipe

xfsprogs - Selects: BR2_PACKAGE_UTIL_LINUX [=n] && BR2_PACKAGE_UTIL_LINUX_LIBUUID [=n]


INTERPRETERS:
Spoiler:

Lua support for Haserl - lua wont build ATM

LIBRARIES: AUDIO
Spoiler:

libcdaudio

libcue

libmpd - Selects: BR2_PACKAGE_LIBGLIB2

LIBS: CRYPTO
Spoiler:

ocf-linux - no kernel driver right now. ( The emulator cold MAYBE take advantage of this but I don't see any value if it can't be translated back onto the device)

openssl - ocf support was left out for obvious reasons

LIBS: FS
Spoiler:

gamin - Selects: BR2_PACKAGE_LIBGLIB2

liblockfile - nfs - erm not right now

libsysfs - its a 2.6 thing but dunno... support?

LIBS: GRAPHICS
Spoiler:

atk - Selects: BR2_PACKAGE_LIBGLIB2 [=n]

gdk-pixbuf - Selects: BR2_PACKAGE_LIBGLIB2 [=n]

pango - Selects: BR2_PACKAGE_LIBGLIB2

webkit - (OUCH) requires libgtk2

zxing - err no. unless someone REALLY REALLY wants a multi-format 1D/2D barcode image processing library. I've done all the barcode processing I want for one lifetime. InterMec I'm looking at you!

opencv - some support was elided - build tests, performance tests, gstreamer support, qt backend support, did not install 'extra data' - lib v4l support as libv4l does not compile

LIBS: HW
Spoiler:

libraw1394

libts - The Touchscreen tslib Library

libfreefare

LIBFTDI: Userspace access to FTDI USB interface chips

LIBIQRF: This library implement specific protocol which is used for communicating with iqrf devices (http://iqrf.org) over usb. For usb access is used libusb library.

LIBNFC: Public platform independent Near Field Communication (NFC) library.

LIBNFC_LLCP: Library extending libnfc with support for Logical Link Control
Protocol.

LIBS: MULTIMEDIA
Spoiler:

LIBMMS: LibMMS is a common library for parsing mms:// and mmsh:// type network streams. These are commonly used to stream Windows Media Video content over the web. LibMMS itself is only for receiving MMS stream, it doesn't handle sending at all.

Selects: BR2_PACKAGE_LIBGLIB2 [=y]

LIBDVDREAD: libdvdread provides a simple foundation for reading DVD-Video images.

LIBDVDNAV: libdvdnav is a library that allows easy use of sophisticated DVD navigation features such as DVD menus, multiangle playback and even interactive DVD games.

LIBPLAYER: libplayer provides a generic A/V API that relies on various multimedia player for Linux systems. It currently supports MPlayer, xine VLC and GStreamer only
(SINCE WE CANT OFFER ANY BACKEND SUPPORT FOR GSTREAMER / MPLAYER pointless)

MEDIASTREAMER: Mediastreamer is a powerful and lightweighted streaming engine specialized for voice/video telephony applications.
Selects: BR2_PACKAGE_ORTP [=n]

LIBS: NETWORKING
Spoiler:

GLIB_NETWORKING: Network-related GIO modules for glib.
Selects: BR2_PACKAGE_LIBGLIB2 [=n]

LIBMNL: libmnl is a minimalistic user-space library oriented to Netlink developers.

LIBMODBUS: libmodbus is a free software library to send/receive data according
to the Modbus protocol. This library is written in C and supports
RTU (serial) and TCP (Ethernet) communications.

LIBMBUS: libmbus is a library for communicating with energy metering devices.
It supports TCP and RS232 M-bus gateways.
(M-bus standard: http://www.m-bus.com/)

LIBNFNETLINK: libnfnetlink is the low-level library for netfilter related kernel/userspace communication.

LIBNETFILTER_CONNTRACK: libnetfilter_conntrack is a userspace library providing a programming interface (API) to the in-kernel connection tracking state table.

LIBNETFILTER_CTTIMEOUT: libnetfilter_cttimeout is the userspace library that provides the programming interface to the fine-grain connection tracking timeout infrastructure.

LIBNL: A library for applications dealing with netlink socket.

LIBOPING: liboping is a C library to generate ICMP echo requests, better known as "ping packets".

LIBPCAP: A system-independent library for user-level network packet capture.

LIBSOUP: libsoup is an HTTP client/server library. It uses GObject and the GLib main loop, to integrate well with GNOME applications.
Selects: BR2_PACKAGE_LIBXML2 [=y] && BR2_PACKAGE_LIBGLIB2 [=n]

LIBUPNP: The portable SDK for UPnP(tm) Devices (libupnp) provides developers
with an API and open source code for building control points,
devices, and bridges that are compliant with Version 1.0 of the
Universal Plug and Play Device Architecture Specification

LIBVNCSERVER: libvncserver is a VNC server/client library.

ZEROMQ: ØMQ (ZeroMQ, 0MQ, zmq) looks like an embeddable networking
library but acts like a concurrency framework.

LIBS: TEXT
Spoiler:

ENCHANT: Enchant is a spell-checking library that provides a consistent API across a number of spell-checking system backends.
Selects: BR2_PACKAGE_LIBGLIB2 [=n]

MISC:


All elided.

NETWORKING APPS:
Spoiler:
IT IS SHORTER TO LIST WHAT WAS BUILT:

CTORRENT, cifs-utils, LINKS, mutt and Rsync all built okay - rest untested as yet.

Package managers:

IPKG: The Itsy Package Installer from handhelds.org
Opkg built instead.

Real-Time

XENOMAI: Real-Time Framework for Linux http://www.xenomai.org
Xenomai is split in two parts: a kernel part and an userspace part. So, No.

System tools

QUOTA: Implementation of the disk quota system.
Selects: BR2_PACKAGE_UTIL_LINUX (which select UUID stuffs, which die, see death reports)

Text editors and viewers

nano is NOT optimized for size

Host utilities
Spoiler:

LPC3250LOADER: lpc3250loader is a tool to load/burn programs (in particular kickstart
and S1L) on an LPC3250 platform.

OMAP_U_BOOT_UTILS: U-Boot Utilities for Texas Instrument's OMAP platforms.
This is a set of tools to control U-Boot from scripts, generate
OMAP-specific signed image files and more.

OPENOCD: OpenOCD - Open On-Chip Debugger

HOST_SAM_BA: Atmel SAM-BA software provides an open set of tools for
programming the Atmel SAM3, SAM7 and SAM9 ARM-based
microcontrollers.


Bootloaders
Spoiler:

All elided (for now)

BAREBOX: The Barebox bootloader, formerly known as U-Boot v2.

BOOTLETS: Stage1 bootloaders for Freescale iMX23/iMX28 SoCs

BOOT: Build "Das U-Boot" Boot Monitor

That's all folks. Everything else built just fine. More details on that in a moment

Last edited by twobob; 08-18-2012 at 06:32 PM. Reason: added blah, and a few deaths on the field of battle
twobob is offline   Reply With Quote
Old 08-18-2012, 08:57 AM   #80
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
libgtk2 with DirectFB as the display device.
This is the problem being addressed on the BR M.L. at the moment.
knc1 is offline   Reply With Quote
Old 08-18-2012, 09:01 AM   #81
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
If we could get a volunteer to get the SMB/CIFS modules configured . . .
Does not look too hard:
http://www.swerdna.net.au/susesambacifs.html#server
(The Kindle becomes the "linux server")

A much better (greater detail) HowTo:
http://www.brennan.id.au/18-Samba.html

Getting the Kindles to provide a "network share" over either USBnet or Wifi is a big step towards getting rid of the FAT-32 formatted user storage area.

Last edited by knc1; 08-18-2012 at 09:12 AM.
knc1 is offline   Reply With Quote
Old 08-18-2012, 10:21 AM   #82
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Quote:
Originally Posted by knc1 View Post
If we could get a volunteer to get the SMB/CIFS modules configured . . .
Does not look too hard:
http://www.swerdna.net.au/susesambacifs.html#server
(The Kindle becomes the "linux server")

A much better (greater detail) HowTo:
http://www.brennan.id.au/18-Samba.html

Getting the Kindles to provide a "network share" over either USBnet or Wifi is a big step towards getting rid of the FAT-32 formatted user storage area.
To this end I have dug through the lists to see what is just 'on offer'.
There is an ssh based filesystem app that I will attempt to x-compile now and see what that is all about.

For what it's worth I have created a CIFS samba before IIRC you just have to create an authentication section and weld that into the request, or create it on the fly. The server config was all config files IIRC. I'll have a look.

Anyways I'll have a look when I've done nursing this build through. I'm testing a Glib2 dependent inclusion at the moment see how my mileage is today

EDIT: Whoops: libglib2 2.30.2 Building
Code:
  CCLD   libglib-2.0.la
  CCLD   gtester
./.libs/libglib-2.0.so: undefined reference to `qsort_r'
collect2: ld returned 1 exit status
make[6]: *** [gtester] Error 1
oh well. ofono will have wait ; )

back to the xconfig for me. back later.

EDIT:
Gah!

FUSE filesystem client based on the SSH File Transfer Protocol.
http://fuse.sourceforge.net/sshfs.html

Selects: BR2_PACKAGE_LIBFUSE [=y] && BR2_PACKAGE_LIBGLIB2 [=y] && BR2_PACKAGE_GETTEXT [=n] && BR2_PACKAGE_LIBINTL [=n] && BR2_PACKAGE_LIBICONV [=n] && BR2_PACKAGE_OPENSSH [=y]

Oh well. That will have to wait too...

Last edited by twobob; 08-18-2012 at 10:28 AM. Reason: stuff happeneded. again.
twobob is offline   Reply With Quote
Old 08-18-2012, 10:29 AM   #83
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Quote:
Originally Posted by knc1 View Post
Another little chore . . . .
FAT-32 does not support symbolic links (required to get the symantics of *nix library sonames correct).

There are (at least) two ways to deal with that:
FAT{,16,32} does partially support hard-links (at least until you run dosfsck on it) ;
The target library of the links could be copied to each of the less specific names (makes a large increase in disk usage, but we have 3Gbytes) ;
or
some combination of the above.

It would probably be appropriate to do that in a custom, post-build, script.


Decisions, decisions, decisions. . . .
On a FAT, your "hard-link" is called a "cross-link". Disk checkers would report that as an error. Cross-linking is a common method of de-duplication used inside .ISO images, which is safe to do when they are mounted read-only (or burned onto read-only media). On a FAT partition it would be better to just provide multiple copies (which is how I did it for my SDL port).

I like how cygwin replaces symlinks with windows shortcuts, but that only works in a cygwin shell. We only have 3GB when the USB drive is not already full of other stuff (like mine), so replacing symlinks with multiple is not an ideal solution, even though it seems to be the most reliable option available on a FAT partition.

Last edited by geekmaster; 08-18-2012 at 11:36 AM.
geekmaster is offline   Reply With Quote
Old 08-18-2012, 11:34 AM   #84
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Quote:
Originally Posted by geekmaster View Post
On a FAT, your "hard-link" is called a "cross-link". Disk checkers would report that as an error. Cross-linking is a common method of de-duplication used inside .ISO images, which is safe to due when they are mounted read-only (or burned onto read-only media). On a FAT partition it would be better to just provide multiple copies (which is how I did it for my SDL port).

I like how cygwin replaces symlinks with windows shortcuts, but that only works in a cygwin shell. We only have 3GB when the USB drive is not already full of other stuff (like mine), so replacing symlinks with multiple is not an ideal solution, even though it seems to be the most reliable option available on a FAT partition.
Yes. There are 3 mainstream MS tools that may be massaged into doing similar roles on various incarnations of MS file systems.
Ranging from a DEBUG Dos hack, another early MS tool whose name evades my mind, XP's "fsutil hardlink foo bar", vista's mlink, 2003 servers linkd, 3rd party things like Symlinker, Winbolic, one could edit the directory-entries manually using a hex editor, we could hijack a related mechanism, etc into more and more obscure and provisional solutions.

Since you are the adventurous and inquisitive type no doubt you will enjoy having a peek in here then. This in essence provides links on FAT.http://homepage1.nifty.com/emk/symlink-1.06-src.zip

I gave it a once over, elegant really. This was the code I was referring to, still not a one stop solution in the short term but maybe... meh.
no it doesn't dumass. ntfs again. BAH - note to self translate comments before bothering others.

time will tell how desperate we are. : )

Any awesome ideas warmly welcomed.

Last edited by twobob; 08-18-2012 at 12:36 PM. Reason: i was wrong. again. good to get one in for the day.
twobob is offline   Reply With Quote
Old 08-18-2012, 11:44 AM   #85
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Quote:
Originally Posted by twobob View Post
...
Since you are the adventurous and inquisitive type no doubt you will enjoy having a peek in here then. This in essence provides links on FAT.

http://homepage1.nifty.com/emk/symlink-1.06-src.zip

I gave it a once over, elegant really. This was the code I was referring to, still not a one stop solution in the short term but maybe... meh.
Hmm... The source code contains comments and printed text messages in some character set that my text editor does not render correctly. Oh well... "Real" programmers don't need comments, right?

EDIT: In that code, where is the FAT symlink support? I only see what looks to me like NTFS support. Am I missing something here? Other peoples' code is hard to follow (too much white space).

Another thing that has annoyed me much too often is no Unicode support on FAT partitions. Some of my drives have file names from a bunch of different code pages, and many of them look scrambled depending on what codepage is loaded. Copying such files to NTFS leaves them scrambled (permanently). Mixed codepage filenames on FAT is a big problem (even worse than no symlinks, IMHO).

Last edited by geekmaster; 08-18-2012 at 11:51 AM.
geekmaster is offline   Reply With Quote
Old 08-18-2012, 12:28 PM   #86
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Quote:
Originally Posted by twobob
ah yes. wouldn't happen to have a location of said patches would you mate. I dug around in the sources with no avail. @___@
Code:
user@mint745 /mnt/shared/kindle/src/Kindle_src_3.3_611680021 $ find|grep patch
./gplrelease/alsa-lib-1.0.13_patch
./gplrelease/alsa-lib-1.0.13_patch/alsa
./gplrelease/alsa-lib-1.0.13_patch/alsa/alsa-lib
./gplrelease/alsa-lib-1.0.13_patch/alsa/alsa-lib/fix-tstamp-declaration.patch
./gplrelease/uboot-1.3.0-rc3/board/BAK/cray/L1/patchme
./gplrelease/uboot-1.3.0-rc3/cpu/mpc8xx/upatch.c
./gplrelease/uboot-1.3.0-rc3/cpu/ixp/npe/IxQMgrDispatcher.c
./gplrelease/uboot-1.3.0-rc3/cpu/ixp/npe/include/IxQMgrDispatcher_p.h
./gplrelease/mtd-utils-1.0.0/mtd-utils-1.0.0/.git/hooks/pre-applypatch
./gplrelease/mtd-utils-1.0.0/mtd-utils-1.0.0/.git/hooks/applypatch-msg
./gplrelease/syslog-ng-1.6.11/debian/patches
./gplrelease/syslog-ng-1.6.11/debian/patches/CVS
./gplrelease/syslog-ng-1.6.11/debian/patches/CVS/Tag
./gplrelease/syslog-ng-1.6.11/debian/patches/CVS/Repository
./gplrelease/syslog-ng-1.6.11/debian/patches/CVS/Entries
./gplrelease/syslog-ng-1.6.11/debian/patches/CVS/Root
./gplrelease/e2fsprogs-1.38_patch
./gplrelease/e2fsprogs-1.38_patch/e2fsprogs
./gplrelease/e2fsprogs-1.38_patch/e2fsprogs/e2fsprogs-1.38
./gplrelease/e2fsprogs-1.38_patch/e2fsprogs/e2fsprogs-1.38/no-hardlinks.patch
./gplrelease/procps-3.2.7_patch
./gplrelease/procps-3.2.7_patch/procps
./gplrelease/procps-3.2.7_patch/procps/procps-3.2.7
./gplrelease/procps-3.2.7_patch/procps/procps-3.2.7/install.patch
./gplrelease/procps-3.2.7_patch/procps/procps-3.2.7/procmodule.patch
./gplrelease/procps-3.2.7_patch/procps/procps-3.2.7/psmodule.patch
./gplrelease/procps-3.2.7_patch/procps/procps-3.2.7/pagesz-not-constant.patch
./gplrelease/gst-plugins-base-0.10.17/common/gettext.patch
./gplrelease/glib-2.22.2/glib/libcharset/make-patch.sh
./gplrelease/glib-2.22.2/glib/libcharset/libcharset-glib.patch
./gplrelease/glib-2.22.2/glib/update-pcre/digitab.patch
./gplrelease/glib-2.22.2/glib/update-pcre/memory.patch
./gplrelease/webkit-1.1.7/WebKitTools/Scripts/svn-create-patch
./gplrelease/alsa-utils-1.0.13_patch
./gplrelease/alsa-utils-1.0.13_patch/alsa
./gplrelease/alsa-utils-1.0.13_patch/alsa/files
./gplrelease/alsa-utils-1.0.13_patch/alsa/files/alsa-utils-sys-siglist.patch
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/ifupdown_0.6.7ubuntu7.patch
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050405164921-48b0a-31ba4f33e19477ff10a68ddb24c6bbd7aad63d0d.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050404011259-48b0a-db60e8597853894dc22ff0226ecf8ea7dfb2bd0f.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050404030039-48b0a-993cd391cfa3d828a35b52da39abed02d69d4d50.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050404030334-48b0a-49ae19612c6b7d8211c6b89239397064c53f7cdf.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403161538-48b0a-75ab76ed9925211a1b83efde1cc4a213f429a7be.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403150334-48b0a-1bec190d7c5130a0de8b79579a1e664bdfe6303f.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050325174926-48b0a-935743f08e999b2ddb6041e3fbd29ec1298555d8.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050404111950-48b0a-360b54b858475ae4e78e2ef4c6e0d84b2dd6a56c.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050326151125-48b0a-c2ed89301d3a7a42fed7174513023f9067a1a347.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403155657-48b0a-a78731fa7b94026a1bce3d86ec14703e4595ad21.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050325173537-48b0a-404f6e17843f4e0292bf258e5542e9802a159b14.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050322185711-48b0a-265b47864d2d5eb1b5e40dcae77f4234e83e1e09.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/unrevert
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403164423-48b0a-f4c3920fcf3caefba1297b1ade7338990f1c859f.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050416142311-48b0a-2cc01e8f4873f2281ecea741c173d52e64b2f6ba.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403071601-48b0a-277064f82b402d73dd3e9f4dc18edec161e592f8.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403161634-48b0a-9010b91cdccf9ad2cffd13e848384692469232bd.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050404030209-48b0a-3d326cb89210df162b267bc2120ca20066deb39e.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050322190943-48b0a-e970d73397730c0825bb9d37e0ac15607857ce11.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050322191425-48b0a-338ca9e6e811ee13e25fcac84c499fa6ee5b81f6.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403161611-48b0a-5dc34a325877de7548d9f4636b75e75d71f8344c.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050325173048-48b0a-f17b1c4e81302f32ea5341c165c72335487c4e0d.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050502135743-bb3ee-eec9c722232316e0040f3ee2baa9df3f4ecd1514.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/pending
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050325172759-48b0a-b001b9856880f508cee8ff667615da2c16df3158.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050423030949-48b0a-07da52fd9e90c570754aff473397bbad371dd748.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403161110-48b0a-710fb33717b518175348f16756bc6248934ae15a.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050325174738-48b0a-508807aae413654455d5d3c00c7717af85ee4c17.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403130722-48b0a-cc5a3bf9eb540a9ba9e130626912237e96a9609d.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403154821-48b0a-c05c4823816cc11771bd66a8eef9baa14ff29e1e.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403170911-48b0a-1b052d27df2f8d7764bd5aa71c832aa5f73aa122.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050405173454-48b0a-7dd75d1a00e8a35a038628a6fceae4eca9e31fd3.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050405164951-48b0a-c06ed2064f300df62ea7b8b18994d3a314e3b6b3.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403150343-48b0a-02e148db83abd6cd9f9e6ec53a2a1916a38a61cb.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403170919-48b0a-40bc9c8afdf3b2ec6cfb9cc84222991be5495c23.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050404111917-48b0a-3666132d54f974fa92dd5402d4570d505724c04e.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050322184259-48b0a-3d7d00a0c38d726902f24ae37090ed7af95dc35b.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403150657-48b0a-15ca5d98146a5b255dd993de9e8ccb07ce586b20.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403161830-48b0a-4cbfbff1753740cb4e4e72b6309621f170caeaae.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050404153209-48b0a-169d4444f3c27466a8d7a3d56ddb15f41d1bb5f1.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050405164755-48b0a-e33319257ad5608206f0abf53c6adf7eb9a3764b.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403164804-48b0a-e909e1e9ed995134a316a22ebc1ffa8d5b3f633a.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050405164913-48b0a-6cb47dfd47e9259a9c588c9a61fc8cf4086d61cd.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403133706-48b0a-ac0145fc85e019fecf12356618aa3ecc6aef73ff.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050405173752-48b0a-3437c72ae180a5c8357dca7a79f16976dd904b10.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403150728-48b0a-ad57c1b54ea04699dd8454be692cf0ac25c599de.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050325174749-48b0a-61da41cded8e77e4347a964ee2111d9b21a2ceea.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050325172831-48b0a-6d40f49e987c5c8dbf4ad2f0f6285d84fb51e3fb.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403150711-48b0a-b7a219596d7793c014e937d477b07e8cf5cf9033.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403160952-48b0a-858bcd92fe2ecda0dff3f0f2d6f4bb88791dd336.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050322185930-48b0a-899f2c66d03fccd88c81a91a27ad918e83df8241.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050326151130-48b0a-e655ac6f135e14c6f088be1a687c07774c58e96d.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403142603-48b0a-ea9f259b5bc7061a3cfcb23e791d27dcaffbb898.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050331140306-48b0a-192b390dc5d22de8e61d5e3c21370d44bca6726e.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403160939-48b0a-69fa8a1fcabd5f848efb68b6efb17d88ea9846e2.gz
./gplrelease/ifupdown_0.6.8/ifupdown-0.6.8/_darcs/patches/20050403164757-48b0a-8ad09d3f62ee0d157e4648a67ef16f680abe8933.gz
./gplrelease/sysvinit-2.86/contrib/zefram-patches
./gplrelease/gstreamer-0.10.17/common/gettext.patch
./gplrelease/gst-plugins-good-0.10.6/common/gettext.patch
./gplrelease/e2fsprogs-1.38/e2fsck/pass1b.c.patch
./gplrelease/DirectFB-1.2.0/proxy/dispatcher
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbinputdevice_dispatcher.h
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbdatabuffer_dispatcher.c
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/Makefile.am
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfb_dispatcher.h
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbimageprovider_dispatcher.h
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbwindow_dispatcher.h
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbscreen_dispatcher.c
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbinputdevice_dispatcher.c
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbdisplaylayer_dispatcher.c
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbimageprovider_dispatcher.c
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbeventbuffer_dispatcher.h
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfb_dispatcher.c
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbwindow_dispatcher.c
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbfont_dispatcher.h
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbscreen_dispatcher.h
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbdatabuffer_dispatcher.h
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbeventbuffer_dispatcher.c
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbsurface_dispatcher.c
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbfont_dispatcher.c
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbpalette_dispatcher.h
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbpalette_dispatcher.c
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbsurface_dispatcher.h
./gplrelease/DirectFB-1.2.0/proxy/dispatcher/idirectfbdisplaylayer_dispatcher.h
./gplrelease/DirectFB-1.2.0/gfxdrivers/davinci/patches
./gplrelease/DirectFB-1.2.0/gfxdrivers/davinci/patches/ti-davinci-2.6.10-mvl401-fbio_set_start.patch
./gplrelease/DirectFB-1.2.0/patches
./gplrelease/DirectFB-1.2.0/patches/matroxfb-full-memory-linux-2.4.21-rc2.patch.bz2
./gplrelease/DirectFB-1.2.0/patches/Makefile.am
./gplrelease/DirectFB-1.2.0/patches/vmwarefb-0.7.0-linux-2.4.22.patch.bz2
./gplrelease/DirectFB-1.2.0/patches/davincifb-triple-osd0-2.6.10.patch.bz2
./gplrelease/DirectFB-1.2.0/patches/README.matroxfb-vsync-irq-patch
./gplrelease/DirectFB-1.2.0/patches/savagefb-0.3.2-linux-2.4.26.patch.bz2
./gplrelease/DirectFB-1.2.0/patches/matroxfb-vsync-irq-2.4.20.patch.bz2
./gplrelease/DirectFB-1.2.0/patches/README.fusion
./gplrelease/DirectFB-1.2.0/patches/README.savagefb
./gplrelease/DirectFB-1.2.0/patches/README.davincifb
./gplrelease/DirectFB-1.2.0/patches/savagefb-0.4.0-linux-2.4.19.patch.bz2
./gplrelease/DirectFB-1.2.0/patches/matroxfb-g400-clock-2.4.22.patch.bz2
./gplrelease/DirectFB-1.2.0/patches/matroxfb-vsync-irq-2.4.21-pre6.patch.bz2
./gplrelease/DirectFB-1.2.0/patches/savagefb-0.4.0-linux-2.4.21-rc2.patch.bz2
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/arch/ppc/8xx_io/micropatch.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/arch/sparc64/lib/NG2patch.S
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/arch/sparc64/lib/NGpatch.S
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/arch/sparc64/lib/U3patch.S
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/arch/sparc64/lib/GENpatch.S
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/arch/x86/kernel/paravirt_patch_64.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/arch/x86/kernel/paravirt_patch_32.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/arch/parisc/math-emu/fpudispatch.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/arch/powerpc/sysdev/micropatch.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/arch/ia64/kernel/patch.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/Documentation/applying-patches.txt
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/drivers/media/video/cpia2/cpia2patch.h
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/drivers/media/dvb/ttpci/budget-patch.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/drivers/acpi/dispatcher
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/drivers/acpi/dispatcher/dsobject.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/drivers/acpi/dispatcher/dsutils.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/drivers/acpi/dispatcher/dsinit.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/drivers/acpi/dispatcher/dswload.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/drivers/acpi/dispatcher/Makefile
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/drivers/acpi/dispatcher/dsmthdat.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/drivers/acpi/dispatcher/dswstate.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/drivers/acpi/dispatcher/dswexec.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/drivers/acpi/dispatcher/dswscope.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/drivers/acpi/dispatcher/dsfield.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/drivers/acpi/dispatcher/dsmethod.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/drivers/acpi/dispatcher/dsopcode.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/net/wanrouter/patchlevel
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/scripts/patch-kernel
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/scripts/cleanpatch
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/scripts/checkpatch.pl
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/sound/pci/ac97/ac97_patch.h
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/sound/pci/ac97/ac97_patch.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/sound/pci/emu10k1/emu10k1_patch.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/sound/pci/hda/patch_sigmatel.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/sound/pci/hda/patch_realtek.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/sound/pci/hda/patch_atihdmi.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/sound/pci/hda/patch_conexant.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/sound/pci/hda/patch_si3054.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/sound/pci/hda/patch_via.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/sound/pci/hda/hda_patch.h
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/sound/pci/hda/patch_analog.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/sound/pci/hda/patch_cmedia.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/sound/isa/sb/emu8000_patch.c
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/include/linux/patchkey.h
./gplrelease/linux-2.6.26-lab126/linux-2.6.26/include/asm-ia64/patch.h
./gplrelease/gst-plugins-base-0.10.6/common/gettext.patch
./gplrelease/module-init-tools-3.2.2_patch
./gplrelease/module-init-tools-3.2.2_patch/module-init-tools
./gplrelease/module-init-tools-3.2.2_patch/module-init-tools/files
./gplrelease/module-init-tools-3.2.2_patch/module-init-tools/files/manpagesopt
./gplrelease/module-init-tools-3.2.2_patch/module-init-tools/files/no_man_rebuild
./gplrelease/module-init-tools-3.2.2_patch/module-init-tools/files/modutils_extension
./gplrelease/module-init-tools-3.2.2_patch/module-init-tools/files/ignore_arch_directory
./gplrelease/busybox-1.7.2/editors/patch.c
Code:
user@mint745 /mnt/shared/kindle/src/Kindle_src_3.3_611680021 $ ls ./gplrelease/linux-2.6.26-lab126/linux-2.6.26/scripts/
basic                   cleanpatch                         Kbuild.include        Makefile.modinst  patch-kernel
bin2c.c                 conmakehash.c                      kconfig               Makefile.modpost  pnmtologo.c
binoffset.c             decodecode                         kernel-doc            makelst           profile2linkerlist.pl
bloat-o-meter           export_report.pl                   ksymoops              mkcompile_h       recordmcount.pl
checkincludes.pl        extract-ikconfig                   Lindent               mkmakefile        rt-tester
checkkconfigsymbols.sh  gcc-version.sh                     Makefile              mksysmap          setlocalversion
checkpatch.pl           gcc-x86_64-has-stack-protector.sh  Makefile.build        mkuboot.sh        show_delta
checkstack.pl           gen_initramfs_list.sh              Makefile.clean        mkversion         testlpp.c
checksyscalls.sh        genksyms                           Makefile.headersinst  mod               unifdef.c
checkversion.pl         hdrcheck.sh                        Makefile.host         namespace.pl      ver_linux
cleanfile               kallsyms.c                         Makefile.lib          package
user@mint745 /mnt/shared/kindle/src/Kindle_src_3.3_611680021 $
Look at the contents of the "patch" scripts, such as ./gplrelease/linux-2.6.26-lab126/linux-2.6.26/scripts/checkpatch.pl
geekmaster is offline   Reply With Quote
Old 08-18-2012, 12:30 PM   #87
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Japanese.

Quote:
Originally Posted by geekmaster View Post
Hmm... The source code contains comments and printed text messages in some character set that my text editor does not render correctly. Oh well... "Real" programmers don't need comments, right?

EDIT: In that code, where is the FAT symlink support? I only see what looks to me like NTFS support. Am I missing something here? Other peoples' code is hard to follow (too much white space).

Another thing that has annoyed me much too often is no Unicode support on FAT partitions. Some of my drives have file names from a bunch of different code pages, and many of them look scrambled depending on what codepage is loaded. Copying such files to NTFS leaves them scrambled (permanently). Mixed codepage filenames on FAT is a big problem (even worse than no symlinks, IMHO).
That would be Japanese

Translated excepts from symlink.h (nothing major here so I just give you the highlights)

[1]
パス名の最大パス長/ / パス 名 の 最大 パス 長
The maximum path length of the name / / path maximum path length of the path name

[2]
作成操作はシンボリックリンクに到達して停止した/ / 作成 操作 は シンボリック リンク に 到達 し て 停止 し た
Create operation stopped after reaching a symbolic link creation operation / / is stopped after reaching a symbolic link

[3]
// IFS Kit で定義/ / IFS Kit で 定義
/ / Defined in the / / IFS Kit defined in the IFS Kit

[4]
高速 I/O テーブルに特定のエントリが存在するかどうか調べる/ / 高速 I / O テーブル に 特定 の エントリ が 存在 する か どうか 調べる
Examine whether there is a specific entry in the I / O speed table / / Check whether there is a specific entry in the I / O fast table


Translation of ioctlcmd little bits:

[1]
// Windowsの定義/ / Definition of Windows

[2]
ULONG Flags; /* 0=絶対パス, 1=相対パス */
Which is ULONG Flags; / * 0 =Path, relative path 1 = absolute * /

[3]
// Symlinkの定義/ / Definition of Symlink


This one senable.c needs to be seen 'in place' to make sense really...

Spoiler:
Code:
Translated version of senable.c
#ifndef UNICODE # Ifndef UNICODE
#define UNICODE # Define UNICODE
#endif # Endif
#ifndef _UNICODE # Ifndef _UNICODE
#define _UNICODE # Define _UNICODE
#endif # Endif
#define WIN32_LEAN_AND_MEAN # Define WIN32_LEAN_AND_MEAN
#define _WIN32_WINNT 0x500 # Define _WIN32_WINNT 0x500
#define WIN32_NO_STATUS # Define WIN32_NO_STATUS
#include <windows.h> # Include <windows.h>
#undef WIN32_NO_STATUS # Undef WIN32_NO_STATUS
#include <ntstatus.h> # Include <ntstatus.h>
#include <winioctl.h> # Include <winioctl.h>
#include <winternl.h> # Include <winternl.h>
#include <psapi.h> # Include <psapi.h>
#include <locale.h> # Include <locale.h>
#include <stddef.h> # Include <stddef.h>
#include <stdio.h> # Include <stdio.h>
#include <stdlib.h> # Include <stdlib.h>
#include <tchar.h> # Include <tchar.h>
#include "ioctlcmd.h" # Include "ioctlcmd.h"
#include "senable.h" # Include "senable.h"

const TCHAR *myname; const TCHAR * myname;

enum { enum {
	ACT_LOAD, ACT_LOAD,
	ACT_INSTALL, ACT_INSTALL,
	ACT_DELETE, ACT_DELETE,
}; };

void PrintWin32Error(LPCTSTR message, DWORD code) void PrintWin32Error (LPCTSTR message, DWORD code)
{ {
	PVOID pv; PVOID pv;

	FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS | FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS |
	              FORMAT_MESSAGE_FROM_SYSTEM, NULL, code, FORMAT_MESSAGE_FROM_SYSTEM, NULL, code,
	              MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
	              (LPTSTR)&pv, 0, NULL); (LPTSTR) & pv, 0, NULL);
	_tprintf(_T("%s (%d): %s"), message, code, pv); _tprintf (_T ("% s (% d):% s"), message, code, pv);
	LocalFree(pv); LocalFree (pv);
} }

BOOL InstallDriver(SC_HANDLE hSCM, LPCTSTR name, LPCTSTR exe, BOOL bootStart) BOOL InstallDriver (SC_HANDLE hSCM, LPCTSTR name, LPCTSTR exe, BOOL bootStart)
{ {
	SC_HANDLE hService; SC_HANDLE hService;

	_tprintf(_T("Install...")); _tprintf (_T ("Install ..."));
	hService = CreateService(hSCM, name, name, SERVICE_ALL_ACCESS, hService = CreateService (hSCM, name, name, SERVICE_ALL_ACCESS,
	                         SERVICE_KERNEL_DRIVER, SERVICE_KERNEL_DRIVER,
	                         bootStart ? SERVICE_BOOT_START : SERVICE_DEMAND_START, ? bootStart SERVICE_BOOT_START: SERVICE_DEMAND_START,
	                         SERVICE_ERROR_NORMAL, exe, SERVICE_ERROR_NORMAL, exe,
	                         _T("Filter"), NULL, NULL, NULL, NULL); _T ("Filter"), NULL, NULL, NULL, NULL);
	if (!hService) { if (! hService) {
		//PrintWin32Error(_T("CreateService failed"), GetLastError()); / / PrintWin32Error (_T ("CreateService failed"), GetLastError ());
		return FALSE; return FALSE;
	} }

	CloseServiceHandle(hService); CloseServiceHandle (hService);

	return TRUE; return TRUE;
} }

BOOL ChangeDriver(SC_HANDLE hSCM, LPCTSTR name, LPCTSTR exe, BOOL bootStart) BOOL ChangeDriver (SC_HANDLE hSCM, LPCTSTR name, LPCTSTR exe, BOOL bootStart)
{ {
	SC_HANDLE hService; SC_HANDLE hService;
	BOOL r; BOOL r;

	_tprintf(_T("Change...")); _tprintf (_T ("Change ..."));
	hService = OpenService(hSCM, name, SERVICE_ALL_ACCESS); hService = OpenService (hSCM, name, SERVICE_ALL_ACCESS);
	if (!hService) if (! hService)
		return FALSE; return FALSE;

	r = ChangeServiceConfig(hService, r = ChangeServiceConfig (hService,
	                        SERVICE_KERNEL_DRIVER, SERVICE_KERNEL_DRIVER,
	                        bootStart ? SERVICE_BOOT_START : SERVICE_DEMAND_START, ? bootStart SERVICE_BOOT_START: SERVICE_DEMAND_START,
	                        SERVICE_ERROR_NORMAL, exe, SERVICE_ERROR_NORMAL, exe,
	                        _T("Filter"), NULL, NULL, NULL, NULL, _T ("Filter"), NULL, NULL, NULL, NULL,
	                        name); name);

	CloseServiceHandle(hService); CloseServiceHandle (hService);

	return r; return r;
} }

BOOL StartDriver(SC_HANDLE hSCM, LPCTSTR name) BOOL StartDriver (SC_HANDLE hSCM, LPCTSTR name)
{ {
	SC_HANDLE hService; SC_HANDLE hService;
	BOOL r; BOOL r;

	_tprintf(_T("Start...")); _tprintf (_T ("Start ..."));
	hService = OpenService(hSCM, name, SERVICE_ALL_ACCESS); hService = OpenService (hSCM, name, SERVICE_ALL_ACCESS);
	if (hService == NULL) if (hService == NULL)
		return FALSE; return FALSE;

	r = StartService(hService, 0, NULL) || r = StartService (hService, 0, NULL) | |
	    GetLastError() == ERROR_SERVICE_ALREADY_RUNNING || GetLastError () == ERROR_SERVICE_ALREADY_RUNNING | |
	    GetLastError() == ERROR_SERVICE_DISABLED; GetLastError () == ERROR_SERVICE_DISABLED;
if (!r) PrintWin32Error(_T("StartService failed"), GetLastError()); if (! r) PrintWin32Error (_T ("StartService failed"), GetLastError ());


	CloseServiceHandle(hService); CloseServiceHandle (hService);

	return r; return r;
} }



BOOL OpenDevice(LPCTSTR name, PHANDLE phDevice) BOOL OpenDevice (LPCTSTR name, PHANDLE phDevice)
{ {
	TCHAR completeDeviceName[64]; TCHAR completeDeviceName [64];
	HANDLE hDevice; HANDLE hDevice;

	if (GetVersion() & 0xFF >= 5) { if (GetVersion () & 0xFF> = 5) {
		wsprintf(completeDeviceName, TEXT("\\\\.\\Global\\%s"), name); wsprintf (completeDeviceName, TEXT (". \ \ \ \ \ \ Global \ \% s"), name);
	} else { } Else {
		wsprintf(completeDeviceName, TEXT("\\\\.\\%s"), name); wsprintf (completeDeviceName, TEXT (". \ \ \ \ \ \% s"), name);
	} }
	hDevice = CreateFile(completeDeviceName, GENERIC_READ | GENERIC_WRITE, hDevice = CreateFile (completeDeviceName, GENERIC_READ | GENERIC_WRITE,
	                     0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
	if (hDevice == INVALID_HANDLE_VALUE) if (hDevice == INVALID_HANDLE_VALUE)
		return FALSE; return FALSE;

	if (phDevice) if (phDevice)
		*phDevice = hDevice; * PhDevice = hDevice;
	else else
		CloseHandle(hDevice); CloseHandle (hDevice);

	return TRUE; return TRUE;
} }

BOOL StopDriver(SC_HANDLE hSCM, LPCTSTR name) BOOL StopDriver (SC_HANDLE hSCM, LPCTSTR name)
{ {
	SC_HANDLE hService; SC_HANDLE hService;
	BOOL r; BOOL r;
	SERVICE_STATUS status; SERVICE_STATUS status;

	_tprintf(_T("Stop...")); _tprintf (_T ("Stop ..."));
	hService = OpenService(hSCM, name, SERVICE_ALL_ACCESS); hService = OpenService (hSCM, name, SERVICE_ALL_ACCESS);
	if (hService == NULL) if (hService == NULL)
		return FALSE; return FALSE;

	r = ControlService(hService, SERVICE_CONTROL_STOP, &status); r = ControlService (hService, SERVICE_CONTROL_STOP, & status);
if (!r) PrintWin32Error(_T("ControlService failed"), GetLastError()); if (! r) PrintWin32Error (_T ("ControlService failed"), GetLastError ());

	CloseServiceHandle(hService); CloseServiceHandle (hService);

	return r; return r;
} }

BOOL RemoveDriver(SC_HANDLE hSCM, LPCTSTR name) BOOL RemoveDriver (SC_HANDLE hSCM, LPCTSTR name)
{ {
	SC_HANDLE hService; SC_HANDLE hService;
	BOOL r; BOOL r;

	_tprintf(_T("Delete...")); _tprintf (_T ("Delete ..."));
	hService = OpenService(hSCM, name, SERVICE_ALL_ACCESS); hService = OpenService (hSCM, name, SERVICE_ALL_ACCESS);
	// サービスがそもそも存在しなかった場合はエラーにしない/ / If the service does not exist in the first place, I do not make the error
	if (hService == NULL) { if (hService == NULL) {
		//PrintWin32Error(_T("OpenService failed"), GetLastError()); / / PrintWin32Error (_T ("OpenService failed"), GetLastError ());
		return GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST; return GetLastError () == ERROR_SERVICE_DOES_NOT_EXIST;
	} }

	// 削除予約済みの場合はエラーにしない/ / If I do not delete the reserved error
	r = DeleteService(hService) || GetLastError() == ERROR_SERVICE_MARKED_FOR_DELETE; r = DeleteService (hService) | | GetLastError () == ERROR_SERVICE_MARKED_FOR_DELETE;
if (!r) PrintWin32Error(_T("DeleteService failed"), GetLastError()); if (! r) PrintWin32Error (_T ("DeleteService failed"), GetLastError ());

	CloseServiceHandle(hService); CloseServiceHandle (hService);

	return r; return r;
} }

BOOL CanUnload(LPCTSTR name, LPBOOL inuse) BOOL CanUnload (LPCTSTR name, LPBOOL inuse)
{ {
	HANDLE hDevice; HANDLE hDevice;
	ULONG irpcount; ULONG irpcount;
	BOOL b = FALSE; BOOL b = FALSE;

	if (inuse) if (inuse)
		*inuse = FALSE; * Inuse = FALSE;

	if (!OpenDevice(name, &hDevice)) { if (! OpenDevice (name, & hDevice)) {
		_tprintf(_T("デバイス %s を開けません: %lu\n"), name, GetLastError()); _tprintf (_T ("Unable to open device% s:% lu \ n"), name, GetLastError ());
		return FALSE; return FALSE;
	} }

	// ドライバがアンロードできるかどうか見る/ / We can see if the driver is unloaded
	if (!DeviceIoControl(hDevice, IOCTL_SYMLINK_UNLOADQUERY, if (! DeviceIoControl (hDevice, IOCTL_SYMLINK_UNLOADQUERY,
						NULL, 0, NULL, 0, NULL, 0, NULL, 0,
						&irpcount, NULL ) ) { & Irpcount, NULL)) {
		_tprintf(_T("Couldn't access device driver: %lu\n"), GetLastError()); _tprintf (_T ("Couldn't access device driver:% lu \ n"), GetLastError ());
	} else if (irpcount) { } Else if (irpcount) {
		_tprintf(_T("使用中のためSymLinkドライバをアンロードできません。\n")); (". \ n SymLink can not unload the driver because it is being used" _T ()) _tprintf;
		if (inuse) if (inuse)
			*inuse = TRUE; * Inuse = TRUE;
	} else { } Else {
		b = TRUE; b = TRUE;
	} }

	CloseHandle(hDevice); CloseHandle (hDevice);

	return b; return b;
} }

BOOL UnloadDeviceDriver(LPCTSTR name, LPBOOL inuse, LPBOOL removed) BOOL UnloadDeviceDriver (LPCTSTR name, LPBOOL inuse, LPBOOL removed)
{ {
	SC_HANDLE hSCM; SC_HANDLE hSCM;
	BOOL r; BOOL r;

	hSCM = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); hSCM = OpenSCManager (NULL, NULL, SC_MANAGER_ALL_ACCESS);

	if (CanUnload(name, inuse)) if (CanUnload (name, inuse))
		StopDriver(hSCM, name); StopDriver (hSCM, name);
	// アンロードの可否にかかわらず削除は試みる/ / Delete attempts regardless of whether the unload
	r = RemoveDriver(hSCM, name); r = RemoveDriver (hSCM, name);
	if (removed) if (removed)
		*removed = r; * Removed = r;

	CloseServiceHandle(hSCM); CloseServiceHandle (hSCM);

	return TRUE; return TRUE;
} }

BOOL LoadDeviceDriver(LPCTSTR name, LPCTSTR path, BOOL bootStart, PHANDLE phDevice, BOOL LoadDeviceDriver (LPCTSTR name, LPCTSTR path, BOOL bootStart, PHANDLE phDevice,
PDWORD error, LPBOOL inuse) PDWORD error, LPBOOL inuse)
{ {
	SC_HANDLE hSCM; SC_HANDLE hSCM;
	BOOL r; BOOL r;

	hSCM = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); hSCM = OpenSCManager (NULL, NULL, SC_MANAGER_ALL_ACCESS);

	if (CanUnload(name, inuse)) if (CanUnload (name, inuse))
		StopDriver(hSCM, name); StopDriver (hSCM, name);

	if (!ChangeDriver(hSCM, name, path, bootStart)) { if (! ChangeDriver (hSCM, name, path, bootStart)) {
		// 以前のインスタンスを取り除く/ / Remove the previous instance
		RemoveDriver(hSCM, name); RemoveDriver (hSCM, name);
		// インストールの成功は無視する: すでにインストールされているかもしれない/ / Ignore the success of the installation: It may already be installed
		InstallDriver(hSCM, name, path, bootStart); InstallDriver (hSCM, name, path, bootStart);
	} }

	// 開始の成功は無視する: すでに開始しているかもしれない/ / Ignore the success of the start: I may have already started
	StartDriver(hSCM, name); StartDriver (hSCM, name);

	// 開けることを確認する/ / Make sure that the open
	r = OpenDevice(name, phDevice); r = OpenDevice (name, phDevice);
	*error = GetLastError(); * Error = GetLastError ();
	CloseServiceHandle(hSCM); CloseServiceHandle (hSCM);

	return r; return r;
} }

// / /
// ドライバのファイルをパスから検索して、 / / From the path to search for the driver file,
// 指定したディレクトリにコピーする。 / / Copy the directory that you specify.
// / /
BOOL copydriver(LPCTSTR driverPath) BOOL copydriver (LPCTSTR driverPath)
{ {
	TCHAR Path[MAX_PATH]; TCHAR Path [MAX_PATH];
	TCHAR *filePart; TCHAR * filePart;
	WIN32_FIND_DATA wfd; WIN32_FIND_DATA wfd;
	HANDLE hFind; HANDLE hFind;

	GetCurrentDirectory(sizeof(Path), Path); GetCurrentDirectory (sizeof (Path), Path);
	_stprintf(Path + lstrlen(Path), _T("\\%s"), SYS_FILE); _stprintf (Path + lstrlen (Path), _T ("\ \% s"), SYS_FILE);

	hFind = FindFirstFile(Path, &wfd); hFind = FindFirstFile (Path, & wfd);
	if (hFind == INVALID_HANDLE_VALUE) { if (hFind == INVALID_HANDLE_VALUE) {
		if (!SearchPath(NULL, SYS_FILE, NULL, sizeof(Path), Path, &filePart)) { if (! SearchPath (NULL, SYS_FILE, NULL, sizeof (Path), Path, & filePart)) {
			_tprintf(_T("%s not found.\n"), SYS_FILE); _tprintf (_T (".% s not found \ n"), SYS_FILE);
			return FALSE; return FALSE;
		} }
	} else FindClose(hFind); } Else FindClose (hFind);

	if (!CopyFile(Path, driverPath, FALSE)) { if (! CopyFile (Path, driverPath, FALSE)) {
		_tprintf(_T("%s を %s にコピーできません。\n") _tprintf (_T ("% copy. \ n can not be in the s% s")
			_T("管理者権限を持っているか確認してください。\n"), (". \ N Please make sure you have administrator privileges") _T,
			SYS_FILE, driverPath); SYS_FILE, driverPath);
		return FALSE; return FALSE;
	} }

	return TRUE; return TRUE;
} }

BOOL opendriver(LPHANDLE phDriver, DWORD action) BOOL opendriver (LPHANDLE phDriver, DWORD action)
{ {
	DWORD version, cb; DWORD version, cb;
	DWORD error; DWORD error;
	TCHAR systemPath[MAX_PATH]; TCHAR systemPath [MAX_PATH];
	TCHAR driverPath[MAX_PATH]; TCHAR driverPath [MAX_PATH];
	BOOL bootStart = action == ACT_INSTALL; BOOL bootStart = action == ACT_INSTALL;
	BOOL inuse; BOOL inuse;

	if (!GetSystemDirectory(systemPath, sizeof(systemPath))) { if (! GetSystemDirectory (systemPath, sizeof (systemPath))) {
		_tprintf(_T("Could not find system directory")); _tprintf (_T ("Could not find system directory"));
		return FALSE; return FALSE;
	} }
	_stprintf(driverPath, _T("%s\\drivers\\%s"), systemPath, SYS_FILE); _stprintf (driverPath, _T ("% s \ \ drivers \ \% s"), systemPath, SYS_FILE);

	if (action == ACT_DELETE) { if (action == ACT_DELETE) {
		BOOL removed; BOOL removed;

		UnloadDeviceDriver(SYS_NAME, &inuse, &removed); UnloadDeviceDriver (SYS_NAME, & inuse, & removed);
		if (inuse) if (inuse)
			_tprintf(_T("削除を完了するにはWindowsの再起動が必要です。\n")); _tprintf (_T (". to complete the deletion \ n it is necessary to restart the Windows"));
		SetFileAttributes(driverPath, FILE_ATTRIBUTE_NORMAL); SetFileAttributes (driverPath, FILE_ATTRIBUTE_NORMAL);
		// 何らかの理由でサービスの登録削除に失敗した場合は/ / If you failed to remove registration of the service for any reason
		// ファイルも削除しない/ / I do not delete any files
		if (removed) if (removed)
			DeleteFile(driverPath); DeleteFile (driverPath);
		return TRUE; return TRUE;
	} }

	// CDやネットワークドライブから実行できるように/ / To be able to run from a network drive, or CD
	// ドライバを system32\drivers へコピーする/ / Copy to system32 \ drivers drivers
	// ブート時ロードドライバとして登録するためにも必要/ / Also need to register as a load driver at boot time
	if (!copydriver(driverPath)) if (! copydriver (driverPath))
		return FALSE; return FALSE;
	SetFileAttributes(driverPath, FILE_ATTRIBUTE_NORMAL); SetFileAttributes (driverPath, FILE_ATTRIBUTE_NORMAL);

	if (!LoadDeviceDriver(SYS_NAME, driverPath, bootStart, phDriver, &error, &inuse)) { if (! LoadDeviceDriver (SYS_NAME, driverPath, bootStart, phDriver, & error, & inuse)) {
		if (!LoadDeviceDriver(SYS_NAME, driverPath, bootStart, phDriver, &error, &inuse)) { if (! LoadDeviceDriver (SYS_NAME, driverPath, bootStart, phDriver, & error, & inuse)) {
			_tprintf(_T("Error loading %s: %d"), SYS_NAME, error); _tprintf (_T ("Error loading% s:% d"), SYS_NAME, error);
			DeleteFile(driverPath); DeleteFile (driverPath);
			return FALSE; return FALSE;
		} }
	} }

	// ドライバのバージョンは正しいか? / / Correct version of the driver?
	if (!DeviceIoControl(*phDriver, IOCTL_SYMLINK_VERSION, if (! DeviceIoControl (* phDriver, IOCTL_SYMLINK_VERSION,
	                     NULL, 0, &version, sizeof(version), &cb, NULL)) { NULL, 0, & version, sizeof (version), & cb, NULL)) {
		PrintWin32Error(_T("DeviceIoControl failed"), GetLastError()); PrintWin32Error (_T ("DeviceIoControl failed"), GetLastError ());
		CloseHandle(*phDriver); CloseHandle (* phDriver);
		return FALSE; return FALSE;
	} else if (version < SYMLINKVERSION) { } Else if (version <SYMLINKVERSION) {
		_tprintf(SYS_NAME _T(" のバージョンが正しくありません。\n")); (". \ n is not correct version of" SYS_NAME _T ()) _tprintf;
		if (inuse) if (inuse)
			_tprintf(_T("ドライバを更新するにはWindowsの再起動が必要です。\n")); _tprintf (_T (". to update the driver \ n it is necessary to restart the Windows"));
		return FALSE; return FALSE;
	} }

	_tprintf(_T("driver version: %d.%02d\n"), version >> 8, version & 0xff); _tprintf (_T (". driver version:% d% 02d \ n"), version >> 8, version & 0xff);

	return TRUE; return TRUE;
} }

int _tmain(int argc, TCHAR **argv) int _tmain (int argc, TCHAR ** argv)
{ {
	HANDLE hDriver = INVALID_HANDLE_VALUE; HANDLE hDriver = INVALID_HANDLE_VALUE;
	DWORD action; DWORD action;

	_tsetlocale(LC_ALL, _T("")); _tsetlocale (LC_ALL, _T (""));
	myname = argv[0]; myname = argv [0];

	action = ACT_LOAD; action = ACT_LOAD;
	if (argc > 1) { if (argc> 1) {
		if (!_tcscmp(argv[1], _T("install"))) if (! _tcscmp (argv [1], _T ("install")))
			action = ACT_INSTALL; action = ACT_INSTALL;
		if (!_tcscmp(argv[1], _T("delete"))) if (! _tcscmp (argv [1], _T ("delete")))
			action = ACT_DELETE; action = ACT_DELETE;
	} }
	if (!opendriver(&hDriver, action)) if (! opendriver (& hDriver, action))
		return EXIT_FAILURE; return EXIT_FAILURE;

	CloseHandle(hDriver); CloseHandle (hDriver);
	return 0; return 0;
} }
<script>_addload(function(){_setupIW();_csi('ja','en','senable.c');});</script>


as does the In.c

Spoiler:
Code:
Translated version of ln.c
#ifndef UNICODE # Ifndef UNICODE
#define UNICODE # Define UNICODE
#endif # Endif
#ifndef _UNICODE # Ifndef _UNICODE
#define _UNICODE # Define _UNICODE
#endif # Endif
// / /
// ln - ハードリンクやジャンクションを作成する/ / Ln - Create a hard link and junction
// / /
#define WIN32_LEAN_AND_MEAN # Define WIN32_LEAN_AND_MEAN
#define _WIN32_WINNT 0x500 # Define _WIN32_WINNT 0x500
#include <windows.h> # Include <windows.h>
#include <winioctl.h> # Include <winioctl.h>
#include <locale.h> # Include <locale.h>
#include <stdio.h> # Include <stdio.h>
#include <stdlib.h> # Include <stdlib.h>
#include <stddef.h> # Include <stddef.h>
#include <io.h> # Include <io.h>
#include <fcntl.h> # Include <fcntl.h>
#include <tchar.h> # Include <tchar.h>
#include "ioctlcmd.h" # Include "ioctlcmd.h"

#define SE_CREATE_SYMBOLIC_LINK_NAME      TEXT("SeCreateSymbolicLinkPrivilege") # Define SE_CREATE_SYMBOLIC_LINK_NAME TEXT ("SeCreateSymbolicLinkPrivilege")

LPCTSTR myname; LPCTSTR myname;

static union { static union {
	REPARSE_DATA_BUFFER iobuf; REPARSE_DATA_BUFFER iobuf;
	TCHAR dummy[MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; TCHAR dummy [MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
} u; } U;

void PrintWin32Error(LPCTSTR message) void PrintWin32Error (LPCTSTR message)
{ {
	DWORD code = GetLastError(); DWORD code = GetLastError ();
	PVOID pv; PVOID pv;

	FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS | FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS |
	              FORMAT_MESSAGE_FROM_SYSTEM, NULL, code, FORMAT_MESSAGE_FROM_SYSTEM, NULL, code,
	              MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
	              (LPTSTR)&pv, 0, NULL); (LPTSTR) & pv, 0, NULL);
//	_tprintf(_T("%s (%d): %s"), message, code, pv); / / _tprintf (_T ("% S (% d):% s"), message, code, pv);
	_tprintf(_T("%s: %s"), message, pv); _tprintf (_T ("% s:% s"), message, pv);
	LocalFree(pv); LocalFree (pv);
} }

void DumpReparsePointBuf(DWORD cb) void DumpReparsePointBuf (DWORD cb)
{ {
	printf("cb = %d\n", cb); printf ("cb =% d \ n", cb);
	printf("ReparseTag = %#08x\n", u.iobuf.ReparseTag); printf ("ReparseTag =% # 08x \ n", u.iobuf.ReparseTag);
	printf("ReparseDataLength = %d\n", u.iobuf.ReparseDataLength); printf ("ReparseDataLength =% d \ n", u.iobuf.ReparseDataLength);
	printf("Reserved = %d\n", u.iobuf.Reserved); printf ("Reserved =% d \ n", u.iobuf.Reserved);
	switch (u.iobuf.ReparseTag) { switch (u.iobuf.ReparseTag) {
	case IO_REPARSE_TAG_MOUNT_POINT: case IO_REPARSE_TAG_MOUNT_POINT:
		printf("SubstituteNameOffset = %d\n", u.iobuf.MountPointReparseBuffer.SubstituteNameOffset); printf ("SubstituteNameOffset =% d \ n", u.iobuf.MountPointReparseBuffer.SubstituteNameOffset);
		printf("SubstituteNameLength = %d\n", u.iobuf.MountPointReparseBuffer.SubstituteNameLength); printf ("SubstituteNameLength =% d \ n", u.iobuf.MountPointReparseBuffer.SubstituteNameLength);
		printf("%.*S\n", printf ("%. * S \ n",
			u.iobuf.MountPointReparseBuffer.SubstituteNameLength / sizeof(WCHAR), u.iobuf.MountPointReparseBuffer.SubstituteNameLength / sizeof (WCHAR),
			u.iobuf.MountPointReparseBuffer.PathBuffer + u.iobuf.MountPointReparseBuffer.SubstituteNameOffset / sizeof(WCHAR)); u.iobuf.MountPointReparseBuffer.PathBuffer + u.iobuf.MountPointReparseBuffer.SubstituteNameOffset / sizeof (WCHAR));
		printf("PrintNameOffset = %d\n", u.iobuf.MountPointReparseBuffer.PrintNameOffset); printf ("PrintNameOffset =% d \ n", u.iobuf.MountPointReparseBuffer.PrintNameOffset);
		printf("PrintNameLength = %d\n", u.iobuf.MountPointReparseBuffer.PrintNameLength); printf ("PrintNameLength =% d \ n", u.iobuf.MountPointReparseBuffer.PrintNameLength);
		printf("%.*S\n", printf ("%. * S \ n",
			u.iobuf.MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR), u.iobuf.MountPointReparseBuffer.PrintNameLength / sizeof (WCHAR),
			u.iobuf.MountPointReparseBuffer.PathBuffer + u.iobuf.MountPointReparseBuffer.PrintNameOffset / sizeof(WCHAR)); u.iobuf.MountPointReparseBuffer.PathBuffer + u.iobuf.MountPointReparseBuffer.PrintNameOffset / sizeof (WCHAR));
		break; break;
	case IO_REPARSE_TAG_SYMLINK: case IO_REPARSE_TAG_SYMLINK:
		printf("SubstituteNameOffset = %d\n", u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameOffset); printf ("SubstituteNameOffset =% d \ n", u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameOffset);
		printf("SubstituteNameLength = %d\n", u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameLength); printf ("SubstituteNameLength =% d \ n", u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameLength);
		printf("%.*S\n", printf ("%. * S \ n",
			u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameLength / sizeof(WCHAR), u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameLength / sizeof (WCHAR),
			u.iobuf.SymbolicLinkReparseBuffer.PathBuffer + u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameOffset / sizeof(WCHAR)); u.iobuf.SymbolicLinkReparseBuffer.PathBuffer + u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameOffset / sizeof (WCHAR));
		printf("PrintNameOffset = %d\n", u.iobuf.SymbolicLinkReparseBuffer.PrintNameOffset); printf ("PrintNameOffset =% d \ n", u.iobuf.SymbolicLinkReparseBuffer.PrintNameOffset);
		printf("PrintNameLength = %d\n", u.iobuf.SymbolicLinkReparseBuffer.PrintNameLength); printf ("PrintNameLength =% d \ n", u.iobuf.SymbolicLinkReparseBuffer.PrintNameLength);
		printf("Flags = %d\n", u.iobuf.SymbolicLinkReparseBuffer.Flags); printf ("Flags =% d \ n", u.iobuf.SymbolicLinkReparseBuffer.Flags);
		printf("%.*S\n", printf ("%. * S \ n",
			u.iobuf.SymbolicLinkReparseBuffer.PrintNameLength / sizeof(WCHAR), u.iobuf.SymbolicLinkReparseBuffer.PrintNameLength / sizeof (WCHAR),
			u.iobuf.SymbolicLinkReparseBuffer.PathBuffer + u.iobuf.SymbolicLinkReparseBuffer.PrintNameOffset / sizeof(WCHAR)); u.iobuf.SymbolicLinkReparseBuffer.PathBuffer + u.iobuf.SymbolicLinkReparseBuffer.PrintNameOffset / sizeof (WCHAR));
		break; break;
	} }
} }

BOOL AcquireSymlinkPriv(LPCTSTR lpLinkName) BOOL AcquireSymlinkPriv (LPCTSTR lpLinkName)
{ {
	HANDLE hToken; HANDLE hToken;
	TOKEN_PRIVILEGES TokenPriv; TOKEN_PRIVILEGES TokenPriv;
	BOOL result; BOOL result;

	if (!LookupPrivilegeValue(NULL, SE_CREATE_SYMBOLIC_LINK_NAME, &TokenPriv.Privileges[0].Luid)) { if (! LookupPrivilegeValue (NULL, SE_CREATE_SYMBOLIC_LINK_NAME, & TokenPriv.Privileges [0]. Luid)) {
		// / /
		// Windows XP以前にはこの特権は存在しない。 / / This privilege does not exist prior to Windows XP.
		// / /
		return TRUE; return TRUE;
	} }
	TokenPriv.PrivilegeCount = 1; TokenPriv.PrivilegeCount = 1;
	TokenPriv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; . TokenPriv.Privileges [0] Attributes = SE_PRIVILEGE_ENABLED;

	if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken)) { if (! OpenProcessToken (GetCurrentProcess (), TOKEN_ADJUST_PRIVILEGES, & hToken)) {
		return FALSE; return FALSE;
	} }

	result = AdjustTokenPrivileges(hToken, FALSE, &TokenPriv, 0, NULL, NULL) result = AdjustTokenPrivileges (hToken, FALSE, & TokenPriv, 0, NULL, NULL)
		&& GetLastError() == ERROR_SUCCESS; && GetLastError () == ERROR_SUCCESS;
	CloseHandle(hToken); CloseHandle (hToken);

	return result; return result;
} }

BOOL CreateSymlink(LPCTSTR lpLinkName, LPCTSTR lpTargetName, LPSECURITY_ATTRIBUTES lpsa) BOOL CreateSymlink (LPCTSTR lpLinkName, LPCTSTR lpTargetName, LPSECURITY_ATTRIBUTES lpsa)
{ {
	HANDLE hFile; HANDLE hFile;
	TCHAR namebuf[MAX_PATH + 6]; TCHAR namebuf [MAX_PATH + 6];
	DWORD cb; DWORD cb;
	DWORD attr; DWORD attr;
	BOOL isDirectory; BOOL isDirectory;
	BOOL (WINAPI *deletefunc)(); BOOL (WINAPI * deletefunc) ();
	BOOL isRelative = FALSE; BOOL isRelative = FALSE;

	attr = GetFileAttributes(lpTargetName); attr = GetFileAttributes (lpTargetName);
	if (attr == INVALID_FILE_ATTRIBUTES) if (attr == INVALID_FILE_ATTRIBUTES)
		return FALSE; return FALSE;
	isDirectory = attr & FILE_ATTRIBUTE_DIRECTORY; isDirectory = attr & FILE_ATTRIBUTE_DIRECTORY;
	deletefunc = isDirectory ? RemoveDirectory : DeleteFile; ? deletefunc = isDirectory RemoveDirectory: DeleteFile;

	if (!AcquireSymlinkPriv(lpLinkName)) if (! AcquireSymlinkPriv (lpLinkName))
		return FALSE; return FALSE;

	if (*lpTargetName == '\\' || isalpha(*lpTargetName) && lpTargetName[1] == ':') { if (* lpTargetName == '\ \' | | isalpha (* lpTargetName) && lpTargetName [1] == ':') {
		BOOL rv; BOOL rv;
		// / /
		// リンク先をフルパスにする/ / Full path where you want to link to
		// / /
		_tcscpy(namebuf, _T("\\?\?\\")); _tcscpy (namebuf, _T ("?? \ \ \ \ \"));
		if (lpTargetName[0] == '\\' && lpTargetName[1] == '\\') { if (lpTargetName [0] == '\ \' && lpTargetName [1] == '\ \') {
			// / /
			// UNCの場合はさらに UNC\ を付加/ / If UNC is adding a UNC \ further
			// / /
			rv = GetFullPathName(lpTargetName, sizeof(namebuf) / sizeof(namebuf[0]) - 6, namebuf + 6, NULL); rv = GetFullPathName (lpTargetName, sizeof (namebuf) / sizeof (namebuf [0]) - 6, namebuf + 6, NULL);
			if (!rv) { if (! rv) {
				return FALSE; return FALSE;
			} }
			_tcsncpy(namebuf + 4, _T("UNC\\"), 4); // \0 は付けないnot put the 0 / / \; _tcsncpy (namebuf + 4, _T ("UNC \ \"), 4)
		} else { } Else {
			rv = GetFullPathName(lpTargetName, sizeof(namebuf) / sizeof(namebuf[0]) - 4, namebuf + 4, NULL); rv = GetFullPathName (lpTargetName, sizeof (namebuf) / sizeof (namebuf [0]) - 4, namebuf + 4, NULL);
			if (!rv) { if (! rv) {
				return FALSE; return FALSE;
			} }
		} }
	} else { } Else {
		// / /
		// 相対パスはフルパス化しない/ / Relative path does not become full path
		// .\ とパスの途中にある ..\ は解決する/ /. \ And in the middle of the path .. \ is resolved
		// このコードはマルチバイト文字の2バイト目を考慮しないので/ / This code does not consider the second byte of a multibyte character
		// WideChar 決め打ち/ / Hard-coded WideChar
		// / /
		LPCWSTR p = lpTargetName; LPCWSTR p = lpTargetName;
		LPWSTR q = namebuf, root = namebuf; LPWSTR q = namebuf, root = namebuf;
		while (*p) { while (* p) {
			for (;;) { for (; ;) {
				if (p[0] == L'.' && p[1] == L'.' && p[2] == L'\\') { if (p [0] == L '.' && p [1] == L '.' && p [2] == L '\ \') {
					// コピー元パスの先頭かパス区切りの直後が ..\ の場合/ / If the .. \ are separated immediately after the beginning of the path or path to copy
					if (q > root) { if (q> root) {
						// その ..\ を削る/ / Delete the the .. \
						p += 3; p + = 3;
						// コピー先の末尾から一階層削る/ / Delete one level from the end of the destination
						q--; q -;
						while (q > root && q[-1] != '\\') while (q> root && q [-1]! = '\ \')
							q--; q -;
					} else { } Else {
						// コピー先から削る余地がない場合は/ / If there is no room to cut from destination
						// ..\ をコピーする/ / .. \ Copy
						// ..\ は後から ..\ が出現しても削られないよう保護する/ / .. \ Is protected so that it is not cut .. \ even if the later emergence
						memcpy(q, p, 3 * sizeof(WCHAR)); memcpy (q, p, 3 * sizeof (WCHAR));
						q += 3; q + = 3;
						root += 3; root + = 3;
						p += 3; p + = 3;
					} }
				} else if (p[0] == L'.' && p[1] == L'\\') { } Else if (p [0] == L '.' && P [1] == L '\ \') {
					// コピー元パスの先頭かパス区切りの直後が .\ の場合/ / If. \ Are separated immediately after the beginning of the path or path to copy
					// その .\ を削る/ / Delete the. \ That
					p += 2; p + = 2;
				} else { } Else {
					break; break;
				} }
			} }
			// パスの終端か次のパス区切りまでコピー/ / Copy to the end of the path or the path delimiter for the next
			while (*p && (*q++ = *p++) != '\\') while (* p && (* q + + = * p + +)! = '\ \')
				; ;
		} }
		*q = 0; * Q = 0;
		isRelative = TRUE; isRelative = TRUE;
	} }
//	_tprintf(_T("%s\n"), namebuf); / / _tprintf (_T ("% S \ n"), namebuf);

	// / /
	// リンクファイルを作成/ / Create a link file
	// / /
	if (isDirectory) { if (isDirectory) {
		if (!CreateDirectory(lpLinkName, lpsa)) if (! CreateDirectory (lpLinkName, lpsa))
			return FALSE; return FALSE;
		hFile = CreateFile(lpLinkName, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, hFile = CreateFile (lpLinkName, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
			OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
	} else { } Else {
		hFile = CreateFile(lpLinkName, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, lpsa, hFile = CreateFile (lpLinkName, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, lpsa,
			CREATE_NEW, 0, NULL); CREATE_NEW, 0, NULL);
	} }
	if (hFile == INVALID_HANDLE_VALUE) { if (hFile == INVALID_HANDLE_VALUE) {
//		_ftprintf(stderr, _T("CreateFile failed (%d)\n"), GetLastError()); / / _ftprintf (Stderr, _T ("CreateFile failed (% d) \ n"), GetLastError ());
		return FALSE; return FALSE;
	} }

	// / /
	// リパースデータを設定/ / Set a reparse data
	// / /
	u.iobuf.ReparseTag = IO_REPARSE_TAG_SYMLINK; u.iobuf.ReparseTag = IO_REPARSE_TAG_SYMLINK;
	u.iobuf.Reserved = 0; u.iobuf.Reserved = 0;
	// 表示名をコピー/ / Copy the display name
	u.iobuf.SymbolicLinkReparseBuffer.PrintNameOffset = 0; u.iobuf.SymbolicLinkReparseBuffer.PrintNameOffset = 0;
	u.iobuf.SymbolicLinkReparseBuffer.PrintNameLength = wcslen(lpTargetName) * sizeof(WCHAR); u.iobuf.SymbolicLinkReparseBuffer.PrintNameLength = wcslen (lpTargetName) * sizeof (WCHAR);
	memcpy((char *)u.iobuf.SymbolicLinkReparseBuffer.PathBuffer + u.iobuf.SymbolicLinkReparseBuffer.PrintNameOffset, memcpy ((char *) u.iobuf.SymbolicLinkReparseBuffer.PathBuffer + u.iobuf.SymbolicLinkReparseBuffer.PrintNameOffset,
		lpTargetName, u.iobuf.SymbolicLinkReparseBuffer.PrintNameLength); lpTargetName, u.iobuf.SymbolicLinkReparseBuffer.PrintNameLength);
	// 置換名をコピー/ / Copy the replacement name
	u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameOffset = u.iobuf.SymbolicLinkReparseBuffer.PrintNameOffset u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameOffset = u.iobuf.SymbolicLinkReparseBuffer.PrintNameOffset
		+ u.iobuf.SymbolicLinkReparseBuffer.PrintNameLength; + U.iobuf.SymbolicLinkReparseBuffer.PrintNameLength;
	u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameLength = wcslen(namebuf) * sizeof(WCHAR); u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameLength = wcslen (namebuf) * sizeof (WCHAR);
	memcpy((char *)u.iobuf.SymbolicLinkReparseBuffer.PathBuffer + u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameOffset, memcpy ((char *) u.iobuf.SymbolicLinkReparseBuffer.PathBuffer + u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameOffset,
		namebuf, u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameLength); namebuf, u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameLength);
	// その他の情報を設定/ / Set the other information
	u.iobuf.SymbolicLinkReparseBuffer.Flags = isRelative ? 1 : 0; ? u.iobuf.SymbolicLinkReparseBuffer.Flags = isRelative 1: 0;
	u.iobuf.ReparseDataLength = u.iobuf.ReparseDataLength =
		12 + 12 +
		u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameOffset + u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameOffset +
		u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameLength; u.iobuf.SymbolicLinkReparseBuffer.SubstituteNameLength;
	cb = 8 + u.iobuf.ReparseDataLength; cb = 8 + u.iobuf.ReparseDataLength;
	//DumpReparsePointBuf(cb); / / DumpReparsePointBuf (cb);
	if (!DeviceIoControl(hFile, FSCTL_SET_REPARSE_POINT, if (! DeviceIoControl (hFile, FSCTL_SET_REPARSE_POINT,
					&u.iobuf, cb, NULL, 0, &cb, NULL)) { & U.iobuf, cb, NULL, 0, & cb, NULL)) {
//		_ftprintf(stderr, _T("DeviceIoControl failed (%d)\n"), GetLastError()); / / _ftprintf (Stderr, _T ("DeviceIoControl failed (% d) \ n"), GetLastError ());
		CloseHandle(hFile); CloseHandle (hFile);
		deletefunc(lpLinkName); deletefunc (lpLinkName);
		return FALSE; return FALSE;
	} }

	CloseHandle(hFile); CloseHandle (hFile);
	return TRUE; return TRUE;
} }

BOOL CreateJunction(LPCTSTR lpLinkName, LPCTSTR lpTargetName, LPSECURITY_ATTRIBUTES lpsa) BOOL CreateJunction (LPCTSTR lpLinkName, LPCTSTR lpTargetName, LPSECURITY_ATTRIBUTES lpsa)
{ {
	HANDLE hFile; HANDLE hFile;
	TCHAR namebuf[MAX_PATH + 4]; TCHAR namebuf [MAX_PATH + 4];
	DWORD cb; DWORD cb;
	DWORD attr; DWORD attr;
	BOOL isDirectory; BOOL isDirectory;
	BOOL (WINAPI *deletefunc)(); BOOL (WINAPI * deletefunc) ();

	attr = GetFileAttributes(lpTargetName); attr = GetFileAttributes (lpTargetName);
	if (attr == INVALID_FILE_ATTRIBUTES) if (attr == INVALID_FILE_ATTRIBUTES)
		return FALSE; return FALSE;
	isDirectory = attr & FILE_ATTRIBUTE_DIRECTORY; isDirectory = attr & FILE_ATTRIBUTE_DIRECTORY;
	deletefunc = isDirectory ? RemoveDirectory : DeleteFile; ? deletefunc = isDirectory RemoveDirectory: DeleteFile;

	// / /
	// リンク先をフルパスにする/ / Full path where you want to link to
	// / /
	_tcscpy(namebuf, _T("\\?\?\\")); _tcscpy (namebuf, _T ("?? \ \ \ \ \"));
	if (!GetFullPathName(lpTargetName, sizeof(namebuf) / sizeof(namebuf[0]) - 4, namebuf + 4, NULL)) { if (! GetFullPathName (lpTargetName, sizeof (namebuf) / sizeof (namebuf [0]) - 4, namebuf + 4, NULL)) {
//		_ftprintf(stderr, _T("GetFullPathName failed (%d)\n"), GetLastError()); / / _ftprintf (Stderr, _T ("GetFullPathName failed (% d) \ n"), GetLastError ());
		return FALSE; return FALSE;
	} }
//	_tprintf(_T("%s\n"), namebuf); / / _tprintf (_T ("% S \ n"), namebuf);
#ifdef UNICODE # Ifdef UNICODE
	if (!lstrcpyn(u.iobuf.MountPointReparseBuffer.PathBuffer, namebuf, MAXIMUM_REPARSE_DATA_BUFFER_SIZE)) if (! lstrcpyn (u.iobuf.MountPointReparseBuffer.PathBuffer, namebuf, MAXIMUM_REPARSE_DATA_BUFFER_SIZE))
#else # Else
	if (!MultiByteToWideChar(CP_ACP, 0, namebuf, -1, if (! MultiByteToWideChar (CP_ACP, 0, namebuf, -1,
			u.iobuf.MountPointReparseBuffer.PathBuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE)) u.iobuf.MountPointReparseBuffer.PathBuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE))
#endif # Endif
	{ {
//		_ftprintf(stderr, _T("MultiByteToWideChar failed (%d)\n"), GetLastError()); / / _ftprintf (Stderr, _T ("MultiByteToWideChar failed (% d) \ n"), GetLastError ());
		return FALSE; return FALSE;
	} }

	// / /
	// リンクファイルを作成/ / Create a link file
	// / /
	if (isDirectory) { if (isDirectory) {
		if (!CreateDirectory(lpLinkName, lpsa)) if (! CreateDirectory (lpLinkName, lpsa))
			return FALSE; return FALSE;
		hFile = CreateFile(lpLinkName, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, hFile = CreateFile (lpLinkName, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
			OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
	} else { } Else {
		hFile = CreateFile(lpLinkName, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, lpsa, hFile = CreateFile (lpLinkName, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, lpsa,
			CREATE_NEW, 0, NULL); CREATE_NEW, 0, NULL);
	} }
	if (hFile == INVALID_HANDLE_VALUE) { if (hFile == INVALID_HANDLE_VALUE) {
//		_ftprintf(stderr, _T("CreateFile failed (%d)\n"), GetLastError()); / / _ftprintf (Stderr, _T ("CreateFile failed (% d) \ n"), GetLastError ());
		return FALSE; return FALSE;
	} }

	// / /
	// リパースデータを設定/ / Set a reparse data
	// / /
	u.iobuf.ReparseTag = IO_REPARSE_TAG_MOUNT_POINT; u.iobuf.ReparseTag = IO_REPARSE_TAG_MOUNT_POINT;
	u.iobuf.Reserved = 0; u.iobuf.Reserved = 0;
	u.iobuf.MountPointReparseBuffer.SubstituteNameOffset = 0; u.iobuf.MountPointReparseBuffer.SubstituteNameOffset = 0;
	u.iobuf.MountPointReparseBuffer.SubstituteNameLength = wcslen(u.iobuf.MountPointReparseBuffer.PathBuffer) * 2; u.iobuf.MountPointReparseBuffer.SubstituteNameLength = wcslen (u.iobuf.MountPointReparseBuffer.PathBuffer) * 2;
	u.iobuf.MountPointReparseBuffer.PrintNameOffset = u.iobuf.MountPointReparseBuffer.SubstituteNameLength + 2; u.iobuf.MountPointReparseBuffer.PrintNameOffset = u.iobuf.MountPointReparseBuffer.SubstituteNameLength + 2;
	u.iobuf.MountPointReparseBuffer.PrintNameLength = 0; u.iobuf.MountPointReparseBuffer.PrintNameLength = 0;
	memset((char *)u.iobuf.MountPointReparseBuffer.PathBuffer + memset ((char *) u.iobuf.MountPointReparseBuffer.PathBuffer +
		u.iobuf.MountPointReparseBuffer.SubstituteNameLength, 0, 4); u.iobuf.MountPointReparseBuffer.SubstituteNameLength, 0, 4);
	u.iobuf.ReparseDataLength = u.iobuf.ReparseDataLength =
		8 + 8 +
		u.iobuf.MountPointReparseBuffer.PrintNameOffset + u.iobuf.MountPointReparseBuffer.PrintNameOffset +
		u.iobuf.MountPointReparseBuffer.PrintNameLength + 2; u.iobuf.MountPointReparseBuffer.PrintNameLength + 2;
	cb = 8 + u.iobuf.ReparseDataLength; cb = 8 + u.iobuf.ReparseDataLength;
	if (!DeviceIoControl(hFile, FSCTL_SET_REPARSE_POINT, if (! DeviceIoControl (hFile, FSCTL_SET_REPARSE_POINT,
					&u.iobuf, cb, NULL, 0, &cb, NULL)) { & U.iobuf, cb, NULL, 0, & cb, NULL)) {
//		_ftprintf(stderr, _T("DeviceIoControl failed (%d)\n"), GetLastError()); / / _ftprintf (Stderr, _T ("DeviceIoControl failed (% d) \ n"), GetLastError ());
		CloseHandle(hFile); CloseHandle (hFile);
		deletefunc(lpLinkName); deletefunc (lpLinkName);
		return FALSE; return FALSE;
	} }

	CloseHandle(hFile); CloseHandle (hFile);
	return TRUE; return TRUE;
} }

BOOL DumpReparsePoint(LPCTSTR lpFileName) BOOL DumpReparsePoint (LPCTSTR lpFileName)
{ {
	HANDLE hFile = CreateFile(lpFileName, 0/*GENERIC_READ*/, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, HANDLE hFile = CreateFile (lpFileName, 0 / * GENERIC_READ * /, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
		OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
//		OPEN_EXISTING, 0, NULL); / / OPEN_EXISTING, 0, NULL);
	BY_HANDLE_FILE_INFORMATION bhfi; BY_HANDLE_FILE_INFORMATION bhfi;
	DWORD size = 0; DWORD size = 0;
	DWORD cb; DWORD cb;
	char *p = NULL; char * p = NULL;
	if (hFile == INVALID_HANDLE_VALUE) { if (hFile == INVALID_HANDLE_VALUE) {
		fprintf(stderr, "CreateFile failed (%d)\n", GetLastError()); fprintf (stderr, "CreateFile failed (% d) \ n", GetLastError ());
	} }
	GetFileInformationByHandle(hFile, &bhfi); GetFileInformationByHandle (hFile, & bhfi);
	printf("attr = %#08x\nlinks = %d\n", bhfi.dwFileAttributes, bhfi.nNumberOfLinks); printf ("attr =% # 08x \ nlinks =% d \ n", bhfi.dwFileAttributes, bhfi.nNumberOfLinks);
	printf("%d\n", size = GetFileSize(hFile, NULL)); printf ("% d \ n", size = GetFileSize (hFile, NULL));
#if 1 # If 1
	if ((long)size > 0) { if ((long) size> 0) {
		p = (char *)malloc(size + 1); p = (char *) malloc (size + 1);
		if ((long)size > 0 && !ReadFile(hFile, p, size, &size, NULL)) { if ((long) size> 0 &&! ReadFile (hFile, p, size, & size, NULL)) {
			fprintf(stderr, "ReadFile failed (%d)\n", GetLastError()); fprintf (stderr, "ReadFile failed (% d) \ n", GetLastError ());
			size = 0; size = 0;
	//		return FALSE; / / Return FALSE;
		} }
		p[size] = 0; p [size] = 0;
		printf("%s", p); printf ("% s", p);
		if (p) free(p); if (p) free (p);
	} }
	CloseHandle(hFile); CloseHandle (hFile);
	puts("using OS Handle"); puts ("using OS Handle");
#elif 0 # Elif 0
	int fd = _open_osfhandle((long)hFile, O_BINARY | O_RDONLY); int fd = _open_osfhandle ((long) hFile, O_BINARY | O_RDONLY);
	char *p = (char *)malloc(size + 1); char * p = (char *) malloc (size + 1);
	read(fd, p, size); read (fd, p, size);
	p[size] = 0; p [size] = 0;
	printf("%s", p); printf ("% s", p);
	free(p); free (p);
	close(fd); close (fd);
	puts("using CRT Handle"); puts ("using CRT Handle");
#else # Else
	int fd = _open_osfhandle((long)hFile, O_BINARY | O_RDONLY); int fd = _open_osfhandle ((long) hFile, O_BINARY | O_RDONLY);
	FILE *fp = fdopen(fd, "rb"); FILE * fp = fdopen (fd, "rb");
	char *p = (char *)malloc(size + 1); char * p = (char *) malloc (size + 1);
#if 1 # If 1
	int c; int c;
	while ((c = getc(fp)) != EOF) { while ((c = getc (fp))! = EOF) {
		printf("%c", c); printf ("% c", c);
	} }
	fflush(fp); fflush (fp);
	puts("using getc"); puts ("using getc");
#elif 1 # Elif 1
	char buf[256]; char buf [256];
	if (fp) if (fp)
		while (fgets(buf, sizeof(buf), fp) != NULL) { while (fgets (buf, sizeof (buf), fp)! = NULL) {
			printf("%s", buf); printf ("% s", buf);
		} }
	} }
	puts("using fgets"); puts ("using fgets");
#else # Else
	fread(p, 1, size, fp); fread (p, 1, size, fp);
	p[size] = 0; p [size] = 0;
	printf("%s", p); printf ("% s", p);
	puts("using fread"); puts ("using fread");
#endif # Endif
	free(p); free (p);
	if (fp) if (fp)
		fclose(fp); fclose (fp);
	puts("using file stream"); puts ("using file stream");
#endif # Endif
	hFile = CreateFile(lpFileName, 0/*GENERIC_WRITE*/, 0, NULL, hFile = CreateFile (lpFileName, 0 / * GENERIC_WRITE * /, 0, NULL,
		OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, NULL); OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, NULL);
	if (hFile == INVALID_HANDLE_VALUE) { if (hFile == INVALID_HANDLE_VALUE) {
		fprintf(stderr, "CreateFile failed (%d)\n", GetLastError()); fprintf (stderr, "CreateFile failed (% d) \ n", GetLastError ());
		return FALSE; return FALSE;
	} }
	if (!DeviceIoControl(hFile, FSCTL_GET_REPARSE_POINT, if (! DeviceIoControl (hFile, FSCTL_GET_REPARSE_POINT,
					NULL, 0, NULL, 0,
					&u.iobuf, 1024, & U.iobuf, 1024,
					&cb, NULL)) { & Cb, NULL)) {
		fprintf(stderr, "DeviceIoControl failed (%d)\n", GetLastError()); fprintf (stderr, "DeviceIoControl failed (% d) \ n", GetLastError ());
		return FALSE; return FALSE;
	} }
	DumpReparsePointBuf(cb); DumpReparsePointBuf (cb);

	return TRUE; return TRUE;
} }

int _tmain(int argc, TCHAR **argv) int _tmain (int argc, TCHAR ** argv)
{ {
	LPCTSTR target = NULL, link = NULL; LPCTSTR target = NULL, link = NULL;
	int sflag = 0, jflag = 0; int sflag = 0, jflag = 0;
	BOOL r; BOOL r;

	_tsetlocale(LC_ALL, _T("")); _tsetlocale (LC_ALL, _T (""));

	myname = argv[0]; myname = argv [0];
	if (argc < 2) { if (argc <2) {
		_ftprintf(stderr, _T("usage: %s [-s|-j] <target> <linkname>\n"), argv[0]); _ftprintf (stderr, _T ("usage:% s [-s |-j] <target> <linkname> \ n"), argv [0]);
		return EXIT_FAILURE; return EXIT_FAILURE;
	} }
	if (argc < 3) { if (argc <3) {
		DumpReparsePoint(argv[1]); DumpReparsePoint (argv [1]);
		return 0; return 0;
	} }
	while (*++argv) { while (* + + argv) {
		if (!_tcscmp(*argv, _T("-s"))) { if (! _tcscmp (* argv, _T ("-s"))) {
			sflag = 1; sflag = 1;
		} else if (!_tcscmp(*argv, _T("-j"))) { } Else if (! _tcscmp (* Argv, _T ("-j"))) {
			jflag = 1; jflag = 1;
		} else if (!target) { } Else if (! Target) {
			target = *argv; target = * argv;
		} else if (!link) { } Else if (! Link) {
			link = *argv; link = * argv;
		} }
	} }
	if (sflag) { if (sflag) {
		r = CreateSymlink(link, target, NULL); r = CreateSymlink (link, target, NULL);
	} else if (jflag) { } Else if (jflag) {
		r = CreateJunction(link, target, NULL); r = CreateJunction (link, target, NULL);
	} else { } Else {
		r = CreateHardLink(link, target, NULL); r = CreateHardLink (link, target, NULL);
	} }
	if (!r) { if (! r) {
		PrintWin32Error(myname); PrintWin32Error (myname);
		return EXIT_FAILURE; return EXIT_FAILURE;
	} }
	return 0; return 0;
} }

<script>_addload(function(){_setupIW();_csi('ja','en','ln.c');});</script>


and finally symlink.c

Spoiler:
Code:
Translated version of symlink.c
// / /
// Symlink - ntfs.sys にパッチを当ててファイルに対するジャンクションを有効にする/ / Symlink - to enable the junction to the ntfs.sys file to patch
// / /
#include <ntddk.h> # Include <ntddk.h>
#include "symlink.h" # Include "symlink.h"

// / /
// このドライバオブジェクト/ / This driver object
// / /
PDRIVER_OBJECT SymlinkDriver; PDRIVER_OBJECT SymlinkDriver;

// / /
// このドライバの制御デバイスオブジェクト/ / Control device object for this driver
// / /
PDEVICE_OBJECT SymlinkController; PDEVICE_OBJECT SymlinkController;

// / /
// アンロード進行中を示すフラグ/ / Flag to indicate progress unload
// / /
BOOLEAN UnloadInProgress = FALSE; BOOLEAN UnloadInProgress = FALSE;

// / /
// 進行中の IRP の数/ / Number of IRP in progress
// / /
#if DBG # If DBG
ULONG OutstandingIRPCount = 0; ULONG OutstandingIRPCount = 0;
KSPIN_LOCK CountMutex; KSPIN_LOCK CountMutex;
#endif // DBG # Endif / / DBG

// / /
// ディスパッチエントリ用の完全パス名の lookaside / / Lookaside the full path name for the dispatch entry
// / /
PAGED_LOOKASIDE_LIST FullPathLookaside; PAGED_LOOKASIDE_LIST FullPathLookaside;


///////////////////////////////////////////////////////////////////////////// / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
// / /
//  各ルーチンにテキストセクションを割り当て/ / Assign text sections for each routine
// / /
///////////////////////////////////////////////////////////////////////////// / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath); NTSTATUS DriverEntry (IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath);

#if DBG # If DBG
VOID SymlinkUnload(IN PDRIVER_OBJECT DriverObject); VOID SymlinkUnload (IN PDRIVER_OBJECT DriverObject);
#endif # Endif

VOID SymlinkFsNotification( VOID SymlinkFsNotification (
	PDEVICE_OBJECT DeviceObject, PDEVICE_OBJECT DeviceObject,
	BOOLEAN FsActive BOOLEAN FsActive
	); );

NTSTATUS NTSTATUS
SymlinkHookDone( SymlinkHookDone (
	IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
	IN PIRP Irp, IN PIRP Irp,
	IN PVOID Context IN PVOID Context
	); );

BOOLEAN SymlinkFilterDevice(PDEVICE_OBJECT DeviceObject); BOOLEAN SymlinkFilterDevice (PDEVICE_OBJECT DeviceObject);

VOID SymlinkResolveLink(IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp, IN PWSTR fullPathName); VOID SymlinkResolveLink (IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp, IN PWSTR fullPathName);

BOOLEAN BOOLEAN
SymlinkFastIoCheckIfPossible( SymlinkFastIoCheckIfPossible (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN ULONG Length, IN ULONG Length,
	IN BOOLEAN Wait, IN BOOLEAN Wait,
	IN ULONG LockKey, IN ULONG LockKey,
	IN BOOLEAN CheckForReadOperation, IN BOOLEAN CheckForReadOperation,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	); );

BOOLEAN BOOLEAN
SymlinkFastIoRead( SymlinkFastIoRead (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN ULONG Length, IN ULONG Length,
	IN BOOLEAN Wait, IN BOOLEAN Wait,
	IN ULONG LockKey, IN ULONG LockKey,
	OUT PVOID Buffer, OUT PVOID Buffer,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	); );

BOOLEAN BOOLEAN
SymlinkFastIoWrite( SymlinkFastIoWrite (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN ULONG Length, IN ULONG Length,
	IN BOOLEAN Wait, IN BOOLEAN Wait,
	IN ULONG LockKey, IN ULONG LockKey,
	IN PVOID Buffer, IN PVOID Buffer,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	); );

BOOLEAN BOOLEAN
SymlinkFastIoQueryBasicInfo( SymlinkFastIoQueryBasicInfo (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN BOOLEAN Wait, IN BOOLEAN Wait,
	OUT PFILE_BASIC_INFORMATION Buffer, OUT PFILE_BASIC_INFORMATION Buffer,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	); );

BOOLEAN BOOLEAN
SymlinkFastIoQueryStandardInfo( SymlinkFastIoQueryStandardInfo (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN BOOLEAN Wait, IN BOOLEAN Wait,
	OUT PFILE_STANDARD_INFORMATION Buffer, OUT PFILE_STANDARD_INFORMATION Buffer,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	); );

BOOLEAN BOOLEAN
SymlinkFastIoLock( SymlinkFastIoLock (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN PLARGE_INTEGER Length, IN PLARGE_INTEGER Length,
	PEPROCESS ProcessId, PEPROCESS ProcessId,
	ULONG Key, ULONG Key,
	BOOLEAN FailImmediately, BOOLEAN FailImmediately,
	BOOLEAN ExclusiveLock, BOOLEAN ExclusiveLock,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	); );

BOOLEAN BOOLEAN
SymlinkFastIoUnlockSingle( SymlinkFastIoUnlockSingle (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN PLARGE_INTEGER Length, IN PLARGE_INTEGER Length,
	PEPROCESS ProcessId, PEPROCESS ProcessId,
	ULONG Key, ULONG Key,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	); );

BOOLEAN BOOLEAN
SymlinkFastIoUnlockAll( SymlinkFastIoUnlockAll (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	PEPROCESS ProcessId, PEPROCESS ProcessId,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	); );

BOOLEAN BOOLEAN
SymlinkFastIoUnlockAllByKey( SymlinkFastIoUnlockAllByKey (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	PEPROCESS ProcessId, PEPROCESS ProcessId,
	ULONG Key, ULONG Key,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	); );

BOOLEAN BOOLEAN
SymlinkFastIoDeviceControl( SymlinkFastIoDeviceControl (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN BOOLEAN Wait, IN BOOLEAN Wait,
	IN PVOID InputBuffer, IN PVOID InputBuffer,
	IN ULONG InputBufferLength, IN ULONG InputBufferLength,
	OUT PVOID OutputBuffer, OUT PVOID OutputBuffer,
	IN ULONG OutputBufferLength, IN ULONG OutputBufferLength,
	IN ULONG IoControlCode, IN ULONG IoControlCode,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	); );

VOID VOID
SymlinkFastIoDetachDevice( SymlinkFastIoDetachDevice (
	PDEVICE_OBJECT SourceDevice, PDEVICE_OBJECT SourceDevice,
	PDEVICE_OBJECT TargetDevice PDEVICE_OBJECT TargetDevice
	); );

BOOLEAN BOOLEAN
SymlinkFastIoQueryNetworkOpenInfo( SymlinkFastIoQueryNetworkOpenInfo (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN BOOLEAN Wait, IN BOOLEAN Wait,
	OUT struct _FILE_NETWORK_OPEN_INFORMATION *Buffer, OUT struct _FILE_NETWORK_OPEN_INFORMATION * Buffer,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	); );

BOOLEAN BOOLEAN
SymlinkFastIoMdlRead( SymlinkFastIoMdlRead (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN ULONG Length, IN ULONG Length,
	IN ULONG LockKey, IN ULONG LockKey,
	OUT PMDL *MdlChain, OUT PMDL * MdlChain,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	); );

BOOLEAN BOOLEAN
SymlinkFastIoPrepareMdlWrite( SymlinkFastIoPrepareMdlWrite (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN ULONG Length, IN ULONG Length,
	IN ULONG LockKey, IN ULONG LockKey,
	OUT PMDL *MdlChain, OUT PMDL * MdlChain,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	); );

BOOLEAN BOOLEAN
SymlinkFastIoMdlWriteComplete( SymlinkFastIoMdlWriteComplete (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN PMDL MdlChain, IN PMDL MdlChain,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	); );

BOOLEAN BOOLEAN
SymlinkFastIoReadCompressed( SymlinkFastIoReadCompressed (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN ULONG Length, IN ULONG Length,
	IN ULONG LockKey, IN ULONG LockKey,
	OUT PVOID Buffer, OUT PVOID Buffer,
	OUT PMDL *MdlChain, OUT PMDL * MdlChain,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	OUT struct _COMPRESSED_DATA_INFO *CompressedDataInfo, OUT struct _COMPRESSED_DATA_INFO * CompressedDataInfo,
	IN ULONG CompressedDataInfoLength, IN ULONG CompressedDataInfoLength,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	); );

BOOLEAN BOOLEAN
SymlinkFastIoWriteCompressed( SymlinkFastIoWriteCompressed (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN ULONG Length, IN ULONG Length,
	IN ULONG LockKey, IN ULONG LockKey,
	OUT PVOID Buffer, OUT PVOID Buffer,
	OUT PMDL *MdlChain, OUT PMDL * MdlChain,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	OUT struct _COMPRESSED_DATA_INFO *CompressedDataInfo, OUT struct _COMPRESSED_DATA_INFO * CompressedDataInfo,
	IN ULONG CompressedDataInfoLength, IN ULONG CompressedDataInfoLength,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	); );

BOOLEAN BOOLEAN
SymlinkFastIoQueryOpen( SymlinkFastIoQueryOpen (
	IN PIRP Irp, IN PIRP Irp,
	OUT PFILE_NETWORK_OPEN_INFORMATION NetworkInformation, OUT PFILE_NETWORK_OPEN_INFORMATION NetworkInformation,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	); );

BOOLEAN BOOLEAN
SymlinkQueryRoot( SymlinkQueryRoot (
	PDEVICE_OBJECT DeviceObject, PDEVICE_OBJECT DeviceObject,
	PHOOK_EXTENSION hookExt PHOOK_EXTENSION hookExt
	); );

VOID VOID
SymlinkGetFullPath( SymlinkGetFullPath (
	PFILE_OBJECT fileObject, PFILE_OBJECT fileObject,
	PHOOK_EXTENSION hookExt, PHOOK_EXTENSION hookExt,
	PWSTR fullPathName PWSTR fullPathName
	); );

VOID SymlinkDeleteDevice(IN PDEVICE_OBJECT DeviceObject); VOID SymlinkDeleteDevice (IN PDEVICE_OBJECT DeviceObject);

BOOLEAN CallBackFastIoDeviceControl( BOOLEAN CallBackFastIoDeviceControl (
	IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, IN PFILE_OBJECT FileObject, IN BOOLEAN Wait,
	IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID InputBuffer, IN ULONG InputBufferLength,
	OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN ULONG IoControlCode, OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN ULONG IoControlCode,
	OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject); OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject);

VOID SymlinkQueryAttributeTag(IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp); VOID SymlinkQueryAttributeTag (IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp);

#ifdef ALLOC_PRAGMA # Ifdef ALLOC_PRAGMA
#pragma alloc_text(INIT, DriverEntry) # Pragma alloc_text (INIT, DriverEntry)
#if DBG # If DBG
#pragma alloc_text(PAGE, SymlinkUnload) # Pragma alloc_text (PAGE, SymlinkUnload)
#endif # Endif
#pragma alloc_text(PAGE, SymlinkFsNotification) # Pragma alloc_text (PAGE, SymlinkFsNotification)
#pragma alloc_text(PAGE, SymlinkHookDone) # Pragma alloc_text (PAGE, SymlinkHookDone)
#pragma alloc_text(PAGE, SymlinkFilterDevice) # Pragma alloc_text (PAGE, SymlinkFilterDevice)
#pragma alloc_text(PAGE, SymlinkResolveLink) # Pragma alloc_text (PAGE, SymlinkResolveLink)
#pragma alloc_text(PAGE, SymlinkFastIoCheckIfPossible) # Pragma alloc_text (PAGE, SymlinkFastIoCheckIfPossible)
#pragma alloc_text(PAGE, SymlinkFastIoRead) # Pragma alloc_text (PAGE, SymlinkFastIoRead)
#pragma alloc_text(PAGE, SymlinkFastIoWrite) # Pragma alloc_text (PAGE, SymlinkFastIoWrite)
#pragma alloc_text(PAGE, SymlinkFastIoQueryBasicInfo) # Pragma alloc_text (PAGE, SymlinkFastIoQueryBasicInfo)
#pragma alloc_text(PAGE, SymlinkFastIoQueryStandardInfo) # Pragma alloc_text (PAGE, SymlinkFastIoQueryStandardInfo)
#pragma alloc_text(PAGE, SymlinkFastIoLock) # Pragma alloc_text (PAGE, SymlinkFastIoLock)
#pragma alloc_text(PAGE, SymlinkFastIoUnlockSingle) # Pragma alloc_text (PAGE, SymlinkFastIoUnlockSingle)
#pragma alloc_text(PAGE, SymlinkFastIoUnlockAll) # Pragma alloc_text (PAGE, SymlinkFastIoUnlockAll)
#pragma alloc_text(PAGE, SymlinkFastIoUnlockAllByKey) # Pragma alloc_text (PAGE, SymlinkFastIoUnlockAllByKey)
#pragma alloc_text(PAGE, SymlinkFastIoDeviceControl) # Pragma alloc_text (PAGE, SymlinkFastIoDeviceControl)
#pragma alloc_text(PAGE, SymlinkFastIoDetachDevice) # Pragma alloc_text (PAGE, SymlinkFastIoDetachDevice)
#pragma alloc_text(PAGE, SymlinkFastIoQueryNetworkOpenInfo) # Pragma alloc_text (PAGE, SymlinkFastIoQueryNetworkOpenInfo)
#pragma alloc_text(PAGE, SymlinkFastIoMdlRead) # Pragma alloc_text (PAGE, SymlinkFastIoMdlRead)
#pragma alloc_text(PAGE, SymlinkFastIoPrepareMdlWrite) # Pragma alloc_text (PAGE, SymlinkFastIoPrepareMdlWrite)
#pragma alloc_text(PAGE, SymlinkFastIoMdlWriteComplete) # Pragma alloc_text (PAGE, SymlinkFastIoMdlWriteComplete)
#pragma alloc_text(PAGE, SymlinkFastIoReadCompressed) # Pragma alloc_text (PAGE, SymlinkFastIoReadCompressed)
#pragma alloc_text(PAGE, SymlinkFastIoWriteCompressed) # Pragma alloc_text (PAGE, SymlinkFastIoWriteCompressed)
#pragma alloc_text(PAGE, SymlinkFastIoQueryOpen) # Pragma alloc_text (PAGE, SymlinkFastIoQueryOpen)
#pragma alloc_text(PAGE, SymlinkQueryRoot) # Pragma alloc_text (PAGE, SymlinkQueryRoot)
#pragma alloc_text(PAGE, SymlinkGetFullPath) # Pragma alloc_text (PAGE, SymlinkGetFullPath)
#pragma alloc_text(PAGE, SymlinkDeleteDevice) # Pragma alloc_text (PAGE, SymlinkDeleteDevice)
#pragma alloc_text(PAGE, CallBackFastIoDeviceControl) # Pragma alloc_text (PAGE, CallBackFastIoDeviceControl)
#pragma alloc_text(PAGE, SymlinkQueryAttributeTag) # Pragma alloc_text (PAGE, SymlinkQueryAttributeTag)
#endif # Endif


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkQueryRoot / / SymlinkQueryRoot
// / /
// hookExt に VDO の名前を設定する。 / / Set the name of the VDO to hookExt.
// hookExt->FileSystem はまだ初期化されていないかもしれないので/ / Because it might not have been initialized yet hookExt-> FileSystem
// 触らないこと。 / / Do not touch.
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkQueryRoot( SymlinkQueryRoot (
	PDEVICE_OBJECT DeviceObject, PDEVICE_OBJECT DeviceObject,
	PHOOK_EXTENSION hookExt PHOOK_EXTENSION hookExt
	) )
{ {
	OBJECT_NAME_INFORMATION nameInfo; OBJECT_NAME_INFORMATION nameInfo;
	POBJECT_NAME_INFORMATION nameBuffer; POBJECT_NAME_INFORMATION nameBuffer;
	ULONG bufferLength; ULONG bufferLength;
	NTSTATUS status; NTSTATUS status;

	PAGED_CODE(); PAGED_CODE ();
	hookExt->RootChecked = TRUE; hookExt-> RootChecked = TRUE;

	status = ObQueryNameString(DeviceObject, &nameInfo, sizeof(OBJECT_NAME_INFORMATION), &bufferLength); status = ObQueryNameString (DeviceObject, & nameInfo, sizeof (OBJECT_NAME_INFORMATION), & bufferLength);
	if (!NT_SUCCESS(status) && status != STATUS_INFO_LENGTH_MISMATCH) { if (! NT_SUCCESS (status) && status! = STATUS_INFO_LENGTH_MISMATCH) {
		KdPrint(("Symlink: Cannot query object name. status=%x\n", status)); KdPrint ((". Symlink: Cannot query object name status =% x \ n", status));
		return FALSE; return FALSE;
	} }
	//KdPrint(("Symlink: required buffer length=%lu\n", bufferLength)); / / KdPrint (("Symlink: required buffer length =% lu \ n", bufferLength));
	nameBuffer = ExAllocatePoolWithTag(NonPagedPool, bufferLength, 'lmyS'); nameBuffer = ExAllocatePoolWithTag (NonPagedPool, bufferLength, 'lmyS');
	if (!nameBuffer) { if (! nameBuffer) {
		KdPrint(("Symlink: Not enough memory allocating name buffer.\n")); KdPrint ((". Symlink: Not enough memory allocating name buffer \ n"));
		return FALSE; return FALSE;
	} }
	status = ObQueryNameString(DeviceObject, nameBuffer, bufferLength, &bufferLength); status = ObQueryNameString (DeviceObject, nameBuffer, bufferLength, & bufferLength);
	if (!NT_SUCCESS(status)) { if (! NT_SUCCESS (status)) {
		KdPrint(("Symlink: Cannot query object name.\n")); KdPrint ((". Symlink: Cannot query object name \ n"));
		ExFreePool(nameBuffer); ExFreePool (nameBuffer);
		return FALSE; return FALSE;
	} }
	// / /
	// 名前が空だったらエラーにする/ / If you were to name an empty error
	// / /
	if (!nameBuffer->Name.Length) { if (! nameBuffer-> Name.Length) {
		KdPrint(("Symlink: Object name is empty.\n")); KdPrint ((". Symlink: Object name is empty \ n"));
		ExFreePool(nameBuffer); ExFreePool (nameBuffer);
		return FALSE; return FALSE;
	} }

	KdPrint(("Symlink: object name: %wZ\n", &nameBuffer->Name)); KdPrint (("Symlink: object name:% wZ \ n", & nameBuffer-> Name));
	hookExt->Root = nameBuffer; hookExt-> Root = nameBuffer;

	return TRUE; return TRUE;
} }

//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkGetFullPath / / SymlinkGetFullPath
// / /
// ファイルオブジェクトとファイル名を取り、整形して完全パス名を返す。 / / Takes a file name and a file object and returns the full path name to shape.
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
VOID VOID
SymlinkGetFullPath( SymlinkGetFullPath (
	PFILE_OBJECT fileObject, PFILE_OBJECT fileObject,
	PHOOK_EXTENSION hookExt, PHOOK_EXTENSION hookExt,
	PWSTR fullPathName PWSTR fullPathName
	) )
{ {
	ULONG pathLen, prefixLen, slashes; ULONG pathLen, prefixLen, slashes;
	PWSTR pathOffset, ptr; PWSTR pathOffset, ptr;
	PFILE_OBJECT relatedFileObject; PFILE_OBJECT relatedFileObject;
	PUNICODE_STRING fileName; PUNICODE_STRING fileName;
	PUNICODE_STRING relatedName; PUNICODE_STRING relatedName;

	PAGED_CODE(); PAGED_CODE ();
	if (!hookExt || !fullPathName) if (hookExt |! |! fullPathName)
		return; return;
	fullPathName[0] = 0; fullPathName [0] = 0;

	// / /
	// 名前をファイルオブジェクトから構築する/ / Construct an object from a file name
	// / /

	// / /
	// ファイルオブジェクトがなければ名前を尋ねることさえできない/ / I can not even ask for the name if there is no object file
	// / /
	if (!fileObject) if (! fileObject)
		return; return;

	// / /
	// プレフィックスの長さを計算/ / Calculate the length of the prefix
	// / /
	if (hookExt->Root) { if (hookExt-> Root) {
		prefixLen = hookExt->Root->Name.Length / sizeof(WCHAR); prefixLen = hookExt-> Root-> Name.Length / sizeof (WCHAR);
	} else if (!hookExt->RootChecked) { } Else if (! HookExt-> RootChecked) {
		if (!SymlinkQueryRoot(fileObject->DeviceObject, hookExt)) if (! SymlinkQueryRoot (fileObject-> DeviceObject, hookExt))
			return; return;
		if (!hookExt->Root) if (! hookExt-> Root)
			return; return;
		prefixLen = hookExt->Root->Name.Length / sizeof(WCHAR); prefixLen = hookExt-> Root-> Name.Length / sizeof (WCHAR);
	} else { } Else {
		// ルートディレクトリ名が不明/ / Name of the root directory is unknown
		return; return;
	} }

	// / /
	// 変数を初期化/ / Initialize variables
	// / /
	fileName = NULL; fileName = NULL;
	relatedName = NULL; relatedName = NULL;

	// / /
	// オブジェクト名に基づいて名前を構築/ / Construct a name based on the name of the object
	// / /

	// / /
	// この時点で名前がなければ、デバイスへの raw アクセスを示す/ / If there is no name at this point shows the raw access to the device
	// 相対パスの構築においては意味をなさないのでエラーにする/ / I want to error in the construction of the relative path does not make sense
	// / /
	if (!fileObject->FileName.Buffer) if (! fileObject-> FileName.Buffer)
		return; return;

	// / /
	// 完全なパス名を作成する。 / / Create the full path name.まず、セパレータの空白と先頭のプレフィックスをFirst, the prefix and the first space of the separator
	// 考慮して長さを計算する/ / Calculate the length due
	// / /
	fileName = &fileObject->FileName; fileName = & fileObject-> FileName;

	pathLen = fileName->Length / sizeof(WCHAR) + prefixLen; pathLen = fileName-> Length / sizeof (WCHAR) + prefixLen;
	relatedFileObject = fileObject->RelatedFileObject; relatedFileObject = fileObject-> RelatedFileObject;

	// / /
	// 相対ファイル名の場合のみ関連ファイルオブジェクトを見る/ / See the file related object only if a relative file name
	// / /
	if (fileName->Buffer[0] != L'\\' && if (fileName-> Buffer [0]! = L '\ \' &&
		relatedFileObject && relatedFileObject->FileName.Length) { relatedFileObject && relatedFileObject-> FileName.Length) {

		relatedName = &relatedFileObject->FileName; relatedName = & relatedFileObject-> FileName;
		pathLen += relatedName->Length / sizeof(WCHAR) + 1; pathLen + = relatedName-> Length / sizeof (WCHAR) + 1;
	} }

	// / /
	// 名前が長すぎたら終了/ / End if the name is too long
	// / /
	if (pathLen >= MAXPATHLEN) if (pathLen> = MAXPATHLEN)
		return; return;

	// / /
	// まずルートディレクトリ名を先頭に追加/ / Add the name of the root directory to the top first
	// / /
	ASSERT(hookExt->Root); ASSERT (hookExt-> Root);
	RtlCopyMemory(fullPathName, hookExt->Root->Name.Buffer, hookExt->Root->Name.Length); RtlCopyMemory (fullPathName, hookExt-> Root-> Name.Buffer, hookExt-> Root-> Name.Length);

	// / /
	// パス名を構築/ / Build the path name
	// / /
	fullPathName[pathLen] = 0; fullPathName [pathLen] = 0;

	pathOffset = fullPathName + pathLen - fileName->Length / sizeof(WCHAR); pathOffset = fullPathName + pathLen - fileName-> Length / sizeof (WCHAR);
	memcpy(pathOffset, fileName->Buffer, fileName->Length); memcpy (pathOffset, fileName-> Buffer, fileName-> Length);

	// / /
	// FIXME: RelatedFileObject->FileName を見てはいけない/ / FIXME: I do not see the RelatedFileObject-> FileName
	// 自力で IRP_MJ_QUERY_INFORMATION を発行して FSD に尋ねるべし/ / I should ask to issue a FSD IRP_MJ_QUERY_INFORMATION on their own
	// / /
	if (fileName->Buffer[0] != L'\\' && if (fileName-> Buffer [0]! = L '\ \' &&
		relatedFileObject && relatedFileObject->FileName.Length) { relatedFileObject && relatedFileObject-> FileName.Length) {

		// / /
		// バックスラッシュの区切りを追加しつつ構成要素をコピー/ / Copy the elements while adding a backslash separator
		// / /
		pathOffset[-1] = L'\\'; pathOffset [-1] = L '\ \';
		pathOffset -= relatedName->Length / sizeof(WCHAR) + 1; pathOffset - = relatedName-> Length / sizeof (WCHAR) + 1;

		memcpy(pathOffset, relatedName->Buffer, relatedName->Length); memcpy (pathOffset, relatedName-> Buffer, relatedName-> Length);

		// / /
		// 先頭に余分なバックスラッシュがあったら取り除く/ / Remove there was extra backslash to top
		// / /
		//if (hookExt->LogicalDrive && / / If (hookExt-> LogicalDrive &&
		//	pathLen > 7 && fullPathName[6] == L'\\' && fullPathName[7] == L'\\') { / / PathLen> 7 && fullPathName [6] == L '\ \' && fullPathName [7] == L '\ \') {

		//	wcscpy(fullPathName + 6, fullPathName + 7); / / Wcscpy (fullPathName + 6, fullPathName + 7);
		//} / /}
	} }

} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkDeleteDevice / / SymlinkDeleteDevice
// / /
// Symlinkのデバイスオブジェクトを削除するために必要な処理をすべて行い、 / / Do all the processing required to remove the device object Symlink,
// 削除する/ / Remove
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
VOID SymlinkDeleteDevice(IN PDEVICE_OBJECT DeviceObject) VOID SymlinkDeleteDevice (IN PDEVICE_OBJECT DeviceObject)
{ {
	PHOOK_EXTENSION deviceExtension; PHOOK_EXTENSION deviceExtension;
	POBJECT_NAME_INFORMATION nameInfo; POBJECT_NAME_INFORMATION nameInfo;

	PAGED_CODE(); PAGED_CODE ();
	if (DeviceObject != SymlinkController) { if (DeviceObject! = SymlinkController) {
		deviceExtension = (PHOOK_EXTENSION)DeviceObject->DeviceExtension; deviceExtension = (PHOOK_EXTENSION) DeviceObject-> DeviceExtension;
		// ファイルシステムオブジェクトがある場合は切り離す/ / If there is a file system object is separated
		if (deviceExtension->FileSystem) { if (deviceExtension-> FileSystem) {
			KdPrint(("Symlink about to detach %p from %p.\n", DeviceObject, deviceExtension->FileSystem)); KdPrint ((". Symlink about to detach% p from% p \ n", DeviceObject, deviceExtension-> FileSystem));
			IoDetachDevice(deviceExtension->FileSystem); IoDetachDevice (deviceExtension-> FileSystem);
			deviceExtension->FileSystem = NULL; deviceExtension-> FileSystem = NULL;
		} }
		// ルートパスを記憶している場合はパス名に使っていたメモリを解放する/ / If you are storing the root path frees the memory that was used in the path name
		if (deviceExtension->Root) { if (deviceExtension-> Root) {
			nameInfo = deviceExtension->Root; nameInfo = deviceExtension-> Root;
			deviceExtension->Root = NULL; deviceExtension-> Root = NULL;
			ExFreePool(nameInfo); ExFreePool (nameInfo);
		} }
	} }
	// 最後にデバイスオブジェクト自体を削除/ / Remove the object at the end of the device itself
	IoDeleteDevice(DeviceObject); IoDeleteDevice (DeviceObject);
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFilterDevice / / SymlinkFilterDevice
// / /
// パラメータで指定されたファイルシステムデバイスにフィルタを取り付ける。 / / Attach the filter to the file system device that is specified by the parameter.
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN SymlinkFilterDevice(PDEVICE_OBJECT DeviceObject) BOOLEAN SymlinkFilterDevice (PDEVICE_OBJECT DeviceObject)
{ {
	PDEVICE_OBJECT checkDevice, hookDevice; PDEVICE_OBJECT checkDevice, hookDevice;
	NTSTATUS status; NTSTATUS status;
	PHOOK_EXTENSION deviceExtension; PHOOK_EXTENSION deviceExtension;

	PAGED_CODE(); PAGED_CODE ();
	// / /
	// ファイルシステムに高速 I/O ディスパッチルーチンがなければ、 / / If there is no I / O dispatch routine fast file system,
	// フィルタすべきでない/ / You should not filter
	// / /
	if (!DeviceObject->DriverObject->FastIoDispatch) { if (! DeviceObject-> DriverObject-> FastIoDispatch) {
		KdPrint(("Symlink: Choosing not to filter a file system with no " KdPrint (("Symlink: Choosing not to filter a file system with no"
		         "fast dispatch routines.\n")); ". Fast dispatch routines \ n"));
		return FALSE; return FALSE;
	} }

	// / /
	// すでに接続済みなら何もしないで成功とみなす/ / Considered a success without doing anything if already connected
	// / /
	checkDevice = DeviceObject; checkDevice = DeviceObject;
	while (checkDevice) { while (checkDevice) {
		if (checkDevice->DriverObject == SymlinkDriver) { if (checkDevice-> DriverObject == SymlinkDriver) {
			KdPrint(("Symlink: Already attahced.\n")); KdPrint ((". Symlink: Already attahced \ n"));
			return TRUE; return TRUE;
		} }
		checkDevice = checkDevice->AttachedDevice; checkDevice = checkDevice-> AttachedDevice;
	} }

	KdPrint(("Symlink: Filtering file system %p\n", DeviceObject)); KdPrint (("Symlink: Filtering file system% p \ n", DeviceObject));

	// / /
	// ドライブ文字を持っていないボリュームに/ / On a volume that does not have a drive letter
	// 「ディスクの管理」からドライブ文字を追加すると、 / / If you add a drive letter from the "Disk Management",
	// ドライブ文字を選ぶ前にマウントが発生してしまう。 / / Mount will occur before you choose a drive letter.
	// つまりこの段階で適切なドライブ文字を取得することは不可能/ / You can get the appropriate drive letter that is not possible at this stage
	// / /

	// / /
	// ファイルシステムに取り付ける新しいデバイスを作成/ / Create a new device attached to the file system
	// / /
	status = IoCreateDevice(SymlinkDriver, status = IoCreateDevice (SymlinkDriver,
	                        sizeof(HOOK_EXTENSION), sizeof (HOOK_EXTENSION),
	                        NULL, NULL,
	                        DeviceObject->DeviceType, DeviceObject-> DeviceType,
	                        0, 0,
	                        FALSE, FALSE,
	                        &hookDevice); & HookDevice);
	if (!NT_SUCCESS(status)) { if (! NT_SUCCESS (status)) {
		return FALSE; return FALSE;
	} }

	// / /
	// 最上位に接続されたデバイスを判定してデバイス拡張を埋め、 / / Fill the expansion device to determine the device that is connected to the top,
	// フラグを適切に設定する。 / / Set the flag properly.
	// / /
	deviceExtension = (PHOOK_EXTENSION)hookDevice->DeviceExtension; deviceExtension = (PHOOK_EXTENSION) hookDevice-> DeviceExtension;

	hookDevice->Flags |= (DeviceObject->Flags & (DO_BUFFERED_IO | DO_DIRECT_IO)); hookDevice-> Flags | = (DeviceObject-> Flags & (DO_BUFFERED_IO | DO_DIRECT_IO));

	if (DeviceObject->DeviceType == FILE_DEVICE_NETWORK_FILE_SYSTEM) if (DeviceObject-> DeviceType == FILE_DEVICE_NETWORK_FILE_SYSTEM)
		SymlinkQueryRoot(DeviceObject, deviceExtension); SymlinkQueryRoot (DeviceObject, deviceExtension);

	deviceExtension->FileSystem = deviceExtension-> FileSystem =
		IoAttachDeviceToDeviceStack(hookDevice, DeviceObject); IoAttachDeviceToDeviceStack (hookDevice, DeviceObject);
	if (!deviceExtension->FileSystem) { if (! deviceExtension-> FileSystem) {
		KdPrint(("Symlink: Failed to attach hook device %p to device %p.\n", KdPrint (("Symlink:. Failed to attach hook device% p to device% p \ n",
		         hookDevice, DeviceObject)); hookDevice, DeviceObject));
		SymlinkDeleteDevice(hookDevice); SymlinkDeleteDevice (hookDevice);
		return FALSE; return FALSE;
	} }

	KdPrint(("Symlink: Attached new hook device %p to device %p.\n", KdPrint (("Symlink:. Attached new hook device% p to device% p \ n",
	         hookDevice, deviceExtension->FileSystem)); hookDevice, deviceExtension-> FileSystem));
	hookDevice->Flags &= ~DO_DEVICE_INITIALIZING; hookDevice-> Flags & = ~ DO_DEVICE_INITIALIZING;

	return TRUE; return TRUE;
} }


#if DBG # If DBG
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkQueryUnload / / SymlinkQueryUnload
// / /
// アンロードのためにすべてのデバイスから切り離す/ / Disconnect from all devices for unloading
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
VOID VOID
SymlinkQueryUnload( SymlinkQueryUnload (
	PIO_STATUS_BLOCK IoStatus PIO_STATUS_BLOCK IoStatus
	) )
{ {
	KIRQL oldirql; KIRQL oldirql;
	PDEVICE_OBJECT device, nextDevice; PDEVICE_OBJECT device, nextDevice;

	// / /
	// スピンロックの区間が存在するのでこのルーチン自体はページング可能/ / This routine itself pageable section of a spin lock because there are
	// セクションに置けないが、ページング可能コードを参照しているので/ / You can not put the section, it refers to the pageable code
	// ページング不可能なときに呼び出してはいけない/ / I do not call when nonpageable
	// / /
	PAGED_CODE(); PAGED_CODE ();
	// / /
	// アンロード可能か? / / Unload it possible?
	// / /
	KeAcquireSpinLock(&CountMutex, &oldirql); KeAcquireSpinLock (& ​​CountMutex, & oldirql);
	IoStatus->Information = OutstandingIRPCount; IoStatus-> Information = OutstandingIRPCount;

	// / /
	// 進行中の IRP が存在するか? / / IRP in progress exist?
	// / /
	if (OutstandingIRPCount) { if (OutstandingIRPCount) {
		KeReleaseSpinLock(&CountMutex, oldirql); KeReleaseSpinLock (& ​​CountMutex, oldirql);
		return; return;
	} }

	// / /
	// なければこれ以上 IRP を処理しない/ / I do not handle any more unless the IRP
	// / /
	UnloadInProgress = TRUE; UnloadInProgress = TRUE;

	KeReleaseSpinLock(&CountMutex, oldirql); KeReleaseSpinLock (& ​​CountMutex, oldirql);

	// / /
	// ファイルシステムデバイスから切り離す/ / Disconnected from the file system device
	// / /
	device = SymlinkDriver->DeviceObject; device = SymlinkDriver-> DeviceObject;
	while (device) { while (device) {
		nextDevice = device->NextDevice; nextDevice = device-> NextDevice;
		if (device != SymlinkController) { if (device! = SymlinkController) {
			SymlinkDeleteDevice(device); SymlinkDeleteDevice (device);
		} }
		device = nextDevice; device = nextDevice;
	} }
} }
#endif // DBG # Endif / / DBG


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
//                高速 I/O ルーチン/ / I / O routine fast
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------

//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoCheckIfPossible / / SymlinkFastIoCheckIfPossible
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoCheckIfPossible( SymlinkFastIoCheckIfPossible (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN ULONG Length, IN ULONG Length,
	IN BOOLEAN Wait, IN BOOLEAN Wait,
	IN ULONG LockKey, IN ULONG LockKey,
	IN BOOLEAN CheckForReadOperation, IN BOOLEAN CheckForReadOperation,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	PAGED_CODE(); PAGED_CODE ();
	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
	hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;

	if (FASTIOPRESENT(hookExt, FastIoCheckIfPossible)) { if (FASTIOPRESENT (hookExt, FastIoCheckIfPossible)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->FastIoCheckIfPossible( retval = hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> FastIoCheckIfPossible (
			FileObject, FileOffset, Length, FileObject, FileOffset, Length,
			Wait, LockKey, CheckForReadOperation, IoStatus, hookExt->FileSystem); Wait, LockKey, CheckForReadOperation, IoStatus, hookExt-> FileSystem);
	} }

	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoRead / / SymlinkFastIoRead
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoRead( SymlinkFastIoRead (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN ULONG Length, IN ULONG Length,
	IN BOOLEAN Wait, IN BOOLEAN Wait,
	IN ULONG LockKey, IN ULONG LockKey,
	OUT PVOID Buffer, OUT PVOID Buffer,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	PAGED_CODE(); PAGED_CODE ();
	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
	hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;

	if (FASTIOPRESENT(hookExt, FastIoRead)) { if (FASTIOPRESENT (hookExt, FastIoRead)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->FastIoRead( retval = hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> FastIoRead (
			FileObject, FileOffset, Length, FileObject, FileOffset, Length,
			Wait, LockKey, Buffer, IoStatus, hookExt->FileSystem); Wait, LockKey, Buffer, IoStatus, hookExt-> FileSystem);
	} }
	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoWrite / / SymlinkFastIoWrite
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoWrite( SymlinkFastIoWrite (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN ULONG Length, IN ULONG Length,
	IN BOOLEAN Wait, IN BOOLEAN Wait,
	IN ULONG LockKey, IN ULONG LockKey,
	IN PVOID Buffer, IN PVOID Buffer,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	PAGED_CODE(); PAGED_CODE ();
	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
	hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;

	if (FASTIOPRESENT( hookExt, FastIoWrite )) { if (FASTIOPRESENT (hookExt, FastIoWrite)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->FastIoWrite( retval = hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> FastIoWrite (
			FileObject, FileOffset, Length, Wait, LockKey, FileObject, FileOffset, Length, Wait, LockKey,
			Buffer, IoStatus, hookExt->FileSystem); Buffer, IoStatus, hookExt-> FileSystem);
	} }
	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoQueryBasicinfo / / SymlinkFastIoQueryBasicinfo
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoQueryBasicInfo( SymlinkFastIoQueryBasicInfo (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN BOOLEAN Wait, IN BOOLEAN Wait,
	OUT PFILE_BASIC_INFORMATION Buffer, OUT PFILE_BASIC_INFORMATION Buffer,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	PAGED_CODE(); PAGED_CODE ();
	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
	hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;

	if (FASTIOPRESENT(hookExt, FastIoQueryBasicInfo)) { if (FASTIOPRESENT (hookExt, FastIoQueryBasicInfo)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->FastIoQueryBasicInfo( retval = hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> FastIoQueryBasicInfo (
			FileObject, Wait, Buffer, IoStatus, hookExt->FileSystem); FileObject, Wait, Buffer, IoStatus, hookExt-> FileSystem);
	} }
	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoQueryStandardInfo / / SymlinkFastIoQueryStandardInfo
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoQueryStandardInfo( SymlinkFastIoQueryStandardInfo (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN BOOLEAN Wait, IN BOOLEAN Wait,
	OUT PFILE_STANDARD_INFORMATION Buffer, OUT PFILE_STANDARD_INFORMATION Buffer,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	PAGED_CODE(); PAGED_CODE ();
	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
	hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;

	if (FASTIOPRESENT(hookExt, FastIoQueryStandardInfo)) { if (FASTIOPRESENT (hookExt, FastIoQueryStandardInfo)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->FastIoQueryStandardInfo( retval = hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> FastIoQueryStandardInfo (
			FileObject, Wait, Buffer, IoStatus, hookExt->FileSystem); FileObject, Wait, Buffer, IoStatus, hookExt-> FileSystem);
	} }
	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoLock / / SymlinkFastIoLock
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoLock( SymlinkFastIoLock (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN PLARGE_INTEGER Length, IN PLARGE_INTEGER Length,
	PEPROCESS ProcessId, PEPROCESS ProcessId,
	ULONG Key, ULONG Key,
	BOOLEAN FailImmediately, BOOLEAN FailImmediately,
	BOOLEAN ExclusiveLock, BOOLEAN ExclusiveLock,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	PAGED_CODE(); PAGED_CODE ();
	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
    hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;

	if (FASTIOPRESENT(hookExt, FastIoLock)) { if (FASTIOPRESENT (hookExt, FastIoLock)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->FastIoLock( retval = hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> FastIoLock (
			FileObject, FileOffset, Length, ProcessId, Key, FailImmediately, FileObject, FileOffset, Length, ProcessId, Key, FailImmediately,
			ExclusiveLock, IoStatus, hookExt->FileSystem); ExclusiveLock, IoStatus, hookExt-> FileSystem);
	} }
	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoUnlockSingle / / SymlinkFastIoUnlockSingle
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoUnlockSingle( SymlinkFastIoUnlockSingle (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN PLARGE_INTEGER Length, IN PLARGE_INTEGER Length,
	PEPROCESS ProcessId, PEPROCESS ProcessId,
	ULONG Key, ULONG Key,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	PAGED_CODE(); PAGED_CODE ();
	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
    hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;

	if (FASTIOPRESENT(hookExt, FastIoUnlockSingle)) { if (FASTIOPRESENT (hookExt, FastIoUnlockSingle)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->FastIoUnlockSingle( retval = hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> FastIoUnlockSingle (
			FileObject, FileOffset, Length, ProcessId, Key, FileObject, FileOffset, Length, ProcessId, Key,
			IoStatus, hookExt->FileSystem); IoStatus, hookExt-> FileSystem);
	} }
	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoUnlockAll / / SymlinkFastIoUnlockAll
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoUnlockAll( SymlinkFastIoUnlockAll (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	PEPROCESS ProcessId, PEPROCESS ProcessId,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	PAGED_CODE(); PAGED_CODE ();
	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
	hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;

	if (FASTIOPRESENT(hookExt, FastIoUnlockAll)) { if (FASTIOPRESENT (hookExt, FastIoUnlockAll)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->FastIoUnlockAll( retval = hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> FastIoUnlockAll (
			FileObject, ProcessId, IoStatus, hookExt->FileSystem); FileObject, ProcessId, IoStatus, hookExt-> FileSystem);
	} }
	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoUnlockAllByKey / / SymlinkFastIoUnlockAllByKey
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoUnlockAllByKey( SymlinkFastIoUnlockAllByKey (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	PEPROCESS ProcessId, PEPROCESS ProcessId,
	ULONG Key, ULONG Key,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	PAGED_CODE(); PAGED_CODE ();
	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
	hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;

	if (FASTIOPRESENT(hookExt, FastIoUnlockAllByKey)) { if (FASTIOPRESENT (hookExt, FastIoUnlockAllByKey)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->FastIoUnlockAllByKey( retval = hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> FastIoUnlockAllByKey (
			FileObject, ProcessId, Key, IoStatus, hookExt->FileSystem); FileObject, ProcessId, Key, IoStatus, hookExt-> FileSystem);
	} }
	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoQueryNetworkOpenInfo / / SymlinkFastIoQueryNetworkOpenInfo
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoQueryNetworkOpenInfo( SymlinkFastIoQueryNetworkOpenInfo (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN BOOLEAN Wait, IN BOOLEAN Wait,
	OUT struct _FILE_NETWORK_OPEN_INFORMATION *Buffer, OUT struct _FILE_NETWORK_OPEN_INFORMATION * Buffer,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	PAGED_CODE(); PAGED_CODE ();
	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
	hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;

	if (FASTIOPRESENT(hookExt, FastIoQueryNetworkOpenInfo)) { if (FASTIOPRESENT (hookExt, FastIoQueryNetworkOpenInfo)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->FastIoQueryNetworkOpenInfo( retval = hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> FastIoQueryNetworkOpenInfo (
			FileObject, Wait, Buffer, IoStatus, hookExt->FileSystem); FileObject, Wait, Buffer, IoStatus, hookExt-> FileSystem);
	} }
	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoAcquireForModWrite / / SymlinkFastIoAcquireForModWrite
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
NTSTATUS NTSTATUS
SymlinkFastIoAcquireForModWrite( SymlinkFastIoAcquireForModWrite (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER EndingOffset, IN PLARGE_INTEGER EndingOffset,
	OUT struct _ERESOURCE **ResourceToRelease, OUT struct _ERESOURCE ** ResourceToRelease,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	NTSTATUS retval = STATUS_NOT_IMPLEMENTED; NTSTATUS retval = STATUS_NOT_IMPLEMENTED;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	if (!DeviceObject) if (! DeviceObject)
		return STATUS_NOT_IMPLEMENTED; return STATUS_NOT_IMPLEMENTED;
	hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;

	if (FASTIOPRESENT(hookExt, AcquireForModWrite)) { if (FASTIOPRESENT (hookExt, AcquireForModWrite)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->AcquireForModWrite( retval = hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> AcquireForModWrite (
			FileObject, EndingOffset, ResourceToRelease, hookExt->FileSystem); FileObject, EndingOffset, ResourceToRelease, hookExt-> FileSystem);
	} }
	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoMdlRead / / SymlinkFastIoMdlRead
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoMdlRead( SymlinkFastIoMdlRead (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN ULONG Length, IN ULONG Length,
	IN ULONG LockKey, IN ULONG LockKey,
	OUT PMDL *MdlChain, OUT PMDL * MdlChain,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	PAGED_CODE(); PAGED_CODE ();
	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
	hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;

	if (FASTIOPRESENT(hookExt, MdlRead)) { if (FASTIOPRESENT (hookExt, MdlRead)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->MdlRead( retval = hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> MdlRead (
			FileObject, FileOffset, Length, LockKey, MdlChain, FileObject, FileOffset, Length, LockKey, MdlChain,
			IoStatus, hookExt->FileSystem); IoStatus, hookExt-> FileSystem);
	} }
	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoMdlReadComplete / / SymlinkFastIoMdlReadComplete
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoMdlReadComplete( SymlinkFastIoMdlReadComplete (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PMDL MdlChain, IN PMDL MdlChain,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
	hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;

	if (FASTIOPRESENT(hookExt, MdlReadComplete)) { if (FASTIOPRESENT (hookExt, MdlReadComplete)) {
		retval = (BOOLEAN) hookExt->FileSystem->DriverObject->FastIoDispatch->MdlReadComplete( retval = (BOOLEAN) hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> MdlReadComplete (
			FileObject, MdlChain, hookExt->FileSystem); FileObject, MdlChain, hookExt-> FileSystem);
	} }
	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoPrepareMdlWrite / / SymlinkFastIoPrepareMdlWrite
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoPrepareMdlWrite( SymlinkFastIoPrepareMdlWrite (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN ULONG Length, IN ULONG Length,
	IN ULONG LockKey, IN ULONG LockKey,
	OUT PMDL *MdlChain, OUT PMDL * MdlChain,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	PAGED_CODE(); PAGED_CODE ();
	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
	hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;
	IoStatus->Status = STATUS_NOT_IMPLEMENTED; IoStatus-> Status = STATUS_NOT_IMPLEMENTED;
	IoStatus->Information = 0; IoStatus-> Information = 0;

	if (FASTIOPRESENT(hookExt, PrepareMdlWrite)) { if (FASTIOPRESENT (hookExt, PrepareMdlWrite)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->PrepareMdlWrite( retval = hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> PrepareMdlWrite (
			FileObject, FileOffset, Length, LockKey, MdlChain, IoStatus, FileObject, FileOffset, Length, LockKey, MdlChain, IoStatus,
			hookExt->FileSystem); hookExt-> FileSystem);
	} }
	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoMdlWriteComplete / / SymlinkFastIoMdlWriteComplete
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoMdlWriteComplete( SymlinkFastIoMdlWriteComplete (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN PMDL MdlChain, IN PMDL MdlChain,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	PAGED_CODE(); PAGED_CODE ();
	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
	hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;

	if (FASTIOPRESENT(hookExt, MdlWriteComplete)) { if (FASTIOPRESENT (hookExt, MdlWriteComplete)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->MdlWriteComplete( retval = hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> MdlWriteComplete (
			FileObject, FileOffset, MdlChain, hookExt->FileSystem); FileObject, FileOffset, MdlChain, hookExt-> FileSystem);
	} }
	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoReadCompressed / / SymlinkFastIoReadCompressed
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoReadCompressed( SymlinkFastIoReadCompressed (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN ULONG Length, IN ULONG Length,
	IN ULONG LockKey, IN ULONG LockKey,
	OUT PVOID Buffer, OUT PVOID Buffer,
	OUT PMDL *MdlChain, OUT PMDL * MdlChain,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	OUT struct _COMPRESSED_DATA_INFO *CompressedDataInfo, OUT struct _COMPRESSED_DATA_INFO * CompressedDataInfo,
	IN ULONG CompressedDataInfoLength, IN ULONG CompressedDataInfoLength,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	PAGED_CODE(); PAGED_CODE ();
	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
	hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;

	if (FASTIOPRESENT(hookExt, FastIoReadCompressed)) { if (FASTIOPRESENT (hookExt, FastIoReadCompressed)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->FastIoReadCompressed( retval = hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> FastIoReadCompressed (
			FileObject, FileOffset, Length, LockKey, Buffer, MdlChain, IoStatus, FileObject, FileOffset, Length, LockKey, Buffer, MdlChain, IoStatus,
			CompressedDataInfo, CompressedDataInfoLength, hookExt->FileSystem); CompressedDataInfo, CompressedDataInfoLength, hookExt-> FileSystem);
	} }
	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoWriteCompressed / / SymlinkFastIoWriteCompressed
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoWriteCompressed( SymlinkFastIoWriteCompressed (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN ULONG Length, IN ULONG Length,
	IN ULONG LockKey, IN ULONG LockKey,
	OUT PVOID Buffer, OUT PVOID Buffer,
	OUT PMDL *MdlChain, OUT PMDL * MdlChain,
	OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
	OUT struct _COMPRESSED_DATA_INFO *CompressedDataInfo, OUT struct _COMPRESSED_DATA_INFO * CompressedDataInfo,
	IN ULONG CompressedDataInfoLength, IN ULONG CompressedDataInfoLength,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	PAGED_CODE(); PAGED_CODE ();
	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
	hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;

	if (FASTIOPRESENT(hookExt, FastIoWriteCompressed)) { if (FASTIOPRESENT (hookExt, FastIoWriteCompressed)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->FastIoWriteCompressed( retval = hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> FastIoWriteCompressed (
			FileObject, FileOffset, Length, LockKey, Buffer, MdlChain, IoStatus, FileObject, FileOffset, Length, LockKey, Buffer, MdlChain, IoStatus,
			CompressedDataInfo, CompressedDataInfoLength, hookExt->FileSystem); CompressedDataInfo, CompressedDataInfoLength, hookExt-> FileSystem);
	} }
	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoMdlReadCompleteCompressed / / SymlinkFastIoMdlReadCompleteCompressed
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoMdlReadCompleteCompressed( SymlinkFastIoMdlReadCompleteCompressed (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PMDL MdlChain, IN PMDL MdlChain,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
	hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;

	if (FASTIOPRESENT(hookExt, MdlReadCompleteCompressed)) { if (FASTIOPRESENT (hookExt, MdlReadCompleteCompressed)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->MdlReadCompleteCompressed( retval = hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> MdlReadCompleteCompressed (
			FileObject, MdlChain, hookExt->FileSystem); FileObject, MdlChain, hookExt-> FileSystem);
	} }
	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoMdlWriteCompleteCompressed / / SymlinkFastIoMdlWriteCompleteCompressed
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoMdlWriteCompleteCompressed( SymlinkFastIoMdlWriteCompleteCompressed (
	IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
	IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER FileOffset,
	IN PMDL MdlChain, IN PMDL MdlChain,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
	hookExt = DeviceObject->DeviceExtension; hookExt = DeviceObject-> DeviceExtension;

	if (FASTIOPRESENT( hookExt, MdlWriteCompleteCompressed)) { if (FASTIOPRESENT (hookExt, MdlWriteCompleteCompressed)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->MdlWriteCompleteCompressed( retval = hookExt-> FileSystem-> DriverObject-> FastIoDispatch-> MdlWriteCompleteCompressed (
			FileObject, FileOffset, MdlChain, hookExt->FileSystem); FileObject, FileOffset, MdlChain, hookExt-> FileSystem);
	} }
	return retval; return retval;
} }


//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
// / /
// SymlinkFastIoQueryOpen / / SymlinkFastIoQueryOpen
// / /
// この呼び出しは実際に IRP を渡します! / / This call passes the IRP actually!
// / /
//---------------------------------------------------------------------- / / ------------------------------------------------ ----------------------
BOOLEAN BOOLEAN
SymlinkFastIoQueryOpen( SymlinkFastIoQueryOpen (
	IN PIRP Irp, IN PIRP Irp,
	OUT PFILE_NETWORK_OPEN_INFORMATION NetworkInformation, OUT PFILE_NETWORK_OPEN_INFORMATION NetworkInformation,
	IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
	) )
{ {
	BOOLEAN retval = FALSE; BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt; PHOOK_EXTENSION hookExt;

	PAGED_CODE(); PAGED_CODE ();
	if (!DeviceObject) if (! DeviceObject)
		return FALSE; return FALSE;
	hookExt = DeviceObject->DeviceExtension;

	if (FASTIOPRESENT(hookExt, FastIoQueryOpen)) {
		PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(Irp);
		PIO_STACK_LOCATION nextIrpStack = IoGetNextIrpStackLocation(Irp);
		PFILE_OBJECT FileObject = currentIrpStack->FileObject;

		// / /
		// パラメータをスタックの次のレベルに渡す
		// / /
		*nextIrpStack = *currentIrpStack;
		nextIrpStack->DeviceObject = hookExt->FileSystem;
		IoSetNextIrpStackLocation(Irp);

		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->FastIoQueryOpen(
			Irp, NetworkInformation, hookExt->FileSystem);

		// / /
		// NT 5.0以前の checked ビルドが文句を言うのでスタックの位置を戻す
		// / /
		Irp->CurrentLocation++;
		Irp->Tail.Overlay.CurrentStackLocation++;
	} }
	return retval;
} }


//----------------------------------------------------------------------
// / /
// SymlinkFastIoReleaseForModWrite
// / /
//----------------------------------------------------------------------
NTSTATUS 
SymlinkFastIoReleaseForModWrite(
	IN PFILE_OBJECT FileObject,
	IN struct _ERESOURCE *ResourceToRelease,
	IN PDEVICE_OBJECT DeviceObject
	)
{ {
	NTSTATUS retval = STATUS_NOT_IMPLEMENTED;
	PHOOK_EXTENSION hookExt;

	if (!DeviceObject)
		return STATUS_NOT_IMPLEMENTED;
	hookExt = DeviceObject->DeviceExtension;

	if (FASTIOPRESENT(hookExt, ReleaseForModWrite)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->ReleaseForModWrite(
		FileObject,  ResourceToRelease, hookExt->FileSystem);
	} }
	return retval;
} }


//----------------------------------------------------------------------
// / /
// SymlinkFastIoAcquireForCcFlush
// / /
//----------------------------------------------------------------------
NTSTATUS 
SymlinkFastIoAcquireForCcFlush(
	IN PFILE_OBJECT FileObject,
	IN PDEVICE_OBJECT DeviceObject
	)
{ {
	NTSTATUS retval = STATUS_NOT_IMPLEMENTED;
	PHOOK_EXTENSION hookExt;

	if (!DeviceObject)
		return STATUS_NOT_IMPLEMENTED;
	hookExt = DeviceObject->DeviceExtension;

	if (FASTIOPRESENT(hookExt, AcquireForCcFlush)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->AcquireForCcFlush(
			FileObject, hookExt->FileSystem);
	} }
	return retval;
} }


//----------------------------------------------------------------------
// / /
// SymlinkFastIoReleaseForCcFlush
// / /
//----------------------------------------------------------------------
NTSTATUS 
SymlinkFastIoReleaseForCcFlush(
	IN PFILE_OBJECT FileObject,
	IN PDEVICE_OBJECT DeviceObject
	)
{ {
	NTSTATUS retval = STATUS_NOT_IMPLEMENTED;
	PHOOK_EXTENSION hookExt;

	if (!DeviceObject)
		return STATUS_NOT_IMPLEMENTED;
	hookExt = DeviceObject->DeviceExtension;

	if (FASTIOPRESENT(hookExt, ReleaseForCcFlush)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->ReleaseForCcFlush(
			FileObject, hookExt->FileSystem);
	} }
	return retval;
} }


BOOLEAN CallBackFastIoDeviceControl(
	IN PFILE_OBJECT FileObject, IN BOOLEAN Wait,
	IN PVOID InputBuffer, IN ULONG InputBufferLength,
	OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN ULONG IoControlCode,
	OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
{ {
	BOOLEAN rv = FALSE;
	ULONG i;

	PAGED_CODE();
	IoStatus->Status = STATUS_SUCCESS;  // 成功と仮定
	IoStatus->Information = 0;  // 何も返されないと仮定

	switch (IoControlCode) {
	case IOCTL_SYMLINK_VERSION:

		// / /
		// バージョン番号
		// / /
		if (OutputBufferLength < sizeof(ULONG)) {
			IoStatus->Status = STATUS_BUFFER_TOO_SMALL;
			return rv;
		} }

		*(ULONG *)OutputBuffer = SYMLINKVERSION;
		IoStatus->Information = sizeof(ULONG);
		break; break;

	case IOCTL_SYMLINK_UNLOADQUERY:
#if DBG
		SymlinkQueryUnload(IoStatus);
#else // DBG
		IoStatus->Information = 1;
#endif // DBG
		break; break;

	// / /
	// 廃止されたIoControlCodeを誤って再利用しないよう
	// 明示的に列挙しておく
	// / /
	case IOCTL_SYMLINK_READ_MEMORY:
		// / /
		// (廃止)指定したアドレスからデータを読み込む
		// fall through
		// / /
	case IOCTL_SYMLINK_WRITE_MEMORY:
		// / /
		// (廃止)指定したアドレスにデータを書き込む
		// fall through
		// / /
	case IOCTL_SYMLINK_SETDRIVES:
		// / /
		// (廃止)ドライブのフックとアンフックを行う
		// fall through
		// / /
	default:

		IoStatus->Status = STATUS_INVALID_DEVICE_REQUEST;
		break; break;
	} }

	return TRUE; return TRUE;
} }


//----------------------------------------------------------------------
// / /
// SymlinkFastIoDeviceControl
// / /
//----------------------------------------------------------------------
BOOLEAN 
SymlinkFastIoDeviceControl(
	IN PFILE_OBJECT FileObject,
	IN BOOLEAN Wait,
	IN PVOID InputBuffer,
	IN ULONG InputBufferLength,
	OUT PVOID OutputBuffer,
	IN ULONG OutputBufferLength,
	IN ULONG IoControlCode,
	OUT PIO_STATUS_BLOCK IoStatus,
	IN PDEVICE_OBJECT DeviceObject
	)
{ {
	BOOLEAN retval = FALSE;
	PHOOK_EXTENSION hookExt;

	PAGED_CODE();
	if (DeviceObject == SymlinkController) {
		// / /
		// このデバイスへの制御メッセージ
		// / /
		return CallBackFastIoDeviceControl(FileObject, Wait, InputBuffer, InputBufferLength,
			OutputBuffer, OutputBufferLength, IoControlCode, IoStatus, DeviceObject);
	} }

	// / /
	// ファイルシステムからの呼び出し、そのまま渡す
	// / /
	hookExt = DeviceObject->DeviceExtension;
	if (FASTIOPRESENT(hookExt, FastIoDeviceControl)) {
		retval = hookExt->FileSystem->DriverObject->FastIoDispatch->FastIoDeviceControl(
			FileObject, Wait, InputBuffer, InputBufferLength, OutputBuffer,
			OutputBufferLength, IoControlCode, IoStatus, hookExt->FileSystem);
	} }

	return retval;
} }


//----------------------------------------------------------------------
// / /
// SymlinkFastIoAcquireFile
// / /
//----------------------------------------------------------------------
VOID 
SymlinkFastIoAcquireFile(
	PFILE_OBJECT FileObject
	)
{ {
	PDEVICE_OBJECT deviceObject, checkDevice;
	PHOOK_EXTENSION hookExt;

	// / /
	// 自分自身のデバイスオブジェクトを探す
	// / /
	if (FileObject->DeviceObject->Vpb)
		checkDevice = FileObject->DeviceObject->Vpb->DeviceObject;
	else else
		checkDevice = FileObject->DeviceObject;
	while (checkDevice) {
		if (checkDevice->DriverObject == SymlinkDriver) {
			// / /
			// 発見
			// / /
			deviceObject = checkDevice;
			hookExt = deviceObject->DeviceExtension;
			if (FASTIOPRESENT(hookExt, AcquireFileForNtCreateSection)) {
				hookExt->FileSystem->DriverObject->FastIoDispatch->AcquireFileForNtCreateSection(
					FileObject);
			} }
			return;
		} }
		checkDevice = checkDevice->AttachedDevice;
	} }
} }


//----------------------------------------------------------------------
// / /
// SymlinkFastIoReleaseFile
// / /
//----------------------------------------------------------------------
VOID 
SymlinkFastIoReleaseFile(
	PFILE_OBJECT FileObject
	)
{ {
	PDEVICE_OBJECT deviceObject, checkDevice;
	PHOOK_EXTENSION hookExt;

	// / /
	// 自分自身のデバイスオブジェクトを探す
	// / /
	if (FileObject->DeviceObject->Vpb)
		checkDevice = FileObject->DeviceObject->Vpb->DeviceObject;
	else else
		checkDevice = FileObject->DeviceObject;
	while (checkDevice) {
		if (checkDevice->DriverObject == SymlinkDriver) {
			deviceObject = checkDevice;
			hookExt = deviceObject->DeviceExtension;

			if (FASTIOPRESENT(hookExt, ReleaseFileForNtCreateSection)) {
				hookExt->FileSystem->DriverObject->FastIoDispatch->ReleaseFileForNtCreateSection(FileObject);
			} }
			return;
		} }
		checkDevice = checkDevice->AttachedDevice;
	} }
} }


//----------------------------------------------------------------------
// / /
// SymlinkFastIoDetachDevice
// / /
// フックしているデバイスが削除されようとしているときに呼び出される。
// これはたとえば、フロッピーがフォーマットされたときに発生する。
// デバイスを切り離して削除しなければならない。
// / /
//----------------------------------------------------------------------
VOID 
SymlinkFastIoDetachDevice(
	PDEVICE_OBJECT SourceDevice,
	PDEVICE_OBJECT TargetDevice
	)
{ {
	PHOOK_EXTENSION hookExt;

	PAGED_CODE();
	// / /
	// デバイスがこのデバイスの下で削除されようとしているか
	// どうか調べる。もしそうなら、そのデバイスが消滅する前にそこから切り離さな
	// ければならない
	// / /
	hookExt = SourceDevice->DeviceExtension;
	if (hookExt->FileSystem == TargetDevice) {
		if (hookExt->Root) {
			KdPrint(("Symlink: Detaching from volume: %wZ\n", &hookExt->Root->Name));
		} }
		SymlinkDeleteDevice(SourceDevice);
		return;
	} }

	// / /
	// FastIoDetachDevice を下位のデバイスに渡すことはない。
	// / /
} }

// / /
// 高速 I/O ディスパッチテーブル。NT はファイルシステムドライバが
// 高速 I/O 呼び出しをサポートしていると仮定するため、ファイルシステム
// フィルタドライバにはこのテーブルが存在しなくてはならない。
// / /
static FAST_IO_DISPATCH FastIoHook = {
	sizeof(FAST_IO_DISPATCH),
	SymlinkFastIoCheckIfPossible,
	SymlinkFastIoRead,
	SymlinkFastIoWrite,
	SymlinkFastIoQueryBasicInfo,
	SymlinkFastIoQueryStandardInfo,
	SymlinkFastIoLock,
	SymlinkFastIoUnlockSingle,
	SymlinkFastIoUnlockAll,
	SymlinkFastIoUnlockAllByKey,
	SymlinkFastIoDeviceControl,
	SymlinkFastIoAcquireFile,
	SymlinkFastIoReleaseFile,
	SymlinkFastIoDetachDevice,

	// / /
	// NT 4.0 から追加
	// / /
	SymlinkFastIoQueryNetworkOpenInfo,
	SymlinkFastIoAcquireForModWrite,
	SymlinkFastIoMdlRead,
	SymlinkFastIoMdlReadComplete,
	SymlinkFastIoPrepareMdlWrite,
	SymlinkFastIoMdlWriteComplete,
	SymlinkFastIoReadCompressed,
	SymlinkFastIoWriteCompressed,
	SymlinkFastIoMdlReadCompleteCompressed,
	SymlinkFastIoMdlWriteCompleteCompressed,
	SymlinkFastIoQueryOpen,
	SymlinkFastIoReleaseForModWrite,
	SymlinkFastIoAcquireForCcFlush,
	SymlinkFastIoReleaseForCcFlush,
}; };


//----------------------------------------------------------------------
//     通知コールバック関数
//----------------------------------------------------------------------


VOID SymlinkFsNotification(
	PDEVICE_OBJECT DeviceObject,
	BOOLEAN FsActive
	)
{ {
	NTSTATUS status;
	UNICODE_STRING fsName;
	PDEVICE_OBJECT hookDevice, checkDevice, fsDevice;
	PHOOK_EXTENSION hookExtension;

	PAGED_CODE();
	KdPrint(("SymlinkFsNotification(%p, %d)\n", DeviceObject, FsActive ? 1 : 0));

	// / /
	// デバイスの種類がディスク、CD、テープのいずれかであることを
	// 確認(それ以外のデバイスに関して通知されることはないはずであるが)
	// リモートコンピュータ上のリンクへのアクセスには未対応
	// / /
	if (DeviceObject->DeviceType != FILE_DEVICE_DISK_FILE_SYSTEM &&
		DeviceObject->DeviceType != FILE_DEVICE_CD_ROM_FILE_SYSTEM &&
		DeviceObject->DeviceType != FILE_DEVICE_TAPE_FILE_SYSTEM/* &&
		DeviceObject->DeviceType != FILE_DEVICE_NETWORK_FILE_SYSTEM*/)
		return;

	RtlInitUnicodeString(&fsName, L"\\FileSystem\\Fs_Rec");
	if (!RtlCompareUnicodeString(&DeviceObject->DriverObject->DriverName, &fsName, TRUE)) {
		// / /
		// レコグナイザには接続しない
		// / /
		return;
	} }
	RtlInitUnicodeString(&fsName, L"\\FileSystem\\Fastfat");
	if (!RtlCompareUnicodeString(&DeviceObject->DriverObject->DriverName, &fsName, TRUE)) {
		// / /
		// FATはリパースポイントをサポートしない
		// Windows 2000 の DFS フィルタのバグを回避するためにも接続しない
		// / /
		return;
	} }

	KdPrint(("%wZ (Type=%d)\n", &DeviceObject->DriverObject->DriverName, DeviceObject->DeviceType));

	if (FsActive) {
		// / /
		// リモートファイルシステムにはマウントの概念がない。
		// Create IRP は直接コントロールデバイスに飛んでくる。
		// / /
		if (DeviceObject->DeviceType == FILE_DEVICE_NETWORK_FILE_SYSTEM) {
			SymlinkFilterDevice(DeviceObject);
			return;
		} }
		// 以降はローカルファイルシステムの場合
		// このデバイスがファイルシステムとして登録されようとしているなら、
		// 新しいフィルタデバイスを作成して接続する。フィルタされるデバイスと
		// 同じデバイスタイプを使っては*ならない*。さもないと、SISのような
		// ものから実際にそのファイルシステムであるとみなされるかもしれない。
		status = IoCreateDevice(SymlinkDriver,
		                        sizeof(HOOK_EXTENSION),
		                        NULL,
		                        FILE_DEVICE_FILE_SYSTEM,
		                        0,
		                        FALSE,
		                        &hookDevice);
		if (!NT_SUCCESS(status))
			return;
		KdPrint(("Symlink about to hook onto %p with hook device %p.\n",
		         DeviceObject, hookDevice));

		hookExtension = hookDevice->DeviceExtension;
		hookExtension->FileSystem =
			IoAttachDeviceToDeviceStack(hookDevice, DeviceObject);

		if (hookExtension->FileSystem) {
			hookDevice->Flags &= ~DO_DEVICE_INITIALIZING;
			KdPrint(("Symlink successfully attached to %p.\n",
			         hookExtension->FileSystem));
		} else { } Else {
			KdPrint(("Symlink failed to attach to %p.\n", DeviceObject));
			SymlinkDeleteDevice(hookDevice);
		} }

		// / /
		// ファイルシステムドライバのデバイスリストを探索して
		// マウント済みのボリュームすべてに接続する。
		// / /
		for (fsDevice = DeviceObject->DriverObject->DeviceObject;
		     fsDevice;
		     fsDevice = fsDevice->NextDevice) {
			// コントローラデバイスはスキップ
			if (fsDevice == DeviceObject)
				continue;
			// デバイスの種類を確認
			if (fsDevice->DeviceType != FILE_DEVICE_DISK_FILE_SYSTEM &&
				fsDevice->DeviceType != FILE_DEVICE_CD_ROM_FILE_SYSTEM &&
				fsDevice->DeviceType != FILE_DEVICE_TAPE_FILE_SYSTEM)
				continue;
			SymlinkFilterDevice(fsDevice);
		} }
	} else { } Else {
		// 引数のデバイスがファイルシステムとして登録解除中であれば、
		// 自分をそこから切り離す必要がある。まず、自分が所有していて
		// 接続されているデバイスを見つける必要がある。
		for (checkDevice = DeviceObject->AttachedDevice;
				checkDevice;
				checkDevice = checkDevice->AttachedDevice) {
			if (checkDevice->DriverObject == SymlinkDriver) {
				hookDevice = checkDevice;
				KdPrint(("The device going away is attached by Symlink device %p.\n"));
				IoDetachDevice(DeviceObject);
				hookExtension = hookDevice->DeviceExtension;
				hookExtension->FileSystem = NULL;
				// デバイスを削除すべきだが、
				// 誰かが接続しているときにそうするのは賢くない
				if (!hookDevice->AttachedDevice)
					SymlinkDeleteDevice(hookDevice);
			} }
		} }
	} }
} }


//----------------------------------------------------------------------
//     ディスパッチとフックのエントリポイント
//----------------------------------------------------------------------


VOID SymlinkUnload(IN PDRIVER_OBJECT DriverObject)
{ {
	WCHAR deviceLinkBuffer[] = L"\\DosDevices\\SymLink";
	UNICODE_STRING deviceLinkUnicodeString;

	// / /
	// ファイルシステム登録通知の登録を解除
	// / /
	IoUnregisterFsRegistrationChange(DriverObject, SymlinkFsNotification);

	// / /
	// シンボリックリンクを削除
	// / /
	RtlInitUnicodeString(&deviceLinkUnicodeString, deviceLinkBuffer);
	IoDeleteSymbolicLink(&deviceLinkUnicodeString);

	KdPrint(("Symlink: unloading\n"));

	// / /
	// デバイスを削除
	// / /
	while (DriverObject->DeviceObject) {
		SymlinkDeleteDevice(DriverObject->DeviceObject);
	} }
	KdPrint(("Symlink: deleted devices\n"));

	// / /
	// 割り当てていたメモリをすべて解放
	// / /
	ExDeletePagedLookasideList(&FullPathLookaside);
} }


//----------------------------------------------------------------------
// / /
// SymlinkResolveLink
// / /
// シンボリックリンクの解決を行う
// / /
//----------------------------------------------------------------------
VOID SymlinkResolveLink(IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp, IN PWSTR fullPathName)
{ {
	PREPARSE_DATA_BUFFER reparse;
	UNICODE_STRING NewFileName;
	PUNICODE_STRING FileName;
	UNICODE_STRING directory, unparsed;
	BOOLEAN relative;
	ULONG bufferLength;
	PWSTR ptr;

	PAGED_CODE();
	// / /
	// シンボリックリンクのリパースタグが返ってきたか調べる。違った場合、
	// 他のフィルタドライバが処理する可能性があるのでStatus等はそのまま
	// / /
	if (Irp->IoStatus.Status != STATUS_REPARSE
	|| Irp->IoStatus.Information != IO_REPARSE_TAG_SYMLINK) {
		return;
	} }

	// / /
	// エラーチェック
	// REPARSE_DATA_BUFFERはユーザーモードのコードが好き勝手な値を設定できる
	// / /
	reparse = (PREPARSE_DATA_BUFFER)Irp->Tail.Overlay.AuxiliaryBuffer;
	if (!reparse
	|| reparse->ReparseDataLength > MAXIMUM_REPARSE_DATA_BUFFER_SIZE
	|| reparse->ReparseDataLength < reparse->SymbolicLinkReparseBuffer.PrintNameOffset
	|| reparse->ReparseDataLength < reparse->SymbolicLinkReparseBuffer.PrintNameLength
	|| reparse->ReparseDataLength < reparse->SymbolicLinkReparseBuffer.PrintNameOffset
	                                + reparse->SymbolicLinkReparseBuffer.PrintNameLength) {
		Irp->IoStatus.Status = STATUS_IO_REPARSE_DATA_INVALID;
		Irp->IoStatus.Information = 0;
		KdPrint(("unexpected reprase data buffer.\n"));
		return;
	} }

	// / /
	// SRV からの要求であるかどうか調べる
	// セキュリティ上の理由からリモートの symlink 解決はクライアント側で
	// 行わなくてはならない。
	// / /
	if (IoIsSystemThread(Irp->Tail.Overlay.Thread)) {
		SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
		BOOLEAN EffectiveOnly, CopyOnOpen;
		//PTOKEN_SOURCE lpTokenSource;
		PACCESS_TOKEN lpToken;

		lpToken = PsReferenceImpersonationToken(Irp->Tail.Overlay.Thread,
			&CopyOnOpen, &EffectiveOnly, &ImpersonationLevel);
		if (lpToken) {
			KdPrint(("Maybe request from SRV. status=%08x path=%S\n", Irp->IoStatus.Status, fullPathName));
			PsDereferenceImpersonationToken(lpToken);
			Irp->IoStatus.Status = STATUS_STOPPED_ON_SYMLINK;
			Irp->IoStatus.Information = 0;
			return;
		} }
	} }

	// / /
	// フルパスが必要
	// / /
	if (!fullPathName || !*fullPathName) {
		Irp->IoStatus.Status = STATUS_OBJECT_PATH_NOT_FOUND;
		Irp->IoStatus.Information = 0;
		KdPrint(("fullPathName is null or empty.\n"));
		return;
	} }
	//if (IrpSp->FileObject) KdPrint((">%.*S\n", IrpSp->FileObject->FileName.Length / sizeof(WCHAR), IrpSp->FileObject->FileName.Buffer));
	RtlInitUnicodeString(&directory, fullPathName);
	// / /
	// Reservedフィールドはパスの未解析の部分のバイト数
	// / /
	if (directory.Length < reparse->Reserved) {
		Irp->IoStatus.Status = STATUS_IO_REPARSE_DATA_INVALID;
		Irp->IoStatus.Information = 0;
		KdPrint(("directory.Length is insufficient.\n"));
		return;
	} }
	directory.Length -= reparse->Reserved;
	// / /
	// 末尾がバックスラッシュだったら未解析の部分に含める
	// / /
	ptr = directory.Buffer + (directory.Length / sizeof(WCHAR)) - 1;
	if (ptr > directory.Buffer && *ptr == L'\\') {
		ptr--;
		directory.Length -= 2;
	} }
	RtlInitUnicodeString(&unparsed, fullPathName + directory.Length / sizeof(WCHAR));
	KdPrint(("%wZ|%wZ\n", &directory.Length, &unparsed));
	// / /
	// 最終コンポーネントを取り除く
	// / /
	while (ptr > directory.Buffer) {
		if (*ptr == L'\\')
			break;
		ptr--;
	} }
	if (ptr <= directory.Buffer) {
		Irp->IoStatus.Status = STATUS_OBJECT_PATH_NOT_FOUND;
		Irp->IoStatus.Information = 0;
		return;
	} }
	directory.Length = (ptr + 1 - directory.Buffer) * sizeof(WCHAR);

	// / /
	// リンク先ファイル名の文字列を組み立て
	// / /
	NewFileName.Length = reparse->SymbolicLinkReparseBuffer.SubstituteNameLength;
	NewFileName.MaximumLength = NewFileName.Length + 1;
	NewFileName.Buffer = reparse->SymbolicLinkReparseBuffer.PathBuffer +
			reparse->SymbolicLinkReparseBuffer.SubstituteNameOffset / sizeof(WCHAR);

	// / /
	// 相対パスを解決
	// / /
	relative = (reparse->SymbolicLinkReparseBuffer.Flags & 1) != 0;
	if (relative) {
		// / /
		// NewFileName の先頭が ..\ だったら削除して
		// directory からも一階層取り除く
		// / /
		while (NewFileName.Length > 3 * sizeof(WCHAR) && NewFileName.Buffer[0] == L'.' &&
		       NewFileName.Buffer[1] == L'.' && NewFileName.Buffer[2] == L'\\') {
			NewFileName.Length -= 3 * sizeof(WCHAR);
			NewFileName.MaximumLength -= 3 * sizeof(WCHAR);
			NewFileName.Buffer += 3;
			// 末尾は必ず \ なのでスキップ
			ptr = directory.Buffer + (directory.Length / sizeof(WCHAR)) - 2;
			ASSERT(ptr[1] == L'\\');
			while (ptr > directory.Buffer) {
				if (*ptr == L'\\')
					break; break;
				ptr--;
			} }
			if (ptr <= directory.Buffer) {
				Irp->IoStatus.Status = STATUS_OBJECT_PATH_NOT_FOUND;
				Irp->IoStatus.Information = 0;
				return;
			} }
			directory.Length = (ptr + 1 - directory.Buffer) * sizeof(WCHAR);
		} }

		bufferLength = directory.Length + NewFileName.Length + unparsed.Length;
	} else { } Else {
		bufferLength = NewFileName.Length + unparsed.Length;
	} }

	FileName = &(IrpSp->FileObject->FileName);
	//KdPrint(("Reparse(%d): %.*S=>%.*S\n", relative,
			//FileName->Length / sizeof(WCHAR), FileName->Buffer,
			//NewFileName.Length / sizeof(WCHAR), NewFileName.Buffer));
	if (FileName->Length < bufferLength) {
		// / /
		// 再割り当てを行う
		// / /
		PVOID FileNameBuffer = ExAllocatePool(NonPagedPool, bufferLength + 1);
		if (!FileNameBuffer) {
			// / /
			// 資源が不足
			// / /
			Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
			Irp->IoStatus.Information = 0;
			return;
		} }
		ExFreePool(FileName->Buffer);
		FileName->Buffer = FileNameBuffer;
		FileName->MaximumLength = (USHORT)bufferLength + 1;
	} }

	if (relative) {
		RtlCopyUnicodeString(FileName, &directory);
		RtlAppendUnicodeStringToString(FileName, &NewFileName);
		RtlAppendUnicodeStringToString(FileName, &unparsed);
	} else { } Else {
		RtlCopyUnicodeString(FileName, &NewFileName);
		RtlAppendUnicodeStringToString(FileName, &unparsed);
	} }
	KdPrint(("Reparse(%d): %wZ\n", relative, FileName));
	Irp->IoStatus.Information = IO_REPARSE;
} }


//----------------------------------------------------------------------
// / /
// SymlinkQueryAttributeTag
// / /
// FileAttributeTagInformationの問い合わせ結果
// / /
//----------------------------------------------------------------------
VOID SymlinkQueryAttributeTag(IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp)
{ {
	PFILE_ATTRIBUTE_TAG_INFORMATION AttrTag;

	PAGED_CODE();
	// / /
	// エラーならここでは何もしない
	// / /
	if (!NT_SUCCESS(Irp->IoStatus.Status))
		return;

	// / /
	// シンボリックリンク以外ならここでは何もしない
	// / /
	AttrTag = (PFILE_ATTRIBUTE_TAG_INFORMATION)Irp->AssociatedIrp.SystemBuffer;
	if (AttrTag->ReparseTag != IO_REPARSE_TAG_SYMLINK)
		return;

	// / /
	// FileAttributeTagInformationは削除やリネーム前にリパースポイントかどうか、
	// またリパースポイントがマウントポイントであるかどうかチェックするために
	// 使われる。マウントポイント以外のリパースポイントはすべてリンク先が削除
	// されてしまうので、(IsReparseTagNameSurrogateは何のためにあるんだ?)
	// リパースポイント属性をクリアしてI/Oマネージャを騙す。
	// / /
	AttrTag->FileAttributes &= ~(FILE_ATTRIBUTE_REPARSE_POINT);

	//KdPrint(("Attr=%08lx, Tag=%08lx\n", AttrTag->FileAttributes, AttrTag->ReparseTag));
} }


//----------------------------------------------------------------------
// / /
// SymlinkHookDone
// / /
// 戻りステータスの情報を得られるようにファイルシステムの操作が
// 完了した後で制御を得る
// / /
//----------------------------------------------------------------------
NTSTATUS 
SymlinkHookDone(
	IN PDEVICE_OBJECT DeviceObject,
	IN PIRP Irp,
	IN PVOID Context
	)
{ {
	PIO_STACK_LOCATION IrpSp;
	PWSTR fullPathName = (PWSTR)Context;

	PAGED_CODE();
	// / /
	// 要求は完了した - 結果を見る
	// / /
	IrpSp = IoGetCurrentIrpStackLocation(Irp);

	switch (IrpSp->MajorFunction) {
	case IRP_MJ_FILE_SYSTEM_CONTROL:
		// / /
		// エラーのときは何もしない
		// / /
		if (NT_SUCCESS(Irp->IoStatus.Status))
			SymlinkFilterDevice(((PDEVICE_OBJECT)Context)->Vpb->DeviceObject);
		break; break;
	case IRP_MJ_CREATE:
		SymlinkResolveLink(Irp, IrpSp, fullPathName);
		// / /
		// バッファがあったら解放
		// / /
		if (fullPathName) {
			ExFreeToPagedLookasideList(&FullPathLookaside, fullPathName);
		} }
		break; break;
	case IRP_MJ_QUERY_INFORMATION:
		SymlinkQueryAttributeTag(Irp, IrpSp);
		break; break;
	} }

	return Irp->IoStatus.Status;
} }


//----------------------------------------------------------------------
// / /
// SymlinkSignalEvent
// / /
// ディスパッチルーチンへ同期的に戻るためのイベントをシグナルする
// / /
//----------------------------------------------------------------------
NTSTATUS 
SymlinkSignalEvent(
	IN PDEVICE_OBJECT DeviceObject,
	IN PIRP Irp,
	IN PVOID Context
	)
{ {
	if (Irp->PendingReturned) {
		KeSetEvent((PKEVENT)Context, IO_NO_INCREMENT, FALSE);
	} }
	return STATUS_MORE_PROCESSING_REQUIRED;
} }


//----------------------------------------------------------------------
// / /
// SymlinkHookRoutine
// / /
// ファイルシステムに送られようとしている呼び出しが何であるか調べる
// メインのフックルーチン
// / /
//----------------------------------------------------------------------
NTSTATUS 
SymlinkHookRoutine(
	PDEVICE_OBJECT HookDevice,
	IN PIRP Irp
	)
{ {
	PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(Irp);
	PIO_STACK_LOCATION nextIrpStack = IoGetNextIrpStackLocation(Irp);
	PFILE_OBJECT FileObject;
	PHOOK_EXTENSION hookExt;
	PWSTR fullPathName = NULL;
	BOOLEAN hookCompletion;
	KIRQL oldirql;
	PVOID context = NULL;
	KEVENT event;
	NTSTATUS status;

	// / /
	// ファイルオブジェクトを IRP から取り出す
	// / /
	FileObject = currentIrpStack->FileObject;

	// / /
	// この IRP がどのファイルシステム用なのかの情報を含む
	// デバイスエクステンションを指す
	// / /
	hookExt = HookDevice->DeviceExtension;

	hookCompletion = FALSE;
	switch (currentIrpStack->MajorFunction) {
	case IRP_MJ_FILE_SYSTEM_CONTROL:
		// / /
		// 接続しているファイルシステムに対するマウント要求を調べる
		// スタック位置に空きがあれば完了ルーチンを IRP に設定する
		// / /
		if (currentIrpStack->MinorFunction == IRP_MN_MOUNT_VOLUME) {
			if (hookExt->FileSystem != NULL &&
				Irp->CurrentLocation >= HookDevice->StackSize) {
				hookCompletion = TRUE;
				context = currentIrpStack->Parameters.MountVolume.Vpb->RealDevice;
			} }
		} }
		break; break;
	case IRP_MJ_CREATE:
		// / /
		// test2\test.txt を開こうとしていて
		// test2 がリンクの場合、FILE_OPEN_REPARSE_POINT を指定していても
		// STATUS_REPARSE が発生するので postCreate の処理は必要
		// / /
		hookCompletion = TRUE;
		fullPathName = ExAllocateFromPagedLookasideList(&FullPathLookaside);
		if (fullPathName) {
			SymlinkGetFullPath(FileObject, hookExt, fullPathName);
		} }
		context = fullPathName;
		break; break;
	case IRP_MJ_QUERY_INFORMATION:
		// / /
		// 興味があるのは FileAttributeTagInformation のみ
		// / /
		hookCompletion = currentIrpStack->Parameters.QueryFile.FileInformationClass == FileAttributeTagInformation;
		break; break;
	} }

	// / /
	// パラメータを自分の下にあるドライバの次レベルのスタックに渡す
	// / /
	*nextIrpStack = *currentIrpStack;

#if DBG
	// / /
	// アンロードが進行中でなければ、
	// IRPの戻りステータスを調べられるように完了ルーチンを登録する
	// / /
	KeAcquireSpinLock(&CountMutex, &oldirql);
#endif # Endif
	if (UnloadInProgress)
		hookCompletion = FALSE;
	if (hookCompletion) {
#if DBG
		// / /
		// 完了ルーチンを設定するので進行中の IRP の数を増やす
		// / /
		SymlinkDriver->DriverUnload = NULL;
		OutstandingIRPCount++;
		//KdPrint(("+%d: %x\n", OutstandingIRPCount, Irp));
#endif // DBG
		IoSetCompletionRoutine(Irp, SymlinkSignalEvent, &event, TRUE, TRUE, TRUE);
	} else { } Else {
		// / /
		// 完了ルーチンを設定しない
		// / /
		IoSetCompletionRoutine(Irp, SymlinkSignalEvent, NULL, FALSE, FALSE, FALSE);
	} }
#if DBG
	KeReleaseSpinLock(&CountMutex, oldirql);
#endif # Endif
	if (hookCompletion) {
		KeInitializeEvent(&event, NotificationEvent, FALSE);
		status = IoCallDriver(hookExt->FileSystem, Irp);
		if (status == STATUS_PENDING) {
			KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
		} }
		SymlinkHookDone(HookDevice, Irp, context);
#if DBG
		// / /
		// IRP の処理を完了したので進行中の IRP の数を減らす
		// / /
		KeAcquireSpinLock(&CountMutex, &oldirql);
		OutstandingIRPCount--;
		//KdPrint(("-%d: %x\n", OutstandingIRPCount, Irp));
		if (!OutstandingIRPCount)
			SymlinkDriver->DriverUnload = SymlinkUnload;
		KeReleaseSpinLock(&CountMutex, oldirql);
#endif # Endif
		status = Irp->IoStatus.Status;
		IoCompleteRequest(Irp, IO_NO_INCREMENT);
	} else { } Else {
		status = IoCallDriver(hookExt->FileSystem, Irp);
	} }
	// / /
	// 呼び出し結果を呼び出し元に返す
	// / /
	return status;
} }


NTSTATUS SymlinkDeviceRoutine(IN PDEVICE_OBJECT DeviceObject, IN PIRP irp)
{ {
	PIO_STACK_LOCATION irpStack;
	PVOID inputBuffer;
	PVOID outputBuffer;
	ULONG inputBufferLength;
	ULONG outputBufferLength;
	ULONG ioControlCode;
	NTSTATUS status;

	// / /
	// 成功と仮定
	// / /
	irp->IoStatus.Status = STATUS_SUCCESS;
	irp->IoStatus.Information = 0;

	// / /
	// IRP内の現在位置へのポインタを取得
	// / /
	irpStack = IoGetCurrentIrpStackLocation(irp);

	// / /
	// 入出力バッファとその長さを取得
	// / /
	inputBuffer = irp->AssociatedIrp.SystemBuffer;
	inputBufferLength = irpStack->Parameters.DeviceIoControl.InputBufferLength;
	outputBuffer = irp->AssociatedIrp.SystemBuffer;
	outputBufferLength = irpStack->Parameters.DeviceIoControl.OutputBufferLength;
	ioControlCode = irpStack->Parameters.DeviceIoControl.IoControlCode;

	switch (irpStack->MajorFunction) {
	case IRP_MJ_CREATE:

		KdPrint(("Symlink: IRP_MJ_CREATE"));

		break; break;

	case IRP_MJ_CLOSE:

		KdPrint(("Symlink: IRP_MJ_CLOSE"));

		break; break;

	case IRP_MJ_DEVICE_CONTROL:

		KdPrint(("Symlink: IRP_MJ_DEVICE_CONTROL"));

		// / /
		// 出力バッファがMDLとして渡されていたらそれを取得
		// / /
		if (irp->MdlAddress) {
			outputBuffer = MmGetSystemAddressForMdl(irp->MdlAddress);
		} }

		// / /
		// 高速ハンドラを呼び出すだけ
		// / /
		CallBackFastIoDeviceControl(irpStack->FileObject, TRUE,
		                            inputBuffer, inputBufferLength,
		                            outputBuffer, outputBufferLength,
		                            ioControlCode, &irp->IoStatus, DeviceObject);

		break; break;
	} }

	// / /
	// IoCompleteRequest の後で IRP を参照してはならないので
	// ステータスを待避する
	// / /
	status = irp->IoStatus.Status;
	// / /
	// IRPを完了する
	// / /
	IoCompleteRequest(irp, IO_NO_INCREMENT);
	return status;
} }


//----------------------------------------------------------------------
// / /
// SymlinkDispatch
// / /
// Irp がどのデバイスに向けられているかに基づいて、ファイルシステム
// フィルタ関数か、自分自身のデバイス処理ルーチンのどちらかを呼び出す。
// / /
//----------------------------------------------------------------------
NTSTATUS 
SymlinkDispatch(
	IN PDEVICE_OBJECT DeviceObject,
	IN PIRP Irp
	)
{ {
	// / /
	// リクエストが UI から来たものか、フックしているファイルシステム
	// ドライバに向けられたものか判定する。
	// / /
	if (DeviceObject == SymlinkController) {
		return SymlinkDeviceRoutine(DeviceObject, Irp);
	} else { } Else {
		return SymlinkHookRoutine(DeviceObject, Irp);
	} }
} }


NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
{ {
	NTSTATUS status;
	PDEVICE_OBJECT device;
	WCHAR deviceNameBuffer[] = L"\\Device\\SymLink";
	UNICODE_STRING deviceNameUnicodeString;
	WCHAR deviceLinkBuffer[] = L"\\DosDevices\\SymLink";
	UNICODE_STRING deviceLinkUnicodeString;
	ULONG i;
	PDEVICE_OBJECT fsDevice;
	PFILE_OBJECT fileObject;

	KdPrint(("Symlink: entering DriverEntry\n"));
	SymlinkDriver = DriverObject;

	// / /
	// デバイスを作成
	// / /
	RtlInitUnicodeString(&deviceNameUnicodeString, deviceNameBuffer);

	status = IoCreateDevice(DriverObject,
	                        0, // 制御デバイスのデバイス拡張は不要
	                        &deviceNameUnicodeString,
	                        FILE_DEVICE_UNKNOWN,
	                        FILE_DEVICE_SECURE_OPEN,
	                        TRUE,
	                        &device);

	if (!NT_SUCCESS(status)) {
		KdPrint(("Symlink: failed to create our device!\n"));
		return status;
	} }

	// / /
	// 制御デバイスとマーク
	// / /
	SymlinkController = device;

	// / /
	// シンボリックリンクを作成
	// / /
	RtlInitUnicodeString(&deviceLinkUnicodeString, deviceLinkBuffer);

	status = IoCreateSymbolicLink(&deviceLinkUnicodeString, 
	                              &deviceNameUnicodeString);
	if (!NT_SUCCESS(status)) {
		KdPrint(("Symlink: IoCreateSymbolicLink failed\n"));
		IoDeleteDevice(device);
		return status;
	} }

	// / /
	// ディスパッチポイントを作成
	// / /
	for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++) {
		DriverObject->MajorFunction[i] = SymlinkDispatch;
	} }
#if DBG
	DriverObject->DriverUnload = SymlinkUnload;
#endif // DBG
	// / /
	// 高速 I/O ディスパッチテーブルを設定
	// / /
	DriverObject->FastIoDispatch = &FastIoHook;

	// / /
	// 同期オブジェクトを初期化
	// / /
#if DBG
	KeInitializeSpinLock(&CountMutex);
#endif # Endif

	// / /
	// ファイル名の lookaside を初期化
	// / /
	ExInitializePagedLookasideList(&FullPathLookaside, NULL, NULL,
				     0, MAXPATHLEN * 2, 'lmyS', 0);

	// ファイルシステムの有効化/無効化通知を受信できるよう
	// このドライバを登録する
	status = IoRegisterFsRegistrationChange(DriverObject,
	                                        SymlinkFsNotification);
	if (!NT_SUCCESS(status)) {
		KdPrint(("Symlink: IoRegisterFsRegistrationChange failed\n"));
		SymlinkUnload(DriverObject);
		return status;
	} }

	// / /
	// Windows 2000 では IoRegisterFsRegistrationChange で
	// ロード済みのファイルシステムが通知されないので、
	// \Ntfs を自分で開いて通知をシミュレート
	// / /
	RtlInitUnicodeString(&deviceNameUnicodeString, L"\\Ntfs");
	status = IoGetDeviceObjectPointer(&deviceNameUnicodeString, FILE_READ_ATTRIBUTES, &fileObject, &fsDevice);
	if (NT_SUCCESS(status)) {
		SymlinkFsNotification(fsDevice, TRUE);
		ObDereferenceObject(fileObject);
	} }

	return STATUS_SUCCESS;
} }

<script>_addload(function(){_setupIW();_csi('ja','en','symlink.c');});</script>


Hope that helps somewhat with the looksee. I believe the code was billed as Ln on FAT but reading it now I see it clearly isnt. BAH. I did hear of storing the location info 'separably' but I really didn't like the sound of that either.
FWIW anyway I don't think such a radical solution is the way forward. Most people won't want to use faffy tools. Although a one pass with a certain tool might be okay.

We needs something 'solid'. what? I have no idea ) Thanks for the feedback

Last edited by twobob; 08-18-2012 at 12:32 PM.
twobob is offline   Reply With Quote
Old 08-18-2012, 12:42 PM   #88
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Quote:
Originally Posted by geekmaster View Post
Look here
Righto. I will look to see about getting this / these patches to the kernel melded with the changes performed by Niluje as a one-shot.

We don't use the other software packages but thanks for the reminder.
twobob is offline   Reply With Quote
Old 08-18-2012, 04:51 PM   #89
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Original Tar - With a whole pile of stuff in it... 365 Mb - for everything other than those things I listed.

The qt demos are 20GB for the record. No really.

simon@dev ~/BLDS/buildroot/images $ tar -x -h --hard-dereference -l -f rootfs.tar ./bin ./etc ./lib ./sbin ./usr

(makes the file structure pictured)

simon@dev ~/BLDS/buildroot/images $ tar -c -h --hard-dereference -l -f kindle.tar ./bin ./etc ./lib ./sbin ./usr
Code:
tar: ./etc/resolv.conf: File removed before we read it
tar: ./sbin/mount.ntfs-3g: File removed before we read it
tar: ./sbin/mkfs.ntfs: File removed before we read it
tar: ./sbin/mount.lowntfs-3g: File removed before we read it
Results in a 792 Mb final delivery file. - So I was right about 200 - 250% when it starts to even out with bigger numbers.

Oh and there is our script - happy days.

On the kindle I run

cd /mnt/us; . env.sh at login

where /mnt/us/env.sh contains

Code:
#!/bin/sh
export LD_LIBRARY_PATH=/lib:/usr/lib:/mnt/us/lib:/mnt/us/usr/lib
export PATH=$PATH:/mnt/us/bin:/mnt/us/usr/bin
and that seems to work okay.

Hope that helps someone.

BEFORE:

[root@kindle us]# df
Filesystem 1k-blocks Used Available Use% Mounted on
fsp 3202192 1460688 1741504 46% /mnt/us

AFTER:

[root@kindle us]# df
Filesystem 1k-blocks Used Available Use% Mounted on
fsp 3202192 2094320 1107872 65% /mnt/us
[root@kindle us]#

mount.ntfs and resolve.conf still moan but other than those exceptions - peachy transfer.
Attached Thumbnails
Click image for larger version

Name:	Selection_008.png
Views:	411
Size:	27.3 KB
ID:	90971  

Last edited by twobob; 08-18-2012 at 04:58 PM.
twobob is offline   Reply With Quote
Old 08-18-2012, 05:41 PM   #90
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
What's in the box?

What IS built. Here's a rough overview. 'Find' is your friend.

Yay Readelf is in the list! Yay.

Anyways here it is...

[root@kindle bin]# cd /mnt/us/usr/bin
[root@kindle bin]# ls

PHP Code:
CreateDOMDocument            fusion_skirmish              netcap
DOMCount                     fusion_stream                netperf
DOMPrint                     gdb                          netserver
EnumVal                      gdbserver                    nfsiostat
MPEG2TransportStreamIndexer  gem                          nm
MemParse                     gen_entropy                  nohup
PParse                       gen_random_ctr_drbg          nslookup
PSVIWriter                   gen_random_havege            nspr
-config
Redirect                     genbrk                       ntfs
-3g
SAX2Count                    gencfu                       ntfs
-3g.probe
SAX2Print                    gencnval                     ntfs
-3g.secaudit
SAXCount                     genctd                       ntfs
-3g.usermap
SAXPrint                     generic_sum                  ntfscat
SCMPrint                     genext2fs                    ntfscluster
SEnumVal                     genrb                        ntfscmp
StdInParse                   geotifcp                     ntfsfix
XInclude                     getfacl                      ntfsinfo
[                            getfattr                     ntfsls
[[                           gnuchess                     objcopy
abxtest                      gnuchessx                    objdump
aclocal                      gnutls
-cli                   od
aclocal
-1.11                 gnutls-cli-debug             ogg123
addr2line                    gnutls
-serv                  oggdec
aescrypt2                    gperf                        oggenc
alsamixer                    gpg
-error                    ogginfo
animate                      gpg
-error-config             omxregister-bellagio
applygeo                     gprof                        opannotate
apr
-1-config                 haserl                       oparchive
apu
-1-config                 head                         opcontrol
ar                           hello                        openRTSP
arping                       hexdump                      opencv_createsamples
as                           hmac256                      opencv_haartraining
aserver                      hostid                       opencv_performance
at                           htop                         opencv_traincascade
atq                          icu
-config                   openvt
atrm                         icuinfo                      opgprof
attr                         id                           ophelp
aumix                        identify                     opjitconv
autoconf                     idle                         opkg
-cl
autoheader                   idn                          opkg
-key
autom4te                     ifnames                      opreport
automake                     imlib2
-config                oprofiled
automake
-1.11                imlib2_conv                  par_mem
autoreconf                   import                       par_ops
autoscan                     innochecksum                 passwd
autoupdate                   inotifywait                  patch
awk                          inotifywatch                 pcregrep
basename                     inputattach                  pcretest
batch                        install                      perl
benchmark                    iostat                       perror
bison                        ipcrm                        pgpewrap
bsdcpio                      ipcs                         pgpring
bsdiff                       irb                          php
-cgi
bsdtar                       jpegtran                     pidstat
bspatch                      jsmin                        pkgdata
bunzip2                      json_reformat                playsound
bw_file_rd                   json_verify                  playsound_simple
bw_mem                       key_app                      prerr
.properties
bw_mmap_rd                   killall                      printf
bw_pipe                      killall5                     protoc
bw_tcp                       lame                         pscap
bw_unix                      last                         psktool
bwm
-ng                       lat_connect                  pv
bzcat                        lat_ctx                      python
bzcmp                        lat_fcntl                    python2.7
bzdiff                       lat_fifo                     rake
bzegrep                      lat_fs                       ramspeed
bzfgrep                      lat_http                     ranlib
bzgrep                       lat_mem_rd                   rdiff
bzip2                        lat_mmap                     rdoc
bzip2recover                 lat_ops                      readelf
bzless                       lat_pagefault                readlink
bzmore                       lat_pipe                     realpath
c
++filt                      lat_proc                     red
cairo
-trace                  lat_rpc                      renice
captest                      lat_select                   replace
ccache                       lat_sem                      reset
cert_app                     lat_sig                      resize
certtool                     lat_syscall                  resolve_stack_dump
cgi
-fcgi                     lat_tcp                      resolveip
cgicc
-config                 lat_udp                      ri
chacl                        lat_unix                     roxml
chrt                         lat_unix_connect             rrdcgi
chvt                         ld                           rrdtool
cifsiostat                   ld
.bfd                       rrdupdate
cksum                        less                         rsa_decrypt
clear                        libart2
-config               rsa_encrypt
cmp                          libesmtp
-config              rsa_genkey
compare                      libgcrypt
-config             rsa_sign
compile
-et.pl                libhid-detach-device         rsa_verify
composite                    libtool                      rsync
conjure                      libtoolize                   ruby
convert                      line                         sadf
coretest_blit2               links                        sar
corrupt_mpeg2                listgeo                      scp
crl_app                      lite_bench                   screen
crontab                      lite_checktest               selftest
crypt_and_hash               lite_dfbspy                  seq
csv2html                     lite_listtest                setfacl
ctorrent                     lite_msgbox                  setfattr
cut                          lite_progressbar             setkeycodes
cvs                          lite_run                     setsid
db_archive                   lite_scrollbartest           sfconvert
db_checkpoint                lite_simple                  sfinfo
db_deadlock                  lite_slider                  sftp
db_dump                      lite_textbuttontest          sha1sum
db_hotbackup                 lite_textlinetest            sha256sum
db_load                      lite_textlisttest            sha2sum
db_log_verify                live555MediaServer           sha512sum
db_printlog                  lmdd                         sip_reg
db_recover                   lmhttp                       size
db_replicate                 lockfile
-check               slogin
db_stat                      lockfile
-create              smime_keys
db_tuner                     lockfile
-remove              smtpd.py
db_upgrade                   lockfile
-touch               sndfile-resample
db_verify                    logger                       sort
dbus
-cleanup-sockets         logname                      speexdec
dbus
-daemon                  logsurfer                    speexenc
dbus
-launch                  loop_o                       spooky
dbus
-monitor                 lowntfs-3g                   sqlite3
dbus
-send                    lsof                         srptool
dbus
-uuidgen                 lspci                        ssh
dc                           lsuio                        ssh
-add
deallocvt                    lsusb                        ssh
-agent
derb                         lsusb
.py                     ssh-keygen
df_drivertest                ltrace                       ssh
-keyscan
df_fonts                     lua                          ssl_cert_test
df_input                     luac                         ssl_client1
df_video                     lzcat                        ssl_client2
df_video_particle            lzcmp                        ssl_fork_server
df_window                    lzdiff                       ssl_mail_client
dfbtest_blit                 lzegrep                      ssl_server
dfbtest_blit2                lzfgrep                      ssl_test
dfbtest_fillrect             lzgrep                       sstrip
dfbtest_font                 lzless                       strace
dfbtest_mirror               lzma                         stream
dfbtest_prealloc             lzmadec                      stress
dfbtest_reinit               lzmainfo                     strings
dfbtest_resize               lzmore                       strip
dfbtest_scale                lzop                         sudo
dfbtest_sync                 m4                           sudoedit
dfbtest_window               madplay                      sudoreplay
dfbtest_window_cursor        mail
-lock                    tail
dfbtest_window_flip_once     mail
-touchlock               tee
dfbtest_window_surface       mail
-unlock                  telnet
dh_client                    make                         test
dh_genprime                  makeconv                     testrb
dh_server                    makegeo                      tftp
dhrystone                    md5sum                       time
dialog                       memsize                      timing_o
diff                         memstat                      tlb
direct_stream                mesg                         top
direct_test                  metaflac                     tr
directfb
-config              mhz                          traceroute
dirname                      microcom                     ts_calibrate
disk                         microperl                    ts_finddev
display                      mkfifo                       ts_harvest
distcc                       mksquashfs                   ts_print
distccd                      mogrify                      ts_print_raw
divine
-config                monit                        ts_test
dmalloc                      montage                      tty
dos2unix                     mpc2sv8                      uconv
dstat                        mpcchap                      uniq
du                           mpccut                       unix2dos
dumpsexp                     mpcdec                       unlzma
easy_install                 mpcenc                       unsquashfs
easy_install
-2.7             mpcgain                      unxz
ed                           mpeg2dec                     unzip
eject                        mpg123                       update
-alternatives
elfedit                      mpi_demo                     uptime
em                           mpstat                       usbhid
-dump
enough                       msleep                       uudecode
env                          msql2mysql                   uuencode
erb                          mute                         vcut
ether
-wake                   mutt                         vlock
event_rpcgen
.py              muttbug                      vorbiscomment
expr                         my_print_defaults            wavcmp
extract_mpeg2                mysql                        wavpack
faad                         mysql_client_test            wc
fbdump                       mysql_config                 wget
fbgrab                       mysql_convert_table_format   whetstone
fbterm                       mysql_find_rows              which
fbv                          mysql_fix_extensions         who
fc
-cache                     mysql_fix_privilege_tables   whoami
fc
-cat                       mysql_secure_installation    wvgain
fc
-list                      mysql_setpermission          wvunpack
fc
-match                     mysql_upgrade                xargs
fdformat                     mysql_waitpid                xaumix
fftw
-wisdom                  mysql_zap                    xml
fftw
-wisdom-to-conf          mysqlaccess                  xmlcatalog
file                         mysqladmin                   xmllint
filecap                      mysqlbinlog                  xsltproc
find                         mysqlbug                     xz
flac                         mysqlcheck                   xzcat
flea                         mysqld_multi                 xzcmp
flex                         mysqldump                    xzdec
flushdisk                    mysqldumpslow                xzdiff
fold                         mysqlhotcopy                 xzegrep
free                         mysqlimport                  xzfgrep
fuser                        mysqlshow                    xzgrep
fusermount                   mysqlslap                    xzless
fusion_call                  mysqltest                    xzmore
fusion_fork                  nano                         yacc
fusion_reactor               nanocom                      yes 

[root@kindle bin]# cd /mnt/us/sbin
[root@kindle sbin]# ls
PHP Code:
blkid              hwclock            lsmod              poweroff           swapon
devmem             ifconfig           makedevs           reboot             switch_root
dosfsck            ifdown             mdev               rmmod              sysctl
dosfslabel         ifup               mkdosfs            route              syslogd
freeramdisk        init               mkswap             runlevel           udhcpc
fsck               insmod             modprobe           setconsole         vconfig
getty              klogd              mount
.cifs         start-stop-daemon  watchdog
halt               loadkmap           nameif             sulogin
hdparm             losetup            pivot_root         swapoff 
/mnt/us/bin currently just contains LOTS of copies of Busybox 1.20.x

/lib contains the new kernel modules and libs obviously
[root@kindle bin]# cd /mnt/us/lib
[root@kindle lib]# ls
PHP Code:
ld-2.3.6.so            libdl.so.2             libnss_dns.so.2        librt-2.3.6.so
ld
-linux.so.3          libgcc_s.so.1          libnss_files-2.3.6.so  librt.so.1
libc
-2.3.6.so          libm-2.3.6.so          libnss_files.so.2      libutil-2.3.6.so
libc
.so.6              libm.so.6              libpthread-2.3.6.so    libutil.so.1
libcrypt
-2.3.6.so      libnsl-2.3.6.so        libpthread.so.0        modules
libcrypt
.so.1          libnsl.so.1            libresolv-2.3.6.so
libdl
-2.3.6.so         libnss_dns-2.3.6.so    libresolv.so.2 
/etc contains the config setupathon detritus

[root@kindle lib]# cd /mnt/us/etc
[root@kindle etc]# ls
PHP Code:
ImageMagick           inittab               mtab                  shadow
TZ                    inputrc               network               ssh_config
at
.deny               issue                 os-release            sshd_config
beecrypt
.conf         ld.so.cache           passwd                ssl
dbus
-1                ld.so.conf            php.ini               sudoers
fonts                 ld
.so.conf.d          profile               sudoers.d
fstab                 ltrace
.conf           protocols             sysconfig
group                 memstat
.conf          random-seed           ts.conf
hostname              mime
.types            screenrc              usb_modeswitch.setup
hosts                 mime
.types.dist       securetty
init
.d                moduli                services 
And then there is /mnt/us/usr/lib a mighty beast indeed for a tiny box

[root@kindle etc]# cd /mnt/us/usr/lib
[root@kindle lib]# ls
Spoiler:
PHP Code:
ImageMagick-6.7.6                         liblockfile.so
alsa
-lib                                  liblockfile.so.1
ao                                        liblockfile
.so.1.0
apr
-util-1                                libltdl.so
apr
.exp                                   libltdl.so.7
aprutil
.exp                               libltdl.so.7.2.2
beecrypt                                  liblua
.so
bellagio                                  liblua
.so.5.1.5
cairo                                     liblzma
.so
directfb
-1.4-6                            liblzma.so.5
esmtp
-plugins                             liblzma.so.5.0.3
icu                                       liblzo2
.so
imlib2                                    liblzo2
.so.2
ldscripts                                 liblzo2
.so.2.0.0
libFLAC
.so                                libmad.so
libFLAC
.so.8                              libmad.so.0
libFLAC
.so.8.2.0                          libmad.so.0.2.1
libImlib2
.so                              libmagic.so
libImlib2
.so.1                            libmagic.so.1
libImlib2
.so.1.4.5                        libmagic.so.1.0.0
libMagick
++.so                            libmicrohttpd.so
libMagick
++.so.5                          libmicrohttpd.so.5
libMagick
++.so.5.0.0                      libmicrohttpd.so.5.2.1
libMagickCore
.so                          libmp3lame.so
libMagickCore
.so.5                        libmp3lame.so.0
libMagickCore
.so.5.0.0                    libmp3lame.so.0.0.0
libMagickWand
.so                          libmpc.so
libMagickWand
.so.5                        libmpc.so.2
libMagickWand
.so.5.0.0                    libmpc.so.2.0.0
libPocoCrypto
.so                          libmpcdec.so
libPocoCrypto
.so.12                       libmpcdec.so.7
libPocoData
.so                            libmpcdec.so.7.0.1
libPocoData
.so.12                         libmpeg2.so
libPocoDataMySQL
.so                       libmpeg2.so.0
libPocoDataMySQL
.so.12                    libmpeg2.so.0.1.0
libPocoDataSQLite
.so                      libmpeg2convert.so
libPocoDataSQLite
.so.12                   libmpeg2convert.so.0
libPocoFoundation
.so                      libmpeg2convert.so.0.0.0
libPocoFoundation
.so.12                   libmpfr.so
libPocoNet
.so                             libmpfr.so.4
libPocoNet
.so.12                          libmpfr.so.4.1.1
libPocoNetSSL
.so                          libmpg123.so
libPocoNetSSL
.so.12                       libmpg123.so.0
libPocoUtil
.so                            libmpg123.so.0.36.3
libPocoUtil
.so.12                         libmxml.so
libPocoXML
.so                             libmxml.so.1
libPocoXML
.so.12                          libmxml.so.1.5
libPocoZip
.so                             libncurses.so
libPocoZip
.so.12                          libncurses.so.5
libSDL
-1.2.so.0                           libncurses.so.5.9
libSDL
-1.2.so.0.11.4                      libneon.so
libSDL
.so                                 libneon.so.27
libSDL_gfx
.so                             libneon.so.27.2.6
libSDL_gfx
.so.13                          libnewt.so
libSDL_gfx
.so.13.5.1                      libnewt.so.0.51
libSDL_image
-1.2.so.0                     libnewt.so.0.51.0
libSDL_image
-1.2.so.0.1.5                 libnspr4.so
libSDL_image
.so                           libnss3.so
libSDL_mixer
-1.2.so.0                     libnssckbi.so
libSDL_mixer
-1.2.so.0.10.1                libnssdbm3.so
libSDL_mixer
.so                           libnssutil3.so
libSDL_net
-1.2.so.0                       libntfs-3g.so
libSDL_net
-1.2.so.0.8.0                   libntfs-3g.so.83
libSDL_net
.so                             libntfs-3g.so.83.0.0
libSDL_sound
-1.0.so.1                     liboauth.so
libSDL_sound
-1.0.so.1.0.2                 liboauth.so.0
libSDL_sound
.so                           liboauth.so.0.8.3
libSDL_ttf
-2.0.so.0                       libogg.so
libSDL_ttf
-2.0.so.0.6.3                   libogg.so.0
libSDL_ttf
.so                             libogg.so.0.8.0
libacl
.so.1                               libomxil-bellagio.so
libacl
.so.1.1.0                           libomxil-bellagio.so.0
libaio
.so                                 libomxil-bellagio.so.0.0.0
libaio
.so.1                               libopcodes-2.21.so
libaio
.so.1.0.1                           libopcodes.so
libao
.so                                  libopencv_calib3d.so
libao
.so.4                                libopencv_calib3d.so.2.4
libao
.so.4.0.0                            libopencv_calib3d.so.2.4.2
libapr
-1.so                               libopencv_contrib.so
libapr
-1.so.0                             libopencv_contrib.so.2.4
libapr
-1.so.0.4.6                         libopencv_contrib.so.2.4.2
libaprutil
-1.so                           libopencv_core.so
libaprutil
-1.so.0                         libopencv_core.so.2.4
libaprutil
-1.so.0.4.1                     libopencv_core.so.2.4.2
libarchive
.so                             libopencv_features2d.so
libarchive
.so.2                           libopencv_features2d.so.2.4
libarchive
.so.2.8.5                       libopencv_features2d.so.2.4.2
libargtable2
.so                           libopencv_flann.so
libargtable2
.so.0                         libopencv_flann.so.2.4
libargtable2
.so.0.1.8                     libopencv_flann.so.2.4.2
libart_lgpl_2
.so                          libopencv_gpu.so
libart_lgpl_2
.so.2                        libopencv_gpu.so.2.4
libart_lgpl_2
.so.2.3.21                   libopencv_gpu.so.2.4.2
libasound
.so                              libopencv_highgui.so
libasound
.so.2                            libopencv_highgui.so.2.4
libasound
.so.2.0.0                        libopencv_highgui.so.2.4.2
libattr
.so.1                              libopencv_imgproc.so
libattr
.so.1.1.0                          libopencv_imgproc.so.2.4
libaudiofile
.so                           libopencv_imgproc.so.2.4.2
libaudiofile
.so.1                         libopencv_legacy.so
libaudiofile
.so.1.0.0                     libopencv_legacy.so.2.4
libbeecrypt
.so                            libopencv_legacy.so.2.4.2
libbeecrypt
.so.7                          libopencv_ml.so
libbeecrypt
.so.7.0.0                      libopencv_ml.so.2.4
libbeecrypt_cxx
.so                        libopencv_ml.so.2.4.2
libbeecrypt_cxx
.so.7                      libopencv_nonfree.so
libbeecrypt_cxx
.so.7.0.0                  libopencv_nonfree.so.2.4
libbfd
-2.21.so                            libopencv_nonfree.so.2.4.2
libbfd
.so                                 libopencv_objdetect.so
libbz2
.so                                 libopencv_objdetect.so.2.4
libbz2
.so.1                               libopencv_objdetect.so.2.4.2
libbz2
.so.1.0                             libopencv_photo.so
libbz2
.so.1.0.6                           libopencv_photo.so.2.4
libcJSON
.so                               libopencv_photo.so.2.4.2
libcairo
-script-interpreter.so            libopencv_stitching.so
libcairo
-script-interpreter.so.2          libopencv_stitching.so.2.4
libcairo
-script-interpreter.so.2.11000.2  libopencv_stitching.so.2.4.2
libcairo
.so                               libopencv_ts.so
libcairo
.so.2                             libopencv_ts.so.2.4
libcairo
.so.2.11000.2                     libopencv_ts.so.2.4.2
libcap
-ng.so                              libopencv_video.so
libcap
-ng.so.0                            libopencv_video.so.2.4
libcap
-ng.so.0.0.0                        libopencv_video.so.2.4.2
libcap
.so                                 libopencv_videostab.so
libcap
.so.2                               libopencv_videostab.so.2.4
libcap
.so.2.22                            libopencv_videostab.so.2.4.2
libcgi
.so                                 libopkg.so
libcgi
.so.0                               libopkg.so.0
libcgicc
.so                               libopkg.so.0.0.0
libcgicc
.so.5                             liborc-0.4.so
libcgicc
.so.5.0.2                         liborc-0.4.so.0
libconfig
++.so                            liborc-0.4.so.0.14.0
libconfig
++.so.9                          liborc-test-0.4.so
libconfig
++.so.9.1.2                      liborc-test-0.4.so.0
libconfig
.so                              liborc-test-0.4.so.0.14.0
libconfig
.so.9                            libosip2.so
libconfig
.so.9.1.2                        libosip2.so.7
libconfuse
.so                             libosip2.so.7.2.0
libconfuse
.so.0                           libosipparser2.so
libconfuse
.so.0.0.0                       libosipparser2.so.7
libcrypto
.so                              libosipparser2.so.7.2.0
libcrypto
.so.1.0.0                        libpcre.so
libcuefile
.so                             libpcre.so.1
libcuefile
.so.0                           libpcre.so.1.0.0
libcuefile
.so.0.0.0                       libpcrecpp.so
libcurl
.so                                libpcrecpp.so.0
libcurl
.so.4                              libpcrecpp.so.0.0.0
libcurl
.so.4.2.0                          libpcreposix.so
libdaemon
.so                              libpcreposix.so.0
libdaemon
.so.0                            libpcreposix.so.0.0.0
libdaemon
.so.0.5.0                        libpixman-1.so
libdb
-5.3.so                              libpixman-1.so.0
libdb
-5.so                                libpixman-1.so.0.25.2
libdb
.so                                  libplc4.so
libdb_cxx
-5.3.so                          libplds4.so
libdb_cxx
-5.so                            libpng.so
libdb_cxx
.so                              libpng14.so
libdbus
-1.so                              libpng14.so.14
libdbus
-1.so.3                            libpng14.so.14.12.0
libdbus
-1.so.3.5.9                        libpolarssl.so
libdirect
-1.4.so.6                        libpolarssl.so.1
libdirect
-1.4.so.6.0.10                   libpolarssl.so.1.1.3
libdirect
.so                              libpopt.so
libdirectfb
-1.4.so.6                      libpopt.so.0
libdirectfb
-1.4.so.6.0.10                 libpopt.so.0.0.0
libdirectfb
.so                            libportaudio.so
libdivine
-0.4.so.0                        libportaudio.so.2
libdivine
-0.4.so.0.0.0                    libportaudio.so.2.0.0
libdivine
.so                              libportaudiocpp.so
libdmalloc
.so                             libportaudiocpp.so.0
libdmallocth
.so                           libportaudiocpp.so.0.0.12
libdmallocthcxx
.so                        libprotobuf-lite.so
libdmallocxx
.so                           libprotobuf-lite.so.7
libdmtx
.so                                libprotobuf-lite.so.7.0.0
libdmtx
.so.0                              libprotobuf.so
libdmtx
.so.0.0.0                          libprotobuf.so.7
libdnet
.so                                libprotobuf.so.7.0.0
libdnet
.so.1                              libprotoc.so
libdnet
.so.1.0.1                          libprotoc.so.7
libeXosip2
.so                             libprotoc.so.7.0.0
libeXosip2
.so.7                           libpython2.7.so
libeXosip2
.so.7.2.0                       libpython2.7.so.1.0
libelf
.so                                 libraw.so
libelf
.so.0                               libraw.so.2
libelf
.so.0.8.12                          libraw.so.2.0.3
libesmtp
.so                               libraw_r.so
libesmtp
.so.6                             libraw_r.so.2
libesmtp
.so.6.1.6                         libraw_r.so.2.0.3
libev
.so                                  libreadline.so
libev
.so.4                                libreadline.so.6
libev
.so.4.0.0                            libreadline.so.6.2
libevent
-2.0.so.5                         libreplaygain.so
libevent
-2.0.so.5.1.3                     libreplaygain.so.1
libevent
.so                               libreplaygain.so.1.0.0
libevent_core
-2.0.so.5                    libroxml.so
libevent_core
-2.0.so.5.1.3                libroxml.so.0
libevent_core
.so                          librrd.so
libevent_extra
-2.0.so.5                   librrd.so.2
libevent_extra
-2.0.so.5.1.3               librrd.so.2.0.15
libevent_extra
.so                         librrd_th.so
libevent_openssl
-2.0.so.5                 librrd_th.so.2
libevent_openssl
-2.0.so.5.1.3             librrd_th.so.2.0.13
libevent_openssl
.so                       librsync.so
libevent_pthreads
-2.0.so.5                librsync.so.1
libevent_pthreads
-2.0.so.5.1.3            librsync.so.1.0.2
libevent_pthreads
.so                      libruby.so
libexif
.so                                libruby.so.1.9
libexif
.so.12                             libruby.so.1.9.1
libexif
.so.12.3.3                         libsamplerate.so
libexpat
.so                               libsamplerate.so.0
libexpat
.so.1                             libsamplerate.so.0.1.8
libexpat
.so.1.6.0                         libsigc-2.0.so
libexslt
.so                               libsigc-2.0.so.0
libexslt
.so.0                             libsigc-2.0.so.0.0.0
libexslt
.so.0.8.15                        libslang.so
libfaad
.so                                libslang.so.1
libfaad
.so.2                              libsmime3.so
libfaad
.so.2.0.0                          libsndfile.so
libfcgi
++.so                              libsndfile.so.1
libfcgi
++.so.0                            libsndfile.so.1.0.25
libfcgi
++.so.0.0.0                        libsoftokn3.so
libfcgi
.so                                libspeex.so
libfcgi
.so.0                              libspeex.so.1
libfcgi
.so.0.0.0                          libspeex.so.1.5.0
libffi
.so                                 libspeexdsp.so
libffi
.so.6                               libspeexdsp.so.1
libffi
.so.6.0.0                           libspeexdsp.so.1.5.0
libfftw3
.so                               libsqlite3.so
libfftw3
.so.3                             libsqlite3.so.0
libfftw3
.so.3.3.0                         libsqlite3.so.0.8.6
libfontconfig
.so                          libssl.so
libfontconfig
.so.1                        libssl.so.1.0.0
libfontconfig
.so.1.3.0                    libssl3.so
libfreebl3
.so                             libstdc++.so.6
libfreetype
.so                            libstdc++.so.6.0.8
libfreetype
.so.6                          libtag.so
libfreetype
.so.6.9.0                      libtag.so.1
libfuse
.so                                libtag.so.1.7.1
libfuse
.so.2                              libtag_c.so
libfuse
.so.2.9.0                          libtag_c.so.0
libfusion
-1.4.so.6                        libtag_c.so.0.0.0
libfusion
-1.4.so.6.0.10                   libtcl8.4.so
libfusion
.so                              libtheora.so
libgcrypt
.so                              libtheora.so.0
libgcrypt
.so.11                           libtheora.so.0.3.10
libgcrypt
.so.11.7.0                       libtheoradec.so
libgeotiff
.so                             libtheoradec.so.1
libgeotiff
.so.2                           libtheoradec.so.1.1.4
libgeotiff
.so.2.0.0                       libtheoraenc.so
libgmp
.so                                 libtheoraenc.so.1
libgmp
.so.10                              libtheoraenc.so.1.1.2
libgmp
.so.10.0.5                          libtiff.so
libgnutls
-extra.so                        libtiff.so.5
libgnutls
-extra.so.26                     libtiff.so.5.0.6
libgnutls
-extra.so.26.22.3                libtorrent.so
libgnutls
-openssl.so                      libtorrent.so.14
libgnutls
-openssl.so.27                   libtorrent.so.14.0.4
libgnutls
-openssl.so.27.0.0               libtpl.so
libgnutls
.so                              libtpl.so.0
libgnutls
.so.26                           libtpl.so.0.0.0
libgnutls
.so.26.22.3                      libts-1.0.so.0
libgnutlsxx
.so                            libts-1.0.so.0.0.0
libgnutlsxx
.so.27                         libts.so
libgnutlsxx
.so.27.0.0                     libungif.so
libgpg
-error.so                           libungif.so.4
libgpg
-error.so.0                         libungif.so.4.1.4
libgpg
-error.so.0.8.0                     libusb-0.1.so.4
libhid
.so                                 libusb-0.1.so.4.4.4
libhid
.so.0                               libusb-1.0.so
libhid
.so.0.0.0                           libusb-1.0.so.0
libhistory
.so                             libusb-1.0.so.0.1.0
libhistory
.so.6                           libusb.so
libhistory
.so.6.2                         libvorbis.so
libical
.so                                libvorbis.so.0
libical
.so.0                              libvorbis.so.0.4.6
libical
.so.0.48.0                         libvorbisenc.so
libicalss
.so                              libvorbisenc.so.2
libicalss
.so.0                            libvorbisenc.so.2.0.9
libicalss
.so.0.48.0                       libvorbisfile.so
libicalvcal
.so                            libvorbisfile.so.3
libicalvcal
.so.0                          libvorbisfile.so.3.3.5
libicalvcal
.so.0.48.0                     libvorbisidec.so
libicudata
.so                             libvorbisidec.so.1
libicudata
.so.48                          libvorbisidec.so.1.0.3
libicudata
.so.48.1.1                      libwavpack.so
libicui18n
.so                             libwavpack.so.1
libicui18n
.so.48                          libwavpack.so.1.1.4
libicui18n
.so.48.1.1                      libwebrtc_audio_processing.so
libicuio
.so                               libwebrtc_audio_processing.so.0
libicuio
.so.48                            libwebrtc_audio_processing.so.0.0.0
libicuio
.so.48.1.1                        libxerces-c-3.1.so
libicule
.so                               libxerces-c.so
libicule
.so.48                            libxml2.so
libicule
.so.48.1.1                        libxml2.so.2
libiculx
.so                               libxml2.so.2.8.0
libiculx
.so.48                            libxslt-plugins
libiculx
.so.48.1.1                        libxslt.so
libicutest
.so                             libxslt.so.1
libicutest
.so.48                          libxslt.so.1.1.26
libicutest
.so.48.1.1                      libyajl.so
libicutu
.so                               libyajl.so.2
libicutu
.so.48                            libyajl.so.2.0.4
libicutu
.so.48.1.1                        libyaml-0.so.2
libicuuc
.so                               libyaml-0.so.2.0.2
libicuuc
.so.48                            libyaml.so
libicuuc
.so.48.1.1                        libz.so
libid3tag
.so                              libz.so.1
libid3tag
.so.0                            libz.so.1.2.7
libid3tag
.so.0.3.0                        lua
libidn
.so                                 mpg123
libidn
.so.11                              mysql
libidn
.so.11.6.8                          omxloaders
libinotifytools
.so                        opkg
libinotifytools
.so.0                      perl5
libinotifytools
.so.0.4.1                  python2.7
libjpeg
.so                                ruby
libjpeg
.so.8                              sa
libjpeg
.so.8.4.0                          sftp-server
libjson
.so                                sigc++-2.0
libjson
.so.0                              ssh-keysign
libjson
.so.0.0.1                          ssh-pkcs11-helper
libleck
.so                                tcl8.4
libleck
.so.3                              tclConfig.sh
libleck
.so.3.0.5                          terminfo
liblite
.so                                ts
liblite
.so.3                              xml2Conf.sh
liblite
.so.3.0.5                          xsltConf.sh 


That concludes the brief - What is in the box?

That can be a purposeful development environment in an emulator for damn sure.
No shortage of twiddling fiddles there.

Might have to Wangle pkg-config in the short term.

Anyways - that was my day.

Building that lot so you lot can be sure what to expect.

Last edited by twobob; 08-18-2012 at 06:22 PM. Reason: 's'
twobob is offline   Reply With Quote
Reply

Tags
buildroot, compile, howto, kernal, kindle 3.3


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Titus enTourage Archive 6 09-07-2010 11:23 AM
So as a Linux..... tajreed General Discussions 13 04-05-2010 12:51 PM
Linux? Ron46 Ectaco jetBook 8 12-24-2009 08:07 AM
Linux coredump Sony Reader 12 11-17-2009 05:07 AM
Linux Help clewley Bookeen 3 04-04-2008 08:40 AM


All times are GMT -4. The time now is 01:30 AM.


MobileRead.com is a privately owned, operated and funded community.