Custom Shell Running Twice On Boot

  • Thread starter Thread starter tomer
  • Start date Start date
T

tomer

Hi,

I wrote a .NET shell replacement application and componentized it to a shell
component in XP Embedded.
Problem is, for some reason the shell app is being launched twice on boot!
Is this common behavior?
Is there a way to baypass it?
To make a long story short, what the hell am I doing wrong? :)

Thanks,
Tomer.
 
Hi,

No idea what you are doing wrong, and this in not regular behavior.
If you can execute regedit from XPe, or open registry offline.
And search trough it for your shell executable name. If you find it on more than one place let us know so we can narrow the problem
down.

Best regards,
Slobodan
 
Hi,

This looks ok.

Then problem is either with your application launching itself. (Everything is possible)
Or some problem with .Net I have never used shell application that use .Net.

For test rename notepad.exe and copy it over your shell application.
If you have only one notepad instance then your application is responsible.

Best regards,
Slobodan
 
Hi,

Thanks for your replay.
I searched the regsitry and got the following results:

on:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon\Shell
and that's probably ok.
I got another 2 hits in:

HKEY_LOCAL_USERS\SOFTWARE\Microsoft\Direct3D\MostRecentApp
and again in almost same path just on HKEY_USERS
I think these 2 hits are pretty harmless since my app is partially a D3D
app.

So I got 3 hits, and they look ok to me, correct me if I'm wrong.
Any thoughts?
 
