Administrator shell and User shell

G

Guest

Hi,

I would like to have two shells (explorer shell and application shell) for
XPE operating system because there are two types of users: administrator and
normal user. The administrator should use the explorer shell that allows him
to have full access to the OS (XPE). The normal user should only be allowed
to use my company’s software application after user’s logon.

I have experimented the idea by following Sean Liming’s article “Different
Shells for Different Users†at
http://msdn2.microsoft.com/en-us/library/ms838576.aspx and using notepad as
an application shell. I included Explorer Shell component in my
configuration. I changed the value of the key
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
NT\CurrentVersion\IniFileMapping\system.ini\boot\Shell

To

USR:Software\Microsoft\Windows NT\CurrentVersion\Winlogon
through the “Extra Registry Data†in the configuration. Then I logged on as
a user and started registry editor to add the key
“HKEY_Current_User\Software\Microsoft\Windows
NT\CurrentVersion\Winlogon\Shell†and the value
“C:\Windows\System32\notepad.exeâ€.

Then I logged on as a user again, the application shell launched the
notepad. When I logged on as an administrator, I saw the explorer shell.
The idea looked very promising.

Then I tried the same configuration and logged on as a user. I copied my
company software application from the external HDD to C:\ drive. I launched
my company application with no problem. Then I used registry editor to add
the key “HKEY_Current_User\Software\Microsoft\Windows
NT\CurrentVersion\Winlogon\Shell†and the value “C:\MyFolder\MyApp.exe†to
point to our company application. Then I logged on as a user and MyApp was
launched briefly and failed at SQLite database connection and then the
application crashed in unable to reference memory location. Why MyApp could
be launched manually in Explorer Shell but not by the application shell?

Later I saw Mike Hall’s article “Creating a Windows XP Embedded Shell†at
http://msdn2.microsoft.com/en-us/library/ms838335.aspx and created a custom
shell component with “Shell Prototype Componentâ€. I included this custom
shell component in my configuration. But when I ran the Dependency Checker,
it failed because of the collision between the Explorer Shell and the custom
shell.

Now I am stuck because both solutions didn’t work. Could someone point me
to the right direction?

Additional info: I am using XPE FP2007 but the configuration was created by
XPE SP2. I upgraded my development tools and component database in last week
to FP2007 but I didn’t update the components in the configuration for the
fear of destroying my configuration if the update doesn’t work out.

Many thanks.
 
S

Sean Liming \(MVP\)

It could be a timing issue with the application and SQLite when loging
in.Can you add a delay to your application before it tris to access the
database?

--
Regards,

Sean Liming
www.sjjmicro.com / www.seanliming.com
Book Author - XP Embedded Advanced, XP Embedded Supplemental Toolkit
 
G

Guest

Hi Sean,

Thank you for your help. I went to my company's application (wrote in MFC)
and added time delay of 20 seconds at the beginning of InitInstance()
function and 10 second delay right after Open() function for SQLite database
(the SQLite error message from last time was right at the 1st database
query). I logon XPE as a user and I copied my application to C:\drive and
manually tested the application with no problem and the time delays work
properly. Then I went to the registry editor to add key 3 and value
according to your article. The value points to my application. Then I
logged in as a user again. I was totally surprised that I got the same
exception ("failed open connection to SQLite db" )thrown by my application
immediately right after logon. It appeared the XPE didn't know how to handle
the time delays in my application. You are right, it is the timing issue.
But why the XPe doesn't know how to handle the delay (I used "::Sleep(20000)"
function in the code)? Am I missing some MFC Dlls in my XPE? Thanks again.
 
S

Sean Liming \(MVP\)

Chip,

There might be something missing. I am not familair with SQLite to be much
help. The other approach would be to put a wait on service for the SQLite.
You might want to check with the programming and database forums to see what
they say.

--
Regards,

Sean Liming
www.sjjmicro.com / www.seanliming.com
Book Author - XP Embedded Advanced, XP Embedded Supplemental Toolkit
 
C

Chip

Hi Sean,

I have put lots of debugging messages in my company's software application
and I finally got to the bottom of the problem. It is not the timing issue.
In my company's software application, our code uses the MS function call
::GetCurrentDirectory() to find the location where the SQLite database should
be created. This function call worked well in the administrator environment
(Explorer Shell) by returning the path of our software executable. However,
the same function call returned "C\Document and Settings\User" directory in
user environment. "C\Document and Settings\User" folder had read-only
attribute. When our software try to create a SQLite database file in this
location, it failed because it tried to write to a read-only folder. I fixed
this problem by replacing ::GetCurrentDirectory() with GetModuleFileName().
GetModuleFileName() worked consistently in both Admininstrator and User
Shells by pointing to the correct location of our company software.

But I got one problem. After successfully creating key 3 and value, and
testing both Admin and User Shells, I followed your key 3 instruction in your
article "Different Shells for Different Users". I quote "after Key 3 has
been set up, you can use FBreseal - found with the Cloning component - to
reseal the image for duplication". I used Windows Explorer to locate
FBReal.exe in System32 folder under admin environment and click on it. Then
I saw the image resealed message and I power down the computer. Then I used
resealed image to create an "sdi" file for deployment. Latter, I used sdimgr
to deploy my sdi file to the formatted clean hard drive. When the image
booted up and I logged on as a user, our company software wasn't launched and
I found key 3 is not in the registry. I thought key 3 should be included in
the image after I resealed it. What have I done wrong?

Then I tried to add key 3 and value into registry to make it work but
Registry Editor refused to let me add them to the registry. Any suggestion?

Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top