I have to restart winxp when i install the minifilter driver, why??

I test the swapbuffers example included in WDK - Vista
RTMhttps:(6000),
when i install it firstly, it works, but when i rebuild it and reinstall it,
it can’t work. why??

install:
rundll32.exe setupapi,InstallHinfSection DefaultInstall 132
.\swapBuffers.inf
fltmc load swapBuffers
uninstall:
fltmc unload swapBuffers
rundll32.exe setupapi,InstallHinfSection DefaultUninstall 132
.\swapBuffers.inf

i only modify the SwapPreReadBuffers method as follows:

//
// If they are trying to read ZERO bytes, then don’t do anything
and
// we don’t need a post-operation callback.
//
if (readLen == 0) {

leave;
}

//
// Get our volume context so we can display our volume name in the
// debug output.
//

status = FltGetVolumeContext( FltObjects->Filter,
FltObjects->Volume,
&volCtx );

if (!NT_SUCCESS(status)) {

LOG_PRINT( LOGFL_ERRORS,
(“SwapBuffers!SwapPreReadBuffers: Error
getting volume context, status=%x\n”,
status) );

leave;
}

// get filename added by yao on 2007/09/30
RtlInitEmptyUnicodeString(&fullName, temp, sizeof(temp));
if (!GetFullName(IN FltObjects, IN Data, OUT &fullName))
{
leave;
}

// check

RtlInitUnicodeString(&encPath,L"D:\ENC\");
if (!IsEnctyptionFile(&fullName, &encPath))
{
leave;
}

KdPrint((“read filtered fullName = %wZ”, &fullName));

//
// If this is a non-cached I/O we need to round the length up to
the
// sector size for this device. We must do this because the file
// systems do this and we need to make sure our buffer is as big
// as they are expecting.
//



GetFullName and IsEnctyptionFile are used in SwapPreReadBuffers routine.

/ ***
*
* Get full filename
*
/
BOOLEAN GetFullName(IN PCFLT_RELATED_OBJECTS FltObjects, IN
PFLT_CALLBACK_DATA Data, OUT PUNICODE_STRING fileName)
{
NTSTATUS status;
PVOLUME_CONTEXT volCtx = NULL;
PFLT_FILE_NAME_INFORMATION nameInfo = NULL;
//WCHAR temp[256];

status = FltGetVolumeContext( FltObjects->Filter,
FltObjects->Volume,
&volCtx );

if (!NT_SUCCESS(status)) {
return FALSE;
}

if(FltObjects->FileObject != 0)
{
status = FltGetFileNameInformation( Data,
FLT_FILE_NAME_NORMALIZED |
FLT_FILE_NAME_QUERY_ALWAYS_ALLOW_CACHE_LOOKUP,
&nameInfo );
}
else
{
status = STATUS_UNSUCCESSFUL;
}

if (NT_SUCCESS( status )) {
status = FltParseFileNameInformation( nameInfo );
}
else
{
return FALSE;
}

//RtlInitEmptyUnicodeString(&fullName, temp, sizeof(temp));
RtlUnicodeStringCat(fileName, &volCtx->Name);
RtlUnicodeStringCat(fileName, &nameInfo->ParentDir);
RtlUnicodeStringCat(fileName, &nameInfo->FinalComponent);
fileName->Length = volCtx->Name.Length + nameInfo->ParentDir.Length +
nameInfo->FinalComponent.Length;

return TRUE;
}

/ ***
*
* Check the file is under encryption path or not
*
/
BOOLEAN IsEnctyptionFile(IN PUNICODE_STRING fileName, IN PUNICODE_STRING
encPath)
{
USHORT temp;

temp = fileName->Length;
fileName->Length = encPath->Length;
if(RtlEqualUnicodeString(fileName, encPath, TRUE))
{
fileName->Length = temp;
return TRUE;
}
else
{
fileName->Length = temp;
return FALSE;
}
}</https:>

Without looking into the code: when you do uninstall, you delete a service.

When this happens, the service is deleted from the registry but stays in the
in-memory SCM’s database; this discrepancy can be corrected only by a
reboot.

However, you don’t need to uninstall a minifilter at all;
unload-rebuild-load is good enough - you can verify that the new binary will
be loaded and run.

Do not do (unnecessary) uninstall, that will solve the problem.

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of ??
Sent: Tuesday, October 09, 2007 9:30 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] I have to restart winxp when i install the minifilter
driver, why??

I test the swapbuffers example included in WDK
https:nloadID=4606> - Vista RTM(6000), when i install it firstly, it works, but
when i rebuild it and reinstall it, it can’t work. why??

install:

rundll32.exe setupapi,InstallHinfSection DefaultInstall 132
.\swapBuffers.inf
fltmc load swapBuffers

uninstall:

fltmc unload swapBuffers
rundll32.exe setupapi,InstallHinfSection DefaultUninstall 132
.\swapBuffers.inf