Unfortunately I can probably only tell you why your XPe boot time is long, for other problem :(

If you want your image to boot faster you can do any of the following things.
- Unplug network cable.
- Provide DHCP server on network.
- Configure all network interfaces to use Static IP addresses instead of DHCP obtained.

Let us know if this helped.

Best regards,
Slobodan
 
I replaced my shell with notepad and got 2 instances of it.
Also, I notice the time it takes to logon is really long... At first I
tought it was because of my app.. but it's the same with notepad so I begin
to suspect something is deeply wrong with this image

Come to think of it, I tried before using only the CMD Shell with my
previous image to test a few thing and it loaded twice too!!!

I've managed to get myself confused now...
What can cause this?

On FBA there's:

Silent DX9.0c + managed extensions setup
Silent ATI IGP chipset setup
Silent LAN Driver setup
Silent Sound Card driver setup
Silnet .NET 2.0 Framework Beta setup.

The Image is mostly based on Advanced Set-top Box
 
tomer,

A few more things to check (it may not be the reason for double shell launch
but may still be worth to check):
I know youve search through the registry at run time but I'd suggest you
to shutdown the device and explore the registry hives offline:
- check [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run],
[...\RunOnce] and [...\RunOnceEx] keys.
- the same keys under HKCU.
- check [HKLM\Test\FBA\RunOnce]
- check \%systemRoot%\system32\systme.ini file for SHELL entry (take the
runtime's system.ini)
- check all your StartUp items, e.g. under "\Documents and Settings\All
Users\Start Menu\Programs\Startup".

You can use BootVis to analyze the booting process on your image.

In any case you can work around the problem by adding initial code in to
your custom app to check for already running app instance (FindWindow
approach or any signaled kernel object you set in your app).

KM
 
tomer,

Well... Delayed boot is a different problem (I'd sugegst you to start a new
thread if you need help with it).

Regarding the shell double launch - confusing. It must be something that we
are missing from the picture.
It would be better to narrow down the area.
At runtime can you launch regedit (or do the following offline) and go
[HKLM\Test\CurrentControlSet\Control\Session Manager] key, remove fbastart
value from BootExecute multistring value? then reboot and see if your shell
is launched twice. this way we will know if it is FBA cuases the issue.

Regarding the application code change. You dont really need to "kill" the
second instance. Just don't allow the app to start if there is another
instance of the app running. For example, create/open a named event at the
start of the WinMain and check the event status. If set - exit the app, if
not - set the event and continue the app code flow. Nothing
"unprofessional".

KM

Hi,

Well, I checked all the registry values (offline) none contained any shell
refrences.
Checked system.ini - nothing.
Checked startup folder - nothing.

I ran bootvis and saw my shell process is run twice and so does
"userinit.exe".
I also see "fba.exe" is run with every boot. Is this normal?

I thought about killing one process via my app, but in most cases because of
the process are launched almost togther, they kill each other :)
Anyhow even if I dedicate time and solve the dual-kill issue, it is not an
option, because it delayes boot time and is very unprofessional.

Thanks,
Tomer.



KM said:
tomer,

A few more things to check (it may not be the reason for double shell
launch
but may still be worth to check):
I know youve search through the registry at run time but I'd suggest
you
to shutdown the device and explore the registry hives offline:
- check [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run],
[...\RunOnce] and [...\RunOnceEx] keys.
- the same keys under HKCU.
- check [HKLM\Test\FBA\RunOnce]
- check \%systemRoot%\system32\systme.ini file for SHELL entry (take
the
runtime's system.ini)
- check all your StartUp items, e.g. under "\Documents and Settings\All
Users\Start Menu\Programs\Startup".

You can use BootVis to analyze the booting process on your image.

In any case you can work around the problem by adding initial code in to
your custom app to check for already running app instance (FindWindow
approach or any signaled kernel object you set in your app).

KM
I replaced my shell with notepad and got 2 instances of it.
Also, I notice the time it takes to logon is really long... At first I
tought it was because of my app.. but it's the same with notepad so I begin
to suspect something is deeply wrong with this image

Come to think of it, I tried before using only the CMD Shell with my
previous image to test a few thing and it loaded twice too!!!

I've managed to get myself confused now...
What can cause this?

On FBA there's:

Silent DX9.0c + managed extensions setup
Silent ATI IGP chipset setup
Silent LAN Driver setup
Silent Sound Card driver setup
Silnet .NET 2.0 Framework Beta setup.

The Image is mostly based on Advanced Set-top Box



Hi,

This looks ok.

Then problem is either with your application launching itself. (Everything
is possible)
Or some problem with .Net I have never used shell application that use
.Net.

For test rename notepad.exe and copy it over your shell application.
If you have only one notepad instance then your application is
responsible.

Best regards,
Slobodan


Hi,

Thanks for your replay.
I searched the regsitry and got the following results:

on:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon\Shel
l
and that's probably ok.
I got another 2 hits in:

HKEY_LOCAL_USERS\SOFTWARE\Microsoft\Direct3D\MostRecentApp
and again in almost same path just on HKEY_USERS
I think these 2 hits are pretty harmless since my app is partially a D3D
app.

So I got 3 hits, and they look ok to me, correct me if I'm wrong.
Any thoughts?




Hi,

No idea what you are doing wrong, and this in not regular behavior.
If you can execute regedit from XPe, or open registry offline.
And search trough it for your shell executable name. If you find
it
on
more than one place let us know so we can narrow the problem
down.

Best regards,
Slobodan

Hi,

I wrote a .NET shell replacement application and componentized it
to a
shell
component in XP Embedded.
Problem is, for some reason the shell app is being launched twice
on
boot!
Is this common behavior?
Is there a way to baypass it?
To make a long story short, what the hell am I doing wrong? :)

Thanks,
Tomer.
 
Hi,

Well, I checked all the registry values (offline) none contained any shell
refrences.
Checked system.ini - nothing.
Checked startup folder - nothing.

I ran bootvis and saw my shell process is run twice and so does
"userinit.exe".
I also see "fba.exe" is run with every boot. Is this normal?

I thought about killing one process via my app, but in most cases because of
the process are launched almost togther, they kill each other :)
Anyhow even if I dedicate time and solve the dual-kill issue, it is not an
option, because it delayes boot time and is very unprofessional.

Thanks,
Tomer.



KM said:
tomer,

