Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Enterprise Tools / December 2007

Tip: Looking for answers? Try searching our database.

msi step fails only if run via bootstrapper

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Thielen - 18 Dec 2007 21:43 GMT
Hi;

We have a problem where if we run OurSetup.msi everything works fine. But if
we run OurBootstrapper.exe which then launches OurSetup.msi, when at the end
of the install we tell it to launch an rtf file. To launch the file we pass
the fully qualified rtf filename so it's something like "c:\documents and
settings\dave\my documents\filename.rtf"

We launch it by calling into a dll we wrote:

extern "C" UINT __declspec(dllexport) __stdcall ShellExec(MSIHANDLE hInstall){
 TCHAR* fileName = NULL;
 DWORD fileNameLength = 0;
 int rv = GetProperty(hInstall,TEXT("SHExecFile"),fileName,fileNameLength);
 if(rv == ERROR_SUCCESS){
   ::ShellExecute(NULL,TEXT("open"),fileName,NULL,TEXT(""),SW_SHOWNORMAL);
   delete fileName;
 }
 return ERROR_SUCCESS;
}

When the bootstrapper runs, it does bring up Word but Word does not have the
passed in file open in it. What strikes me as very weird is it uses the
extension on the passed in file to determine it needs to run Word. So why
does it not open the file? And more to the point, how do we fix this?

The install is run under users with local admin rights.

Signature

thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm

WenYuan Wang [MSFT] - 19 Dec 2007 09:41 GMT
Hello Dave,

According to your description, I understood your OurBootstrapper.exe calls
"ShellExecute" API to open an rft file. But, when bootstrapper runs, the
word starts up, however, the rtf file haven't been passed in, correct? If I
misunderstood anything here, please correct me.

I have created a simple C++ application, added
ShellExecute(NULL,TEXT("open"),_T("c:\\documents and Settings\\v-wywang\\my
documents\\filename.rtf"),NULL,TEXT(""),SW_SHOWNORMAL); in it.
After this application runs, it brings up Word and opens filename.rtf for
me. It works fine. The code you pasted is fine. I cannot reproduce the
issue. Am I missing anything here? By the way, I'm not sure whether your
OurBootstraper.exe is unmanaged code(C++) or managed code. Would you please
give me some more detailed information about the OurBootstraper.exe?

In addition, I suggest you may try this exe file on other machines. Does
this issue also occur on the other machines? Thereby, we can make sure if
the issue is related to System Environment.

At last, is it possible for you to create a simple application? In that,
please specify the file path directly when calling ShellExecute API, such
as:
ShellExecute(NULL,TEXT("open"),_T("c:\\filename.rtf"),NULL,TEXT(""),SW_SHOWN
ORMAL);
Does it work fine?

I apologize if there are too many questions. But would you please try these
steps and let me the result. Thereby, we can perform further research. If
you have any more concern, please feel free to update here. We are glad to
assist you.

Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
David Thielen - 19 Dec 2007 23:50 GMT
Hi;

I think I wasn't clear. It is a little different from what you said.

I use the msbuild <bootstrapper ...> tag to create a setup.exe file. That
program, when it completes downloading/installing the .NET runtime (if
needed), then runs setup.msi.

setup.msi calls a DLL written in unmanaged C++ that does the ShellExecute.
The last step of setup.msi passes ShellExecute the rtf filename to launch.

If I run setup.msi directly, it launches Word with the file in it.

If I run the bootstrapper, it then launches setup.msi, and at the end it
does launch Word but with no file in it.

This problems occurs on all 4 machines we tested it on.

Signature

thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm

> Hello Dave,
>
[quoted text clipped - 35 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
WenYuan Wang [MSFT] - 20 Dec 2007 09:56 GMT
Hello Dave,
Thanks for your reply.

Now, I understood you have written a DLL in unmanaged C++ to call
ShellExecute. Your setup.msi pass ShellExecute() the filepath to launch. If
you run the setup.msi directly, it launches word with the file correctly.
But, if you run the bootstrapper to launch setup.msi, it only launch word
but without the file in it. It should be something like
bootstrapper->setup.msi->DLL. Please correct me if I misunderstood anything
here again.

It seems you didn't check the result value returned by ShellExecute method.
Raymond Chen wrote a blog about the HINSTANCE. You can check if the return
value is greater than 32, indicating that the call was successful. If the
value is less than 32, then it is an error code. Would you please let me
know the result? We may get some clue from the return value.
http://blogs.msdn.com/oldnewthing/archive/2006/05/05/590749.aspx
[What can I do with the HINSTANCE returned by the ShellExecute function?]

By the way, I'm not sure, but I guess this may be related to service
account. As far as I know, setup file is running in System account. But the
rtf file which you passed into ShellExecute is located in a user document
folder. Bootstrapper may no have enough privilege to read it. This causes
the issue. I suggest you may put the rtf in a public folder (e.g C:\ or
D:\). Then, try it again.

Hope this helps, please try the above method and let me know the result. We
are glad to assist you.

Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
David Thielen - 20 Dec 2007 17:46 GMT
Hi;

The HINSTANCE returned is greater than 32 -> success. That makes sense as
Word is launched.

You security  problem idea makes sense. However, we need to have the file be
in the user's My Document folder as it is a document of theirs. How can we
set the bootstrapper.exe, and the msi it launches, to be run as the user? Or
at least that it launches Word using the credentials of the user?

Signature

thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm

> Hello Dave,
> Thanks for your reply.
[quoted text clipped - 32 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
WenYuan Wang [MSFT] - 21 Dec 2007 10:22 GMT
Hello Dave,
Thanks for your reply.

I have consulted another support engineer focused on MSI. This should not
be a security problem. In the beginning of installation, the application is
running under current user account. When it's necessary to copy some filed
into System folders, it will run into SYSTEM account. After installed, it
will still running under current user account. It seems your msi opens the
rtf file by "Custom Action" after installation, correct? This should be
fine.

Now, the issue seems strange, MSI works fine, but it only failed when
running in bootstrapper.exe. The value retruned by ShellExecute indicate it
launch successfully.

My least idea is enabling Windows Installer Logging to trace what happened
when running installation. I suggest you try this method in two scenarios.
#1 is using MSI file. #2 is using bootstrapper.exe. Thereby, we can compare
what the different is between these two installation file.
http://support.microsoft.com/kb/223300
[How to enable Windows Installer logging]

By the way, it will be wonderful if you can send a reproduce sample to me.
Thereby we can perform further research on my side.
My alias is v-wywang@microsoft.com.

Please feel free to let me know if you have any more concern, we are glad
to assist you.

Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.