<s>
Layered	B-Library
Service	I-Library
Provider	I-Library
(	O
LSP	O
)	O
is	O
a	O
deprecated	O
feature	O
of	O
the	O
Microsoft	B-Application
Windows	I-Application
Winsock	B-Application
2	I-Application
Service	B-Application
Provider	I-Application
Interface	I-Application
(	O
SPI	O
)	O
.	O
</s>
<s>
A	O
Layered	B-Library
Service	I-Library
Provider	I-Library
is	O
a	O
DLL	O
that	O
uses	O
Winsock	B-Application
APIs	O
to	O
attempt	O
to	O
insert	O
itself	O
into	O
the	O
TCP/IP	B-Protocol
protocol	I-Protocol
stack	I-Protocol
.	O
</s>
<s>
Once	O
in	O
the	O
stack	O
,	O
a	O
Layered	B-Library
Service	I-Library
Provider	I-Library
can	O
intercept	O
and	O
modify	O
inbound	O
and	O
outbound	O
Internet	O
traffic	O
.	O
</s>
<s>
It	O
allows	O
processing	O
of	O
all	O
the	O
TCP/IP	B-Protocol
traffic	O
taking	O
place	O
between	O
the	O
Internet	O
and	O
the	O
applications	O
that	O
are	O
accessing	O
the	O
Internet	O
(	O
such	O
as	O
a	O
web	O
browser	O
,	O
the	O
email	O
client	O
,	O
etc	O
.	O
)	O
.	O
</s>
<s>
The	O
Winsock	B-Library
Service	I-Library
Provider	I-Library
Interface	O
(	O
SPI	O
)	O
API	O
provides	O
a	O
mechanism	O
for	O
layering	O
providers	O
on	O
top	O
of	O
each	O
other	O
.	O
</s>
<s>
Winsock	B-Library
LSPs	I-Library
are	O
available	O
for	O
a	O
range	O
of	O
useful	O
purposes	O
,	O
including	O
parental	O
controls	O
and	O
Web	O
content	O
filtering	O
.	O
</s>
<s>
The	O
layering	O
order	O
of	O
all	O
providers	O
is	O
kept	O
in	O
the	O
Winsock	B-Application
Catalog	O
.	O
</s>
<s>
Unlike	O
the	O
well-known	O
Winsock	B-Application
2	I-Application
API	O
,	O
which	O
is	O
covered	O
by	O
numerous	O
books	O
,	O
documentation	O
,	O
and	O
samples	O
,	O
the	O
Winsock	B-Application
2	I-Application
SPI	O
is	O
relatively	O
unexplored	O
.	O
</s>
<s>
The	O
Winsock	B-Application
2	I-Application
SPI	O
is	O
implemented	O
by	O
network	O
transport	O
service	O
providers	O
and	O
namespace	O
resolution	O
service	O
providers	O
.	O
</s>
<s>
The	O
Winsock	B-Application
2	I-Application
SPI	O
can	O
be	O
used	O
to	O
extend	O
an	O
existing	O
transport	O
service	O
provider	O
by	O
implementing	O
a	O
Layered	B-Library
Service	I-Library
Provider	I-Library
.	O
</s>
<s>
For	O
example	O
,	O
quality	O
of	O
service	O
(	O
QoS	O
)	O
on	O
Windows	O
98	O
and	O
Windows	O
2000	O
is	O
implemented	O
as	O
an	O
LSP	O
over	O
the	O
TCP/IP	B-Protocol
protocol	I-Protocol
stack	I-Protocol
.	O
</s>
<s>
The	O
Winsock	B-Application
2	I-Application
SPI	O
allows	O
software	O
developers	O
to	O
create	O
two	O
different	O
types	O
of	O
service	O
providers	O
—	O
transport	O
and	O
namespace	O
.	O
</s>
<s>
Transport	O
providers	O
(	O
commonly	O
referred	O
to	O
as	O
protocol	B-Protocol
stacks	I-Protocol
)	O
are	O
services	O
,	O
which	O
supply	O
functions	O
that	O
set	O
up	O
connections	O
,	O
transfer	O
data	O
,	O
exercise	O
flow	O
control	O
,	O
error	O
control	O
,	O
and	O
so	O
on	O
.	O
</s>
<s>
The	O
SPI	O
also	O
allows	O
you	O
to	O
develop	O
two	O
types	O
of	O
transport	O
service	O
providers	O
—	O
base	O
and	O
layered	B-Library
service	I-Library
providers	I-Library
.	O
</s>
<s>
Layered	B-Library
service	I-Library
providers	I-Library
implement	O
only	O
higher-level	O
custom	O
communication	O
functions	O
and	O
rely	O
on	O
an	O
existing	O
underlying	O
base	O
provider	O
for	O
the	O
actual	O
data	O
exchange	O
with	O
a	O
remote	O
endpoint	O
.	O
</s>
<s>
Winsock	B-Application
2	I-Application
LSPs	O
are	O
implemented	O
as	O
Windows	O
DLLs	O
with	O
a	O
single	O
exported	O
entry	O
function	O
,	O
WSPStartup	O
.	O
</s>
<s>
The	O
LSP	O
DLL	O
has	O
to	O
be	O
registered	O
using	O
a	O
special	O
LSP	O
registrant	O
which	O
instructs	O
Winsock	B-Application
2	I-Application
,	O
the	O
loading	O
order	O
of	O
the	O
LSPs	O
(	O
there	O
can	O
be	O
more	O
than	O
one	O
LSP	O
installed	O
)	O
and	O
which	O
protocols	O
to	O
intercept	O
.	O
</s>
<s>
LSPs	O
work	O
by	O
intercepting	O
Winsock	B-Application
2	I-Application
commands	O
before	O
they	O
are	O
processed	O
by	O
ws2_32.dll	O
;	O
they	O
can	O
therefore	O
modify	O
the	O
commands	O
,	O
drop	O
a	O
command	O
,	O
or	O
just	O
log	O
the	O
data	O
which	O
makes	O
them	O
a	O
useful	O
tool	O
for	O
malware	O
,	O
network	O
filters	O
,	O
network	O
intercepters	O
,	O
and	O
stream	O
based	O
sniffers	O
.	O
</s>
<s>
Sniffing	O
network	O
traffic	O
through	O
LSP	O
can	O
sometimes	O
be	O
troublesome	O
since	O
anti-virus	O
vendors	O
typically	O
flag	O
such	O
activity	O
as	O
malicious	O
—	O
a	O
network	O
packet	B-Protocol
analyzer	I-Protocol
is	O
therefore	O
a	O
better	O
alternative	O
for	O
capturing	O
network	O
traffic	O
.	O
</s>
<s>
A	O
feature	O
of	O
LSP	O
and	O
Winsock	B-Application
proxy	O
sniffing	O
is	O
that	O
they	O
allow	O
traffic	O
to	O
be	O
captured	O
from	O
a	O
single	O
application	O
and	O
also	O
enable	O
traffic	O
going	O
to	O
localhost	B-Protocol
(	O
127.0.0.1	B-Protocol
)	O
to	O
be	O
sniffed	O
on	O
Windows	O
.	O
</s>
<s>
The	O
difference	O
between	O
the	O
two	O
LSPs	O
is	O
that	O
non	O
IFS	O
LSPs	O
modify	O
the	O
socket	B-Protocol
handle	O
to	O
a	O
non	O
valid	O
Windows	O
IFS	O
handle	O
and	O
therefore	O
the	O
LSP	O
must	O
implement	O
all	O
Winsock	B-Application
2	I-Application
methods	O
.	O
</s>
<s>
IFS	O
LSPs	O
,	O
on	O
the	O
other	O
hand	O
,	O
preserve	O
the	O
socket	B-Protocol
handle	O
,	O
which	O
allows	O
the	O
LSP	O
to	O
implement	O
only	O
the	O
functions	O
it	O
wants	O
to	O
intercept	O
.	O
</s>
<s>
LSPs	O
have	O
been	O
deprecated	O
since	O
Windows	B-Device
Server	I-Device
2012	I-Device
.	O
</s>
<s>
For	O
example	O
,	O
an	O
LSP	O
that	O
returns	O
the	O
wrong	O
number	O
of	O
bytes	O
sent	O
through	O
an	O
interface	O
can	O
cause	O
applications	O
to	O
go	O
into	O
an	O
infinite	O
loop	O
while	O
waiting	O
for	O
the	O
network	B-Protocol
stack	I-Protocol
to	O
indicate	O
that	O
data	O
has	O
been	O
sent	O
.	O
</s>
<s>
Another	O
major	O
common	O
issue	O
with	O
LSPs	O
was	O
that	O
if	O
they	O
were	O
to	O
be	O
removed	O
or	O
unregistered	O
improperly	O
or	O
if	O
the	O
LSP	O
was	O
buggy	O
,	O
it	O
would	O
result	O
in	O
corruption	O
of	O
the	O
Winsock	B-Application
catalog	O
in	O
the	O
registry	O
,	O
and	O
the	O
entire	O
TCP/IP	B-Protocol
stack	I-Protocol
would	O
break	O
and	O
the	O
computer	O
could	O
no	O
longer	O
access	O
the	O
network	O
.	O
</s>
<s>
For	O
example	O
,	O
malware	O
may	O
insert	O
itself	O
as	O
an	O
LSP	O
in	O
the	O
network	B-Protocol
stack	I-Protocol
and	O
forward	O
all	O
of	O
the	O
user	O
's	O
traffic	O
to	O
an	O
unauthorized	O
external	O
site	O
,	O
where	O
it	O
can	O
be	O
data-mined	O
to	O
find	O
the	O
user	O
's	O
interests	O
to	O
bombard	O
him/her	O
with	O
targeted	O
advertisements	O
,	O
as	O
well	O
as	O
spam	O
e-mail	O
.	O
</s>
<s>
Such	O
potential	O
loss	O
of	O
all	O
network	O
connectivity	O
is	O
prevented	O
in	O
Windows	O
XP	O
Service	O
Pack	O
2	O
,	O
Windows	O
Server	O
2003	O
Service	O
Pack	O
1	O
and	O
all	O
later	O
Windows	B-Application
operating	I-Application
systems	I-Application
,	O
in	O
which	O
Winsock	B-Application
has	O
the	O
ability	O
to	O
self-heal	O
after	O
a	O
user	O
uninstalls	O
such	O
an	O
LSP	O
.	O
</s>
<s>
Installed	O
LSPs	O
can	O
be	O
viewed	O
using	O
the	O
XP/Vista	O
Windows	B-Application
Defender	I-Application
's	O
Software	O
Explorer	O
or	O
using	O
third-party	O
utilities	O
.	O
</s>