A few more things to check (it may not be the reason for double shell
launch
but may still be worth to check):
I know youve search through the registry at run time but I'd suggest
you
to shutdown the device and explore the registry hives offline:
- check [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run],
[...\RunOnce] and [...\RunOnceEx] keys.
- the same keys under HKCU.
- check [HKLM\Test\FBA\RunOnce]
- check \%systemRoot%\system32\systme.ini file for SHELL entry (take
the
runtime's system.ini)
- check all your StartUp items, e.g. under "\Documents and Settings\All
Users\Start Menu\Programs\Startup".

You can use BootVis to analyze the booting process on your image.

In any case you can work around the problem by adding initial code in to
your custom app to check for already running app instance (FindWindow
approach or any signaled kernel object you set in your app).

KM
I replaced my shell with notepad and got 2 instances of it.
Also, I notice the time it takes to logon is really long... At first I
tought it was because of my app.. but it's the same with notepad so I begin
to suspect something is deeply wrong with this image

Come to think of it, I tried before using only the CMD Shell with my
previous image to test a few thing and it loaded twice too!!!

I've managed to get myself confused now...
What can cause this?

On FBA there's:

Silent DX9.0c + managed extensions setup
Silent ATI IGP chipset setup
Silent LAN Driver setup
Silent Sound Card driver setup
Silnet .NET 2.0 Framework Beta setup.

The Image is mostly based on Advanced Set-top Box



HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon\Shel
l
 
Hi,

It appears that you have found a source of problem.

Although in XPe image I think (I should look) that userinit.exe is intruder. fba.exe call should stay.
So try finding component that added userinit.exe to this reg position and let us know.

Best regards.
Slobodan

tomer said:
Hi,

I looked at BootExecute - it's empty.
BUT, when I ran bootvis I told you I saw 2 userinit process, so I opened the
registry, and went to:

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit

and there I saw something a bit odd, the value was:
d:\windows\system32\userinit.exe ,d:\windows\fba\fba.exe -run
Seemed to me that fba.exe -run shouldn't be there, so I removed the fba -run
and path, restarted, and then, problem solved! NO MORE 2 Shells!!! :)
Now, the question is, why was FBA in userinit in this stage(after the image
is completely built)?

Thanks,
Tomer.


KM said:
tomer,

Well... Delayed boot is a different problem (I'd sugegst you to start a
new
thread if you need help with it).

Regarding the shell double launch - confusing. It must be something that
we
are missing from the picture.
It would be better to narrow down the area.
At runtime can you launch regedit (or do the following offline) and go
[HKLM\Test\CurrentControlSet\Control\Session Manager] key, remove fbastart
value from BootExecute multistring value? then reboot and see if your
shell
is launched twice. this way we will know if it is FBA cuases the issue.

Regarding the application code change. You dont really need to "kill" the
second instance. Just don't allow the app to start if there is another
instance of the app running. For example, create/open a named event at the
start of the WinMain and check the event status. If set - exit the app, if
not - set the event and continue the app code flow. Nothing
"unprofessional".

KM

Hi,

Well, I checked all the registry values (offline) none contained any
shell
refrences.
Checked system.ini - nothing.
Checked startup folder - nothing.

I ran bootvis and saw my shell process is run twice and so does
"userinit.exe".
I also see "fba.exe" is run with every boot. Is this normal?

I thought about killing one process via my app, but in most cases because of
the process are launched almost togther, they kill each other :)
Anyhow even if I dedicate time and solve the dual-kill issue, it is not
an
option, because it delayes boot time and is very unprofessional.

Thanks,
Tomer.



tomer,

A few more things to check (it may not be the reason for double shell
launch
but may still be worth to check):
I know youve search through the registry at run time but I'd suggest
you
to shutdown the device and explore the registry hives offline:
- check [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run],
[...\RunOnce] and [...\RunOnceEx] keys.
- the same keys under HKCU.
- check [HKLM\Test\FBA\RunOnce]
- check \%systemRoot%\system32\systme.ini file for SHELL entry (take
the
runtime's system.ini)
- check all your StartUp items, e.g. under "\Documents and Settings\All
Users\Start Menu\Programs\Startup".

You can use BootVis to analyze the booting process on your image.

In any case you can work around the problem by adding initial code in
to
your custom app to check for already running app instance (FindWindow
approach or any signaled kernel object you set in your app).

KM

I replaced my shell with notepad and got 2 instances of it.
Also, I notice the time it takes to logon is really long... At first I
tought it was because of my app.. but it's the same with notepad so I
begin
to suspect something is deeply wrong with this image

Come to think of it, I tried before using only the CMD Shell with my
previous image to test a few thing and it loaded twice too!!!

I've managed to get myself confused now...
What can cause this?

On FBA there's:

Silent DX9.0c + managed extensions setup
Silent ATI IGP chipset setup
Silent LAN Driver setup
Silent Sound Card driver setup
Silnet .NET 2.0 Framework Beta setup.

The Image is mostly based on Advanced Set-top Box



Hi,

This looks ok.

Then problem is either with your application launching itself.
(Everything
is possible)
Or some problem with .Net I have never used shell application that use
.Net.

For test rename notepad.exe and copy it over your shell application.
If you have only one notepad instance then your application is
responsible.

Best regards,
Slobodan


Hi,

Thanks for your replay.
I searched the regsitry and got the following results:

on:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon\Shel
l
and that's probably ok.
I got another 2 hits in:

HKEY_LOCAL_USERS\SOFTWARE\Microsoft\Direct3D\MostRecentApp
and again in almost same path just on HKEY_USERS
I think these 2 hits are pretty harmless since my app is partially
a
D3D
app.

So I got 3 hits, and they look ok to me, correct me if I'm wrong.
Any thoughts?




Hi,

No idea what you are doing wrong, and this in not regular behavior.
If you can execute regedit from XPe, or open registry offline.
And search trough it for your shell executable name. If you find it
on
more than one place let us know so we can narrow the problem
down.

Best regards,
Slobodan

Hi,

I wrote a .NET shell replacement application and componentized
it
to
a
shell
component in XP Embedded.
Problem is, for some reason the shell app is being launched
twice
on
boot!
Is this common behavior?
Is there a way to baypass it?
To make a long story short, what the hell am I doing wrong? :)

