Win7 and shralias

#1
Rex, I'm now running Win7 (and later today, VS2010).

Did you have to make any changes to SHRALIAS to ensure that the files are properly saved at logoff/shutdown?

My SHRALIAS is in a DLL which I inject into Explorer.exe at logon time. It works correctly except that, at logoff/shutdown, only *some* of the command history save-file is written. It may be only a few lines or a few hundred lines but it's not *all* lines.

Win7 logs off and shuts down very quickly. Would it kill my (explorer) thread before its window process finished processing WM_ENDSESSION? Should I do something in DllMain/PROCESS_DETACH that causes the files to be dumped before returning?

Any other ideas?

Thanks.
 

rconn

Administrator
Staff member
May 14, 2008
10,575
97
#4
> Did you have to make any changes to SHRALIAS to ensure that the
> files are properly saved at logoff/shutdown?
I didn't make any changes to SHRALIAS for Win 7. I haven't seen any
problems with the save files at shutdown (nor have I had any reports of
problems), but then I always shut down Take Command before logging off or
rebooting.


> My SHRALIAS is in a DLL which I inject into Explorer.exe at logon time.
(Quickly making the sign of the cross and hanging some garlic around my neck
...)


> Win7 logs off and shuts down very quickly. Would it kill my (explorer)
> thread before its window process finished processing WM_ENDSESSION?
Unlikely. More likely is you'll get an "Explorer is not responding" error.


> Should I do something in DllMain/PROCESS_DETACH that causes the
> files to be dumped before returning?
How long is it taking your dll to process the files and return from
WM_ENDSESSION? If you're taking longer than 4-5 seconds to shut down
SHRALIAS, you probably need to rethink your shutdown algorithm!

The PROCESS_DETACH call should be coming in after the WM_ENDSESSION has
returned, which means that if you're doing it in DllMain you have *very*
little (if any) time to clean up and clear out.

I would put the shutdown code in the WM_QUERYENDSESSION handler, which
should give you a little more time.

Rex
 
#5
How long is it taking your dll to process the files and return from
WM_ENDSESSION? If you're taking longer than 4-5 seconds to shut down
SHRALIAS, you probably need to rethink your shutdown algorithm!
I recon it takes less than a second.

The PROCESS_DETACH call should be coming in after the WM_ENDSESSION has returned, which means that if you're doing it in DllMain you have *very* little (if any) time to clean up and clear out.
I was doing it in the window process, but only for WM_ENDSESSION and WM_CLOSE. Putting it DllMain (on DLL_PROCESS_DETACH) saved nothing.

I would put the shutdown code in the WM_QUERYENDSESSION handler, which should give you a little more time.
That seems to work. With it, I've gotten a full restore of the lists after several logoffs.

Thanks.
 

samintz

Scott Mintz
May 20, 2008
1,288
11
Solon, OH, USA
#6
Vince,

Since you don't have a UI for a DLL
injected into Explorer.exe, why don't you make it a Windows Service instead?
The additional code to do that is trivial and everything else should
operate the same.

You could also use a memory mapped file
to hold your history save file.

-Scott



From:
vefatica <>
To:
[email protected]
Date:
07/30/2011 10:38 AM
Subject:
[Plugins-t-3016]
Win7 and shralias




Rex, I'm now running Win7 (and later today,
VS2010).

Did you have to make any changes to SHRALIAS to ensure that the files are
properly saved at logoff/shutdown?

My SHRALIAS is in a DLL which I inject into Explorer.exe at logon time.
It works correctly except that, at logoff/shutdown, only *some* of the
command history save-file is written. It may be only a few lines or a few
hundred lines but it's not *all* lines.

Win7 logs off and shuts down very quickly. Would it kill my (explorer)
thread before its window process finished processing WM_ENDSESSION? Should
I do something in DllMain/PROCESS_DETACH that causes the files to be dumped
before returning?

Any other ideas?

Thanks.
 

samintz

Scott Mintz
May 20, 2008
1,288
11
Solon, OH, USA
#7
No. I think that would be Steve running
Win7 and using a GUI. :)

-Scott

Charles Dye <> wrote on
07/30/2011 11:30:38 AM:


> Quote:
>
> Originally Posted by vefatica [image removed]
> Rex, I'm now running Win7
>
> Isn't this one of the Biblical signs of the Apocalypse?
>
>
 
#8
On Mon, 01 Aug 2011 11:37:47 -0400, samintz <> wrote:

|Since you don't have a UI for a DLL
|injected into Explorer.exe, why don't you make it a Windows Service instead?
| The additional code to do that is trivial and everything else should
|operate the same.
|
|You could also use a memory mapped file
|to hold your history save file.

I've written a service and that part is not hard. But there's no point. The
purpose of SHRALIAS is to guard (keep an open HANDLE) memory-mapped files which
were created by TCC and some user so the user can close all TCCs and still find
those memory mapped files later. The username is actually a part of the
memory-mapped filename.

That has always been SHRALIAS's M.O.

At service start-up there are no users ... no TCC ... no memory-mapped files to
guard. What would SHRALIAS do?