i only modify the SwapPreReadBuffers method as follows:

//
// If they are trying to read ZERO bytes, then don’t do anything
and
// we don’t need a post-operation callback.
//
if (readLen == 0) {

leave;
}

//
// Get our volume context so we can display our volume name in the
// debug output.
//

status = FltGetVolumeContext( FltObjects->Filter,
FltObjects->Volume,
&volCtx );

if (!NT_SUCCESS(status)) {

LOG_PRINT( LOGFL_ERRORS,
(“SwapBuffers!SwapPreReadBuffers: Error
getting volume context, status=%x\n”,
status) );

leave;
}

// get filename added by yao on 2007/09/30
RtlInitEmptyUnicodeString(&fullName, temp, sizeof(temp));
if (!GetFullName(IN FltObjects, IN Data, OUT &fullName))
{
leave;
}

// check

RtlInitUnicodeString(&encPath,L"D:\ENC\");
if (!IsEnctyptionFile(&fullName, &encPath))
{
leave;
}

KdPrint((“read filtered fullName = %wZ”, &fullName));

//
// If this is a non-cached I/O we need to round the length up to
the
// sector size for this device. We must do this because the file
// systems do this and we need to make sure our buffer is as big
// as they are expecting.
//



GetFullName and IsEnctyptionFile are used in SwapPreReadBuffers routine.

/ **************************************************

* *
* Get full filename *
* *

****************************************************
/
BOOLEAN GetFullName(IN PCFLT_RELATED_OBJECTS FltObjects, IN
PFLT_CALLBACK_DATA Data, OUT PUNICODE_STRING fileName)
{
NTSTATUS status;
PVOLUME_CONTEXT volCtx = NULL;
PFLT_FILE_NAME_INFORMATION nameInfo = NULL;
//WCHAR temp[256];

status = FltGetVolumeContext( FltObjects->Filter,
FltObjects->Volume,
&volCtx );

if (!NT_SUCCESS(status)) {
return FALSE;
}

if(FltObjects->FileObject != 0)
{
status = FltGetFileNameInformation( Data,
FLT_FILE_NAME_NORMALIZED |
FLT_FILE_NAME_QUERY_ALWAYS_ALLOW_CACHE_LOOKUP,
&nameInfo );
}
else
{
status = STATUS_UNSUCCESSFUL;
}

if (NT_SUCCESS( status )) {
status = FltParseFileNameInformation( nameInfo );
}
else
{
return FALSE;
}

//RtlInitEmptyUnicodeString(&fullName, temp, sizeof(temp));
RtlUnicodeStringCat(fileName, &volCtx->Name);
RtlUnicodeStringCat(fileName, &nameInfo->ParentDir);
RtlUnicodeStringCat(fileName, &nameInfo->FinalComponent);
fileName->Length = volCtx->Name.Length + nameInfo->ParentDir.Length +
nameInfo->FinalComponent.Length;

return TRUE;
}

/ **************************************************

* *
* Check the file is under encryption path or not *
* *

****************************************************
/
BOOLEAN IsEnctyptionFile(IN PUNICODE_STRING fileName, IN PUNICODE_STRING
encPath)
{
USHORT temp;

temp = fileName->Length;
fileName->Length = encPath->Length;
if(RtlEqualUnicodeString(fileName, encPath, TRUE))
{
fileName->Length = temp;
return TRUE;
}
else
{
fileName->Length = temp;
return FALSE;
}
}

— NTFSD is sponsored by OSR For our schedule debugging and file system
seminars (including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars You are currently subscribed to ntfsd as:
xxxxx@comcast.net To unsubscribe send a blank email to
xxxxx@lists.osr.com</https:>

Making the mini filter driver’s start type as demand start in its .inf file
will help here, if ur intention is not to restart machine for each
installation. It’s simple to develop a application to start the driver in
demand start. (Pls ignore this msg if ur intention is not related to this at
all.)


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Alex Shvedov
Sent: Wednesday, October 10, 2007 7:52 AM
To: Windows File Systems Devs Interest List
Subject: RE: [ntfsd] I have to restart winxp when i install the minifilter
driver, why??

Without looking into the code: when you do uninstall, you delete a service.

When this happens, the service is deleted from the registry but stays in the
in-memory SCM’s database; this discrepancy can be corrected only by a
reboot.

However, you don’t need to uninstall a minifilter at all;
unload-rebuild-load is good enough - you can verify that the new binary will
be loaded and run.

Do not do (unnecessary) uninstall, that will solve the problem.

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of ??
Sent: Tuesday, October 09, 2007 9:30 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] I have to restart winxp when i install the minifilter
driver, why??

I test the swapbuffers example included in WDK
https:nloadID=4606> - Vista RTM(6000), when i install it firstly, it works, but
when i rebuild it and reinstall it, it can’t work. why??

install:

rundll32.exe setupapi,InstallHinfSection DefaultInstall 132
.\swapBuffers.inf
fltmc load swapBuffers

uninstall:

fltmc unload swapBuffers
rundll32.exe setupapi,InstallHinfSection DefaultUninstall 132
.\swapBuffers.inf

i only modify the SwapPreReadBuffers method as follows:

//
// If they are trying to read ZERO bytes, then don’t do anything
and
// we don’t need a post-operation callback.
//
if (readLen == 0) {

leave;
}

//
// Get our volume context so we can display our volume name in the
// debug output.
//

status = FltGetVolumeContext( FltObjects->Filter,
FltObjects->Volume,
&volCtx );

if (!NT_SUCCESS(status)) {

LOG_PRINT( LOGFL_ERRORS,
(“SwapBuffers!SwapPreReadBuffers: Error
getting volume context, status=%x\n”,
status) );

leave;
}

// get filename added by yao on 2007/09/30
RtlInitEmptyUnicodeString(&fullName, temp, sizeof(temp));
if (!GetFullName(IN FltObjects, IN Data, OUT &fullName))
{
leave;
}

// check

RtlInitUnicodeString(&encPath,L"D:\ENC\");
if (!IsEnctyptionFile(&fullName, &encPath))
{
leave;
}

KdPrint((“read filtered fullName = %wZ”, &fullName));

//
// If this is a non-cached I/O we need to round the length up to
the
// sector size for this device. We must do this because the file
// systems do this and we need to make sure our buffer is as big
// as they are expecting.
//



GetFullName and IsEnctyptionFile are used in SwapPreReadBuffers routine.

/ **************************************************

* *
* Get full filename *
* *

****************************************************
/
BOOLEAN GetFullName(IN PCFLT_RELATED_OBJECTS FltObjects, IN
PFLT_CALLBACK_DATA Data, OUT PUNICODE_STRING fileName)
{
NTSTATUS status;
PVOLUME_CONTEXT volCtx = NULL;
PFLT_FILE_NAME_INFORMATION nameInfo = NULL;
//WCHAR temp[256];

status = FltGetVolumeContext( FltObjects->Filter,
FltObjects->Volume,
&volCtx );

if (!NT_SUCCESS(status)) {
return FALSE;
}

if(FltObjects->FileObject != 0)
{
status = FltGetFileNameInformation( Data,
FLT_FILE_NAME_NORMALIZED |
FLT_FILE_NAME_QUERY_ALWAYS_ALLOW_CACHE_LOOKUP,
&nameInfo );
}
else
{
status = STATUS_UNSUCCESSFUL;
}

if (NT_SUCCESS( status )) {
status = FltParseFileNameInformation( nameInfo );
}
else
{
return FALSE;
}

//RtlInitEmptyUnicodeString(&fullName, temp, sizeof(temp));
RtlUnicodeStringCat(fileName, &volCtx->Name);
RtlUnicodeStringCat(fileName, &nameInfo->ParentDir);
RtlUnicodeStringCat(fileName, &nameInfo->FinalComponent);
fileName->Length = volCtx->Name.Length + nameInfo->ParentDir.Length +
nameInfo->FinalComponent.Length;

return TRUE;
}

/ **************************************************

* *
* Check the file is under encryption path or not *
* *

****************************************************
/
BOOLEAN IsEnctyptionFile(IN PUNICODE_STRING fileName, IN PUNICODE_STRING
encPath)
{
USHORT temp;

temp = fileName->Length;
fileName->Length = encPath->Length;
if(RtlEqualUnicodeString(fileName, encPath, TRUE))
{
fileName->Length = temp;
return TRUE;
}
else
{
fileName->Length = temp;
return FALSE;
}
}

— NTFSD is sponsored by OSR For our schedule debugging and file system
seminars (including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars You are currently subscribed to ntfsd as:
xxxxx@comcast.net To unsubscribe send a blank email to
xxxxx@lists.osr.com


NTFSD is sponsored by OSR

For our schedule debugging and file system seminars
(including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars

You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com
http://www.patni.com
World-Wide Partnerships. World-Class Solutions.


This e-mail message may contain proprietary, confidential or legally
privileged information for the sole use of the person or entity to whom this
message was originally addressed. Any review, e-transmission dissemination
or other use of or taking of any action in reliance upon this information by
persons or entities other than the intended recipient is prohibited. If you
have received this e-mail in error kindly delete this e-mail from your
records. If it appears that this mail has been forwarded to you without
proper authority, please notify us immediately at xxxxx@patni.com and
delete this mail.


http://www.patni.com
World-Wide Partnerships. World-Class Solutions.


This e-mail message may contain proprietary, confidential or legally
privileged information for the sole use of the person or entity to
whom this message was originally addressed. Any review, e-transmission
dissemination or other use of or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited. If you have received this e-mail in error
kindly delete this e-mail from your records. If it appears that this
mail has been forwarded to you without proper authority, please notify
us immediately at xxxxx@patni.com and delete this mail.
</https:>