Thanks,
Tomer.
 
Hi,

I looked at BootExecute - it's empty.
BUT, when I ran bootvis I told you I saw 2 userinit process, so I opened the
registry, and went to:

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit

and there I saw something a bit odd, the value was:
d:\windows\system32\userinit.exe ,d:\windows\fba\fba.exe -run
Seemed to me that fba.exe -run shouldn't be there, so I removed the fba -run
and path, restarted, and then, problem solved! NO MORE 2 Shells!!! :)
Now, the question is, why was FBA in userinit in this stage(after the image
is completely built)?

Thanks,
Tomer.


KM said:
tomer,

Well... Delayed boot is a different problem (I'd sugegst you to start a
new
thread if you need help with it).

Regarding the shell double launch - confusing. It must be something that
we
are missing from the picture.
It would be better to narrow down the area.
At runtime can you launch regedit (or do the following offline) and go
[HKLM\Test\CurrentControlSet\Control\Session Manager] key, remove fbastart
value from BootExecute multistring value? then reboot and see if your
shell
is launched twice. this way we will know if it is FBA cuases the issue.

Regarding the application code change. You dont really need to "kill" the
second instance. Just don't allow the app to start if there is another
instance of the app running. For example, create/open a named event at the
start of the WinMain and check the event status. If set - exit the app, if
not - set the event and continue the app code flow. Nothing
"unprofessional".

KM

Hi,

Well, I checked all the registry values (offline) none contained any
shell
refrences.
Checked system.ini - nothing.
Checked startup folder - nothing.

I ran bootvis and saw my shell process is run twice and so does
"userinit.exe".
I also see "fba.exe" is run with every boot. Is this normal?

I thought about killing one process via my app, but in most cases because of
the process are launched almost togther, they kill each other :)
Anyhow even if I dedicate time and solve the dual-kill issue, it is not
an
option, because it delayes boot time and is very unprofessional.

Thanks,
Tomer.



KM said:
tomer,

A few more things to check (it may not be the reason for double shell
launch
but may still be worth to check):
I know youve search through the registry at run time but I'd suggest
you
to shutdown the device and explore the registry hives offline:
- check [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run],
[...\RunOnce] and [...\RunOnceEx] keys.
- the same keys under HKCU.
- check [HKLM\Test\FBA\RunOnce]
- check \%systemRoot%\system32\systme.ini file for SHELL entry (take
the
runtime's system.ini)
- check all your StartUp items, e.g. under "\Documents and Settings\All
Users\Start Menu\Programs\Startup".

You can use BootVis to analyze the booting process on your image.

In any case you can work around the problem by adding initial code in
to
your custom app to check for already running app instance (FindWindow
approach or any signaled kernel object you set in your app).

KM

I replaced my shell with notepad and got 2 instances of it.
Also, I notice the time it takes to logon is really long... At first I
tought it was because of my app.. but it's the same with notepad so I
begin
to suspect something is deeply wrong with this image

Come to think of it, I tried before using only the CMD Shell with my
previous image to test a few thing and it loaded twice too!!!

I've managed to get myself confused now...
What can cause this?

On FBA there's:

Silent DX9.0c + managed extensions setup
Silent ATI IGP chipset setup
Silent LAN Driver setup
Silent Sound Card driver setup
Silnet .NET 2.0 Framework Beta setup.

The Image is mostly based on Advanced Set-top Box



Hi,

This looks ok.

Then problem is either with your application launching itself.
(Everything
is possible)
Or some problem with .Net I have never used shell application that use
.Net.

For test rename notepad.exe and copy it over your shell application.
If you have only one notepad instance then your application is
responsible.

Best regards,
Slobodan


Hi,

Thanks for your replay.
I searched the regsitry and got the following results:

on:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon\Shel
l
and that's probably ok.
I got another 2 hits in:

HKEY_LOCAL_USERS\SOFTWARE\Microsoft\Direct3D\MostRecentApp
and again in almost same path just on HKEY_USERS
I think these 2 hits are pretty harmless since my app is partially
a
D3D
app.

So I got 3 hits, and they look ok to me, correct me if I'm wrong.
Any thoughts?




Hi,

No idea what you are doing wrong, and this in not regular behavior.
If you can execute regedit from XPe, or open registry offline.
And search trough it for your shell executable name. If you find it
on
more than one place let us know so we can narrow the problem
down.

Best regards,
Slobodan

Hi,

I wrote a .NET shell replacement application and componentized
it
to
a
shell
component in XP Embedded.
Problem is, for some reason the shell app is being launched
twice
on
boot!
Is this common behavior?
Is there a way to baypass it?
To make a long story short, what the hell am I doing wrong? :)

Thanks,
Tomer.
 
tomer,

I am glad you found the root of the problem.

I suspected FBA is the one who launches your shell twice. FBA definitely works with userinit key but how - I don't know, it is
undocumented.

Can you check your postFBA system hive? [HKLM\FBA],"Shell" value - what does it have there?

--
Regards,
KM, BSquare Corp.

Hi,

I looked at BootExecute - it's empty.
BUT, when I ran bootvis I told you I saw 2 userinit process, so I opened the
registry, and went to:

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit

and there I saw something a bit odd, the value was:
d:\windows\system32\userinit.exe ,d:\windows\fba\fba.exe -run
Seemed to me that fba.exe -run shouldn't be there, so I removed the fba -run
and path, restarted, and then, problem solved! NO MORE 2 Shells!!! :)
Now, the question is, why was FBA in userinit in this stage(after the image
is completely built)?

Thanks,
Tomer.


KM said:
tomer,

Well... Delayed boot is a different problem (I'd sugegst you to start a
new
thread if you need help with it).

Regarding the shell double launch - confusing. It must be something that
we
are missing from the picture.
It would be better to narrow down the area.
At runtime can you launch regedit (or do the following offline) and go
[HKLM\Test\CurrentControlSet\Control\Session Manager] key, remove fbastart
value from BootExecute multistring value? then reboot and see if your
shell
is launched twice. this way we will know if it is FBA cuases the issue.

Regarding the application code change. You dont really need to "kill" the
second instance. Just don't allow the app to start if there is another
instance of the app running. For example, create/open a named event at the
start of the WinMain and check the event status. If set - exit the app, if
not - set the event and continue the app code flow. Nothing
"unprofessional".

KM

Hi,

Well, I checked all the registry values (offline) none contained any
shell
refrences.
Checked system.ini - nothing.
Checked startup folder - nothing.

I ran bootvis and saw my shell process is run twice and so does
"userinit.exe".
I also see "fba.exe" is run with every boot. Is this normal?

I thought about killing one process via my app, but in most cases because of
the process are launched almost togther, they kill each other :)
Anyhow even if I dedicate time and solve the dual-kill issue, it is not
an
option, because it delayes boot time and is very unprofessional.

Thanks,
Tomer.



tomer,

A few more things to check (it may not be the reason for double shell
launch
but may still be worth to check):
I know youve search through the registry at run time but I'd suggest
you
to shutdown the device and explore the registry hives offline:
- check [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run],
[...\RunOnce] and [...\RunOnceEx] keys.
- the same keys under HKCU.
- check [HKLM\Test\FBA\RunOnce]
- check \%systemRoot%\system32\systme.ini file for SHELL entry (take
the
runtime's system.ini)
- check all your StartUp items, e.g. under "\Documents and Settings\All
Users\Start Menu\Programs\Startup".

You can use BootVis to analyze the booting process on your image.

In any case you can work around the problem by adding initial code in
to
your custom app to check for already running app instance (FindWindow
approach or any signaled kernel object you set in your app).

KM

I replaced my shell with notepad and got 2 instances of it.
Also, I notice the time it takes to logon is really long... At first I
tought it was because of my app.. but it's the same with notepad so I
begin
to suspect something is deeply wrong with this image

Come to think of it, I tried before using only the CMD Shell with my
previous image to test a few thing and it loaded twice too!!!

I've managed to get myself confused now...
What can cause this?

On FBA there's:

Silent DX9.0c + managed extensions setup
Silent ATI IGP chipset setup
Silent LAN Driver setup
Silent Sound Card driver setup
Silnet .NET 2.0 Framework Beta setup.

The Image is mostly based on Advanced Set-top Box



Hi,

This looks ok.

Then problem is either with your application launching itself.
(Everything
is possible)
Or some problem with .Net I have never used shell application that use
.Net.

For test rename notepad.exe and copy it over your shell application.
If you have only one notepad instance then your application is
responsible.

Best regards,
Slobodan


Hi,

Thanks for your replay.
I searched the regsitry and got the following results:

on:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon\Shel
l
and that's probably ok.
I got another 2 hits in:

HKEY_LOCAL_USERS\SOFTWARE\Microsoft\Direct3D\MostRecentApp
and again in almost same path just on HKEY_USERS
I think these 2 hits are pretty harmless since my app is partially
a
D3D
app.

So I got 3 hits, and they look ok to me, correct me if I'm wrong.
Any thoughts?




Hi,

No idea what you are doing wrong, and this in not regular behavior.
If you can execute regedit from XPe, or open registry offline.
And search trough it for your shell executable name. If you find it
on
more than one place let us know so we can narrow the problem
down.

Best regards,
Slobodan

Hi,

I wrote a .NET shell replacement application and componentized
it
to
a
shell
component in XP Embedded.
Problem is, for some reason the shell app is being launched
twice
on
boot!
Is this common behavior?
Is there a way to baypass it?
To make a long story short, what the hell am I doing wrong? :)

Thanks,
Tomer.
 
tomer,

That is the proper value (-shell command line switch).

Well.. The fba.exe should replace (add) userinit.exe to the userinit value. I am wondering why it does not do that for you.
MS would probably answer this question (FBA is undocumented :-( ).

Do you see the FBA Setup complete message at the end of the FBA process? Any errors in FBALog?
Your image is Winlogon based, is it right? (I saw you mentioned .Net) How do you shutdown/reboot the image after FBA is done?

--
Regards,
KM, BSquare Corp.

KM - d:\windows\fba\fab.exe -shell

I still havn't found out what caused the dual-boot exactly, but I made a
fresh new Image with a my custom shell only,
and the Userinit value is - d:\windows\fba\fba.exe -run.
Meaning, this is for certain the right value.
Only thing left to find out is what added the userinit.exe to the value.

Tomer.

KM said:
tomer,

I am glad you found the root of the problem.

I suspected FBA is the one who launches your shell twice. FBA definitely
works with userinit key but how - I don't know, it is
undocumented.

Can you check your postFBA system hive? [HKLM\FBA],"Shell" value - what
does it have there?

--
Regards,
KM, BSquare Corp.

Hi,

I looked at BootExecute - it's empty.
BUT, when I ran bootvis I told you I saw 2 userinit process, so I opened
the
registry, and went to:

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit

and there I saw something a bit odd, the value was:
d:\windows\system32\userinit.exe ,d:\windows\fba\fba.exe -run
Seemed to me that fba.exe -run shouldn't be there, so I removed the
fba -run
and path, restarted, and then, problem solved! NO MORE 2 Shells!!! :)
Now, the question is, why was FBA in userinit in this stage(after the
image
is completely built)?

Thanks,
Tomer.


tomer,

Well... Delayed boot is a different problem (I'd sugegst you to start a
new
thread if you need help with it).

Regarding the shell double launch - confusing. It must be something
that
we
are missing from the picture.
It would be better to narrow down the area.
At runtime can you launch regedit (or do the following offline) and go
[HKLM\Test\CurrentControlSet\Control\Session Manager] key, remove
fbastart
value from BootExecute multistring value? then reboot and see if your
shell
is launched twice. this way we will know if it is FBA cuases the issue.

Regarding the application code change. You dont really need to "kill"
the
second instance. Just don't allow the app to start if there is another
instance of the app running. For example, create/open a named event at
the
start of the WinMain and check the event status. If set - exit the app,
if
not - set the event and continue the app code flow. Nothing
"unprofessional".

KM


Hi,

Well, I checked all the registry values (offline) none contained any
shell
refrences.
Checked system.ini - nothing.
Checked startup folder - nothing.

I ran bootvis and saw my shell process is run twice and so does
"userinit.exe".
I also see "fba.exe" is run with every boot. Is this normal?

I thought about killing one process via my app, but in most cases
because
of
the process are launched almost togther, they kill each other :)
Anyhow even if I dedicate time and solve the dual-kill issue, it is
not
an
option, because it delayes boot time and is very unprofessional.

Thanks,
Tomer.



tomer,

A few more things to check (it may not be the reason for double
shell
launch
but may still be worth to check):
I know youve search through the registry at run time but I'd
suggest
you
to shutdown the device and explore the registry hives offline:
- check [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run],
[...\RunOnce] and [...\RunOnceEx] keys.
- the same keys under HKCU.
- check [HKLM\Test\FBA\RunOnce]
- check \%systemRoot%\system32\systme.ini file for SHELL entry
(take
the
runtime's system.ini)
- check all your StartUp items, e.g. under "\Documents and
Settings\All
Users\Start Menu\Programs\Startup".

You can use BootVis to analyze the booting process on your image.

In any case you can work around the problem by adding initial code
in
to
your custom app to check for already running app instance
(FindWindow
approach or any signaled kernel object you set in your app).

KM

I replaced my shell with notepad and got 2 instances of it.
Also, I notice the time it takes to logon is really long... At
first I
tought it was because of my app.. but it's the same with notepad so
I
begin
to suspect something is deeply wrong with this image

Come to think of it, I tried before using only the CMD Shell with
my
previous image to test a few thing and it loaded twice too!!!

I've managed to get myself confused now...
What can cause this?

On FBA there's:

Silent DX9.0c + managed extensions setup
Silent ATI IGP chipset setup
Silent LAN Driver setup
Silent Sound Card driver setup
Silnet .NET 2.0 Framework Beta setup.

The Image is mostly based on Advanced Set-top Box



Hi,

This looks ok.

Then problem is either with your application launching itself.
(Everything
is possible)
Or some problem with .Net I have never used shell application
that
use
.Net.

For test rename notepad.exe and copy it over your shell
application.
If you have only one notepad instance then your application is
responsible.

Best regards,
Slobodan


Hi,

Thanks for your replay.
I searched the regsitry and got the following results:

on:


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon\Shel
l
and that's probably ok.
I got another 2 hits in:

HKEY_LOCAL_USERS\SOFTWARE\Microsoft\Direct3D\MostRecentApp
and again in almost same path just on HKEY_USERS
I think these 2 hits are pretty harmless since my app is
partially
a
D3D
app.

So I got 3 hits, and they look ok to me, correct me if I'm
wrong.
Any thoughts?




Hi,

No idea what you are doing wrong, and this in not regular
behavior.
If you can execute regedit from XPe, or open registry offline.
And search trough it for your shell executable name. If you
find
it
on
more than one place let us know so we can narrow the problem
down.

Best regards,
Slobodan

Hi,

I wrote a .NET shell replacement application and
componentized
it
to
a
shell
component in XP Embedded.
Problem is, for some reason the shell app is being launched
twice
on
boot!
Is this common behavior?
Is there a way to baypass it?
To make a long story short, what the hell am I doing wrong?
:)

Thanks,
Tomer.
 
KM - d:\windows\fba\fab.exe -shell

I still havn't found out what caused the dual-boot exactly, but I made a
fresh new Image with a my custom shell only,
and the Userinit value is - d:\windows\fba\fba.exe -run.
Meaning, this is for certain the right value.
Only thing left to find out is what added the userinit.exe to the value.

Tomer.

KM said:
tomer,

I am glad you found the root of the problem.

I suspected FBA is the one who launches your shell twice. FBA definitely
works with userinit key but how - I don't know, it is
undocumented.

Can you check your postFBA system hive? [HKLM\FBA],"Shell" value - what
does it have there?

--
Regards,
KM, BSquare Corp.

Hi,

I looked at BootExecute - it's empty.
BUT, when I ran bootvis I told you I saw 2 userinit process, so I opened
the
registry, and went to:

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit

and there I saw something a bit odd, the value was:
d:\windows\system32\userinit.exe ,d:\windows\fba\fba.exe -run
Seemed to me that fba.exe -run shouldn't be there, so I removed the
fba -run
and path, restarted, and then, problem solved! NO MORE 2 Shells!!! :)
Now, the question is, why was FBA in userinit in this stage(after the
image
is completely built)?

Thanks,
Tomer.


KM said:
tomer,

Well... Delayed boot is a different problem (I'd sugegst you to start a
new
thread if you need help with it).

Regarding the shell double launch - confusing. It must be something
that
we
are missing from the picture.
It would be better to narrow down the area.
At runtime can you launch regedit (or do the following offline) and go
[HKLM\Test\CurrentControlSet\Control\Session Manager] key, remove
fbastart
value from BootExecute multistring value? then reboot and see if your
shell
is launched twice. this way we will know if it is FBA cuases the issue.

Regarding the application code change. You dont really need to "kill"
the
second instance. Just don't allow the app to start if there is another
instance of the app running. For example, create/open a named event at
the
start of the WinMain and check the event status. If set - exit the app,
if
not - set the event and continue the app code flow. Nothing
"unprofessional".

KM


Hi,

Well, I checked all the registry values (offline) none contained any
shell
refrences.
Checked system.ini - nothing.
Checked startup folder - nothing.

I ran bootvis and saw my shell process is run twice and so does
"userinit.exe".
I also see "fba.exe" is run with every boot. Is this normal?

I thought about killing one process via my app, but in most cases
because
of
the process are launched almost togther, they kill each other :)
Anyhow even if I dedicate time and solve the dual-kill issue, it is
not
an
option, because it delayes boot time and is very unprofessional.

Thanks,
Tomer.



tomer,

A few more things to check (it may not be the reason for double
shell
launch
but may still be worth to check):
I know youve search through the registry at run time but I'd
suggest
you
to shutdown the device and explore the registry hives offline:
- check [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run],
[...\RunOnce] and [...\RunOnceEx] keys.
- the same keys under HKCU.
- check [HKLM\Test\FBA\RunOnce]
- check \%systemRoot%\system32\systme.ini file for SHELL entry
(take
the
runtime's system.ini)
- check all your StartUp items, e.g. under "\Documents and
Settings\All
Users\Start Menu\Programs\Startup".

You can use BootVis to analyze the booting process on your image.

In any case you can work around the problem by adding initial code
in
to
your custom app to check for already running app instance
(FindWindow
approach or any signaled kernel object you set in your app).

KM

I replaced my shell with notepad and got 2 instances of it.
Also, I notice the time it takes to logon is really long... At
first I
tought it was because of my app.. but it's the same with notepad so
I
begin
to suspect something is deeply wrong with this image

Come to think of it, I tried before using only the CMD Shell with
my
previous image to test a few thing and it loaded twice too!!!

I've managed to get myself confused now...
What can cause this?

On FBA there's:

Silent DX9.0c + managed extensions setup
Silent ATI IGP chipset setup
Silent LAN Driver setup
Silent Sound Card driver setup
Silnet .NET 2.0 Framework Beta setup.

The Image is mostly based on Advanced Set-top Box



Hi,

This looks ok.

Then problem is either with your application launching itself.
(Everything
is possible)
Or some problem with .Net I have never used shell application
that
use
.Net.

For test rename notepad.exe and copy it over your shell
application.
If you have only one notepad instance then your application is
responsible.

Best regards,
Slobodan


Hi,

Thanks for your replay.
I searched the regsitry and got the following results:

on:


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon\Shel
l
and that's probably ok.
I got another 2 hits in:

HKEY_LOCAL_USERS\SOFTWARE\Microsoft\Direct3D\MostRecentApp
and again in almost same path just on HKEY_USERS
I think these 2 hits are pretty harmless since my app is
partially
a
D3D
app.

So I got 3 hits, and they look ok to me, correct me if I'm
wrong.
Any thoughts?




Hi,

No idea what you are doing wrong, and this in not regular
behavior.
If you can execute regedit from XPe, or open registry offline.
And search trough it for your shell executable name. If you
find
it
on
more than one place let us know so we can narrow the problem
down.

Best regards,
Slobodan

Hi,

I wrote a .NET shell replacement application and
componentized
it
to
a
shell
component in XP Embedded.
Problem is, for some reason the shell app is being launched
twice
on
boot!
Is this common behavior?
Is there a way to baypass it?
To make a long story short, what the hell am I doing wrong?
:)

Thanks,
Tomer.
 
Back
Top